/* ═══════════════════════════════════════════
   Design tokens
   ── A dictionary/vocabulary app: ink-teal accent (reading,
   annotation), warm parchment neutrals, serif for headwords
   (the word being studied is the hero of each screen),
   humanist sans for UI chrome.
════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Accent — ink teal */
    --ink:        #1F5B54;
    --ink-dk:     #163F3A;
    --ink-lt:     #E7F1EF;

    /* Semantic */
    --good:       #2F8F5B;
    --good-dk:    #23703F;
    --bad:        #C4453A;
    --bad-dk:     #A3352C;
    --gold:       #C9932E;
    --gold-dk:    #A97A22;
    --gold-lt:    #FBF2DF;

    /* Neutrals — warm parchment bias, not pure grey */
    --paper:      #FBF9F5;
    --paper-dim:  #F3EFE7;
    --line:       #E4DDD0;
    --line-dk:    #D2C8B6;
    --ink-500:    #7A7166;
    --ink-700:    #4A443C;
    --ink-900:    #2A251F;
    --white:      #FFFFFF;

    --shadow-sm:  0 1px 3px rgba(42,37,31,0.08);
    --shadow:     0 8px 24px rgba(42,37,31,0.10);
    --shadow-lg:  0 20px 50px rgba(42,37,31,0.22);
    --radius:     16px;
    --radius-sm:  10px;

    --font-display: Iowan Old Style, Palatino Linotype, Palatino, Georgia, 'Noto Serif', serif;
    --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono:    ui-monospace, 'SF Mono', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink:        #6FBFAE;
        --ink-dk:     #4F9C8C;
        --ink-lt:     #163431;

        --good:       #4CB07C;
        --good-dk:    #3A8F62;
        --bad:        #E2685D;
        --bad-dk:     #C24E43;
        --gold:       #D9A94C;
        --gold-dk:    #B98B34;
        --gold-lt:    #2E2617;

        --paper:      #17181A;
        --paper-dim:  #1E2022;
        --line:       #33352F;
        --line-dk:    #454740;
        --ink-500:    #A6A093;
        --ink-700:    #D8D3C7;
        --ink-900:    #F3F0E8;
        --white:      #201F1D;

        --shadow-sm:  0 1px 3px rgba(0,0,0,0.35);
        --shadow:     0 8px 24px rgba(0,0,0,0.4);
        --shadow-lg:  0 20px 50px rgba(0,0,0,0.55);
    }
}
:root[data-theme="dark"] {
    --ink:        #6FBFAE;
    --ink-dk:     #4F9C8C;
    --ink-lt:     #163431;

    --good:       #4CB07C;
    --good-dk:    #3A8F62;
    --bad:        #E2685D;
    --bad-dk:     #C24E43;
    --gold:       #D9A94C;
    --gold-dk:    #B98B34;
    --gold-lt:    #2E2617;

    --paper:      #17181A;
    --paper-dim:  #1E2022;
    --line:       #33352F;
    --line-dk:    #454740;
    --ink-500:    #A6A093;
    --ink-700:    #D8D3C7;
    --ink-900:    #F3F0E8;
    --white:      #201F1D;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.35);
    --shadow:     0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg:  0 20px 50px rgba(0,0,0,0.55);
}
:root[data-theme="light"] {
    --ink:        #1F5B54;
    --ink-dk:     #163F3A;
    --ink-lt:     #E7F1EF;

    --good:       #2F8F5B;
    --good-dk:    #23703F;
    --bad:        #C4453A;
    --bad-dk:     #A3352C;
    --gold:       #C9932E;
    --gold-dk:    #A97A22;
    --gold-lt:    #FBF2DF;

    --paper:      #FBF9F5;
    --paper-dim:  #F3EFE7;
    --line:       #E4DDD0;
    --line-dk:    #D2C8B6;
    --ink-500:    #7A7166;
    --ink-700:    #4A443C;
    --ink-900:    #2A251F;
    --white:      #FFFFFF;

    --shadow-sm:  0 1px 3px rgba(42,37,31,0.08);
    --shadow:     0 8px 24px rgba(42,37,31,0.10);
    --shadow-lg:  0 20px 50px rgba(42,37,31,0.22);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

html { color-scheme: light dark; }

body {
    font-family: var(--font-body);
    background: var(--paper-dim);
    min-height: 100vh;
    padding: 24px;
    color: var(--ink-900);
    line-height: 1.5;
}

::selection { background: var(--ink-lt); color: var(--ink-dk); }

:focus-visible {
    outline: 2.5px solid var(--ink);
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink-900);
    text-wrap: balance;
}

