/* ============================================
   100% CLUB - Daily IQ Challenge
   Deep purple/indigo theme with gold accents
   ============================================ */

/* --- CSS Variables --- */
:root {
    /* Primary Palette */
    --primary: #4c1d95;
    --primary-dark: #3b0764;
    --primary-light: rgba(76, 29, 149, 0.15);
    --primary-mid: #5b21b6;
    --indigo: #312e81;
    --indigo-light: #4338ca;

    /* Accent (Gold) */
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --accent-light: rgba(245, 158, 11, 0.15);
    --accent-glow: rgba(245, 158, 11, 0.4);

    /* Background & Surface */
    --bg: #0f0a1e;
    --bg-light: #1a1333;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-hover: rgba(255, 255, 255, 0.1);

    /* Text */
    --text: #f1f5f9;
    --text-secondary: #a5b4c4;
    --text-muted: #64748b;

    /* Semantic */
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;

    /* Category Colours */
    --cat-logical: #3b82f6;
    --cat-numerical: #10b981;
    --cat-spatial: #f97316;
    --cat-verbal: #ec4899;
    --cat-pattern: #06b6d4;
    --cat-lateral: #8b5cf6;

    /* Difficulty Colours */
    --diff-easy: #10b981;
    --diff-medium: #f59e0b;
    --diff-hard: #ef4444;
    --diff-very-hard: #7c3aed;

    /* Gradients */
    --gradient-bg: linear-gradient(145deg, #0f0a1e 0%, #1a1040 50%, #0f0a1e 100%);
    --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #fbbf24 100%);
    --gradient-hero: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #f97316 100%);
    --gradient-end: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #f97316 100%);

    /* Typography */
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-xs: 12px;
    --fs-sm: 14px;
    --fs-base: 16px;
    --fs-lg: 18px;
    --fs-xl: 20px;
    --fs-xxl: 28px;
    --fs-huge: 40px;
    --fs-mega: 56px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    color: var(--text);
    background: var(--gradient-bg);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

/* --- Loading Screen --- */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
}

.loading-title {
    font-size: var(--fs-huge);
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(245, 158, 11, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

/* --- Landing Screen --- */
#landing-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.landing-header {
    padding: var(--space-md) var(--space-lg);
    padding-top: env(safe-area-inset-top, var(--space-md));
}

.landing-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.header-spacer {
    width: 44px;
}

.landing-titles {
    text-align: center;
    flex: 1;
}

.landing-title {
    font-size: var(--fs-mega);
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    line-height: 1.1;
}

.landing-subtitle {
    font-size: var(--fs-lg);
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: var(--space-xs);
}

.landing-date {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.landing-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-lg);
    gap: var(--space-lg);
}

/* Streak Badge */
.landing-streak {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--accent-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-full);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent);
}

.streak-icon {
    font-size: var(--fs-lg);
}

/* Insights Summary */
.landing-insights {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    min-width: 200px;
}

.insights-band {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-xs);
}

.insights-accuracy {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

/* Play Button */
.play-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    padding: var(--space-md) var(--space-xxl);
    font-family: var(--font);
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--gradient-gold);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-glow), var(--shadow-md);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--accent-glow), var(--shadow-lg);
}

.play-button:active {
    transform: scale(0.98);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: var(--shadow-glow), var(--shadow-md); }
    50% { box-shadow: 0 0 30px var(--accent-glow), var(--shadow-lg); }
}

.play-button {
    animation: pulse-glow 2.5s ease-in-out infinite;
}

.play-button:hover {
    animation: none;
}

/* --- Icon Button (Hamburger, Close) --- */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--fs-xl);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

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

.header-right {
    display: flex;
    align-items: center;
}

/* --- Game Screen --- */
#game-screen {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: var(--space-sm) var(--space-md);
    padding-top: env(safe-area-inset-top, var(--space-sm));
    overflow: hidden;
}

/* Top Bar */
.game-top-bar {
    margin-bottom: var(--space-xs);
}

.progress-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.progress-text {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 48px;
}

.progress-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-gold);
    border-radius: var(--radius-full);
    transition: width 0.4s var(--ease-out);
}

