@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0c1a12;
    --bg-secondary: #111f16;
    --bg-tertiary: #162a1c;
    --text-primary: #e8e4da;
    --text-secondary: #8a9e90;
    --text-muted: #5a6e60;
    --accent: #3d9e6a;
    --accent-amber: #d4a843;
    --border: #1e3326;
    --success: #3d9e6a;
    --error: #c44040;
    --font: 'DM Sans', Inter, sans-serif;
    --font-display: 'Fraunces', Georgia, serif;
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --card-bg: #111f16;
    --card-border: #1e3326;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --input-bg: #0c1a12;
    --header-bg: #0c1a12;
    --choice-selected-bg: #162a1c;
    --correct-bg: #122a18;
    --correct-border: #2a5a3a;
    --correct-text: #3d9e6a;
    --incorrect-bg: #2a1818;
    --incorrect-border: #5a2a2a;
    --subject-1: #122a18;
    --subject-2: #12182a;
    --subject-3: #2a2518;
    --subject-4: #2a1818;
    --subject-5: #1e122a;
    --icon-bg: #162a1c;
    --icon-border: rgba(255, 255, 255, 0.06);
}

/* Dark theme matches root -- Dark Editorial is the default palette */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: env(safe-area-inset-top, 0) 0 0 0;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.875rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s var(--ease);
}

.logo:hover {
    opacity: 0.8;
}

.logo i {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stats {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-pill);
    border: 2px solid transparent;
    transition: all 0.2s var(--ease);
    letter-spacing: 0.01em;
}

.stat-item i {
    font-size: 0.75rem;
}

.stat-item .stat-val {
    font-variant-numeric: tabular-nums;
}

.stat-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}

.stat-streak i {
    color: #FF9600;
}

.stat-xp i {
    color: #FFC800;
}

.stat-hearts i {
    color: #FF4B4B;
}

.container {
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0));
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

.category-tabs::-webkit-scrollbar {
    height: 4px;
}

.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.category-tab {
    padding: 0.625rem 1rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s var(--ease);
    letter-spacing: 0.01em;
    margin-bottom: -2px;
}

.category-tab:hover {
    color: var(--text-secondary);
}

