:root {
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --bg-surface: #1e2a48;
    --bg-hover: rgba(255, 255, 255, 0.08);
    --text: #eaeaea;
    --text-secondary: #c8c8dc;
    --text-muted: #a0a0be;
    --accent: #7cc02e;
    --accent-hover: #92d448;
    --accent-dim: rgba(124, 192, 46, 0.12);
    --danger: #e05545;
    --danger-hover: #f06858;
    --warning: #f5b731;
    --success: #3cc76a;
    --border: #3a4068;
    --border-light: #4a5080;
    --credit-analysis: #4a9eff;
    --credit-activity: #f0a030;
    --radius: 6px;
    --radius-lg: 10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* Black chess figurines — warm brown for visibility on dark background */
.fig-b { color: #c4a36e; }

/* Move number and arrow styling for numbered notation */
.mv-num {
    color: var(--accent);
    font-weight: 600;
}

.mv-arrow {
    color: #555;
    margin: 0 0.15em;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2.5rem;
}

/* ── Navbar ───────────────────────────────────────────────── */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.navbar .logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.3px;
}

.navbar .logo:hover { color: var(--accent-hover); }

.logo-icon { width: 28px; height: 28px; }

.nav-right {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
    color: #fff;
    background: var(--bg-hover);
}

.nav-separator {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 0.5rem;
}


/* ── Credit Indicators ──────────────────────────────────── */

.credit-indicators {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.credit-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.credit-indicator:hover {
    background: var(--bg-hover);
}

.credit-analysis {
    color: var(--credit-analysis);
}

.credit-activity {
    color: var(--credit-activity);
}

/* Low credits (1-2) */
.credit-indicator--low {
    opacity: 0.7;
}

.credit-indicator--low .credit-count {
    color: var(--warning);
}

/* Zero credits */
.credit-indicator--zero {
    color: var(--text-muted);
}

.credit-indicator--zero .credit-count {
    color: var(--danger);
}

.credit-emoji {
    font-size: 0.95rem;
    line-height: 1;
}

/* ── Upgrade Nudge ─────────────────────────────────────── */

.upgrade-nudge {
    display: none;
    align-items: center;
    color: var(--warning);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    gap: 0.25rem;
}

.upgrade-nudge:hover {
    background: var(--bg-hover);
    color: var(--warning);
}

.upgrade-nudge.visible {
    display: flex;
}

.upgrade-nudge svg {
    width: 14px;
    height: 14px;
}

/* ── User Menu ──────────────────────────────────────────── */

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    transition: background 0.15s;
}

.user-menu-trigger:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-menu-name {
    font-weight: 600;
    color: var(--accent);
}

.user-menu-chevron {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.15s;
}

.user-menu.open .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    min-width: 200px;
    z-index: 100;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    padding: 0.35rem;
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

.user-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.user-menu-item:hover {
    color: #fff;
    background: var(--bg-hover);
}

.user-menu-item--danger:hover {
    color: var(--danger);
}

.user-menu-separator {
    height: 1px;
    background: var(--border);
    margin: 0.35rem 0;
}

/* ── Language Submenu ─────────────────────────────────── */

.user-menu-submenu {
    position: relative;
}

.user-menu-submenu-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
}

.user-menu-submenu-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.user-menu-submenu-panel {
    display: none;
    position: absolute;
    right: calc(100% + 4px);
    top: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    padding: 0.35rem;
    z-index: 101;
    white-space: nowrap;
}

.user-menu-submenu:hover > .user-menu-submenu-panel,
.user-menu-submenu:focus-within > .user-menu-submenu-panel {
    display: block;
}

.user-menu-lang {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
}

.user-menu-lang-btn {
    background: none;
    border: 1px solid transparent;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: border-color 0.15s, background 0.15s;
}

.user-menu-lang-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.user-menu-lang-btn.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 0.65rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
    line-height: 1.4;
    font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: #111;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #111;
}

.btn-secondary {
    background: var(--border-light);
    color: var(--text);
}

.btn-secondary:hover {
    background: #4a5078;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
}

.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: var(--danger-hover); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    color: var(--text-secondary);
    opacity: 0.75;
    transition: opacity 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
}

