/* ============================================
   English Typing Adventure - Main Stylesheet
   七年级英语打字闯关游戏
   ============================================ */

/* ---------- CSS Variables / Themes ---------- */
:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f97316;
    --bg: #f0f4ff;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(79, 70, 229, 0.1);
    --radius: 16px;
    --radius-sm: 8px;
    --font-main: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --transition: all 0.3s ease;
}

/* Space Theme */
body.theme-space {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --border: #334155;
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --shadow: 0 4px 20px rgba(124, 58, 237, 0.2);
}

/* Adventure Theme */
body.theme-adventure {
    --bg: #fef3c7;
    --bg-card: #fffbeb;
    --text: #78350f;
    --text-light: #92400e;
    --border: #fbbf24;
    --primary: #d97706;
    --primary-light: #fbbf24;
    --shadow: 0 4px 20px rgba(217, 119, 6, 0.15);
}

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

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------- Page System ---------- */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: #0ea5e9; color: white; }
.btn-info:hover { background: #0284c7; }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-back {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-back:hover { background: var(--primary); color: white; }

/* ---------- HOME PAGE ---------- */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-width: 500px;
    width: 100%;
    padding-top: 40px;
}

.logo-area {
    text-align: center;
}

.logo-icon {
    font-size: 72px;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo-area h1 {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 4px;
}

.logo-area h2 {
    font-size: 20px;
    color: var(--text-light);
    font-weight: 400;
}

.subtitle {
    margin-top: 8px;
    color: var(--accent);
    font-weight: 600;
}

.home-stats {
    display: flex;
    gap: 20px;
    background: var(--bg-card);
    padding: 20px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-icon { font-size: 24px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-light); }

.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.home-footer {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* ---------- PAGE HEADER ---------- */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 900px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.page-header h2 {
    font-size: 24px;
}

/* ---------- LEVELS PAGE ---------- */
.levels-container {
    width: 100%;
    max-width: 700px;
}

.level-path {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.level-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border-left: 5px solid var(--border);
}

.level-card:hover { transform: translateX(5px); }
.level-card.unlocked { border-left-color: var(--success); }
.level-card.locked { opacity: 0.5; cursor: not-allowed; }
.level-card.current { border-left-color: var(--primary); background: linear-gradient(135deg, var(--bg-card), #eef2ff); }

.level-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    background: var(--primary);
    color: white;
}

.level-card.locked .level-number { background: var(--text-light); }

.level-info { flex: 1; }
.level-info h3 { font-size: 18px; margin-bottom: 4px; }
.level-info p { font-size: 14px; color: var(--text-light); }

.level-stars {
    font-size: 20px;
    letter-spacing: 2px;
}

/* ---------- MODULE GRID ---------- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 900px;
}

.module-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.2);
}

.module-card .module-icon { font-size: 48px; margin-bottom: 12px; }
.module-card h3 { font-size: 18px; margin-bottom: 4px; }
.module-card p { font-size: 14px; color: var(--text-light); }

/* ---------- MODE SELECTION ---------- */
.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    width: 100%;
}

.mode-selection h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.mode-selection .btn {
    width: 100%;
    max-width: 350px;
}

/* ---------- GAME PAGE ---------- */
.game-header {
    width: 100%;
    max-width: 800px;
}

.game-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.game-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.info-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
}

.info-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.game-info-item.lives .info-value { color: var(--danger); font-size: 18px; }
.game-info-item.timer .info-value { color: var(--warning); }

.game-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    min-width: 50px;
    text-align: right;
}