.timer {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 48px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Badges */
.badges-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category badges */
.category-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.category-logical {
    background: rgba(59, 130, 246, 0.15);
    color: var(--cat-logical);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.category-numerical {
    background: rgba(16, 185, 129, 0.15);
    color: var(--cat-numerical);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.category-spatial {
    background: rgba(249, 115, 22, 0.15);
    color: var(--cat-spatial);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.category-verbal {
    background: rgba(236, 72, 153, 0.15);
    color: var(--cat-verbal);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.category-pattern {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cat-pattern);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.category-lateral {
    background: rgba(139, 92, 246, 0.15);
    color: var(--cat-lateral);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Difficulty badges */
.difficulty-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.difficulty-easy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--diff-easy);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.difficulty-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--diff-medium);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.difficulty-hard {
    background: rgba(239, 68, 68, 0.15);
    color: var(--diff-hard);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.difficulty-very-hard {
    background: rgba(124, 58, 230, 0.15);
    color: var(--diff-very-hard);
    border: 1px solid rgba(124, 58, 230, 0.3);
}

/* Question */
.question-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) 0;
    min-height: 0;
    overflow-y: auto;
}

.question-text {
    font-size: var(--fs-xl);
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    color: var(--text);
    max-width: 480px;
}

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: var(--space-xs);
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.option-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease-out);
    text-align: center;
    line-height: 1.3;
}

.option-button:hover {
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.option-button:active {
    transform: scale(0.98);
}

.option-button.correct {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
    font-weight: 600;
}

.option-button.wrong {
    background: var(--error-light);
    border-color: var(--error);
    color: var(--error);
    font-weight: 600;
}

.option-button.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Feedback */
.feedback-container {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    animation: slide-up 0.3s var(--ease-out);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.feedback-icon {
    font-size: var(--fs-xl);
    flex-shrink: 0;
    line-height: 1;
}

.feedback-text {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.feedback-container.feedback-correct {
    background: var(--success-light);
    border-color: rgba(16, 185, 129, 0.3);
}

.feedback-container.feedback-correct .feedback-text {
    color: var(--success);
}

.feedback-container.feedback-wrong {
    background: var(--error-light);
    border-color: rgba(239, 68, 68, 0.3);
}

.feedback-container.feedback-wrong .feedback-text {
    color: var(--error);
}

/* --- End Screen Modal --- */
.end-screen-modal {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: var(--gradient-end);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.3s ease-out;
}

.end-screen-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(249,115,22,0.15) 0%, transparent 50%);
    pointer-events: none;
}

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

.end-screen-content {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md);
    padding-top: env(safe-area-inset-top, var(--space-sm));
    padding-bottom: env(safe-area-inset-bottom, var(--space-sm));
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Hero Section */
.end-hero {
    text-align: center;
    padding: var(--space-sm) 0 0;
}

.end-hero-stars {
    font-size: var(--fs-huge);
    margin-bottom: var(--space-sm);
}

.end-hero-score {
    font-size: 64px;
    font-weight: 800;
    color: white;
    line-height: 1;
    text-shadow: 0 2px 16px rgba(0,0,0,0.2);
    animation: endScoreCount 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    font-variant-numeric: tabular-nums;
}

@keyframes endScoreCount {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

.end-hero-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.end-hero-sublabel {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    margin-top: 2px;
}

/* Stats Row */
.end-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    padding: 4px 0;
}

.end-stat {
    padding: 12px 8px;
    text-align: center;
    position: relative;
}

.end-stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 12px;
    bottom: 12px;
    width: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.end-stat .stat-value {
    font-size: 22px;
    font-weight: 800;
    color: white;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.end-stat .stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

/* Ranking */
.end-ranking {
    text-align: center;
    font-size: var(--fs-sm);
    color: rgba(255, 255, 255, 0.85);
    padding: 0;
}

/* Group Leaderboards */
.end-group-leaderboards {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.end-group-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.end-group-card h3,
.end-group-header {
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: var(--space-sm) var(--space-sm) 4px;
    color: var(--text);
}

.end-group-table {
    width: 100%;
    border-collapse: collapse;
}

.end-group-table td {
    padding: 4px var(--space-sm);
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.end-group-table td:first-child {
    width: 32px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
}

.end-group-table td:last-child {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.end-group-table tr.leaderboard-me {
    background: var(--accent-light);
}

.end-group-table tr.leaderboard-me td {
    color: var(--accent);
    font-weight: 600;
}

.end-group-empty {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    padding: var(--space-sm);
    text-align: center;
}

/* Result Dots - instant visual summary of Q1-Q10 */
.end-result-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 2px 0;
}

.result-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-block;
    animation: dotPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.result-dot:nth-child(1) { animation-delay: 0.05s; }
.result-dot:nth-child(2) { animation-delay: 0.1s; }
.result-dot:nth-child(3) { animation-delay: 0.15s; }
.result-dot:nth-child(4) { animation-delay: 0.2s; }
.result-dot:nth-child(5) { animation-delay: 0.25s; }
.result-dot:nth-child(6) { animation-delay: 0.3s; }
.result-dot:nth-child(7) { animation-delay: 0.35s; }
.result-dot:nth-child(8) { animation-delay: 0.4s; }
.result-dot:nth-child(9) { animation-delay: 0.45s; }
.result-dot:nth-child(10) { animation-delay: 0.5s; }

@keyframes dotPop {
    0% { opacity: 0; transform: scale(0); }
    100% { opacity: 1; transform: scale(1); }
}

.dot-correct {
    background: rgba(110, 231, 183, 0.9);
    box-shadow: 0 0 6px rgba(110, 231, 183, 0.4);
}

.dot-wrong {
    background: rgba(252, 165, 165, 0.9);
    box-shadow: 0 0 6px rgba(252, 165, 165, 0.4);
}

/* Question Details - collapsible section */
.end-detail-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--space-xs);
}

.end-detail-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
}

.end-detail-toggle:active {
    color: rgba(255, 255, 255, 0.8);
}

.detail-chevron {
    font-size: 9px;
    transition: transform 0.2s ease;
}

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

.end-detail-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.end-detail-body.open {
    max-height: 2000px;
    overflow-y: auto;
}

/* Answer Grid - Accordion List */
.end-answer-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.answer-row {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.answer-row-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.answer-row-header:active {
    background: rgba(255, 255, 255, 0.08);
}

.answer-row .answer-num {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    min-width: 24px;
}

.answer-row .answer-icon {
    font-size: var(--fs-base);
}

.answer-row .answer-category {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    flex: 1;
}

.answer-chevron {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
}

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

.answer-row-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 10px;
}

.answer-row-detail.open {
    max-height: 300px;
    padding: 0 10px 10px;
}

.answer-question {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 6px;
    line-height: 1.4;
}

.answer-yours {
    font-size: 11px;
    color: #fca5a5;
    margin-bottom: 4px;
}

.answer-correct-text {
    font-size: 11px;
    color: #6ee7b7;
    font-weight: 600;
    margin-bottom: 4px;
}

.answer-explanation {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    font-style: italic;
}

.answer-correct .answer-icon {
    color: #6ee7b7;
}

.answer-wrong .answer-icon {
    color: #fca5a5;
}

/* Category Breakdown */
.end-category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-label {
    width: 64px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.category-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.8);
    transition: width 0.6s var(--ease-out);
}

.category-score {
    width: 32px;
    text-align: right;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

/* End Buttons - stacked full-width (matching Thirdle) */
.end-buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: var(--space-xs) 0;
}

.end-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s var(--ease-out);
}