/* ═══════════════════════════════════════════
   Theme toggle
════════════════════════════════════════════ */
.theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2000;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--white);
    border: 1.5px solid var(--line);
    box-shadow: var(--shadow-sm);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, transform 0.15s;
}
.theme-toggle:hover { border-color: var(--ink); transform: scale(1.06); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

/* ═══════════════════════════════════════════
   Auth Screen
════════════════════════════════════════════ */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-container {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 48px 42px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    font-size: 46px;
    text-align: center;
    margin-bottom: 14px;
}

.auth-container h1 {
    text-align: center;
    color: var(--ink-900);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    text-wrap: balance;
}

.tagline {
    text-align: center;
    color: var(--ink-500);
    font-size: 15px;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 26px;
    background: var(--paper-dim);
    padding: 4px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--ink-500);
    border-radius: 9px;
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.auth-tab.active {
    background: var(--white);
    color: var(--ink-900);
    box-shadow: var(--shadow-sm);
}

.auth-form input {
    width: 100%;
    padding: 13px 15px;
    margin-bottom: 12px;
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--ink-900);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: block;
}

.auth-form input::placeholder { color: var(--ink-500); opacity: 0.75; }
.auth-form input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-lt); }

.divider {
    text-align: center;
    margin: 20px 0;
    color: var(--ink-500);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    position: relative;
}

.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--line);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

.google-btn {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--ink-900);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.15s, border-color 0.15s;
    font-weight: 500;
}
.google-btn:hover { background: var(--paper-dim); border-color: var(--line-dk); }

/* ═══════════════════════════════════════════
   Main Container
════════════════════════════════════════════ */
.container { max-width: 1080px; margin: 0 auto; }

.header {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 22px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    gap: 14px;
    flex-wrap: wrap;
}

.header h1 {
    color: var(--ink-900);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 21px;
    letter-spacing: -0.01em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lang-pair-select {
    padding: 9px 14px;
    border: 1.5px solid var(--line);
    background: var(--paper-dim);
    color: var(--ink-900);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
}
.lang-pair-select:hover { border-color: var(--ink); }
.lang-pair-select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-lt); }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.user-avatar-btn {
    border: none;
    padding: 0;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.user-avatar-btn:hover,
.user-avatar-btn[aria-expanded="true"] {
    box-shadow: 0 0 0 3px var(--ink-lt);
}

.avatar-menu-wrap {
    position: relative;
}

.avatar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.avatar-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-900);
    cursor: pointer;
    transition: background 0.12s;
}
.avatar-menu button:hover { background: var(--paper-dim); }

.avatar-menu-danger { color: var(--bad) !important; }
.avatar-menu-danger:hover { background: var(--bad) !important; color: var(--white) !important; }

.avatar-menu-divider {
    height: 1px;
    background: var(--line);
    margin: 4px 2px;
}

.premium-badge-header {
    background: var(--gold-lt);
    color: var(--gold-dk);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--gold);
}

.logout-btn {
    padding: 9px 16px;
    background: transparent;
    color: var(--bad);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}
.logout-btn:hover { background: var(--bad-dk); color: var(--white); border-color: var(--bad-dk); }

/* ═══════════════════════════════════════════
   Tabs
════════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px;
    box-shadow: var(--shadow-sm);
}

.tab {
    padding: 11px 18px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink-500);
    transition: background 0.16s, color 0.16s;
    white-space: nowrap;
    flex: 1;
    min-width: fit-content;
}

.tab.active {
    background: var(--ink);
    color: var(--white);
}

.tab:hover:not(.active) {
    background: var(--paper-dim);
    color: var(--ink-900);
}

.premium-badge {
    background: var(--gold-lt);
    color: var(--gold-dk);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 5px;
    border: 1px solid var(--gold);
}

/* ═══════════════════════════════════════════
   Cards
════════════════════════════════════════════ */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px 32px;
    box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════
   Learn tab
════════════════════════════════════════════ */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    padding: 14px 16px;
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--ink-900);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 16px;
    min-width: 200px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar input::placeholder { color: var(--ink-500); opacity: 0.75; }
.search-bar input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-lt); }