.btn-icon:hover { opacity: 1; color: var(--text); }

.btn-icon-danger:hover { opacity: 1; color: var(--danger); }

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
}

.btn-xs {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
}

.btn-disabled {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

.btn-pending { opacity: 0.7; font-style: italic; }

/* ── Badges ───────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}

.badge-free { background: #2a4a2a; color: #a0e0a0; }
.badge-premium { background: #4a3510; color: #ffc94d; }
.badge-pro { background: #1a3058; color: #7ec0f0; }
.badge-danger { background: #4a1a1a; color: #ff8888; }
.badge-success { background: #1a3a28; color: #60e090; }
.badge-warning { background: #3a3018; color: #ffb400; }
.badge-admin { background: #351a4a; color: #d0a0f0; }
.badge-platform { background: #1a2e48; color: #88c8e8; }

/* ── Form Controls ────────────────────────────────────────── */

.form-input,
.form-select {
    background: var(--bg);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.form-select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8ea8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2.2rem;
}

.form-select option {
    background: var(--bg-card);
    color: var(--text);
}

.form-error {
    background: #4a1a1a;
    border: 1px solid var(--danger);
    color: #ffaaaa;
    padding: 0.75rem 1.15rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

/* ── Login Page ───────────────────────────────────────────── */

/* ── Auth pages ──────────────────────────────────────────── */

.auth-page {
    max-width: 420px;
    margin: 4rem auto;
    text-align: center;
}
.auth-page h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.auth-tagline {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.auth-form {
    text-align: left;
    margin-bottom: 1.5rem;
}
.auth-form label {
    display: block;
    margin-bottom: 0.4rem;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.auth-form label:first-child {
    margin-top: 0;
}
.auth-form .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
}
.auth-form .form-input:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-form .btn {
    width: 100%;
    margin-top: 1.5rem;
}
.auth-error {
    background: rgba(220, 50, 50, 0.15);
    border: 1px solid rgba(220, 50, 50, 0.3);
    color: #ff6b6b;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: left;
}
.auth-success {
    background: rgba(124, 192, 46, 0.15);
    border: 1px solid rgba(124, 192, 46, 0.3);
    color: var(--accent);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-divider span {
    padding: 0 1rem;
}
.auth-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}
.auth-link a {
    color: var(--accent);
}
.auth-continue-banner {
    display: block;
    padding: 0.65rem 1rem;
    margin: 0 0 1.25rem;
    border-radius: var(--radius);
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(124, 192, 46, 0.25);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}
.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 0.75rem;
}
.register-options {
    margin: 2rem 0;
}

.register-pricing {
    max-width: 900px;
    margin: 3rem auto 0;
    text-align: center;
}
.register-pricing h2 {
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
}
.register-pricing-sub {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}

/* Email verification banner */
.verify-banner {
    background: rgba(255, 180, 0, 0.15);
    border: 1px solid rgba(255, 180, 0, 0.3);
    color: #ffb400;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.verify-banner a {
    color: var(--accent);
    white-space: nowrap;
}

/* Legacy login-container (used by chesscom_verify) */
.login-container {
    max-width: 460px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.login-container h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
    font-size: 1.35rem;
}

.login-container label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.login-container .form-input {
    width: 100%;
    margin-bottom: 1.25rem;
}

.login-container .btn {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
}

.form-back {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.88rem;
}

.form-back a { color: var(--text-secondary); text-decoration: none; }
.form-back a:hover { color: var(--accent); }

/* ── Chess.com Verify ─────────────────────────────────────── */

.verification-code {
    background: var(--bg);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    text-align: center;
}

.verification-code code {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
}

.verify-steps {
    margin: 1.25rem 0 1.75rem 1.25rem;
    font-size: 0.92rem;
    line-height: 2;
    color: var(--text-secondary);
}

.verify-steps li { margin-bottom: 0.25rem; }
.verify-steps a { color: var(--accent); }
.verify-steps a:hover { color: var(--accent-hover); }

/* ── Dashboard ────────────────────────────────────────────── */

.dashboard h2 { margin-bottom: 1.25rem; }

.game-result { font-weight: 600; font-size: 0.9rem; }
.game-result.won { color: var(--success); }
.game-result.lost { color: var(--danger); }
.game-result.draw { color: var(--text-muted); }

.accuracy-badge {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 2.5rem;
    text-align: center;
}

.accuracy-badge.empty { visibility: hidden; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dashboard-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.hidden-games-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.hidden-games-title {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

/* ── Item Cards (shared layout for games, studies, openings) ─── */

.item-card-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: border-color 0.15s;
}
.item-card:hover {
    border-color: var(--border-light);
}

.item-card-board {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.item-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.item-card-title {
    font-weight: 600;
    font-size: 1rem;
}

.item-card-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.25rem;
}
.item-card-subtitle p {
    margin: 0;
}

.item-card-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.game-meta-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.game-meta-row .game-opening {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}
.game-meta-row .accuracy-badge {
    font-weight: 600;
}

.item-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
    align-self: center;
}

.item-card-hidden {
    opacity: 0.65;
}

@media (max-width: 600px) {
    .item-card {
        flex-wrap: wrap;
    }
    .item-card-board {
        width: 90px;
        height: 90px;
    }
    .item-card-meta > span {
        min-width: auto;
    }
    .item-card-actions {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
}

/* ── Usage Bar ────────────────────────────────────────────── */

.usage-bar-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.usage-item {
    flex: 1;
    min-width: 140px;
    max-width: 280px;
}

.usage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.usage-count { font-weight: 600; color: var(--text-secondary); }

.usage-track {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-fill.usage-full { background: var(--warning); }

.usage-tier {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    white-space: nowrap;
}

.usage-upgrade-link {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
}

.usage-upgrade-link:hover { color: var(--accent); }

@media (max-width: 768px) {
    .usage-bar-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .usage-item { max-width: none; }
    .usage-tier { margin-left: 0; justify-content: space-between; }
}

/* ── Import Page ─────────────────────────────────────────── */

.import-page {
    max-width: 640px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.import-header {
    margin-bottom: 1.5rem;
}

.import-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.import-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.import-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.import-section {
    padding: 1.25rem 1.5rem;
}

.import-section + .import-section {
    border-top: 1px solid var(--border);
}

.import-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Tabs */
.import-tabs {
    display: flex;
    gap: 0.5rem;
}

.import-tab {
    flex: 1;
    cursor: pointer;
}

.import-tab input[type="radio"] {
    display: none;
}

.import-tab-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.88rem;
    transition: all 0.15s ease;
}

.import-tab-icon {
    font-size: 1rem;
}

.import-tab input:checked + .import-tab-label {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.import-tab-label:hover {
    border-color: var(--border-light);
    color: var(--text-secondary);
}

/* Input areas */
.import-input-area {
    padding-top: 0;
    padding-bottom: 0;
}

.import-input-area .import-method {
    padding: 1.25rem 0;
}

.import-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
}

.import-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.import-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.import-url-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
}

.import-url-input:focus {
    outline: none;
    border-color: var(--accent);
}

.import-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Drop zone */
.import-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.import-dropzone.has-file {
    border-color: var(--accent);
    border-style: solid;
}

.import-dropzone-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.import-dropzone-text {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.import-file-input {
    display: none;
}

/* Color picker */
.import-color-picker {
    display: flex;
    gap: 1rem;
}

.import-color-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s ease;
    font-size: 0.9rem;
}

.import-color-option input[type="radio"] {
    display: none;
}

.import-color-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.import-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--border-light);
}

.import-color-white {
    background: #f0d9b5;
}

.import-color-black {
    background: #b58863;
}

/* Actions */
.import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Feedback banners */
.import-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.import-banner-icon {
    font-weight: bold;
    flex-shrink: 0;
}

.import-banner-success {
    background: rgba(60, 199, 106, 0.12);
    border: 1px solid rgba(60, 199, 106, 0.3);
    color: var(--success);
}

.import-banner-error {
    background: rgba(224, 85, 69, 0.12);
    border: 1px solid rgba(224, 85, 69, 0.3);
    color: var(--danger);
}

.import-banner-info {
    background: rgba(124, 192, 46, 0.12);
    border: 1px solid rgba(124, 192, 46, 0.3);
    color: var(--text-secondary);
}

.import-banner-detail {
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.import-banner-link {
    margin-left: auto;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.import-banner-link:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .import-page { margin: 1rem auto; }
    .import-tabs { flex-direction: column; }
    .import-section { padding: 1rem; }
    .import-color-picker { flex-direction: column; gap: 0.5rem; }
    .import-actions { flex-direction: column-reverse; }
    .import-actions .btn { width: 100%; }
}

/* ── Insights Page ────────────────────────────────────────── */

.insights-page { max-width: 960px; margin: 0 auto; }
.insights-page h2 { margin-bottom: 1.75rem; }

.insights-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-muted);
}