.end-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

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

.end-btn-primary {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.end-btn-primary:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* --- Game Chooser Modal --- */
.game-chooser-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.game-chooser-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.game-chooser-content {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    max-width: 400px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.game-chooser-content h2 {
    font-size: var(--fs-xl);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-lg);
    color: #0f172a;
}

.game-chooser-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: #0f172a;
    transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease-out);
    margin-bottom: var(--space-sm);
    cursor: pointer;
}

.game-chooser-item:last-child {
    margin-bottom: 0;
}

.game-chooser-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.game-chooser-icon {
    font-size: var(--fs-xxl);
    flex-shrink: 0;
    width: 44px;
    text-align: center;
}

.game-chooser-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-chooser-name {
    font-size: var(--fs-base);
    font-weight: 600;
    color: #0f172a;
}

.game-chooser-desc {
    font-size: var(--fs-xs);
    color: #94a3b8;
}

.game-chooser-arrow {
    font-size: var(--fs-lg);
    color: #94a3b8;
    flex-shrink: 0;
}

.game-chooser-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin-top: var(--space-md);
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.2s;
}

.game-chooser-close-btn:hover {
    background: #f8fafc;
}

/* --- Toast --- */
.club-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-sm) var(--space-lg);
    background: rgba(30, 27, 75, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
}