.search-bar button {
    padding: 14px 24px;
    background: var(--ink);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.search-bar button:hover:not(:disabled) { background: var(--ink-dk); }
.search-bar button:disabled { opacity: 0.55; cursor: not-allowed; }

.camera-btn { background: var(--paper-dim) !important; color: var(--ink-900) !important; border: 1.5px solid var(--line) !important; }
.camera-btn:hover:not(:disabled) { background: var(--paper-dim) !important; border-color: var(--line-dk) !important; }

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    color: var(--ink-500);
}

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--line);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Word display — dictionary entry treatment */
.word-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
    gap: 18px;
}

.word-info { flex: 1; min-width: 0; }

.word-header h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 42px;
    letter-spacing: -0.015em;
    color: var(--ink-900);
    margin-bottom: 6px;
    text-wrap: balance;
}

.french-word { font-family: var(--font-body); font-size: 19px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.phonetic    { font-family: var(--font-mono); font-size: 14px; color: var(--ink-500); }

.play-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.speed-selector {
    display: flex;
    gap: 4px;
    background: var(--paper-dim);
    padding: 3px;
    border-radius: 20px;
}

.speed-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: var(--ink-500);
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.speed-btn:hover { color: var(--ink-900); }
.speed-btn.active { background: var(--white); color: var(--ink-900); box-shadow: var(--shadow-sm); }

.play-btn {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--white);
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    box-shadow: var(--shadow-sm);
}
.play-btn:hover { background: var(--ink-dk); transform: scale(1.06); }

.image-container { text-align: center; margin: 22px 0; }

#wordImage {
    max-width: 100%;
    max-height: 340px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}

.no-image-text {
    text-align: center;
    color: var(--ink-500);
    font-style: italic;
    padding: 20px 0;
}

.examples-section {
    background: var(--paper-dim);
    padding: 22px;
    border-radius: var(--radius-sm);
    margin: 22px 0;
}

.examples-section h3 {
    margin-bottom: 14px;
    color: var(--ink-700);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.examples-loading {
    list-style: none;
    color: var(--ink-500);
    font-style: italic;
    padding: 10px 0;
    font-size: 14px;
}

.examples-section ul { list-style: none; }

.examples-section li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    padding: 14px 16px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 15.5px;
    line-height: 1.55;
}
.examples-section li:last-child { margin-bottom: 0; }

.examples-section li button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--ink-lt);
    color: var(--ink);
    border: none;
    cursor: pointer;
    font-size: 12px;
    margin-top: 1px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.examples-section li button:hover { background: var(--ink); color: var(--white); }

.word-highlight,
.red-word {
    color: var(--ink) !important;
    font-weight: 700;
    text-decoration: underline dotted !important;
    text-decoration-color: var(--line-dk) !important;
    text-underline-offset: 3px;
}

.save-btn {
    width: 100%;
    padding: 16px;
    background: var(--good);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.15s;
    margin-top: 8px;
}
.save-btn:hover { background: var(--good-dk); }

/* ═══════════════════════════════════════════
   My Words
════════════════════════════════════════════ */
.month-section { margin-bottom: 32px; }

.month-section h3 {
    color: var(--ink-900);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.word-item:hover { border-color: var(--ink); background: var(--ink-lt); }

.word-item-info strong { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.word-item-info .arrow { color: var(--ink-500); margin: 0 8px; }

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ink-lt);
    color: var(--ink);
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--ink); color: var(--white); }

/* ═══════════════════════════════════════════
   Quiz
════════════════════════════════════════════ */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 10px;
}

.quiz-header h2 { font-family: var(--font-display); font-weight: 700; font-size: 22px; }

.hint {
    font-size: 13px;
    color: var(--ink-500);
    margin-top: 4px;
    margin-bottom: 10px;
}

.weekly-cap-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--gold-lt);
    border: 1px solid var(--gold);
    color: var(--gold-dk);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.weekly-cap-banner p { font-weight: 600; font-size: 14px; margin: 0; }

.month-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 15px;
}

.month-checkbox.disabled { color: var(--ink-500); cursor: not-allowed; }
.month-checkbox input    { width: 18px; height: 18px; cursor: pointer; accent-color: var(--ink); }
.month-checkbox.disabled input { cursor: not-allowed; }

.question-block {
    border-bottom: 1px solid var(--line);
    padding-bottom: 22px;
    margin-bottom: 24px;
}

.question-text {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 14px;
    color: var(--ink-900);
    line-height: 1.5;
}

.choice-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color 0.13s, background 0.13s;
    font-size: 15px;
}

.choice-label:hover { border-color: var(--ink); background: var(--ink-lt); }
.choice-label input[type=radio] { width: 18px; height: 18px; accent-color: var(--ink); }

