:root {
    --primary: #5865F2;
    --primary-dark: #4752C4;
    --secondary: #7289DA;
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--gray-900);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 12px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header - reduced by 30% */
.header {
    background: var(--primary);
    color: white;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header h1 {
    font-size: 1.4em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.header h1::before {
    content: '🤖';
    font-size: 1.1em;
}

.tagline {
    margin: 4px 0 0 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.8em;
    font-weight: 400;
}

.header p {
    display: none; /* Removed tagline for cleaner header */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9em;
}

.user-score-badge {
    background: rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    white-space: nowrap;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header-right a {
    color: rgba(255, 255, 255, 0.98);
    text-decoration: none;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.header-right a:hover {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Navigation - increased spacing, medium weight */
.nav {
    background: var(--gray-50);
    padding: 10px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav a {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    transition: color 0.2s;
    padding: 6px 0;
}

.nav a:hover {
    color: var(--primary);
}

/* Content - tighter spacing for one-screen fit */
.content {
    padding: 16px;
    max-width: 640px;
    margin: 0 auto;
}

.flash {
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9em;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.flash.success {
    background: var(--success-bg);
    color: #065f46;
    border-left: 3px solid var(--success);
}

.flash.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid var(--danger);
}

/* Question box - stronger presence */
.question-box {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.question-box h2 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.question-text {
    font-size: 1.6em;
    color: var(--gray-900);
    margin: 12px 0 20px;
    font-weight: 700;
    line-height: 1.3;
}

/* Answer Reveal Card */
.reveal-card {
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: 12px;
    padding: 12px;
    margin: 6px 0;
    box-shadow: var(--shadow-md);
    animation: revealFade 0.4s ease-out;
}

@keyframes revealFade {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* AI Answer Section - Primary focus */
.ai-reveal {
    text-align: center;
    padding: 10px 0;
    background: linear-gradient(to bottom, #eef2ff 0%, #e0e7ff 100%);
    margin: -12px -12px 0 -12px;
    padding: 16px 12px;
    border-radius: 12px 12px 0 0;
}

.ai-label {
    font-size: 0.75em;
    color: #3730a3;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-weight: 600;
}

.ai-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #312e81;
    margin-bottom: 6px;
}

.ai-match {
    font-size: 0.9em;
    color: var(--success);
    font-weight: 600;
}

.ai-nomatch {
    font-size: 0.9em;
    color: var(--gray-600);
    font-weight: 500;
}

/* Crowd Info - Secondary/Entertainment */
.crowd-bonus {
    text-align: center;
    padding: 8px 0;
    background: var(--gray-50);
    margin: 0 -12px -12px -12px;
    padding: 12px;
    border-radius: 0 0 12px 12px;
}

.crowd-bonus-label {
    font-size: 0.7em;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.crowd-bonus-value {
    font-size: 0.95em;
    color: var(--gray-600);
}

.divider {
    height: 1px;
    background: var(--gray-300);
    margin: 10px 0;
}

.user-reveal {
    text-align: center;
    padding: 6px 0;
}

.user-reveal-label {
    font-size: 0.75em;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.user-reveal-value {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.user-reveal-score {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-700);
}

.user-reveal-score .score-number {
    color: var(--primary);
}

/* Answer result - visually distinct with stronger contrast */
.score-display {
    background: linear-gradient(to bottom, #f7f7fa 0%, #ededf0 100%);
    border: 2px solid var(--gray-300);
    padding: 16px;
    border-radius: 12px;
    margin: 6px 0;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.score-display.has-points {
    border-color: var(--success);
    background: linear-gradient(to bottom, #d1fae5 0%, #a7f3d0 100%);
}

.score-display.no-points {
    border-color: var(--gray-400);
    background: linear-gradient(to bottom, #f7f7fa 0%, #ededf0 100%);
}

.score-display .answer-label {
    font-size: 0.8em;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.score-display .answer-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.score-display .score-value {
    font-size: 2.75rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--primary);
    margin-bottom: 8px;
    animation: countUp 0.3s ease-out;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.score-display.has-points .score-value {
    color: var(--success);
}

.score-display .score-message {
    font-size: 0.9em;
    color: var(--gray-600);
    font-weight: 500;
}

.score-display.has-points .score-message {
    color: #065f46;
}

.score-display.no-points .score-message {
    color: var(--gray-600);
}

/* Action buttons row - clear primary/secondary hierarchy */
.action-buttons {
    display: flex;
    gap: 10px;
    margin: 8px 0;
    justify-content: center;
}

.action-buttons .btn {
    flex: 0 0 48%;
    max-width: 200px;
    text-align: center;
}

.action-buttons .btn:first-child {
    background: #4f46e5;
    color: white;
    border: none;
}

.action-buttons .btn:first-child:hover {
    background: #4338ca;
}

.action-buttons .btn:last-child {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.action-buttons .btn:last-child:hover {
    background: #eef2ff;
}

/* Suggest Question Page */
.suggest-header {
    text-align: center;
    margin-bottom: 20px;
}

.suggest-header h2 {
    margin-bottom: 8px;
}

.suggest-subtitle {
    color: var(--gray-600);
    font-size: 0.95em;
}

.suggest-form-container {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.suggest-form {
    margin-bottom: 20px;
}

.char-counter {
    text-align: right;
    margin-top: 4px;
}

.char-counter small {
    color: var(--gray-500);
    font-size: 0.85em;
}

.suggest-tips {
    background: var(--gray-50);
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    border-radius: 6px;
}

.suggest-tips h3 {
    font-size: 0.9em;
    margin: 0 0 8px 0;
    color: var(--gray-700);
}

.suggest-tips ul {
    margin: 0;
    padding-left: 20px;
}

.suggest-tips li {
    font-size: 0.9em;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.suggest-footer {
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    width: 100%;
}

.btn-primary:hover {
    background: #4338ca;
}

/* Form elements */
.answer-form {
    margin-top: 16px;
}

.answer-form input[type="text"],
.answer-form textarea,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.answer-form input[type="text"]:focus,
.answer-form textarea:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

/* Buttons - 44px minimum tap target */
.btn {
    display: inline-block;
    padding: 12px 20px;
    min-height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 8px 14px;
    min-height: 36px;
    font-size: 0.85em;
}

/* Top 3 Leaderboard Preview - only show if 3+ players */
.leaderboard-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 14px;
    margin: 16px 0;
}

.leaderboard-preview h3 {
    font-size: 0.85em;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
}

.leaderboard-preview-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaderboard-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: white;
    border-radius: 6px;
    font-size: 0.9em;
}

.leaderboard-preview-rank {
    font-weight: 700;
    width: 28px;
    font-size: 0.95em;
}

.leaderboard-preview-rank.rank-1 { color: #d97706; }
.leaderboard-preview-rank.rank-2 { color: #64748b; }
.leaderboard-preview-rank.rank-3 { color: #92400e; }

.leaderboard-preview-name {
    flex: 1;
    margin-left: 10px;
    font-weight: 500;
}

.leaderboard-preview-points {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9em;
}

.leaderboard-preview-footer {
    text-align: center;
    margin-top: 10px;
}

.leaderboard-preview-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
}

.leaderboard-preview-footer a:hover {
    text-decoration: underline;
}

/* Empty leaderboard state */
.leaderboard-empty {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9em;
    line-height: 1.4;
}

/* Leaderboard header with return link */
.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.leaderboard-header h2 {
    margin: 0;
}

.return-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.return-link:hover {
    background: var(--gray-100);
}

/* Daily Winner */
.daily-winner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 14px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
}

.daily-winner-icon {
    font-size: 2.5em;
    line-height: 1;
}

.daily-winner-content {
    flex: 1;
}

.daily-winner-label {
    font-size: 0.75em;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    font-weight: 600;
}

.daily-winner-name {
    font-size: 1.3em;
    font-weight: 700;
    color: #78350f;
    margin-bottom: 2px;
}

.daily-winner-points {
    font-size: 0.95em;
    color: #92400e;
    font-weight: 600;
}

.daily-winner-reset {
    font-size: 0.75em;
    color: #92400e;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Full Leaderboard */
.leaderboard {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.leaderboard th,
.leaderboard td {
    padding: 10px 14px;
    text-align: left;
}

.leaderboard th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75em;
    letter-spacing: 0.05em;
}

.leaderboard tr {
    background: white;
    transition: background 0.2s;
}

.leaderboard tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.leaderboard tbody tr:hover {
    background: #e0e7ff;
}

.leaderboard .current-user {
    background: #fef3c7 !important;
    font-weight: 600;
}

.rank-1 {
    color: #d97706;
    font-weight: bold;
    font-size: 1.1em;
}

.rank-2 {
    color: #64748b;
    font-weight: bold;
}

.rank-3 {
    color: #92400e;
    font-weight: bold;
}

/* User rank display (for users outside top 100) */
.user-rank-display {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
    text-align: center;
}

.user-rank-label {
    font-size: 0.9em;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.user-rank-details {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.user-rank-number {
    font-size: 1.8em;
    font-weight: bold;
    color: #d97706;
}

.user-rank-score {
    font-size: 1.3em;
    font-weight: 600;
    color: #92400e;
}

/* User stats on leaderboard page */
.user-stats {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.9em;
    color: var(--gray-700);
}

.user-stats strong {
    color: var(--gray-900);
}

/* Next question info - minimal countdown */
.next-question-info {
    padding: 8px 0;
    margin: 12px 0;
    text-align: center;
    font-size: 0.8em;
    color: var(--gray-700);
}

.next-question-info strong {
    color: var(--gray-700);
    font-weight: 600;
}

/* Form groups */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9em;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--gray-600);
    font-size: 0.85em;
}

/* Previous questions list */
.question-list {
    margin-top: 16px;
}

.question-list h2 {
    font-size: 1em;
    color: var(--gray-700);
    margin-bottom: 10px;
    font-weight: 600;
}

.question-item {
    background: white;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-left: 3px solid var(--gray-400);
    transition: all 0.2s;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-item.answered {
    border-left-color: var(--success);
}

.question-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.question-status {
    font-size: 1.2em;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    color: var(--success);
}

.question-item a {
    color: var(--gray-900);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85em;
    flex: 1;
}

/* Answer stats */
.answer-stats {
    margin-top: 20px;
}

.answer-stats h3 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1em;
    font-weight: 700;
}

.stat-item {
    background: white;
    padding: 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    font-size: 0.85em;
}

.stat-bar {
    flex-grow: 1;
    height: 18px;
    background: var(--gray-200);
    border-radius: 9px;
    margin: 0 10px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease-out;
    border-radius: 9px;
}

/* Period tabs */
.period-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.period-tabs a {
    padding: 7px 14px;
    background: white;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85em;
    transition: all 0.2s;
    border: 2px solid var(--gray-200);
}

.period-tabs a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.period-tabs a:hover:not(.active) {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Admin sections */
.admin-section {
    margin-bottom: 20px;
}

.admin-section h2,
.admin-section h3 {
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gray-200);
    font-weight: 700;
    font-size: 1.1em;
}

.admin-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.suggestion-item {
    background: white;
    padding: 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-left: 3px solid var(--warning);
    box-shadow: var(--shadow);
    font-size: 0.9em;
}

.suggestion-item.approved {
    border-left-color: var(--success);
    background: #f0fdf4;
}

.suggestion-item.rejected {
    border-left-color: var(--danger);
    background: #fef2f2;
}

h2 {
    color: var(--gray-900);
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1.2em;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .container {
        border-radius: 8px;
    }

    .header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 1.3em;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .nav {
        padding: 8px 12px;
        gap: 16px;
    }

    .content {
        padding: 16px 12px;
    }

    .question-box {
        padding: 16px 12px;
    }

    .question-text {
        font-size: 1.4em;
    }

    .stat-item {
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    .stat-bar {
        width: 100%;
        margin: 6px 0;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        flex: 1;
        max-width: none;
        width: 100%;
    }
}