.category-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.section-title {
    font-size: 0.8125rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.subject-card {
    background: var(--subject-1);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    transition: transform 0.15s var(--spring), border-color 0.2s var(--ease);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    position: relative;
}

.subject-card:nth-child(5n + 1) {
    background: var(--subject-1);
}

.subject-card:nth-child(5n + 2) {
    background: var(--subject-2);
}

.subject-card:nth-child(5n + 3) {
    background: var(--subject-3);
}

.subject-card:nth-child(5n + 4) {
    background: var(--subject-4);
}

.subject-card:nth-child(5n + 5) {
    background: var(--subject-5);
}

.subject-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.subject-card.selected {
    border-color: var(--accent);
    border-bottom: 4px solid #2d7a50;
}

.subject-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--icon-bg);
    border: 2px solid var(--icon-border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.subject-name {
    font-weight: 800;
    font-size: 0.9375rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.subject-level {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.lesson-container {
    display: none;
}

.lesson-container.active {
    display: block;
    animation: fadeUp 0.35s var(--ease);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-container {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar {
    flex: 1;
    background: var(--border);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    background: var(--accent);
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s var(--ease);
    width: 0%;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 700;
}

.question-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.question-container {
    animation: fadeIn 0.3s var(--ease);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.question-type {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.question-text {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.75rem;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.math-equation {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
    margin: 1.5rem 0 2rem;
    letter-spacing: -0.02em;
}

.math-input,
.translation-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: var(--font);
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.math-input {
    text-align: center;
}

.math-input::placeholder,
.translation-input::placeholder {
    color: var(--text-muted);
}

.math-input:focus,
.translation-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 158, 106, 0.15);
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice-btn {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-bottom: 4px solid var(--card-border);
    padding: 1rem 1.25rem;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-family: var(--font);
    color: var(--text-primary);
    transition: all 0.15s var(--ease), transform 0.2s var(--spring);
    text-align: left;
    font-weight: 700;
    line-height: 1.4;
}

.choice-btn:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.choice-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.choice-btn.selected {
    border-color: var(--accent);
    background: var(--choice-selected-bg);
}

.choice-btn.correct {
    background: var(--correct-bg);
    border-color: var(--success);
    color: var(--correct-text);
}

.choice-btn.incorrect {
    background: var(--incorrect-bg);
    border-color: var(--error);
    color: var(--error);
}

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    min-height: 64px;
}

.word-chip {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.15s var(--ease);
    font-size: 0.875rem;
    font-weight: 700;
    border: 2px solid var(--border);
    user-select: none;
}

.word-chip:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.word-chip.used {
    opacity: 0.35;
    cursor: default;
    transform: scale(0.95);
}

.answer-box {
    min-height: 56px;
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.btn {
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 800;
    padding: 0.625rem 1.25rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border: 2px solid var(--card-border);
    border-bottom: 4px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.btn:hover {
    border-color: var(--border);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
    border: 2px solid var(--accent);
    border-bottom: 4px solid #2d7a50;
}

.btn-primary:hover {
    background: #4aad76;
    border-color: #4aad76;
    color: #FFFFFF;
}

.btn-primary:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.feedback {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: none;
    font-size: 0.875rem;
    font-weight: 800;
}

.feedback.correct {
    background: var(--correct-bg);
    color: var(--correct-text);
    border: 2px solid var(--correct-border);
}

.feedback.incorrect {
    background: var(--incorrect-bg);
    color: var(--error);
    border: 2px solid var(--incorrect-border);
}

.feedback.show {
    display: block;
}

.result-container {
    display: none;
    text-align: center;
}

.result-container.active {
    display: block;
    animation: fadeUp 0.35s var(--ease);
}

.result-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 3rem 2rem;
}

.result-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--correct-bg);
    border: 2px solid var(--correct-border);
    color: var(--success);
    font-size: 1.25rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.375rem;
    letter-spacing: -0.01em;
}

.result-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 700;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.result-stat {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 2rem;
    flex: 1;
}

.result-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.result-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
}

@media (max-width: 640px) {
    .header-inner {
        padding: 0.75rem 1rem;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .stats {
        gap: 0;
    }

    .stat-item {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    .question-text {
        font-size: 1.125rem;
    }

    .math-equation {
        font-size: 1.375rem;
    }

    .question-card {
        padding: 1.5rem;
    }

    .subject-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .result-stats {
        flex-direction: column;
    }

    .result-stat {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.choice-btn:focus-visible,
.word-chip:focus-visible,
.subject-card:focus-visible {
    outline-offset: -2px;
}

.math-input:focus-visible,
.translation-input:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.achievement-toast {
    position: fixed;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--card-bg);
    border: 2px solid var(--correct-border);
    border-radius: var(--radius-lg);
    transition: top 0.3s var(--spring);
    max-width: 90vw;
}

.achievement-toast.show {
    top: calc(env(safe-area-inset-top, 0px) + 80px);
}

.achievement-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--correct-bg);
    border: 2px solid var(--correct-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 1rem;
    flex-shrink: 0;
}

.achievement-toast-title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--correct-text);
    font-weight: 800;
}

.achievement-toast-name {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--text-primary);
}

.achievement-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 2px solid var(--border);
    z-index: 200;
    transition: right 0.3s var(--ease);
    overflow-y: auto;
    padding: 1.5rem;
}

.achievement-panel.active {
    right: 0;
}

.achievement-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.achievement-panel-header h2 {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.achievement-close {
    border: none !important;
    padding: 0.5rem !important;
}

.achievement-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease);
}

.achievement-item.locked {
    opacity: 0.45;
}

.achievement-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.achievement-item.unlocked .achievement-icon {
    background: var(--correct-bg);
    border-color: var(--correct-border);
    color: var(--success);
}

.achievement-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.achievement-info {
    flex: 1;
}

.achievement-check {
    color: var(--success);
    font-size: 0.875rem;
}

.mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.mic-btn:hover {
    border-color: var(--border);
    color: var(--text-primary);
}

.mic-btn.listening {
    background: var(--incorrect-bg);
    border-color: var(--incorrect-border);
    color: var(--error);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.review-badge {
    font-size: 0.6875rem;
    font-weight: 800;
    color: var(--correct-text);
    background: var(--correct-bg);
    border: 2px solid var(--correct-border);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-pill);
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.btn,
.choice-btn,
.subject-card,
.word-chip {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(61, 158, 106, 0.2);
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
    animation: rippleEffect 0.5s ease-out;
    pointer-events: none;
}

@keyframes correctBounce {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(61, 158, 106, 0.15);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes incorrectShake {
    0% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-6px);
    }
    40% {
        transform: translateX(6px);
    }
    60% {
        transform: translateX(-4px);
    }
    80% {
        transform: translateX(4px);
    }
    100% {
        transform: translateX(0);
    }
}

.question-card.correct-anim {
    animation: correctBounce 0.5s var(--ease);
    border-color: var(--correct-border);
}

.question-card.incorrect-anim {
    animation: incorrectShake 0.5s var(--ease);
    border-color: var(--incorrect-border);
}

@keyframes xpFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px);
    }
}