.answer-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--ink-900);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.answer-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-lt); }

/* ═══════════════════════════════════════════
   Results
════════════════════════════════════════════ */
.result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.result-score {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.result-date { font-size: 13px; color: var(--ink-500); }

.cert-btn {
    padding: 10px 18px;
    background: var(--gold-lt);
    color: var(--gold-dk);
    border: 1px solid var(--gold);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    transition: background 0.15s;
}
.cert-btn:hover { background: var(--gold); color: var(--white); }

/* ═══════════════════════════════════════════
   Groups
════════════════════════════════════════════ */
.groups-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 14px;
}

.groups-header h2 { font-family: var(--font-display); font-weight: 700; font-size: 22px; }

.groups-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.online-label { font-size: 13px; color: var(--good); margin-top: 4px; font-weight: 500; }
.online-dot   { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 5px; }
.offline-dot  { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-500); margin-right: 5px; }

.section { margin-bottom: 36px; }
.section h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink-900);
    margin-bottom: 16px;
}

.group-card {
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.group-card:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 10px;
}

.group-card h4 { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.group-size     { color: var(--ink-500); font-size: 13.5px; white-space: nowrap; }

/* Member cards */
.member-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: border-color 0.15s, background 0.15s;
}
.member-card:hover { border-color: var(--ink); background: var(--ink-lt); }

.member-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.member-avatar-large {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 30px;
    margin: 0 auto 14px;
}

.small-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 14px !important;
}

.member-info h4     { margin-bottom: 4px; font-size: 15.5px; font-weight: 600; }
.member-status      { font-size: 13px; color: var(--ink-500); }

.member-profile { text-align: center; margin-bottom: 22px; }
.member-profile h2  { font-family: var(--font-display); font-weight: 700; margin-bottom: 6px; }

/* Month cards */
.month-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    gap: 10px;
}

.badge-accepted {
    color: var(--good);
    font-weight: 600;
    font-size: 13.5px;
}

.badge-pending {
    color: var(--ink-500);
    font-size: 13.5px;
}

/* Request rows */
.request-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.request-info { flex: 1; font-size: 15px; }
.request-actions { display: flex; gap: 8px; }

/* Group quiz */
.group-quiz-section {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.group-quiz-section h3 { font-family: var(--font-display); font-weight: 700; margin-bottom: 14px; font-size: 17px; }

.pending-quiz-banner {
    margin-top: 16px;
    padding: 14px;
    background: var(--gold-lt);
    border: 1.5px solid var(--gold);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--ink-900);
}

.quiz-timer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    margin-bottom: 24px;
    color: var(--ink-700);
}

.timer-display {
    font-family: var(--font-mono);
    font-size: 38px;
    font-weight: bold;
    color: var(--bad);
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Leaderboard */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--paper-dim);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.rank          { font-size: 20px; min-width: 34px; text-align: center; }
.rank.first    { color: var(--gold); }
.rank.second   { color: var(--ink-500); }

.leaderboard-name  { flex: 1; font-weight: 600; font-size: 15.5px; }
.leaderboard-score { font-family: var(--font-mono); font-size: 17px; font-weight: bold; color: var(--good); font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════
   Premium Section
════════════════════════════════════════════ */
.premium-prompt {
    text-align: center;
    padding: 44px 20px;
}

.premium-icon  { font-size: 52px; margin-bottom: 18px; }

.premium-prompt h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    margin-bottom: 10px;
}

.premium-features {
    list-style: none;
    text-align: left;
    max-width: 380px;
    margin: 26px auto;
    font-size: 16px;
}

.premium-features li {
    padding: 9px 0;
    color: var(--ink-700);
}

.premium-price {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 700;
    color: var(--ink);
    margin: 16px 0;
}

