:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #14141f;
    --bg-card: #1a1a2e;
    --bg-card-hover: #22223a;
    --accent-blue: #4c75f2;
    --accent-blue-dark: #3a5fd9;
    --accent-green: #4bb34b;
    --accent-red: #e64646;
    --accent-gold: #ffa000;
    --text-primary: #ffffff;
    --text-secondary: #8e8e9f;
    --text-muted: #5c5c6e;
    --border-color: #2a2a3d;
    --gradient-primary: linear-gradient(135deg, #4c75f2 0%, #7c4dff 100%);
    --gradient-success: linear-gradient(135deg, #4bb34b 0%, #66bb6a 100%);
    --gradient-danger: linear-gradient(135deg, #e64646 0%, #ff5252 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(76, 117, 242, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Theme variants */
.theme-cyber {
    --bg-primary: #0d0208; --bg-secondary: #0a1a0a; --bg-card: #0f2a0f; --bg-card-hover: #143a14;
    --border-color: #00ff41; --accent-blue: #00ff41; --accent-blue-dark: #00cc33;
    --text-primary: #00ff41; --text-secondary: #00cc33; --text-muted: #009926;
    --gradient-primary: linear-gradient(135deg, #00ff41, #008f11);
    --shadow-glow: 0 0 20px rgba(0, 255, 65, 0.3);
}
.theme-light {
    --bg-primary: #f5f5f5; --bg-secondary: #eaeaea; --bg-card: #ffffff; --bg-card-hover: #f0f0f0;
    --border-color: #cccccc; --text-primary: #222222; --text-secondary: #666666; --text-muted: #999999;
    --accent-blue: #3366cc; --accent-blue-dark: #2855aa;
    --gradient-primary: linear-gradient(135deg, #3366cc, #6633cc);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1); --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(51,102,204,0.2);
}
.theme-ocean {
    --bg-primary: #001a2e; --bg-secondary: #002a45; --bg-card: #003a5c; --bg-card-hover: #004a72;
    --border-color: #0077be; --accent-blue: #4fc3f7; --accent-blue-dark: #29b6f6;
    --text-primary: #e0f7fa; --text-secondary: #80deea; --text-muted: #4dd0e1;
    --gradient-primary: linear-gradient(135deg, #006699, #00aaff);
    --shadow-glow: 0 0 20px rgba(0, 170, 255, 0.3);
}
.theme-sunset {
    --bg-primary: #1a0a0a; --bg-secondary: #2a1515; --bg-card: #3a1f1f; --bg-card-hover: #4a2929;
    --border-color: #ff6b35; --accent-blue: #ff6b35; --accent-blue-dark: #e05520;
    --text-primary: #ffe0cc; --text-secondary: #ffaa80; --text-muted: #cc6644;
    --gradient-primary: linear-gradient(135deg, #ff6b35, #ff0033);
    --shadow-glow: 0 0 20px rgba(255, 107, 53, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 70px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.stat-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.stat-inline:active { opacity: 0.8; }

.stat-label-inline { color: var(--text-secondary); }

/* Screens */
.screen {
    display: none;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

.screen.active { display: block; }

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

/* Re-engagement message */
.re-engagement-msg {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    border-left: 3px solid var(--accent-blue);
    margin-bottom: 16px;
}

.re-engagement-msg p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Theme of Day */
.theme-of-day {
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.theme-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.theme-of-day h2 { font-size: 22px; margin: 8px 0; }
.theme-timer { font-size: 12px; opacity: 0.7; }

/* Player Stats */
.player-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.stat-card:active { background: var(--bg-card-hover); }

.stat-rank { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.stat-detail { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; }

.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Energy Refill */
.energy-refill-block {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.refill-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.refill-bar {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.refill-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    transition: width 1s linear;
}

.refill-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Near Achievement */
.near-achievement {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--accent-gold);
    margin-bottom: 16px;
}

.near-label {
    font-size: 11px;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.near-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.near-detail { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Bet Section */
.bet-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.bet-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

.bet-options { display: flex; gap: 8px; margin-bottom: 8px; }

.bet-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.bet-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.bet-info { font-size: 12px; color: var(--text-secondary); text-align: center; }

/* Buttons */
.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-small {
    background: var(--accent-blue);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.btn-large { width: 100%; }

.btn-true {
    background: var(--gradient-success);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    flex: 1;
}

.btn-false {
    background: var(--gradient-danger);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    flex: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-text {
    background: none;
    color: var(--text-secondary);
    padding: 10px;
    font-size: 13px;
    width: 100%;
    text-decoration: underline;
}

.admin-link-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Daily Challenges */
.daily-challenges {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.daily-challenges h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.challenge-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.challenge-item:last-child { border-bottom: none; }

.challenge-check {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    min-width: 38px;
    text-align: center;
}

.challenge-check.done {
    background: rgba(75, 179, 75, 0.2);
    color: var(--accent-green);
}

.challenge-check.not-done {
    background: rgba(92, 92, 110, 0.2);
    color: var(--text-muted);
}

.challenge-reward {
    margin-left: auto;
    color: var(--accent-gold);
    font-size: 12px;
    font-weight: 600;
}

/* Rematch Banner */
.re-match-banner {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--accent-blue);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rematch-info { display: flex; flex-direction: column; }
.rematch-label { font-size: 11px; color: var(--text-muted); }
.rematch-name { font-size: 14px; font-weight: 600; }

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.game-progress { flex: 1; }

.game-progress span {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.game-progress-bar { height: 4px; }

.game-timer {
    background: var(--bg-card);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 20px;
    font-weight: 700;
    margin-left: 12px;
    min-width: 50px;
    text-align: center;
    transition: background 0.3s, color 0.3s;
}

.game-timer.warning {
    color: #ff6b35;
    background: rgba(255, 107, 53, 0.15);
    animation: pulse 0.5s infinite;
}

.game-timer.critical {
    color: var(--accent-red);
    background: rgba(230, 70, 70, 0.2);
    animation: pulse 0.3s infinite;
}

.question-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    margin-bottom: 20px;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.question-container.slide-in {
    animation: questionSlide 0.4s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes questionSlide {
    0% { opacity: 0; transform: translateY(20px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.topic-badge {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Combo */
.combo-display {
    text-align: center;
    margin-bottom: 12px;
    padding: 6px;
    background: rgba(76, 117, 242, 0.1);
    border-radius: var(--radius-sm);
    animation: comboFlash 0.3s ease;
}

@keyframes comboFlash {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.combo-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-blue);
}

.question-container.correct-flash {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(75, 179, 75, 0.2);
}

.question-container.incorrect-flash {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px rgba(230, 70, 70, 0.2);
}

.question-text {
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    line-height: 1.5;
}

.answer-buttons { display: flex; gap: 12px; margin-bottom: 16px; }

/* Explanation */
.explanation {
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
    border-left: 3px solid;
}

.explanation.correct {
    background: rgba(75, 179, 75, 0.1);
    border-color: var(--accent-green);
}

.explanation.incorrect {
    background: rgba(230, 70, 70, 0.1);
    border-color: var(--accent-red);
}

.explanation-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.explanation.correct .explanation-title { color: var(--accent-green); }
.explanation.incorrect .explanation-title { color: var(--accent-red); }

#explanation-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.social-proof {
    text-align: center;
    padding: 10px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.social-rank {
    font-size: 12px;
    color: var(--accent-blue);
    font-weight: 600;
    margin-top: 4px;
}

/* Result Screen */
.result-header { text-align: center; padding: 30px 0 20px; }
.result-header h1 { font-size: 28px; margin-bottom: 8px; }

.result-score {
    text-align: center;
    font-size: 48px;
    font-weight: 700;
    margin: 20px 0;
}

.result-score span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-energy-change {
    text-align: center;
    margin: 10px 0 16px;
    animation: energySlide 0.5s ease;
}

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

.energy-change-value { font-size: 24px; font-weight: 700; }
.energy-change-value.positive { color: var(--accent-green); }
.energy-change-value.negative { color: var(--accent-red); }
.energy-change-label { font-size: 13px; color: var(--text-secondary); margin-left: 4px; }

.result-rewards {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.reward-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-width: 100px;
}

.reward-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-gold);
}

.reward-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Variable Reward */
.variable-popup { text-align: center; margin-bottom: 20px; perspective: 600px; }

.variable-card {
    width: 160px;
    height: 120px;
    margin: 0 auto 12px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.variable-card.flipped { transform: rotateY(180deg); }

.variable-front,
.variable-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.variable-front {
    background: var(--gradient-primary);
    border: 2px solid var(--accent-blue);
}

.variable-icon { font-size: 36px; margin-bottom: 4px; }
.variable-front .variable-icon { color: white; font-size: 40px; }
.variable-label { font-size: 13px; color: rgba(255,255,255,0.8); }

.variable-back {
    background: var(--bg-card);
    border: 2px solid var(--accent-gold);
    transform: rotateY(180deg);
}

.variable-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-gold);
}

/* Result Achievement */
.result-achievement {
    text-align: center;
    padding: 12px;
    background: rgba(255, 160, 0, 0.1);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    animation: fadeIn 0.5s ease;
}

.result-achievement-label {
    font-size: 11px;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-achievement-name { font-size: 16px; font-weight: 700; margin-top: 4px; }

/* Level Up */
.level-up-banner {
    text-align: center;
    padding: 12px;
    background: rgba(76, 117, 242, 0.1);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    animation: fadeIn 0.5s ease;
}

.level-up-label {
    font-size: 11px;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.level-up-name { font-size: 16px; font-weight: 700; margin-top: 4px; }

/* Level Up Overlay */
.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.level-up-overlay-content {
    background: var(--bg-card);
    border: 2px solid var(--accent-blue);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    max-width: 300px;
    animation: fadeIn 0.3s ease;
}

.level-up-overlay-label {
    font-size: 12px;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.level-up-overlay-name {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.level-up-overlay-content .btn { width: 100%; }

.rematch-timer {
    background: var(--accent-red);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
}

/* Result actions */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

/* Duel Screen */
#screen-duel h2 { font-size: 20px; margin-bottom: 8px; text-align: center; }
.duel-subtitle { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }

.friend-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.friend-item:hover { background: var(--bg-card-hover); }

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.friend-info { flex: 1; display: flex; flex-direction: column; }
.friend-name { font-weight: 600; font-size: 14px; }
.friend-level { font-size: 12px; color: var(--text-secondary); }

.share-link {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.share-link p { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.link-copy { display: flex; gap: 8px; }

.link-copy input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: monospace;
}

/* Profile */
.profile-header { text-align: center; padding: 20px 0; }

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 12px;
    color: white;
    box-shadow: var(--shadow-glow);
}

.profile-header h2 { font-size: 20px; margin-bottom: 6px; }
.profile-league { font-size: 13px; color: var(--accent-gold); }

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.profile-stat {
    background: var(--bg-card);
    padding: 12px 8px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.achievement {
    background: var(--bg-card);
    padding: 14px 8px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.achievement.earned { border-color: var(--accent-gold); }
.achievement.locked { opacity: 0.4; }

.achievement-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.achievement-desc { font-size: 10px; color: var(--text-secondary); }
.achievement-progress { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* League progress */
.league-progress {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.league-tier {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 6px;
    opacity: 0.4;
    color: white;
}

.league-tier:last-child { margin-bottom: 0; }
.league-tier.active { opacity: 1; font-weight: 600; }

.league-tier.bronze { background: #cd7f32; }
.league-tier.silver { background: #a0a0a0; }
.league-tier.gold { background: var(--accent-gold); color: #000; }
.league-tier.platinum { background: #7b1fa2; }
.league-tier.master { background: #c62828; }

/* Streak screen */
#screen-streak h2 { text-align: center; font-size: 18px; margin-bottom: 20px; }

.streak-big { text-align: center; margin-bottom: 24px; }

.streak-big-number {
    font-size: 64px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.streak-big-label { font-size: 14px; color: var(--text-secondary); }

.streak-calendar {
    display: flex;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.streak-day { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.day-name { font-size: 12px; color: var(--text-secondary); }

.day-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
}

.day-dot.filled { background: var(--accent-blue); border-color: var(--accent-blue); }

.streak-day.today .day-name { color: var(--accent-blue); font-weight: 600; }
.streak-day.today .day-dot { border-color: var(--accent-blue); width: 14px; height: 14px; }

.streak-multiplier {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
    margin-bottom: 16px;
}

.multiplier-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.multiplier-value { font-size: 28px; font-weight: 700; color: var(--accent-gold); }
.multiplier-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.streak-reminder {
    background: rgba(230, 70, 70, 0.1);
    border: 1px solid var(--accent-red);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.reminder-text { font-size: 13px; color: var(--accent-red); text-align: center; }

/* Settings Screen */
#screen-settings h2 { text-align: center; font-size: 20px; margin-bottom: 20px; }
.settings-group {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 12px;
}
.settings-label {
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Theme selector in settings */
.theme-selector { display: flex; gap: 10px; }
.theme-selector .theme-option {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    border: 3px solid transparent; transition: all 0.2s;
}
.theme-selector .theme-option:active { transform: scale(0.9); }
.theme-selector .theme-option.active { border-color: var(--accent-blue); box-shadow: 0 0 10px rgba(76,117,242,0.5); }
.theme-selector .theme-option.theme-dark { background: #0a0a0f; }
.theme-selector .theme-option.theme-cyber { background: #00ff41; }
.theme-selector .theme-option.theme-light { background: #f0f0f0; }
.theme-selector .theme-option.theme-ocean { background: #0077be; }
.theme-selector .theme-option.theme-sunset { background: #ff6b35; }

/* Toggle switch */
.switch {
    position: relative; display: inline-block; width: 48px; height: 26px;
    cursor: pointer;
}
.switch input { display: none; }
.switch-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border-color); border-radius: 26px; transition: 0.3s;
}
.switch-slider:before {
    content: ""; position: absolute; left: 3px; bottom: 3px;
    width: 20px; height: 20px; background: white; border-radius: 50%; transition: 0.3s;
}
.switch input:checked + .switch-slider { background: var(--accent-blue); }
.switch input:checked + .switch-slider:before { transform: translateX(22px); }

/* Language select */
.settings-group select {
    width: 100%; padding: 10px; border-radius: var(--radius-sm);
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    color: var(--text-primary); font-size: 14px; font-family: inherit;
}

/* Nickname row */
.nick-row { display: flex; gap: 8px; }
.nick-row input {
    flex: 1; padding: 10px; border-radius: var(--radius-sm);
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    color: var(--text-primary); font-size: 14px; font-family: inherit;
}
.nick-row input:focus { outline: none; border-color: var(--accent-blue); }

/* Danger button */
.btn-danger { color: var(--accent-red); border-color: var(--accent-red); }

/* About section */
.about-section p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.5; }
.about-links { margin-top: 8px; }

/* Duel search */
.duel-search { margin-bottom: 12px; }
.duel-search input {
    width: 100%; padding: 10px 14px; border-radius: var(--radius-md);
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    color: var(--text-primary); font-size: 14px; font-family: inherit;
    transition: border-color 0.2s;
}
.duel-search input:focus { outline: none; border-color: var(--accent-blue); }
.duel-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 14px; }

/* League Table */
#screen-league h2 { text-align: center; font-size: 18px; margin-bottom: 4px; }
.league-subtitle { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }

.league-table {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    overflow: hidden;
}

.league-row {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.league-row:last-child { border-bottom: none; }

.league-row.you {
    background: rgba(76, 117, 242, 0.1);
    border-left: 3px solid var(--accent-blue);
}

.league-row.promoted {
    border-left: 3px solid var(--accent-green);
}

.league-row.demoted {
    border-left: 3px solid var(--accent-red);
}

.league-pos {
    width: 28px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
}

.league-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-right: 10px;
    color: var(--text-secondary);
}

.league-row.you .league-avatar { background: var(--gradient-primary); color: white; }

.league-name { flex: 1; font-size: 14px; font-weight: 500; }
.league-score { font-size: 13px; color: var(--text-secondary); }
.league-row.you .league-name { color: var(--accent-blue); font-weight: 600; }

.league-info { text-align: center; margin-bottom: 16px; }
.league-info-text { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-around;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 0;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 13px;
}

.nav-item.active { color: var(--accent-blue); }

/* XP Animation */
@keyframes xpPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--accent-gold); }
    100% { transform: scale(1); }
}

.xp-animate { animation: xpPop 0.5s ease; }

.question-container.joker-active {
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 30px rgba(255, 160, 0, 0.3);
    animation: jokerGlow 1.5s infinite;
}

@keyframes jokerGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 160, 0, 0.2); }
    50% { box-shadow: 0 0 40px rgba(255, 160, 0, 0.5); }
}

.question-container.joker-correct {
    border-color: var(--accent-gold);
    box-shadow: 0 0 40px rgba(255, 160, 0, 0.4);
    animation: jokerWin 0.5s ease;
}

@keyframes jokerWin {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.question-container.joker-incorrect {
    border-color: var(--accent-red);
    box-shadow: 0 0 30px rgba(230, 70, 70, 0.3);
}

.explanation.joker-correct {
    background: rgba(255, 160, 0, 0.1);
    border-color: var(--accent-gold);
}

.explanation.joker-correct .explanation-title {
    color: var(--accent-gold);
}

.explanation.joker-incorrect {
    background: rgba(230, 70, 70, 0.1);
    border-color: var(--accent-red);
}

.explanation.joker-incorrect .explanation-title {
    color: var(--accent-red);
}

/* Responsive */
@media (max-width: 360px) {
    .question-text { font-size: 16px; }
    .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .achievements-grid { grid-template-columns: repeat(2, 1fr); }
    .streak-calendar { padding: 12px 8px; }
    .day-name { font-size: 10px; }
    .tournament-panel { flex-direction: column; text-align: center; }
    .history-row { flex-wrap: wrap; font-size: 11px; gap: 4px; }
}
@media (min-width: 768px) {
    #app { max-width: 640px; padding: 0 16px 70px; }
    .question-text { font-size: 20px; }
    .result-score { font-size: 56px; }
    .streak-big-number { font-size: 80px; }
    .player-stats { gap: 16px; }
    .stat-card { padding: 18px; }
    .achievements-grid { grid-template-columns: repeat(3, 1fr); }
    .profile-stats-grid { grid-template-columns: repeat(4, 1fr); }
    .bottom-nav { max-width: 640px; }
}
@media (min-width: 1024px) {
    #app { max-width: 720px; }
    .bottom-nav { max-width: 720px; }
    .question-container { min-height: 160px; padding: 40px 30px; }
    .theme-of-day { padding: 28px; }
    .history-row { padding: 10px 14px; }
}

/* Screen Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}
#app.shake { animation: shake 0.3s ease; }

/* Particles */
#particles-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 998; overflow: hidden;
}
.particle {
    position: absolute; width: 8px; height: 8px; border-radius: 50%;
    animation: particleFly var(--s, 0.8s) ease-out forwards;
    pointer-events: none;
}
@keyframes particleFly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx, 100px), var(--dy, -100px)) scale(0); opacity: 0; }
}

/* Confetti */
#confetti-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 997; overflow: hidden;
}
.confetti-piece {
    position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px;
    animation: confettiFall 2.5s ease-in forwards; pointer-events: none;
    transform: rotate(var(--rot, 0deg)); opacity: 0.9;
}
@keyframes confettiFall {
    0% { top: -10px; transform: rotate(0deg) translateX(0); opacity: 1; }
    100% { top: 110vh; transform: rotate(720deg) translateX(100px); opacity: 0; }
}

/* VS Panel */
.vs-panel {
    display: flex; justify-content: space-around; align-items: center;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 10px 16px; margin-bottom: 12px;
}
.vs-player, .vs-bot { text-align: center; }
.vs-label { font-size: 11px; color: var(--text-secondary); display: block; margin-bottom: 2px; }
.vs-score { font-size: 22px; font-weight: 700; color: var(--accent-blue); }
.vs-vs { font-size: 14px; font-weight: 700; color: var(--accent-gold); }
.vs-result {
    text-align: center; padding: 8px; font-size: 14px; font-weight: 600;
    color: var(--accent-gold); margin: 8px 0;
}

/* XP Breakdown */
.xp-breakdown {
    text-align: center; padding: 8px 12px;
    background: var(--bg-card); border-radius: var(--radius-sm);
    font-size: 12px; color: var(--text-secondary); margin-bottom: 12px;
}

/* Challenge Result */
.challenge-result {
    text-align: center; padding: 10px; margin-bottom: 12px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    background: rgba(255,160,0,0.1); border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
}

/* Achievement Reward Text */
.result-reward-text {
    text-align: center; padding: 8px; font-size: 13px; font-weight: 600;
    color: var(--accent-green); margin-bottom: 12px;
}

/* Challenge Banner */
.challenge-banner, .referral-banner {
    background: var(--bg-card); border: 1px solid var(--accent-blue);
    border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 12px;
    text-align: center; font-size: 14px; color: var(--accent-blue); font-weight: 600;
}

/* Tournament Panel */
.tournament-panel {
    background: linear-gradient(135deg, #7c4dff, #4c75f2);
    border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tournament-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }
.tournament-score { font-size: 13px; font-weight: 600; white-space: nowrap; }
.tournament-btn { background: rgba(255,255,255,0.2); color: white; white-space: nowrap; }
.tournament-btn:active { background: rgba(255,255,255,0.3); }

/* History List */
.history-list { margin-bottom: 20px; }
.history-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    background: var(--bg-card); border-radius: var(--radius-sm);
    border: 1px solid var(--border-color); margin-bottom: 4px; font-size: 12px;
}
.history-date { color: var(--text-muted); min-width: 36px; }
.history-score { font-weight: 700; color: var(--accent-blue); min-width: 36px; }
.history-bot { color: var(--text-secondary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-result { font-weight: 600; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.history-result.win { color: var(--accent-green); background: rgba(75,179,75,0.15); }
.history-result.lose { color: var(--accent-red); background: rgba(230,70,70,0.15); }
.history-league { color: var(--text-muted); font-size: 10px; }

/* Power-ups Panel */
.powerups-panel {
    display: flex; gap: 8px; justify-content: center; margin-bottom: 12px;
}
.powerup-btn {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer;
    font-family: inherit; display: flex; align-items: center; gap: 6px;
    transition: all 0.2s; color: var(--text-primary); font-size: 12px;
}
.powerup-btn:active { transform: scale(0.95); }
.powerup-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.powerup-btn:hover:not(:disabled) { border-color: var(--accent-blue); background: var(--bg-card-hover); }
.pu-icon { font-weight: 700; font-size: 11px; color: var(--accent-gold); }
.pu-count { background: var(--accent-blue); color: white; padding: 0 5px; border-radius: 8px; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center; }

/* Daily Reward */
.daily-reward-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center;
    z-index: 999;
}
.daily-reward-content {
    background: var(--bg-card); border: 2px solid var(--accent-gold);
    border-radius: var(--radius-lg); padding: 30px 24px; text-align: center;
    max-width: 280px; animation: fadeIn 0.3s ease;
}
.daily-reward-title { font-size: 12px; color: var(--accent-gold); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.daily-reward-day { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.daily-reward-icon { font-size: 48px; font-weight: 700; color: var(--accent-gold); margin-bottom: 8px; }
.daily-reward-text { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.daily-reward-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.daily-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-secondary); border: 2px solid var(--border-color); }
.daily-dot.active { background: var(--accent-gold); border-color: var(--accent-gold); }
.daily-dot.done { background: var(--accent-green); border-color: var(--accent-green); }

/* Showcase */
.showcase-home-btn {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--gradient-primary); border-radius: var(--radius-md);
    padding: 14px 16px; margin-bottom: 16px; cursor: pointer; gap: 10px;
}
.showcase-home-btn:active { opacity: 0.85; }
.showcase-home-label { font-size: 14px; font-weight: 600; color: white; }
.showcase-home-arrow { font-size: 18px; color: white; opacity: 0.7; }

.showcase-subtitle {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 16px;
}
.showcase-list { margin-bottom: 16px; }
.showcase-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 8px;
    cursor: pointer; transition: background 0.2s;
}
.showcase-card:active { background: var(--bg-card-hover); }
.showcase-card-top {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.showcase-author { font-size: 14px; font-weight: 600; }
.showcase-count { font-size: 11px; color: var(--text-muted); }
.showcase-topics { font-size: 12px; color: var(--accent-blue); margin-bottom: 4px; }
.showcase-date { font-size: 10px; color: var(--text-muted); }
.text-muted { font-size: 13px; color: var(--text-secondary); text-align: center; padding: 20px 0; }