.xp-float {
    position: absolute;
    top: -0.25rem;
    right: 0;
    font-size: 0.875rem;
    font-weight: 800;
    color: #FFC800;
    pointer-events: none;
    animation: xpFloat 1s var(--ease) forwards;
    z-index: 101;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti-piece {
    position: fixed;
    top: -10px;
    width: 8px;
    height: 8px;
    z-index: 1000;
    pointer-events: none;
    animation: confettiFall 2s var(--ease) forwards;
}

@keyframes rippleEffect {
    from {
        transform: scale(0);
        opacity: 1;
    }
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    font-size: 0.875rem;
    padding: 0;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}

.theme-toggle .fa-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-sun {
    display: inline;
}

[data-theme="dark"] .theme-toggle .fa-moon {
    display: none;
}

/* Dark theme already matches root -- editorial dark is the default */

.sr-only:focus {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: auto !important;
    height: auto !important;
    padding: 0.75rem 1.5rem !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--accent) !important;
    border-radius: var(--radius-md) !important;
    z-index: 10000 !important;
    font-size: 0.875rem;
    font-weight: 700;
}

/* ── Noise texture overlay ── */

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
}

/* ── Auth / Landing screen ── */

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.auth-card {
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
}

.auth-copy {
    margin-bottom: 2.5rem;
}

.auth-section-label {
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.auth-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.auth-subtitle {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 360px;
}

.auth-panel {
    width: 100%;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-field span {
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.auth-field input {
    font-family: var(--font);
    font-size: 1rem;
    padding: 0.875rem 1rem;
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color 0.2s var(--ease);
    outline: none;
}

.auth-field input::placeholder {
    color: var(--text-muted);
}

.auth-field input:focus {
    border-color: var(--accent);
}

.auth-avatar-label {
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: -0.5rem;
}

/* ── Avatar picker (3x2 grid) ── */

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.2s var(--spring), border-color 0.2s var(--ease);
    font-family: var(--font);
}

.avatar-option:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.avatar-option.selected {
    border-color: var(--accent);
    background: var(--choice-selected-bg);
}

.avatar-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.avatar-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Auth CTA (pill button) ── */

.auth-submit {
    background: var(--text-primary);
    color: var(--bg-primary);
    border: 2px solid var(--text-primary);
    border-bottom: 2px solid var(--text-primary);
    border-radius: 100px;
    padding: 0.875rem 2rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.2s var(--spring), background 0.2s var(--ease), border-color 0.2s var(--ease);
    margin-top: 0.5rem;
}

.auth-submit:hover {
    background: var(--accent-amber);
    border-color: var(--accent-amber);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

/* ── Auth feedback ── */

.auth-feedback {
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--accent);
    margin-top: 1rem;
    min-height: 1.25rem;
}

.auth-feedback.success {
    color: var(--accent);
}

.auth-feedback.error {
    color: var(--error);
}

/* ── Profile chip (header) ── */

.profile-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform 0.2s var(--spring), border-color 0.2s var(--ease);
    font-family: var(--font);
}

.profile-chip:hover {
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

.profile-chip-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-tertiary);
    font-size: 0.875rem;
    line-height: 1;
}

.profile-chip-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Profile panel (slide-out) ── */

.profile-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 2px solid var(--border);
    z-index: 200;
    transition: right 0.3s var(--ease);
    overflow-y: auto;
    padding: 1.5rem;
}

.profile-panel.active {
    right: 0;
}

.profile-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.profile-panel-header h2 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.profile-panel-kicker {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.profile-summary-avatar {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-tertiary);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.profile-summary-copy {
    flex: 1;
}

.profile-summary-name {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.profile-summary-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .auth-shell {
        min-height: auto;
        padding: 1rem 0;
    }

    .avatar-picker {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .avatar-option {
        padding: 0.75rem 0.25rem;
    }

    .auth-heading {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }

    .profile-panel {
        width: 100vw;
        right: -100vw;
    }
}