.premium-subscribe-btn {
    padding: 16px 44px;
    background: var(--gold);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    box-shadow: var(--shadow-sm);
}
.premium-subscribe-btn:hover {
    background: var(--gold-dk);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════
   Buttons (shared)
════════════════════════════════════════════ */
.primary-btn {
    padding: 13px 24px;
    background: var(--ink);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.primary-btn:hover { background: var(--ink-dk); }

.secondary-btn {
    padding: 13px 20px;
    background: var(--white);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.secondary-btn:hover { background: var(--ink-lt); }

.danger-btn {
    padding: 10px 18px;
    background: transparent;
    color: var(--bad);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.danger-btn:hover { background: var(--bad); color: var(--white); border-color: var(--bad); }

.small-btn { padding: 7px 14px !important; font-size: 13px !important; }

.full-width { width: 100%; }

.badge {
    display: inline-block;
    background: var(--bad);
    color: var(--white);
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    margin-left: 4px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════
   Modal
════════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(20,18,15,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 36px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-content.large { max-width: 800px; }

.modal-content h2 { font-family: var(--font-display); font-weight: 700; }

.close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--ink-500);
    line-height: 1;
    padding: 4px;
    transition: color 0.15s;
}
.close-btn:hover { color: var(--ink-900); }

/* ═══════════════════════════════════════════
   Certificate
════════════════════════════════════════════ */
.certificate {
    text-align: center;
    border: 3px double var(--gold);
}

.cert-seal   { font-size: 64px; margin-bottom: 12px; }

.certificate h1 {
    color: var(--ink-900);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 30px;
    margin-bottom: 16px;
    text-wrap: balance;
}

.certificate h2 {
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 25px;
    margin: 8px 0;
}

.cert-sub    { font-size: 16px; color: var(--ink-700); margin: 8px 0; }
.cert-details { font-size: 14px; color: var(--ink-500); margin: 18px 0 24px; line-height: 1.6; }

.score {
    font-family: var(--font-display);
    font-size: 46px;
    font-weight: bold;
    color: var(--good);
    margin: 12px 0;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   Form Groups
════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: var(--ink-700);
    font-size: 14px;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--ink-900);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-lt); }

.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* ═══════════════════════════════════════════
   Group details
════════════════════════════════════════════ */
.group-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.group-details-header h2 { font-family: var(--font-display); font-weight: 700; font-size: 21px; }

/* ═══════════════════════════════════════════
   Word image popup
════════════════════════════════════════════ */
#wordPopup {
    position: absolute;
    z-index: 5000;
    background: var(--white);
    border-radius: 14px;
    padding: 14px;
    width: 320px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    display: none;
}

.popup-word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink-900);
    margin-bottom: 10px;
    text-align: center;
    text-transform: capitalize;
}

.popup-img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
    background: var(--paper-dim);
}

.popup-no-image {
    text-align: center;
    color: var(--ink-500);
    font-size: 13px;
    padding: 10px 0;
}

.popup-loading {
    text-align: center;
    color: var(--ink-500);
    font-size: 14px;
    padding: 20px 0;
}

.popup-verb-tag {
    display: inline-block;
    background: var(--ink-lt);
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.popup-definition {
    font-size: 14px;
    color: var(--ink-700);
    line-height: 1.6;
    margin-top: 8px;
    text-align: center;
}

.popup-infinitive {
    font-size: 15px;
    color: var(--ink-700);
    margin-top: 6px;
    text-align: center;
}

.popup-infinitive strong {
    font-family: var(--font-display);
    color: var(--ink);
    font-size: 17px;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 15px;
    cursor: pointer;
    color: var(--ink-500);
    line-height: 1;
    transition: color 0.15s;
}
.popup-close:hover { color: var(--ink-900); }

/* ═══════════════════════════════════════════
   Toast
════════════════════════════════════════════ */
#toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink-900);
    color: var(--paper);
    padding: 14px 26px;
    border-radius: 50px;
    font-size: 14.5px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    text-align: center;
}

#toast.toast-error { background: var(--bad-dk); color: var(--white); }

/* ═══════════════════════════════════════════
   Empty state
════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--ink-500);
}
.empty-state p { font-size: 16px; }

/* ═══════════════════════════════════════════
   Responsive
════════════════════════════════════════════ */
@media (max-width: 768px) {
    body { padding: 12px; }

    .header { flex-direction: column; gap: 14px; text-align: center; }
    .tabs   { flex-direction: column; }
    .tab    { text-align: center; }

    .search-bar  { flex-direction: column; }
    .search-bar input, .search-bar button { width: 100%; }

    .word-header { flex-direction: column; gap: 18px; }
    .word-header h2 { font-size: 34px; }
    .play-controls { flex-direction: row; width: 100%; justify-content: space-between; }

    .form-row { flex-direction: column; }

    .groups-header { flex-direction: column; }
    .groups-actions { flex-direction: column; }
    .groups-actions button { width: 100%; }

    .result-card { flex-direction: column; align-items: flex-start; gap: 12px; }

    .quiz-header { flex-direction: column; align-items: flex-start; gap: 10px; }

    .auth-container { padding: 36px 26px; }
}

@media (max-width: 480px) {
    .word-header h2 { font-size: 28px; }
    .card { padding: 22px 18px; }
}