.club-toast-visible {
    opacity: 1;
}

/* --- Side Menu --- */
.side-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity 0.3s var(--ease-out);
}

.side-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    z-index: 810;
    background: var(--bg-light);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    transition: right 0.3s var(--ease-out);
    box-shadow: var(--shadow-lg);
}

.side-menu.open {
    right: 0;
}

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    padding-top: env(safe-area-inset-top, var(--space-lg));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.side-menu-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.side-menu-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-xs);
}

.menu-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-link:hover {
    background: var(--surface-hover);
}

.menu-icon {
    font-size: var(--fs-lg);
    width: 28px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: var(--space-xs) var(--space-md);
}

.side-menu-footer {
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.menu-credit {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-align: center;
}

/* --- Responsive --- */

/* Taller phones — breathe a little more */
@media (min-height: 780px) {
    .end-screen-content {
        gap: var(--space-md);
        padding: var(--space-md) var(--space-md);
    }

    .end-hero {
        padding: var(--space-md) 0 var(--space-xs);
    }

    .end-hero-score {
        font-size: var(--fs-mega);
    }

    .end-hero-title {
        font-size: var(--fs-xl);
    }

    #game-screen {
        padding: var(--space-md) var(--space-lg);
    }

    .question-area {
        padding: var(--space-sm) 0;
    }

    .option-button {
        min-height: 48px;
        font-size: var(--fs-base);
    }
}

@media (min-width: 480px) {
    .question-text {
        font-size: var(--fs-xxl);
    }

    .landing-title {
        font-size: 64px;
    }
}

@media (min-width: 768px) {
    .option-button {
        min-height: 54px;
        font-size: var(--fs-lg);
    }

    .question-text {
        font-size: 32px;
    }
}

/* --- Utility Animations --- */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fade-in 0.3s var(--ease-out);
}

.scale-in {
    animation: scale-in 0.3s var(--ease-bounce);
}

/* Groups Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.input-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.text-input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    background: rgba(255,255,255,0.08);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}
.text-input:focus {
    outline: none;
    border-color: var(--accent);
}
.btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
}
.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
}
.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-secondary {
    background: rgba(255,255,255,0.12);
    color: var(--text);
}
.btn-link {
    background: none;
    color: var(--text-muted);
    padding: 4px 0;
    text-decoration: underline;
}
.groups-list {
    margin-bottom: 16px;
}
.groups-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 16px 0;
}
.group-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    margin-bottom: 8px;
}
.group-card-name {
    font-weight: 600;
    color: var(--text);
    display: block;
}
.group-card-code {
    font-size: 0.8rem;
    color: var(--accent);
    font-family: monospace;
}
.group-leave-btn {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}
.groups-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.groups-actions .btn {
    flex: 1;
}
.group-form {
    margin-top: 8px;
}
.player-name-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* IQ Insights Card */
.insights-card {
    background: rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}
.insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.insights-band {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.insights-trend {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.insights-accuracy-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.insights-accuracy-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.insights-accuracy-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}
.insights-categories {
    margin-bottom: 16px;
}
.insight-cat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.insight-cat-label {
    width: 80px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    flex-shrink: 0;
}
.insight-cat-bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}
.insight-cat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light, #7c3aed), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}
.insight-cat-pct {
    width: 36px;
    font-size: 0.8rem;
    color: var(--text);
    text-align: right;
    flex-shrink: 0;
}
.insights-strengths-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}
.insights-col {
    flex: 1;
}
.insights-col-title {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.insights-col-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.insights-games {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.insights-disclaimer {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    font-style: italic;
}

/* ============================================
   Visual Question Styles
   ============================================ */

.question-visual {
    text-align: center;
}

/* Question text above visual */
.q-text {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--text);
}

/* Generic grid container */
.q-grid {
    display: inline-grid;
    gap: 3px;
    margin: 8px auto;
    justify-content: center;
}
.q-grid-2x2 { grid-template-columns: repeat(2, 48px); }
.q-grid-2x3 { grid-template-columns: repeat(3, 48px); }
.q-grid-3x3 { grid-template-columns: repeat(3, 48px); }
.q-grid-4x4 { grid-template-columns: repeat(4, 38px); }
.q-grid-1x4 { grid-template-columns: repeat(4, 48px); }
.q-grid-1x5 { grid-template-columns: repeat(5, 44px); }
.q-grid-1x6 { grid-template-columns: repeat(6, 38px); }

/* Grid cells */
.q-cell {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
}
.q-cell-highlight {
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
    font-weight: 700;
}
.q-cell-empty {
    background: rgba(255,255,255,0.02);
    border-style: dashed;
}
.q-cell-dark {
    background: var(--primary);
    color: #fff;
}
.q-cell-accent {
    background: var(--accent);
    color: #000;
}

/* Horizontal row of items (sequence) */
.q-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 0;
    flex-wrap: wrap;
}