.insight-section {
    margin-bottom: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
}

.insight-section h3 {
    color: var(--accent);
    margin: 0 0 1.25rem;
    font-size: 1.15rem;
}

/* Stat cards */
.accuracy-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 110px;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-value.trend-up { color: var(--success); }
.stat-value.trend-down { color: var(--danger); }

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.35rem;
}

/* Tier-colored stat cards */
.stat-card-free { border-color: #3a5a3a; }
.stat-card-free .stat-value { color: #a0e0a0; }
.stat-card-premium { border-color: #5a3a10; }
.stat-card-premium .stat-value { color: var(--warning); }
.stat-card-pro { border-color: #2a3a5a; }
.stat-card-pro .stat-value { color: #7ec0f0; }
.stat-card-danger { border-color: #5a1a1a; }
.stat-card-danger .stat-value { color: #ff8888; }

/* Insights tables */
.insights-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.insights-table th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insights-table td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--border);
}

.insights-table tbody tr:hover { background: var(--bg-hover); }

.result-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.3rem;
}

.result-dot.won { background: var(--success); }
.result-dot.lost { background: var(--danger); }
.result-dot.draw { background: #95a5a6; }

/* Pattern grid */
.pattern-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.pattern-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
}

.pattern-card h4 {
    margin: 0 0 0.85rem;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.phase-row, .class-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.88rem;
}

.phase-name, .class-name { flex: 1; }
.phase-count, .class-count { flex: 0.5; text-align: right; color: var(--text-muted); }
.phase-loss, .class-pct { flex: 0.7; text-align: right; }

.class-name.blunder { color: var(--danger); }
.class-name.mistake { color: #e67e22; }
.class-name.inaccuracy { color: #f1c40f; }
.class-name.good { color: var(--text); }

.pattern-summary {
    margin: 0.85rem 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Deep insight */
.deep-insight {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.insight-report { margin-bottom: 1.25rem; }

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.insight-header h4 { margin: 0; color: var(--accent); }

.insight-text { line-height: 1.7; font-size: 0.95rem; }
.insight-text p { margin-bottom: 0.6rem; }

.insight-loading {
    display: none;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.insight-loading.htmx-request {
    display: flex;
}
.insight-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-muted { color: var(--text-muted); }

@media (max-width: 768px) {
    .pattern-grid { grid-template-columns: 1fr; }
    .accuracy-summary { flex-wrap: wrap; }

    /* Insights tables → card layout on mobile */
    .insights-table thead { display: none; }
    .insights-table,
    .insights-table tbody,
    .insights-table tr,
    .insights-table td {
        display: block;
        width: 100%;
    }
    .insights-table tr {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border);
    }
    .insights-table td {
        padding: 0.15rem 0;
        border-bottom: none;
        font-size: 0.88rem;
    }
    .insights-table td:first-child {
        font-weight: 600;
        font-size: 0.92rem;
    }
    .insights-table td:empty { display: none; }
    .insights-table td .btn { margin-top: 0.3rem; }

    /* Insight section reduce padding */
    .insight-section { padding: 1.25rem; }

    /* Settings display name form */
    .settings-row-stacked {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .settings-inline-form {
        width: 100%;
    }
    .settings-inline-form .form-input {
        flex: 1;
        min-width: 0;
    }

    /* Credit summary wrap */
    .credit-summary {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }

    /* Pack cards */
    .pack-cards {
        grid-template-columns: 1fr;
        max-width: 320px;
    }

    /* Admin table → card layout */
    .admin-table thead { display: none; }
    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }
    .admin-table tr {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border);
    }
    .admin-table td {
        padding: 0.2rem 0.5rem;
        border-bottom: none;
        font-size: 0.88rem;
    }
    .admin-table td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted);
        display: block;
    }
    .admin-table td:first-child {
        font-weight: 600;
    }

    /* Admin stats grid */
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Settings Page ────────────────────────────────────────── */

.settings-page {
    max-width: 680px;
    margin: 0 auto;
}

.settings-page h1 {
    margin-bottom: 2rem;
    font-size: 1.6rem;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.settings-card-title {
    padding: 1rem 1.5rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

.settings-card-body {
    padding: 1.5rem;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
}

.settings-row + .settings-row {
    border-top: 1px solid var(--border);
}

.settings-label {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.inline-form { display: inline; }

.settings-inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.platform-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.platform-link + .platform-link {
    border-top: 1px solid var(--border);
}

.platform-username {
    font-weight: 500;
    color: var(--text);
}

/* ── Rating Charts ───────────────────────────────────────── */

.rating-chart-container {
    padding: 0.5rem 0;
    min-height: 60px;
}

.rating-chart-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.rating-canvas {
    max-height: 250px;
}

.rating-loading {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 1rem 0;
    display: block;
}

.rating-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 0.5rem 0;
}

/* ── Legal Pages (Terms, Refund) ──────────────────────────── */

.legal-page {
    max-width: 740px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.legal-page h1 { margin-bottom: 0.25rem; }
.legal-updated { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 2rem; }
.legal-section { margin-bottom: 1.75rem; }
.legal-section h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.legal-section p { line-height: 1.6; margin-bottom: 0.5rem; }
.legal-section ul { margin: 0.5rem 0 0.5rem 1.5rem; line-height: 1.6; }
.legal-section a { color: var(--accent); }
.legal-section h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0.5rem 0 1rem;
}
.legal-table th, .legal-table td {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.legal-table th {
    background: var(--bg-card);
    font-weight: 600;
}

/* ── Upgrade Page ─────────────────────────────────────────── */

.upgrade-page {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    padding: 1rem 0 3rem;
}

.upgrade-page h1 {
    margin-bottom: 2.5rem;
    font-size: 1.75rem;
}

.tier-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 650px;
    margin: 0 auto;
    align-items: start;
}

.tier-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    padding-bottom: 0.5rem;
}

.tier-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.tier-card.featured {
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(124, 192, 46, 0.12);
}

.tier-card.featured:hover {
    box-shadow: 0 8px 40px rgba(124, 192, 46, 0.2);
}

.tier-card.current {
    border-color: var(--accent);
}


.tier-card-header {
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
}

.tier-card-header h2 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.tier-header-free h2 { color: #a0e0a0; }
.tier-header-premium h2 { color: var(--warning); }

.tier-price {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.tier-price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.tier-features {
    list-style: none;
    padding: 0.5rem 1.75rem 0.5rem;
    margin: 0;
}

.tier-features li {
    padding: 0.6rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: left;
    padding-left: 1.5rem;
    position: relative;
}

.tier-features li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.tier-card-footer {
    padding: 1.25rem 1.75rem 1.5rem;
    text-align: center;
}

.tier-card-footer .btn {
    width: 100%;
    padding: 0.7rem;
}

@media (max-width: 900px) {
    .tier-cards {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
        gap: 1.5rem;
    }
}

/* Credit info explainer */
.credit-info {
    max-width: 650px;
    margin: 2rem auto 0;
    text-align: left;
}
.credit-info h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.credit-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.credit-info-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.credit-info-item strong {
    display: block;
    color: var(--accent);
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
}
.credit-info-item p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.credit-info-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    text-align: center;
}

@media (max-width: 600px) {
    .credit-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Upgrade page sections */
.upgrade-section-title {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.upgrade-section-desc {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.credit-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}
.credit-summary strong {
    color: var(--accent);
}

/* Booster pack cards */
.pack-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto;
}
.pack-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}
.pack-card-header h3 {
    margin: 0 0 0.5rem;
    color: var(--text);
}
.pack-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
}
.pack-credits {
    color: var(--text-muted);
    margin: 1rem 0;
}
.pack-card-footer {
    margin-top: 1rem;
}

/* ── Quota Exceeded ───────────────────────────────────────── */

.quota-exceeded {
    text-align: center;
    max-width: 520px;
    margin: 5rem auto;
    padding: 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.quota-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.quota-exceeded h2 {
    color: var(--warning);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.quota-exceeded p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.6;
}

.quota-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ── Admin Pages ──────────────────────────────────────────── */

.admin-dashboard,
.admin-users,
.admin-user-detail {
    max-width: 1060px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.admin-header h1 {
    font-size: 1.6rem;
}

.admin-section {
    margin-bottom: 2.5rem;
}

.admin-section-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

/* Admin Search */
.admin-search {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.admin-search input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
}

.admin-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.admin-count {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Admin Table */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th {
    text-align: left;
    padding: 0.85rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: var(--bg-hover);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.admin-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.pagination-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* ── Admin User Detail ────────────────────────────────────── */

.detail-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.detail-card-title {
    padding: 1rem 1.5rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1.25rem;
    padding: 1.25rem 1.5rem;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 0.4rem 0;
}

.detail-list dd {
    padding: 0.4rem 0;
    font-size: 0.92rem;
    color: var(--text);
}

.platform-list { padding: 1rem 1.5rem; }

.platform-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
}

.platform-item + .platform-item {
    border-top: 1px solid var(--border);
}

/* Admin Actions */
.admin-actions {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.action-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    min-width: 70px;
    font-weight: 500;
}

.action-row {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .detail-columns {
        grid-template-columns: 1fr;
    }
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* ── Help Page ────────────────────────────────────────────── */

.help-page { max-width: 740px; margin: 0 auto; }
.help-section { margin-bottom: 2.5rem; }
.help-section h3 { margin-bottom: 0.75rem; }

.notation-legend { margin-top: 1.25rem; font-size: 1.1rem; }
.notation-row { margin-bottom: 0.6rem; }
.notation-label { font-weight: 600; margin-right: 0.5rem; }
.notation-pieces { font-size: 1.2rem; }

/* ── Responsive ───────────────────────────────────────────── */

/* ── Hamburger button (hidden on desktop) ──────────────── */

.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    margin-left: auto;
}
.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}
.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 768px) {
    .container { padding: 1.25rem 1rem; }

    .navbar {
        height: auto;
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
    }

    /* Hide "Centipawn" text, keep logo icon */
    .navbar .logo span {
        display: none;
    }

    /* Credit indicators stay visible next to logo */
    .credit-indicators {
        margin-left: auto;
        margin-right: 0.5rem;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-right {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.15rem;
        padding-top: 0.4rem;
        border-top: 1px solid var(--border);
        margin-top: 0.4rem;
        background: var(--bg-card);
        border-bottom: 2px solid var(--accent);
        padding-bottom: 0.5rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

    .nav-right.open {
        display: flex;
    }

    /* Consistent alignment for all mobile menu items */
    .nav-right .nav-link {
        text-align: left;
        padding: 0.55rem 0.75rem;
        font-size: 0.9rem;
        display: block;
        width: 100%;
    }

    .nav-separator { display: none; }

    /* User menu: flatten into mobile menu */
    .nav-right .user-menu {
        width: 100%;
    }

    .nav-right .user-menu-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        min-width: unset;
        padding: 0;
        display: none;
    }

    .nav-right.open .user-menu-dropdown {
        display: block;
    }

    .nav-right.open .user-menu-trigger {
        display: none;
    }

    /* All dropdown items match nav-link alignment exactly */
    .nav-right .user-menu-item {
        text-align: left;
        padding: 0.55rem 0.75rem;
        font-size: 0.9rem;
        display: block;
        width: 100%;
    }

    .user-menu-separator {
        margin: 0.25rem 0.75rem;
    }

    /* Language submenu: inline on mobile (no flyout) */
    .user-menu-submenu-trigger {
        display: none;
    }

    .user-menu-submenu-panel {
        display: block;
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .user-menu-lang {
        padding: 0.35rem 0.75rem;
    }

    /* Upgrade nudge in mobile — stays next to credits */
    .upgrade-nudge {
        font-size: 0.7rem;
        padding: 0.15rem 0.35rem;
    }
}
