/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pyrogram-bg: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0d1f3c 100%);
    --telethon-bg: linear-gradient(135deg, #0a1f14 0%, #1a3a2a 50%, #0d2f1c 100%);
    --default-bg: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 50%, #0d0d2a 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-blue: #4a9eff;
    --accent-green: #4aff9e;
    --radius: 20px;
    --radius-sm: 12px;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--default-bg);
    color: var(--text-primary);
    overflow: hidden;
}

body.theme-pyrogram {
    background: var(--pyrogram-bg);
}

body.theme-telethon {
    background: var(--telethon-bg);
}

/* ─── Screens ─────────────────────────────────────────────────────────── */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

/* ─── Glass Cards ─────────────────────────────────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    padding: 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.hero-card {
    max-width: 500px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

p, .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

.hero-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #4a9eff, #6c63ff);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-pyrogram {
    background: linear-gradient(135deg, #1e3a5f, #2a5298);
    color: white;
    padding: 20px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius);
    flex: 1;
}

.btn-telethon {
    background: linear-gradient(135deg, #1a3a2a, #2a7a4a);
    color: white;
    padding: 20px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius);
    flex: 1;
}

.btn-method {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 16px 24px;
    flex: 1;
    border-radius: var(--radius-sm);
}

.btn-method:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 10px 20px;
    margin-top: 12px;
}

.btn-ghost:hover {
    color: white;
    box-shadow: none;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.choice-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.method-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-icon {
    font-size: 1.2rem;
}

/* ─── Inputs ──────────────────────────────────────────────────────────── */
.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent-blue);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
}

/* ─── QR ──────────────────────────────────────────────────────────────── */
.qr-container {
    margin: 20px auto;
    padding: 16px;
    background: white;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.qr-container img {
    width: 200px;
    height: 200px;
    display: block;
}

.qr-loading {
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-loading p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.qr-timer {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ─── Overlays ────────────────────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.session-display {
    margin: 16px 0;
}

.session-display textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--accent-blue);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    resize: none;
    outline: none;
    word-break: break-all;
}

/* ─── Loading Spinner ─────────────────────────────────────────────────── */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-card {
    padding: 40px 60px;
}

/* ─── Background Orbs ─────────────────────────────────────────────────── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 8s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #4a9eff;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: #6c63ff;
    bottom: -80px;
    left: -80px;
    animation-delay: -3s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: #4aff9e;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(20px, -20px); }
    66% { transform: translate(-15px, 15px); }
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .glass-card {
        padding: 28px 20px;
    }

    h1 {
        font-size: 1.7rem;
    }

    .choice-buttons {
        flex-direction: column;
    }

    .method-buttons {
        flex-direction: column;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }
}