/* Individual shape in a sequence */
.q-shape {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
}
.q-shape-lg {
    width: 60px;
    height: 60px;
    font-size: 2rem;
}

/* Arrow between sequence items */
.q-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Question mark placeholder */
.q-unknown {
    color: var(--accent);
    font-weight: 800;
    font-size: 1.6rem;
}

/* Rotation/transform display */
.q-rotate-90 { transform: rotate(90deg); }
.q-rotate-180 { transform: rotate(180deg); }
.q-rotate-270 { transform: rotate(270deg); }
.q-flip-h { transform: scaleX(-1); }
.q-flip-v { transform: scaleY(-1); }

/* Side-by-side comparison */
.q-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 8px 0;
}
.q-compare-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-align: center;
}
.q-compare-item {
    text-align: center;
}

/* Cube/3D representation */
.q-cube-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 8px auto;
}
.q-cube-row {
    display: flex;
    gap: 2px;
}
.q-cube {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-light, #7c3aed), var(--primary));
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
}
.q-cube-empty {
    width: 28px;
    height: 28px;
}

/* Net/unfolding display */
.q-net {
    display: inline-grid;
    gap: 2px;
    margin: 8px auto;
}
.q-net-cell {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: 3px;
}
.q-net-filled {
    background: rgba(124, 58, 237, 0.3);
    border: 1px solid rgba(124, 58, 237, 0.5);
}
.q-net-empty {
    background: transparent;
}
.q-net-marked {
    background: rgba(245, 158, 11, 0.3);
    border: 1px solid var(--accent);
}

/* Visual option buttons */
.option-visual {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1.2;
}

/* 2-column option: icon left, label right */
.q-opt-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 8px;
}
.q-opt-row .q-opt-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
}
.q-opt-row .q-opt-text {
    font-size: var(--fs-sm);
    color: var(--text);
    text-align: left;
}

/* Compact grids/shapes inside option buttons */
.q-opt-grid {
    display: inline-grid;
    gap: 2px;
}
.q-opt-grid-3x3 { grid-template-columns: repeat(3, 18px); }
.q-opt-cell {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
}
.q-opt-cell-dark {
    background: var(--accent);
    border-color: var(--accent-dark);
}

/* Larger grid for question display (matches answer style) */
.q-opt-grid-3x3-lg { grid-template-columns: repeat(3, 36px); }
.q-opt-cell-lg {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
}
.q-opt-cell-lg.q-opt-cell-dark {
    background: var(--accent);
    border-color: var(--accent-dark);
}

/* Shape-only option (standalone, no label) */
.q-opt-shape {
    font-size: 1.6rem;
    line-height: 1;
}
.q-opt-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* CSS-drawn cross-section shapes for options */
.q-opt-xsec {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.q-opt-xsec-square {
    width: 28px;
    height: 28px;
    border: 2px solid var(--text);
    border-radius: 3px;
}
.q-opt-xsec-circle {
    width: 28px;
    height: 28px;
    border: 2px solid var(--text);
    border-radius: 50%;
}
.q-opt-xsec-ring {
    width: 28px;
    height: 28px;
    border: 2px solid var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.q-opt-xsec-ring::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--text);
    border-radius: 50%;
}
.q-opt-xsec-sq-hole {
    width: 28px;
    height: 28px;
    border: 2px solid var(--text);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.q-opt-xsec-sq-hole::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--text);
    border-radius: 50%;
}

/* Colour shapes for questions */
.q-color-red { color: #ef4444; }
.q-color-blue { color: #3b82f6; }
.q-color-green { color: #22c55e; }
.q-color-yellow { color: #eab308; }
.q-color-purple { color: #a855f7; }
.q-color-white { color: #ffffff; }
