/* ==========================================================================
   ALTMASS — DESIGN SYSTEM
   Identity: premium gaming + social platform — clean light surfaces,
   deep navy/charcoal text, a bold blue-purple gaming accent, and a
   bright gold accent reserved specifically for XP/rewards so progress
   always reads distinctly from ordinary UI actions.
   Signature motif: the hexagon (XP rings, avatar frames, badges) —
   evokes an arena/hive of competition rather than generic circular UI.
   Dark mode mirrors this with inverted surfaces (see prefers-color-scheme).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    /* Color tokens — light theme (default) */
    --am-bg:          #F6F7FC;
    --am-bg-alt:      #EEF0FB;
    --am-surface:     #FFFFFF;
    --am-surface-2:   #F1F2FA;
    --am-border:      #E3E6F5;
    --am-text:        #171B36;
    --am-text-muted:  #676E96;
    --am-accent:      #1F4B3F;   /* blue-purple — primary gaming accent */
    --am-accent-dark: #007054;
    --am-coral:       #FF5C6C;   /* challenges, alerts, wrong answers */
    --am-gold:        #FFB020;   /* XP / rewards — reserved, never reused for plain UI */
    --am-focus:       #8286FF;
    --am-accent-rgb:  31, 75, 63;
    --am-alert-error-text:   #B3241F;
    --am-alert-success-text: #0F7A4E;

    /* Type */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-card: 0 12px 30px -14px rgba(23, 27, 54, 0.18);
    --max-width: 1180px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --am-bg:          #0E1130;
        --am-bg-alt:      #14183F;
        --am-surface:     #1A1F4D;
        --am-surface-2:   #232962;
        --am-border:      #303875;
        --am-text:        #F4F5FB;
        --am-text-muted:  #9BA1C9;
        --am-accent:      #7C80FF;
        --am-accent-dark: #1F4B3F;
        --am-coral:       #FF6B6B;
        --am-gold:        #FFC94A;
        --am-focus:       #9EA1FF;
        --am-alert-error-text:   #FF9BA3;
        --am-alert-success-text: #6EE7B7;
        --shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
    }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--am-bg);
    color: var(--am-text);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0 0 0.5em; line-height: 1.15; }
p { margin: 0 0 1em; color: var(--am-text-muted); }
a { color: var(--am-accent); text-decoration: none; }
a:hover { text-decoration: none; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* Focus visibility (accessibility) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--am-focus);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------- Hexagon signature motif ---------------- */
.hex {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
.hex-badge {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, var(--am-surface-2), var(--am-surface));
    border: 2px solid var(--am-accent);
    font-family: var(--font-mono); font-weight: 700; color: var(--am-accent);
}
.hex-avatar {
    width: 72px; height: 72px;
    object-fit: cover;
    background: var(--am-surface-2);
    border: 3px solid var(--am-accent);
}

/* ---------------- Header / nav ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--am-surface) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--am-border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--am-text); }
.logo:hover { text-decoration: none; }
.logo .hex-badge { width: 34px; height: 34px; font-size: 0.75rem; }
.logo .site-logo-img { width: 34px; height: 34px; border-radius: var(--radius-sm); object-fit: cover; }
.main-nav { display: flex; align-items: center; gap: 24px; }
.main-nav a { color: var(--am-text-muted); font-weight: 500; font-size: 0.95rem; }
.main-nav a:hover, .main-nav a.active { color: var(--am-accent); text-decoration: none; }

/* ---------------- Mobile bottom navigation (per design spec wireframe) ---------------- */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
    background: var(--am-surface);
    border-top: 1px solid var(--am-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px -10px rgba(23, 27, 54, 0.15);
}
.bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; color: var(--am-text-muted); font-size: 0.7rem; font-weight: 600;
    border-radius: var(--radius-sm);
}
.bottom-nav-item:hover, .bottom-nav-item.active { color: var(--am-accent); text-decoration: none; }
.bottom-nav-icon { font-size: 1.3rem; line-height: 1; }