/* ---------- GAME AREA ---------- */
.game-area {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.hint-area {
    background: var(--accent);
    color: white;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 600;
}

.target-area {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    width: 100%;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.target-text {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text);
    word-break: break-all;
}

.target-text .char-correct { color: var(--success); }
.target-text .char-wrong { color: var(--danger); text-decoration: underline; }
.target-text .char-current { background: #fef3c7; border-radius: 3px; padding: 0 2px; }

.listening-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-area {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 600px;
}

.game-input {
    flex: 1;
    padding: 16px 24px;
    font-size: 22px;
    border: 3px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: var(--transition);
    font-family: 'Consolas', 'Courier New', monospace;
    text-align: center;
}

.game-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.game-input.correct { border-color: var(--success); background: #f0fdf4; }
.game-input.wrong { border-color: var(--danger); background: #fef2f2; animation: shake 0.4s; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.btn-submit {
    padding: 16px 24px;
    font-size: 16px;
}

.feedback-area {
    font-size: 18px;
    font-weight: 600;
    min-height: 30px;
    text-align: center;
}

.feedback-correct { color: var(--success); animation: popIn 0.3s; }
.feedback-wrong { color: var(--danger); animation: popIn 0.3s; font-size: 1.1rem; line-height: 1.8; }

/* Diff highlighting for wrong answers */
.diff-label { color: #aaa; font-size: 0.9em; }
.diff-correct { color: #4ade80; font-weight: 600; }
.diff-wrong { color: #ff4444; font-weight: 700; text-decoration: underline; background: rgba(255, 68, 68, 0.15); border-radius: 2px; padding: 0 1px; }
.diff-missing { color: #ffaa00; font-weight: 700; text-decoration: underline wavy; background: rgba(255, 170, 0, 0.15); border-radius: 2px; padding: 0 1px; }

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

.game-footer {
    margin-top: 30px;
    display: flex;
    gap: 12px;
}

/* ---------- RESULTS PAGE ---------- */
.results-container {
    max-width: 500px;
    width: 100%;
    text-align: center;
    padding-top: 40px;
}

.results-header {
    margin-bottom: 30px;
}

.results-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.stars-display {
    font-size: 48px;
    letter-spacing: 8px;
}

.results-stats {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.result-stat:last-child { border-bottom: none; }
.result-label { font-size: 16px; color: var(--text-light); }
.result-value { font-size: 20px; font-weight: 700; color: var(--primary); }

.results-achievements {
    margin-bottom: 24px;
}

.achievement-popup {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    font-weight: 600;
    animation: slideIn 0.5s ease;
}

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

.results-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* ---------- ACHIEVEMENTS PAGE ---------- */
.achievements-summary {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 20px 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 900px;
}

.badge-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.badge-card.earned {
    border: 2px solid var(--accent);
    background: linear-gradient(135deg, #fffbeb, var(--bg-card));
}

.badge-card.locked { opacity: 0.5; }

.badge-icon { font-size: 40px; margin-bottom: 8px; }
.badge-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.badge-desc { font-size: 12px; color: var(--text-light); }

/* ---------- LEADERBOARD ---------- */
.leaderboard-content {
    width: 100%;
    max-width: 600px;
}

.leaderboard-input {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.leaderboard-input label { font-weight: 600; }
.leaderboard-input input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
    min-width: 150px;
}

.leaderboard-list {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.lb-entry {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.lb-entry:last-child { border-bottom: none; }
.lb-rank { font-size: 20px; font-weight: 700; width: 40px; text-align: center; }
.lb-rank.gold { color: #f59e0b; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #d97706; }
.lb-name { flex: 1; font-weight: 600; }
.lb-score { font-weight: 700; color: var(--primary); }

/* ---------- REVIEW PAGE ---------- */
.review-content {
    width: 100%;
    max-width: 700px;
}

.empty-message {
    text-align: center;
    color: var(--text-light);
    padding: 40px;
    font-size: 18px;
}

/* ============================================
   Image Upload / OCR Page Styles
   ============================================ */
.upload-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

.upload-instructions {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
}

.upload-dropzone {
    border: 3px dashed var(--primary);
    border-radius: 16px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.03);
    margin-bottom: 20px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--secondary);
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.upload-dropzone p {
    font-size: 16px;
    color: var(--text-light);
    margin: 6px 0;
}

.upload-dropzone small {
    color: #999;
}

.upload-preview {
    text-align: center;
    margin: 15px 0;
    display: none;
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.upload-progress {
    margin: 15px 0;
    display: none;
}

.upload-progress .progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.upload-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.upload-progress .progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.recognized-section {
    margin-top: 20px;
    display: none;
}

.recognized-section h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text);
}

.recognized-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
}

.tag-word {
    background: #dbeafe;
    color: #1d4ed8;
}

.tag-phrase {
    background: #dcfce7;
    color: #15803d;
}

.tag-sentence {
    background: #fef3c7;
    color: #b45309;
}

.upload-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.upload-actions .btn {
    min-width: 140px;
}

/* ============================================
   Proofreading UI Styles
   ============================================ */
.upload-divider {
    border: none;
    border-top: 2px dashed #e5e7eb;
    margin: 30px 0;
}

.proofread-hint {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.proofread-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.proofread-header label {
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
}

.proofread-input-title {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.proofread-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}
.proofread-meta input {
    flex: 1;
    min-width: 130px;
    padding: 8px 10px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
}
.proofread-meta input[type="number"] {
    flex: 0 0 100px;
    min-width: 80px;
}

.saved-units-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px 0;
    flex-wrap: wrap;
}

.unit-group-label {
    margin: 12px 0 6px;
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.proofread-section {
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.proofread-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.proofread-section-header h4 {
    font-size: 16px;
    margin: 0;
}

.proofread-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.proofread-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.proofread-num {
    width: 28px;
    font-weight: 600;
    color: var(--text-light);
    text-align: right;
    flex-shrink: 0;
}

.proofread-en {
    flex: 1;
    min-width: 140px;
    padding: 8px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    font-family: 'Segoe UI', sans-serif;
}

.proofread-en:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.proofread-cn {
    flex: 2;
    min-width: 220px;
    padding: 8px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-light);
    text-overflow: ellipsis;
}

/* Sentence section: full-width inputs for long text */
.proofread-item-sentence {
    align-items: flex-start;
}

.proofread-sentence-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.proofread-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
}

.proofread-textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.proofread-textarea.proofread-cn {
    color: var(--text-light);
    font-size: 13px;
}

.proofread-cn:focus {
    border-color: var(--secondary);
    outline: none;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-delete:hover {
    background: #fee2e2;
    color: var(--danger);
}

.proofread-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ============================================
   Saved Units Styles
   ============================================ */
.saved-units-section {
    margin-bottom: 20px;
}

.saved-units-section h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.empty-hint {
    color: var(--text-light);
    font-size: 14px;
    text-align: center;
    padding: 16px;
}

.saved-unit-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.saved-unit-info h4 {
    font-size: 16px;
    margin: 0 0 4px 0;
    color: var(--text);
}

.saved-unit-info p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.saved-unit-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

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

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

.review-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.review-item .correct-answer { color: var(--success); font-weight: 600; font-size: 18px; }
.review-item .your-answer { color: var(--danger); font-size: 14px; }
.review-item .hint { color: var(--text-light); font-size: 14px; }

/* ---------- SETTINGS ---------- */
.settings-content {
    width: 100%;
    max-width: 500px;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.setting-group label { font-weight: 600; }
.setting-group select {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
}

.setting-group.danger { border: 2px solid var(--danger); }

/* ---------- MODAL ---------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 { margin-bottom: 24px; }
.modal-content .btn { margin: 8px; }

/* ---------- CELEBRATION ---------- */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.celebration-content {
    text-align: center;
    animation: celebrateIn 0.5s ease;
}

@keyframes celebrateIn {
    0% { transform: scale(0) rotate(-10deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0); }
}

.celebration-emoji { font-size: 80px; margin-bottom: 16px; }
.celebration-text { font-size: 32px; font-weight: 700; color: white; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .game-info-bar { gap: 8px; padding: 12px; }
    .game-info-item { min-width: 60px; }
    .info-value { font-size: 16px; }
    .target-text { font-size: 24px; }
    .game-input { font-size: 18px; padding: 12px 16px; }
    .home-stats { flex-wrap: wrap; padding: 16px; }
    .level-card { padding: 14px; }
}

/* ============================================
   Auth / Login Styles
   ============================================ */

.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin: 24px 0 16px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--primary);
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--primary);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font-main);
    transition: var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.auth-error {
    color: var(--danger);
    font-size: 14px;
    min-height: 20px;
    margin: 0;
}

/* User Info Bar */
.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.user-badge {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg);
    font-size: 14px;
}

.user-badge.admin {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

/* Public badge */
.public-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--success);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    vertical-align: middle;
}

/* ============================================
   Admin Panel Styles
   ============================================ */

.admin-content {
    padding: 16px;
}

.admin-section h3 {
    margin-bottom: 16px;
    color: var(--text);
}

.admin-unit-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.admin-unit-info h4 {
    margin: 0 0 4px;
    font-size: 16px;
}

.admin-unit-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-light);
}

.admin-unit-info .unit-date {
    font-size: 12px;
    margin-top: 4px;
}

.admin-unit-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.public-unit {
    border-left: 4px solid var(--success);
}

@media (max-width: 768px) {
    .admin-unit-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .admin-unit-actions {
        width: 100%;
        justify-content: flex-start;
    }
}


/* ---------- ADMIN TABS / PROFILE / RANKINGS ---------- */
.admin-tab-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab-btn {
    padding: 10px 16px; border: 2px solid var(--primary, #4a90e2); background: transparent;
    color: var(--text, #333); border-radius: 8px; cursor: pointer; font-weight: bold;
}
.admin-tab-btn.active { background: var(--primary, #4a90e2); color: white; }
.admin-tab-content { animation: fadeIn 0.2s; }
.admin-rank-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.rank-sub-btn.active { background: var(--primary, #4a90e2); color: white; border-color: var(--primary, #4a90e2); }

.admin-users-table, .admin-rankings-table, .profile-history-table {
    width: 100%; border-collapse: collapse; margin-top: 12px;
}
.admin-users-table th, .admin-users-table td,
.admin-rankings-table th, .admin-rankings-table td,
.profile-history-table th, .profile-history-table td {
    padding: 10px; border-bottom: 1px solid #e2e8f0; text-align: left; font-size: 14px;
}
.admin-users-table th, .admin-rankings-table th, .profile-history-table th {
    background: #f7fafc; font-weight: bold;
}

.profile-content { max-width: 900px; margin: 0 auto; padding: 20px; }
.profile-section { background: var(--bg-card, white); padding: 20px; border-radius: 12px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.profile-section h3 { margin-bottom: 12px; }
.profile-info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #eee; }
.profile-info-row:last-child { border-bottom: none; }
.profile-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