@media (max-width: 860px) {
    .main-nav { display: none; }
    .bottom-nav { display: flex; }
    body { padding-bottom: 70px; }
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border-radius: var(--radius-md);
    font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
    border: 1px solid transparent; cursor: pointer; text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.btn-primary { background: var(--am-accent); color: #FFFFFF; }
.btn.btn-primary:hover { background: var(--am-accent-dark); box-shadow: 0 8px 24px -8px rgba(var(--am-accent-rgb), 0.45); color: #FFFFFF; }
.btn.btn-secondary { background: var(--am-surface); color: var(--am-text); border-color: var(--am-border); }
.btn.btn-secondary:hover { border-color: var(--am-accent); color: var(--am-accent); }
.btn.btn-coral { background: var(--am-coral); color: #FFFFFF; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ---------------- Cards ---------------- */
.card {
    background: linear-gradient(160deg, var(--am-surface), var(--am-bg-alt));
    border: 1px solid var(--am-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* ---------------- Auth pages ---------------- */
.auth-shell {
    min-height: calc(100vh - 68px);
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-card .eyebrow { font-family: var(--font-mono); color: var(--am-accent); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-card h1 { font-size: 1.75rem; margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--am-text-muted); font-size: 0.9rem; }

/* ---------------- OAuth / social login buttons ---------------- */
.oauth-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.oauth-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 12px 18px; border-radius: var(--radius-md);
    background: var(--am-surface); border: 1px solid var(--am-border);
    color: var(--am-text); font-weight: 600; font-size: 0.9rem; text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.oauth-btn:hover { border-color: var(--am-accent); text-decoration: none; box-shadow: var(--shadow-card); }
.oauth-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.oauth-divider { display: flex; align-items: center; gap: 12px; color: var(--am-text-muted); font-size: 0.8rem; margin-bottom: 22px; }
.oauth-divider::before, .oauth-divider::after { content: ''; flex: 1; height: 1px; background: var(--am-border); }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--am-text); margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.input, select.input, textarea.input {
    width: 100%;
    padding: 12px 14px;
    background: var(--am-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--radius-sm);
    color: var(--am-text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.15s ease;
}
.input::placeholder { color: #6670A8; }
.input:focus { border-color: var(--am-accent); outline: none; }
.field-error { color: var(--am-coral); font-size: 0.8rem; margin-top: 6px; }

/* Password field with view/hide toggle button */
.password-field { position: relative; }
.password-field .input { padding-right: 46px; }
.password-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--am-text-muted);
}
.password-toggle:hover { color: var(--am-accent); background: var(--am-surface-2); }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle[data-visible="true"] .icon-eye { display: none; }
.password-toggle[data-visible="true"] .icon-eye-off { display: block; }

.form-meta-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; font-size: 0.85rem; }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--am-text-muted); }
.checkbox-row input { accent-color: var(--am-accent); }

/* ---------------- Alerts / toasts ---------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 18px; }
.alert-error { background: rgba(255, 92, 108, 0.12); border: 1px solid var(--am-coral); color: var(--am-alert-error-text); }
.alert-success { background: rgba(45, 200, 130, 0.12); border: 1px solid #2DC882; color: var(--am-alert-success-text); }
.alert-info { background: rgba(var(--am-accent-rgb), 0.10); border: 1px solid var(--am-accent); color: var(--am-text); }

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--am-surface-2); border: 1px solid var(--am-border); border-left: 4px solid var(--am-accent); padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-card); animation: toast-in 0.2s ease; font-size: 0.9rem; }
.toast.toast-error { border-left-color: var(--am-coral); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Hero / homepage ---------------- */
.hero { padding: 80px 0 60px; text-align: center; }
.hero .eyebrow { font-family: var(--font-mono); color: var(--am-accent); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.85rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 820px; margin: 12px auto; }
.hero p.lead { max-width: 620px; margin: 0 auto 32px; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

section { padding: 56px 0; }
.section-title { text-align: center; margin-bottom: 36px; }
.section-title .eyebrow { font-family: var(--font-mono); color: var(--am-accent); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; text-align: center; }
.stat-grid .value { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--am-accent); }
.stat-grid .label { color: var(--am-text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------------- Profile page ---------------- */
.profile-header-card { padding: 0; overflow: hidden; text-align: center; margin-bottom: 24px; }
.profile-cover { height: 110px; background: linear-gradient(120deg, var(--am-accent), var(--am-coral, #E55B4C)); }
.profile-avatar-wrap { margin-top: -46px; margin-bottom: 12px; }
.profile-avatar-wrap .avatar-lg { border: 4px solid var(--am-surface); box-shadow: var(--shadow-card); }
.profile-stats-row {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; margin: 16px 0 20px;
    padding: 14px 0; border-top: 1px solid var(--am-border); border-bottom: 1px solid var(--am-border);
}
.profile-stats-row > div { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
.profile-stats-row strong { font-family: var(--font-mono); font-size: 1.15rem; }
.profile-stats-row span { color: var(--am-text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.profile-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--am-border); margin-bottom: 20px; overflow-x: auto; }
.profile-tab-btn {
    background: none; border: none; cursor: pointer; padding: 10px 16px; font-size: 0.9rem; font-weight: 600;
    color: var(--am-text-muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.profile-tab-btn:hover { color: var(--am-text); }
.profile-tab-btn.active { color: var(--am-accent); border-bottom-color: var(--am-accent); }
.profile-info-list { display: flex; flex-direction: column; gap: 10px; }
.profile-info-item { display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--am-border); font-size: 0.9rem; }
.profile-info-item:last-child { border-bottom: none; padding-bottom: 0; }
.profile-info-item span { color: var(--am-text-muted); }

.game-card { display: flex; flex-direction: column; gap: 12px; }
.game-card .hex-badge { font-size: 1.4rem; }
.game-card h3 { font-size: 1.1rem; margin: 0; }

.site-footer { border-top: 1px solid var(--am-border); padding: 40px 0; color: var(--am-text-muted); font-size: 0.85rem; text-align: center; }
.site-footer a { color: var(--am-text-muted); }
.footer-links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------------- Dashboard shell ---------------- */
.dash-layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 32px 0 80px; }
@media (max-width: 900px) { .dash-layout { grid-template-columns: 1fr; } }
.dash-sidebar .card { position: sticky; top: 90px; }
.dash-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.dash-profile .name { font-weight: 700; }
.dash-profile .level { color: var(--am-accent); font-family: var(--font-mono); font-size: 0.8rem; }
.dash-nav { display: flex; flex-direction: column; gap: 4px; }
.dash-nav a { padding: 10px 12px; border-radius: var(--radius-sm); color: var(--am-text-muted); font-weight: 500; }
.dash-nav a:hover, .dash-nav a.active { background: var(--am-surface-2); color: var(--am-accent); text-decoration: none; }
.dash-nav-chat-btn {
    padding: 10px 12px; border-radius: var(--radius-sm); color: var(--am-text-muted); font-weight: 500;
    text-align: left; background: none; border: none; cursor: pointer; font-family: inherit; font-size: inherit;
}
.dash-nav-chat-btn:hover { background: var(--am-surface-2); color: var(--am-accent); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--am-border); font-size: 0.9rem; }
.data-table th { color: var(--am-text-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }

/* ---------------- Cookie consent banner ---------------- */
.cookie-consent {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: var(--am-surface); border-top: 1px solid var(--am-border);
    box-shadow: 0 -8px 24px -12px rgba(23,27,54,0.2);
    padding: 18px 20px;
}
@media (max-width: 860px) {
    .cookie-consent { bottom: 70px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}
.cookie-consent-inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cookie-consent-inner p { margin: 0; flex: 1; min-width: 240px; font-size: 0.85rem; }
.cookie-consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-preferences { max-width: var(--max-width); margin: 14px auto 0; padding-top: 14px; border-top: 1px solid var(--am-border); display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

.xp-bar { height: 10px; border-radius: 6px; background: var(--am-surface-2); overflow: hidden; border: 1px solid var(--am-border); }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, #FF9A1F, var(--am-gold)); }

/* ---------------- Game play screen ---------------- */
.game-shell { max-width: 720px; margin: 0 auto; padding: 32px 20px 80px; }
.game-progress-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 0.85rem; color: var(--am-text-muted); }
.game-progress-bar { height: 8px; border-radius: 6px; background: var(--am-surface-2); overflow: hidden; margin-bottom: 24px; }
.game-progress-fill { height: 100%; background: var(--am-accent); transition: width 0.3s ease; }
.game-timer { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; color: var(--am-accent); }
.game-timer.low-time { color: var(--am-coral); }
.sound-toggle-btn {
    width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--am-border); background: var(--am-surface-2);
    font-size: 0.95rem; line-height: 1; cursor: pointer; color: var(--am-text);
}
.sound-toggle-btn:hover { border-color: var(--am-accent); }
.question-prompt { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 24px; }
.option-list { display: flex; flex-direction: column; gap: 12px; }
.option-btn {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px; border-radius: var(--radius-md);
    background: var(--am-surface); border: 2px solid var(--am-border);
    font-size: 1rem; font-weight: 600; color: var(--am-text);
    cursor: pointer; text-align: left; transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.option-btn:hover:not(:disabled) { border-color: var(--am-accent); transform: translateY(-1px); }
.option-btn:disabled { cursor: default; }
.option-btn .option-letter {
    width: 30px; height: 30px; border-radius: 50%; background: var(--am-surface-2);
    display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.85rem; flex-shrink: 0;
}
.option-btn.correct { background: rgba(45, 200, 130, 0.12); border-color: #2DC882; }
.option-btn.incorrect { background: rgba(255, 92, 108, 0.1); border-color: var(--am-coral); }
.option-btn.selected { background: rgba(31, 75, 63, 0.12); border-color: var(--am-accent); }

.result-hero { text-align: center; padding: 20px 0 32px; }
.result-hero .score-value { font-family: var(--font-display); font-size: 3rem; color: var(--am-accent); }
.result-hero .xp-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 176, 32, 0.15); color: #B57200; padding: 6px 16px; border-radius: 20px; font-weight: 700; font-family: var(--font-mono); margin-top: 8px; }

.iq-category-breakdown { max-width: 420px; margin: 20px auto 0; text-align: left; }
.iq-category-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.82rem; }
.iq-category-name { flex: 0 0 150px; color: var(--am-text-muted); }
.iq-category-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--am-surface-2); overflow: hidden; }
.iq-category-bar-fill { height: 100%; background: var(--am-accent); border-radius: 4px; }
.iq-category-pct { flex: 0 0 40px; text-align: right; font-family: var(--font-mono); color: var(--am-text-muted); }

/* ---------------- Daily battle banner ---------------- */
.daily-battle {
    background: linear-gradient(120deg, var(--am-accent), #8083FF);
    border-radius: var(--radius-lg);
    padding: 32px;
    color: #fff;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;
}
.daily-battle h2 { color: #fff; margin: 0 0 6px; }
.daily-battle .meta { display: flex; gap: 24px; flex-wrap: wrap; font-size: 0.9rem; opacity: 0.9; }
.daily-battle .btn-primary { background: #fff; color: var(--am-accent-dark); }
.daily-battle .btn-primary:hover { background: #F1F2FF; }

/* ---------------- Announcement banner ---------------- */
.announcement-banner {
    background: linear-gradient(90deg, var(--am-accent), #8083FF);
    color: #fff;
}
.announcement-banner-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 20px; font-size: 0.9rem;
}
.announcement-dismiss {
    background: none; border: none; color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; flex-shrink: 0;
    opacity: 0.85;
}
.announcement-dismiss:hover { opacity: 1; }

/* ---------------- Share buttons ---------------- */
.share-icon-row { display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; padding: 2px; }
.share-icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; min-width: 40px; border-radius: 50%; flex-shrink: 0;
    background: var(--am-surface-2); border: 1px solid var(--am-border); cursor: pointer;
    text-decoration: none; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.share-icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.share-icon-btn svg { width: 20px; height: 20px; }
.share-icon-btn[data-label]::after {
    content: attr(data-label); position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%) translateY(4px); background: var(--am-text); color: var(--am-surface);
    font-size: 0.72rem; font-weight: 600; padding: 4px 9px; border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.12s ease, transform 0.12s ease;
}
.share-icon-btn[data-label]:hover::after, .share-icon-btn[data-label]:focus-visible::after {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ---------------- Millionaire Challenge lifelines ---------------- */
.lifeline-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--am-border); }
.lifeline-btn {
    flex: 1; min-width: 100px;
    padding: 10px 12px; border-radius: var(--radius-md);
    background: var(--am-surface-2); border: 1px solid var(--am-border);
    font-size: 0.85rem; font-weight: 600; color: var(--am-text);
    cursor: pointer; transition: border-color 0.15s ease, opacity 0.15s ease;
}
.lifeline-btn:hover:not(:disabled) { border-color: var(--am-accent); color: var(--am-accent); }
.lifeline-btn:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.lifeline-note {
    margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
    background: rgba(255, 176, 32, 0.12); border: 1px solid var(--am-gold);
    font-size: 0.85rem; color: var(--am-text);
}
.option-btn.hidden-5050 { display: none; }
.option-btn { position: relative; }
.audience-pct {
    position: absolute; top: 8px; right: 10px; padding: 2px 8px; border-radius: 999px;
    background: var(--am-accent); color: #1F2A17; font-family: var(--font-mono);
    font-size: 0.75rem; font-weight: 700; line-height: 1.6;
}

/* Sponsored ad images (Section: sponsored ads image upload) */
.sponsored-ad-card-img {
    display: block; width: 100%; max-height: 150px; object-fit: cover;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin: -12px -14px 10px;
    width: calc(100% + 28px);
}
/* Main-content placement (search.php, games.php, play.php) — a wide column,
   so each ad reads as a single horizontal card: image on the LEFT, text on
   the right, one full-width card per row. The sidebar widget below keeps
   the image-on-top vertical stack instead, since it's a narrow rail where a
   side-by-side image has no room to breathe. Below ~560px there isn't
   enough width for a side image either, so it falls back to the same
   image-on-top layout the sidebar uses. */
.sponsored-ad-row { display: flex; flex-direction: column; gap: 14px; margin: 18px 0; max-width: 720px; }
.sponsored-ad-row .sponsored-ad-card {
    display: flex; flex-direction: row; align-items: stretch; gap: 14px;
    padding: 12px; margin-bottom: 0;
}
.sponsored-ad-row .sponsored-ad-card-img {
    flex: 0 0 240px; width: 240px; aspect-ratio: 3 / 2; height: auto;
    max-height: none; margin: 0; border-radius: var(--radius-sm); align-self: center;
}
.sponsored-ad-row .sponsored-ad-body { display: flex; flex: 1 1 0; flex-direction: column; justify-content: center; min-width: 0; }
@media (max-width: 560px) {
    .sponsored-ad-row .sponsored-ad-card { flex-direction: column; padding: 12px 14px 14px; }
    .sponsored-ad-row .sponsored-ad-card-img { flex: none; width: calc(100% + 28px); aspect-ratio: auto; align-self: auto; max-height: 150px; margin: -12px -14px 10px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
    .sponsored-ad-row .sponsored-ad-body { flex: none; justify-content: flex-start; }
}

/* Level-locked game cards */
.game-card.locked { opacity: 0.65; }
.level-lock-badge {
    display: inline-block; margin-top: 8px; padding: 4px 10px;
    border-radius: 20px; background: rgba(255,92,108,0.12);
    border: 1px solid var(--am-coral); color: var(--am-coral);
    font-size: 0.75rem; font-weight: 600;
}

/* ---------------- Social layer: avatars, feed, comments, report modal ---------------- */
.avatar-circle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--am-accent), var(--am-accent-dark));
    color: #fff; font-weight: 700; font-family: var(--font-mono); font-size: 1rem;
}
.avatar-circle.avatar-sm { width: 30px; height: 30px; font-size: 0.8rem; }
.avatar-circle.avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; }

.feed-post {
    background: var(--am-surface); border: 1px solid var(--am-border);
    border-radius: var(--radius-md); padding: 18px; margin-bottom: 16px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.feed-post:hover { box-shadow: var(--shadow-card); border-color: var(--am-border-strong, var(--am-border)); }
.feed-post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.feed-post-menu-wrap { position: relative; flex-shrink: 0; }
.feed-post-menu-btn {
    background: none; border: none; cursor: pointer; color: var(--am-text-muted);
    width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
.feed-post-menu-btn:hover { background: var(--am-surface-2); color: var(--am-text); }
.feed-post-menu-btn svg { width: 17px; height: 17px; }
.feed-post-menu {
    position: absolute; top: 36px; right: 0; z-index: 30; min-width: 190px;
    background: var(--am-surface); border: 1px solid var(--am-border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card); padding: 6px; display: flex; flex-direction: column; gap: 1px;
}
.feed-post-menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none;
    cursor: pointer; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--am-text); font-size: 0.85rem;
    text-decoration: none; font-family: inherit;
}
.feed-post-menu-item:hover { background: var(--am-surface-2); }
.feed-post-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.feed-post-menu-danger { color: var(--am-coral); }
.feed-post-menu-danger svg { color: var(--am-coral); opacity: 1; }
.feed-post-edit-form textarea { width: 100%; resize: vertical; margin-bottom: 8px; }
.feed-post-edit-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.feed-post-author { font-weight: 700; color: var(--am-text); }
.feed-post-author:hover { color: var(--am-accent); }
.feed-post-time { font-size: 0.78rem; color: var(--am-text-muted); }
.feed-post-body { font-size: 0.95rem; margin-bottom: 12px; line-height: 1.5; }
.feed-post-body a { color: var(--am-accent); word-break: break-word; }
.feed-post-link { margin-left: 8px; font-weight: 600; white-space: nowrap; }
.feed-post-image-link { display: block; margin-bottom: 12px; }
.feed-post-image {
    display: block; width: 100%; max-height: 420px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--am-border);
}

/* ---- Link-preview unfurl card (Title/Image/Description) ---- */
.link-preview-holder { margin-bottom: 12px; }
.link-preview-card {
    display: flex; align-items: stretch; gap: 0; border: 1px solid var(--am-border);
    border-radius: var(--radius-sm); overflow: hidden; text-decoration: none; color: var(--am-text);
    background: var(--am-surface-2); transition: border-color 0.12s ease;
}
.link-preview-card:hover { border-color: var(--am-accent); }
.link-preview-image { width: 120px; min-width: 120px; height: auto; object-fit: cover; }
.link-preview-body { flex: 1; min-width: 0; padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.link-preview-title { font-size: 0.9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-preview-desc { font-size: 0.78rem; color: var(--am-text-muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-preview-domain { font-size: 0.7rem; color: var(--am-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.link-preview-chevron { display: flex; align-items: center; padding: 0 14px; color: var(--am-text-muted); font-size: 1.3rem; flex-shrink: 0; }
@media (max-width: 480px) { .link-preview-image { width: 84px; min-width: 84px; } }
.feed-post-actions {
    display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--am-border);
    padding-top: 8px; margin-top: 4px;
}
.feed-post-actions button {
    background: none; border: none; cursor: pointer; color: var(--am-text-muted);
    font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 999px; transition: background 0.12s ease, color 0.12s ease;
}
.feed-post-actions button:hover { color: var(--am-text); background: var(--am-surface-2); }
.feed-post-actions button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.75; }
.feed-post-actions button:hover svg { opacity: 1; }
.feed-report-btn { color: var(--am-text-muted); }
.feed-like-btn.liked { color: var(--am-coral); font-weight: 700; }
.feed-like-btn.liked svg { color: var(--am-coral); opacity: 1; }

.feed-comments { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--am-border); }
.feed-comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }

.comment-item { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-weight: 700; font-size: 0.85rem; margin-right: 6px; }
.comment-text { font-size: 0.88rem; word-break: break-word; }
.comment-text a { color: var(--am-accent); }
.comment-meta { font-size: 0.72rem; color: var(--am-text-muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.comment-meta-sep { opacity: 0.6; }
.comment-like-btn {
    background: none; border: none; cursor: pointer; color: var(--am-text-muted);
    display: inline-flex; align-items: center; gap: 3px; padding: 0; font-size: 0.72rem;
}
.comment-like-btn svg { width: 12px; height: 12px; opacity: 0.75; }
.comment-like-btn:hover svg { opacity: 1; }
.comment-like-btn.liked { color: var(--am-coral); font-weight: 700; }
.comment-like-btn.liked svg { color: var(--am-coral); opacity: 1; }
.comment-edit-form { margin: 6px 0; }
.comment-edit-form textarea { width: 100%; font-size: 0.85rem; resize: vertical; margin-bottom: 6px; }
.comment-edit-actions { display: flex; gap: 8px; }
.comment-edit-btn, .comment-edit-cancel { background: none; border: none; color: var(--am-coral); cursor: pointer; font-size: 0.72rem; padding: 0; }
.comment-edit-cancel { color: var(--am-text-muted); font-size: 0.8rem; }
.comment-delete-btn, .comment-report-btn {
    background: none; border: none; color: var(--am-coral); cursor: pointer; font-size: 0.72rem; padding: 0;
}
.comment-report-btn { color: var(--am-text-muted); }
.comment-image-link { display: inline-block; margin-top: 6px; }
.comment-image {
    display: block; max-width: 220px; max-height: 220px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--am-border);
}

/* ---- Comment composer: pill input + emoji/photo/send icon buttons ---- */
.feed-comment-form { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; position: relative; }
.comment-input-wrap {
    flex: 1; min-width: 160px; display: flex; align-items: center; gap: 4px;
    background: var(--am-surface-2); border: 1px solid var(--am-border);
    border-radius: 999px; padding: 4px 6px 4px 14px;
}
.comment-input-wrap:focus-within { border-color: var(--am-accent); }
.comment-text-input { flex: 1; border: none; background: none; padding: 6px 4px; font-size: 0.88rem; min-width: 0; }
.comment-text-input:focus { outline: none; box-shadow: none; }
.comment-emoji-btn, .comment-image-btn, .comment-send-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
    background: none; color: var(--am-text-muted); flex-shrink: 0;
}
.comment-emoji-btn:hover, .comment-image-btn:hover { background: var(--am-surface); color: var(--am-text); }
.comment-emoji-btn svg, .comment-image-btn svg { width: 18px; height: 18px; }
.comment-send-btn { background: var(--am-accent); color: #fff; }
.comment-send-btn:hover { background: var(--am-accent-dark); }
.comment-send-btn svg { width: 15px; height: 15px; }
.comment-image-preview, .composer-image-preview {
    display: flex; align-items: center; gap: 10px; margin: 8px 0;
    background: var(--am-surface-2); border: 1px solid var(--am-border);
    border-radius: var(--radius-sm); padding: 6px; width: fit-content;
}
.comment-image-preview img, .composer-image-preview img {
    max-height: 70px; max-width: 110px; object-fit: cover; border-radius: var(--radius-sm);
}
.comment-image-remove {
    background: none; border: none; cursor: pointer; color: var(--am-text-muted);
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
}
.comment-image-remove svg { width: 14px; height: 14px; }

/* ---- Feed composer (top of feed page) ---- */
.feed-composer-card { padding: 16px; }
.feed-composer-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.feed-composer-row textarea { flex: 1; resize: vertical; }
.feed-composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feed-composer-tools { display: flex; align-items: center; gap: 4px; }
.feed-composer-tools .comment-image-btn { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 10px; border-radius: 999px; font-size: 0.82rem; }

/* ---- Emoji picker ---- */
.am-emoji-picker {
    z-index: 400; background: var(--am-surface); border: 1px solid var(--am-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-card);
    padding: 10px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px;
    max-width: 320px;
}
.am-emoji-option {
    background: none; border: none; cursor: pointer; font-size: 1.15rem;
    line-height: 1.6; border-radius: var(--radius-sm); padding: 2px;
}
.am-emoji-option:hover { background: var(--am-surface-2); }
@media (max-width: 480px) { .am-emoji-picker { grid-template-columns: repeat(7, 1fr); left: 8px !important; } }

.am-modal-overlay {
    position: fixed; inset: 0; background: rgba(10, 12, 30, 0.6);
    display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.am-modal { max-width: 420px; width: 100%; }

/* ---------------- Sponsored competitions: visually distinct from normal games (Section 37) ---------------- */
.competition-card {
    display: block; text-decoration: none; color: var(--am-text);
    border: 1px solid var(--am-gold); background: linear-gradient(160deg, rgba(255,176,32,0.08), var(--am-surface));
}
.competition-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    background: var(--am-gold); color: #4A3200; font-size: 0.7rem; font-weight: 800;
    letter-spacing: 0.04em;
}

/* ---------------- Public quiz meta bar (Section 47/86: real content for guests + crawlers) ---------------- */
.quiz-meta-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.quiz-meta-pill {
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 20px;
    background: var(--am-surface-2); border: 1px solid var(--am-border); font-size: 0.8rem; color: var(--am-text-muted);
}

/* ---------------- Ad slots (Section 60): device targeting via CSS, never user-agent sniffing ---------------- */
.ad-slot { margin: 16px 0; text-align: center; overflow: hidden; }
.ad-slot::before { content: "Advertisement"; display: block; font-size: 0.65rem; letter-spacing: 0.05em; color: var(--am-text-muted); text-transform: uppercase; margin-bottom: 4px; }
@media (max-width: 768px) { .ad-device-desktop { display: none; } }
@media (min-width: 769px) { .ad-device-mobile { display: none; } }

/* ---------------- Sponsored user ads (feed sidebar) ---------------- */
.sponsored-ad-card {
    display: block; padding: 12px 14px 14px; border-radius: var(--radius-md); border: 1px solid var(--am-border);
    background: var(--am-surface); text-decoration: none; color: var(--am-text); margin-bottom: 14px;
    overflow: hidden; transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.sponsored-ad-card:hover { border-color: var(--am-accent); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.sponsored-ad-card strong { display: block; font-size: 1rem; margin-top: 2px; line-height: 1.3; }
.sponsored-ad-card p { font-size: 0.82rem; color: var(--am-text-muted); margin: 6px 0 0; line-height: 1.45; }
.sponsored-ad-label {
    display: inline-block; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--am-accent-dark); background: rgba(154, 217, 61, 0.15); padding: 2px 8px; border-radius: 20px;
    font-weight: 700;
}
.sponsored-ad-cta {
    display: inline-block; margin-top: 10px; font-size: 0.8rem; font-weight: 700; color: var(--am-accent-dark, var(--am-accent));
}

/* ---------------- Uploaded avatar photos (vs. the letter-circle fallback) ---------------- */
.avatar-img { object-fit: cover; vertical-align: middle; }

/* ---------------- Coin Shop avatar frames (Section 39, purely cosmetic) ---------------- */
.avatar-frame-gold { box-shadow: 0 0 0 3px #FFD700; }
.avatar-frame-neon { box-shadow: 0 0 0 3px #B026FF, 0 0 10px #B026FF; }
.avatar-frame-fire { box-shadow: 0 0 0 3px #FF4500, 0 0 10px #FF6B35; }
.avatar-frame-ice { box-shadow: 0 0 0 3px #00E5FF, 0 0 10px #7DF9FF; }

/* ---------------- Feed 3-column layout (left nav, center feed, right widgets) ---------------- */
.feed-layout { display: grid; grid-template-columns: 220px 1fr 260px; gap: 24px; align-items: start; }
@media (max-width: 1024px) { .feed-layout { grid-template-columns: 1fr; } .feed-sidebar { display: none; } }
.feed-sidebar { position: sticky; top: 20px; }
.feed-sidebar-profile {
    display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--am-text);
    padding: 14px; border-radius: var(--radius-md); background: var(--am-surface); border: 1px solid var(--am-border); margin-bottom: 12px;
}
.feed-sidebar-nav { display: flex; flex-direction: column; gap: 2px; background: var(--am-surface); border: 1px solid var(--am-border); border-radius: var(--radius-md); padding: 8px; }
.feed-sidebar-nav a { display: block; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--am-text); text-decoration: none; font-size: 0.9rem; }
.feed-sidebar-nav a:hover { background: var(--am-surface-2); }
.feed-sidebar-chat-btn {
    display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--am-text); font-size: 0.9rem; background: none; border: none; cursor: pointer; font-family: inherit;
}
.feed-sidebar-chat-btn:hover { background: var(--am-surface-2); }
.feed-sidebar-widget { background: var(--am-surface); border: 1px solid var(--am-border); border-radius: var(--radius-md); padding: 14px; margin-bottom: 16px; }
.feed-sidebar-widget h4 { margin: 0 0 10px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--am-text-muted); }
.feed-sidebar-user-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.85rem; }
.feed-sidebar-user-row a { display: flex; align-items: center; gap: 8px; color: var(--am-text); text-decoration: none; }

/* ---------------- Dashboard action grid: fixed 3 columns (3 x 4 = 12 cards) ---------------- */
.dash-action-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .dash-action-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .dash-action-grid { grid-template-columns: 1fr; } }

/* ---------------- Mobile top-bar menu (hamburger + notifications), shown after login on small screens ---------------- */
.mobile-topbar-actions { display: none; align-items: center; gap: 6px; }
@media (max-width: 860px) { .mobile-topbar-actions { display: flex; } }
.mobile-icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: transparent; border: none; font-size: 1.25rem; line-height: 1;
    color: var(--am-text); cursor: pointer;
}
.mobile-icon-btn:hover { background: var(--am-surface-2); }
.mobile-icon-badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--am-coral); color: #fff; font-size: 0.6rem; font-weight: 700;
    border-radius: 10px; padding: 1px 5px; line-height: 1.3;
}
.mobile-menu-overlay {
    display: none; position: fixed; inset: 0; z-index: 150;
    background: rgba(14, 17, 48, 0.55);
}
.mobile-menu-overlay.open { display: block; }
.mobile-menu-panel {
    position: fixed; top: 0; right: 0; z-index: 151;
    width: min(300px, 82vw); height: 100%;
    background: var(--am-surface);
    border-left: 1px solid var(--am-border);
    box-shadow: -12px 0 30px -14px rgba(23, 27, 54, 0.35);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}
.mobile-menu-overlay.open .mobile-menu-panel { transform: translateX(0); }
.mobile-menu-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mobile-menu-header strong { font-family: var(--font-display); font-size: 1.05rem; }
.mobile-menu-close {
    width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); border: none; background: var(--am-surface-2); color: var(--am-text);
    font-size: 1.1rem; cursor: pointer;
}
.mobile-menu-panel nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-menu-panel nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 12px; border-radius: var(--radius-sm);
    color: var(--am-text); font-weight: 500; text-decoration: none; font-size: 0.98rem;
}
.mobile-menu-panel nav a:hover, .mobile-menu-panel nav a.active { background: var(--am-surface-2); color: var(--am-accent); }
.mobile-menu-panel nav a .menu-icon { font-size: 1.15rem; width: 22px; text-align: center; }

/* ---------------- FAQ accordion ---------------- */
.faq-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; }
.faq-toc a {
    font-size: 0.82rem; font-weight: 500; padding: 6px 14px; border-radius: 20px;
    background: var(--am-surface-2); border: 1px solid var(--am-border); color: var(--am-text);
}
.faq-toc a:hover { border-color: var(--am-accent); color: var(--am-accent); text-decoration: none; }
.faq-section { margin-bottom: 36px; }
.faq-section h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; scroll-margin-top: 90px; }
.faq-item {
    background: var(--am-surface);
    border: 1px solid var(--am-border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
}
.faq-item summary {
    padding: 15px 18px; cursor: pointer; font-weight: 600; list-style: none;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--am-text-muted); flex-shrink: 0; }
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { border-bottom: 1px solid var(--am-border); }
.faq-item p, .faq-item ul { padding: 0 18px; margin: 14px 0; font-size: 0.92rem; }
.faq-item ul { padding-left: 36px; }
.faq-item p:last-child, .faq-item ul:last-child { margin-bottom: 16px; }

/* ================================================================
   Millionaire Challenge — themed redesign
   Recreates the classic escalating money-ladder game-show layout
   (wordmark header, lifeline + score toolbar, question panel, and a
   live-tracking ladder sidebar) in the brand color #1F4B3F instead
   of the traditional blue. Everything below is scoped under
   .millionaire-shell so no other game type is affected.
   ================================================================ */
.millionaire-shell {
    max-width: 1000px;
    background: radial-gradient(120% 140% at 50% -10%, #2F6B57 0%, #1F4B3F 45%, #0E2921 100%);
    border: 1px solid #3E7C67;
    border-radius: var(--radius-lg);
    padding: 22px 22px 28px;
    box-shadow: 0 24px 60px -24px rgba(6, 20, 16, 0.65);
}
.millionaire-shell .card {
    background: linear-gradient(160deg, #1B4437, #123128);
    border: 1px solid #3E7C67;
    color: #F3F1E3;
}
.millionaire-shell .btn-secondary { background: #163A2F; color: #F3F1E3; border-color: #3E7C67; }
.millionaire-shell .btn-secondary:hover { border-color: #F0C24B; color: #F0C24B; }
.millionaire-shell .btn-primary { background: #F0C24B; color: #163A2F; }
.millionaire-shell .btn-primary:hover { background: #FCE7A8; color: #163A2F; }
.millionaire-shell .oauth-btn { background: #163A2F; border-color: #3E7C67; color: #F3F1E3; }
.millionaire-shell .oauth-btn:hover { border-color: #F0C24B; }

/* Wordmark header */
.millionaire-header { text-align: center; padding: 6px 6px 16px; }
.millionaire-eyebrow {
    font-family: var(--font-mono); letter-spacing: 0.28em; text-transform: uppercase;
    font-size: 0.72rem; color: #B9D3C8; margin-bottom: 2px;
}
.millionaire-wordmark { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.millionaire-wordmark .mw-line1 {
    font-family: var(--font-display); font-weight: 800; font-size: clamp(2.1rem, 6vw, 3.4rem);
    letter-spacing: 0.03em;
    background: linear-gradient(180deg, #FCE7A8, #F0C24B 55%, #C6912C);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 2px 0 rgba(0,0,0,0.25));
}
.millionaire-wordmark .mw-line2 {
    font-family: var(--font-display); font-weight: 600; font-size: clamp(0.9rem, 2.2vw, 1.2rem);
    letter-spacing: 0.5em; color: #E7F3EE; margin-top: 4px; padding-left: 0.5em;
}
.millionaire-header-rule { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.millionaire-header-rule::before, .millionaire-header-rule::after {
    content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #F0C24B, transparent);
}
.mh-diamond { color: #F0C24B; font-size: 0.7rem; }

/* Two-column play area: question panel + lifelines/score/ladder sidebar */
.millionaire-shell .millionaire-play-card { padding: 18px; }
.millionaire-body { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .millionaire-body { grid-template-columns: 1fr; } }

.millionaire-question-col .game-progress-row { color: #B9D3C8; }
.millionaire-question-col .game-progress-bar { background: #163A2F; border: 1px solid #3E7C67; }
.millionaire-question-col .game-progress-fill { background: linear-gradient(90deg, #F0C24B, #FCE7A8); }
.millionaire-question-col .game-timer { color: #F0C24B; }
.millionaire-question-col .game-timer.low-time { color: #FF7A7A; }
.millionaire-question-col .sound-toggle-btn { background: #163A2F; border-color: #3E7C67; color: #F3F1E3; }
.millionaire-question-col .question-prompt { color: #FBF8EC; }

.millionaire-question-col .option-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .millionaire-question-col .option-list { grid-template-columns: 1fr; } }
.millionaire-question-col .option-btn {
    background: linear-gradient(135deg, #2A6350, #1A4436);
    border: 2px solid #4E8B76;
    color: #F3F1E3;
    padding: 16px 30px;
    clip-path: polygon(2.5% 0%, 97.5% 0%, 100% 50%, 97.5% 100%, 2.5% 100%, 0% 50%);
}
.millionaire-question-col .option-btn:hover:not(:disabled) { border-color: #F0C24B; background: linear-gradient(135deg, #367A63, #235241); transform: none; }
.millionaire-question-col .option-btn .option-letter { background: #123128; border: 1px solid #F0C24B; color: #F0C24B; }
.millionaire-question-col .option-btn.correct { background: linear-gradient(135deg, #2E8B57, #1F6B41); border-color: #7CEAA8; }
.millionaire-question-col .option-btn.incorrect { background: linear-gradient(135deg, #8B3A2E, #5C1F1F); border-color: #FF9B8A; }
.millionaire-question-col .option-btn.selected { background: linear-gradient(135deg, #3B7864, #23503F); border-color: #F0C24B; }
.millionaire-shell .lifeline-note { background: rgba(240, 194, 75, 0.14); border: 1px solid #F0C24B; color: #F3F1E3; }

.millionaire-confirm {
    align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: rgba(240, 194, 75, 0.12); border: 1px solid #F0C24B; border-radius: var(--radius-md);
    padding: 12px 16px; margin-top: 12px; color: #FBF8EC; font-weight: 600;
}
.millionaire-confirm-actions { display: flex; gap: 10px; }
.millionaire-confirm-actions .btn { padding: 8px 16px; font-size: 0.9rem; }

/* Lifelines + live score toolbar (sits above the ladder, as in the reference layout) */
.millionaire-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: linear-gradient(160deg, #1B4437, #123128);
    border: 1px solid #3E7C67; border-radius: var(--radius-md);
    padding: 12px 14px; margin-bottom: 14px;
}
.millionaire-shell .lifeline-bar { margin: 0; padding: 0; border: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.millionaire-shell .lifeline-btn {
    flex: 0 0 auto; width: 48px; height: 48px; min-width: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; position: relative;
    background: radial-gradient(circle at 35% 30%, #2E6B57, #123128);
    border: 2px solid #F0C24B; color: #FCE7A8; font-size: 0.68rem; font-weight: 700;
    padding: 0;
}
.lifeline-icon { line-height: 1; }
.millionaire-shell .lifeline-btn:hover:not(:disabled) { box-shadow: 0 0 0 3px rgba(240, 194, 75, 0.25); border-color: #FCE7A8; color: #FCE7A8; }
.millionaire-shell .lifeline-btn:disabled { opacity: 0.35; border-color: #5C7A70; color: #5C7A70; text-decoration: none; }
.millionaire-shell .lifeline-btn.used {
    opacity: 0.55; border-color: #5C7A70; color: #8FAFA2;
    background: radial-gradient(circle at 35% 30%, #1E362F, #0F211B);
}
.millionaire-shell .lifeline-btn.used::after {
    content: '✓';
    position: absolute; top: -4px; right: -4px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #2E8B57; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
    border: 1px solid #123128;
}

.millionaire-score-box { text-align: right; }
.millionaire-score-label { display: block; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: #B9D3C8; }
.millionaire-score-value { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; color: #FCE7A8; }

/* Money ladder sidebar */
.millionaire-ladder {
    list-style: none; margin: 0; padding: 0;
    background: linear-gradient(160deg, #1B4437, #123128);
    border: 1px solid #3E7C67; border-radius: var(--radius-md);
    overflow: hidden;
}
.millionaire-ladder .rung {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 14px; font-family: var(--font-mono); font-size: 0.85rem;
    color: #DCEDE6; border-bottom: 1px solid rgba(62, 124, 103, 0.4);
}
.millionaire-ladder .rung:last-child { border-bottom: 0; }
.millionaire-ladder .rung .rung-num { width: 22px; color: #7FAE9C; font-weight: 600; }
.millionaire-ladder .rung.milestone { color: #F5C56B; font-weight: 700; }
.millionaire-ladder .rung.milestone .rung-num { color: #F0C24B; }
.millionaire-ladder .rung.climbed { opacity: 0.5; }
.millionaire-ladder .rung.current {
    background: linear-gradient(90deg, #F0C24B, #E0A93B);
    color: #1F2A17;
}
.millionaire-ladder .rung.current .rung-num { color: #1F2A17; }

/* Result screen + footer bar */
.millionaire-shell .result-hero .score-value { color: #FCE7A8; }
.millionaire-shell .result-hero .xp-pill { background: #F0C24B; color: #163A2F; }
.millionaire-footer-bar {
    margin-top: 14px; text-align: center; padding: 10px 14px;
    border: 1px solid #3E7C67; border-radius: var(--radius-md);
    background: linear-gradient(160deg, #1B4437, #123128);
    color: #DCEDE6; font-size: 0.85rem;
}

/* Admin branding (logo/favicon) upload previews */
.branding-preview-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.branding-preview-row img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--am-border); background: var(--am-surface); }
.branding-preview-row .branding-preview-empty {
    width: 56px; height: 56px; border-radius: var(--radius-sm); border: 1px dashed var(--am-border);
    display: flex; align-items: center; justify-content: center; color: var(--am-text-muted); font-size: 0.7rem; text-align: center;
}

/* ==================== Chat widget (direct messages) ==================== */
.chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 500; }
.chat-bubble-btn {
    display: none; position: relative; width: 56px; height: 56px; border-radius: 50%; border: none;
    background: var(--am-accent); color: #fff; cursor: pointer; box-shadow: var(--shadow-card);
    align-items: center; justify-content: center; transition: transform 0.12s ease;
}
.chat-bubble-btn.visible { display: flex; }
.chat-bubble-btn:hover { transform: translateY(-2px); }
.chat-bubble-btn svg { width: 24px; height: 24px; }
.chat-bubble-badge {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 4px;
    border-radius: 999px; background: var(--am-coral); color: #fff; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; border: 2px solid var(--am-surface);
}
.chat-panel {
    position: absolute; right: 0; bottom: 68px; width: 340px; height: 480px; max-height: 70vh;
    background: var(--am-surface); border: 1px solid var(--am-border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-card); display: flex; flex-direction: column; overflow: hidden;
}
.chat-view { display: flex; flex-direction: column; height: 100%; }
.chat-panel-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px;
    border-bottom: 1px solid var(--am-border); flex-shrink: 0;
}
.chat-panel-header strong { font-size: 0.95rem; }
.chat-thread-user { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; flex: 1; min-width: 0; }
.chat-header-actions { display: flex; align-items: center; gap: 4px; }
#chatNewBtn, .chat-close-btn, #chatCloseBtn, .chat-back-btn {
    background: none; border: none; cursor: pointer; color: var(--am-text-muted);
    width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
#chatNewBtn:hover, .chat-close-btn:hover, #chatCloseBtn:hover, .chat-back-btn:hover { background: var(--am-surface-2); color: var(--am-text); }
.chat-close-btn svg, #chatCloseBtn svg { width: 13px; height: 13px; }

.chat-list-scroll { flex: 1; overflow-y: auto; padding: 6px; }
.chat-empty { color: var(--am-text-muted); font-size: 0.85rem; text-align: center; padding: 24px 12px; margin: 0; }

.chat-conversation-item, .chat-person-row {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer; padding: 9px 8px; border-radius: var(--radius-sm);
}
.chat-conversation-item:hover, .chat-person-row:hover { background: var(--am-surface-2); }
.chat-conversation-item.unread { background: rgba(var(--am-accent-rgb, 31, 75, 63), 0.06); }
.chat-conv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-conv-info strong, .chat-person-row strong { font-size: 0.85rem; }
.chat-conv-preview {
    font-size: 0.78rem; color: var(--am-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-conversation-item.unread .chat-conv-preview { color: var(--am-text); font-weight: 600; }
.chat-unread-badge {
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--am-accent);
    color: #fff; font-size: 0.68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-person-row span { display: flex; flex-direction: column; gap: 1px; }
.chat-person-name { font-size: 0.78rem; color: var(--am-text-muted); }

.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble-row { display: flex; flex-direction: column; max-width: 78%; }
.chat-bubble-row.own { align-self: flex-end; align-items: flex-end; }
.chat-bubble-row.their { align-self: flex-start; align-items: flex-start; }
.chat-bubble { padding: 8px 12px; border-radius: 14px; font-size: 0.87rem; line-height: 1.4; word-break: break-word; }
.chat-bubble-row.own .chat-bubble { background: var(--am-accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble-row.their .chat-bubble { background: var(--am-surface-2); border-bottom-left-radius: 4px; }
.chat-bubble a { color: inherit; text-decoration: none; font-weight: 600; }
.chat-bubble-time { font-size: 0.65rem; color: var(--am-text-muted); margin-top: 2px; padding: 0 4px; }

.chat-send-form { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--am-border); flex-shrink: 0; }
.chat-send-form input { flex: 1; }
.chat-send-form button {
    width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--am-accent); color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-send-form button svg { width: 15px; height: 15px; }

@media (max-width: 480px) {
    .chat-widget { right: 12px; bottom: 12px; }
    .chat-panel { width: calc(100vw - 24px); height: 65vh; max-height: none; }
}
