/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #0a0a0f; font-family: 'Rajdhani', sans-serif; color: #e0e0e0; cursor: crosshair; }
canvas { display: block; }
#game-container { position: relative; width: 100vw; height: 100vh; }
#game-canvas { width: 100%; height: 100%; }

/* ===== OVERLAYS ===== */
.overlay { position: fixed; inset: 0; display: none; justify-content: center; align-items: center; z-index: 100;
    background: radial-gradient(ellipse at center, rgba(5,15,30,0.92) 0%, rgba(0,0,0,0.97) 100%);
    backdrop-filter: blur(8px); }
.overlay.active { display: flex; }

/* ===== LOADING ===== */
.loading-content { text-align: center; }
.game-title { font-family: 'Orbitron', sans-serif; font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 900;
    background: linear-gradient(135deg, #00e5ff, #76ff03, #ffea00);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    text-shadow: 0 0 40px rgba(0,229,255,0.3); letter-spacing: 4px; margin-bottom: 8px; }
.game-subtitle { font-family: 'Share Tech Mono', monospace; font-size: clamp(0.8rem, 2vw, 1.2rem);
    color: #76ff03; letter-spacing: 8px; margin-bottom: 40px; text-transform: uppercase; }
.loading-bar-container { width: 300px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px;
    margin: 0 auto 20px; overflow: hidden; }
.loading-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #00e5ff, #76ff03);
    border-radius: 2px; transition: width 0.3s ease; }
.loading-text { font-family: 'Share Tech Mono', monospace; font-size: 0.85rem; color: #607d8b; }

/* Thai font support */
.lang-th, .lang-th button, .lang-th span, .lang-th div, .lang-th p {
    font-family: 'Noto Sans Thai', 'Rajdhani', sans-serif !important;
}
.lang-th .game-title {
    font-family: 'Noto Sans Thai', 'Orbitron', sans-serif !important;
    letter-spacing: 0;
}
.lang-th .game-subtitle {
    letter-spacing: 0;
}
.lang-th .menu-btn, .lang-th .diff-btn, .lang-th .stat-value,
.lang-th .wave-number, .lang-th .score-value, .lang-th .level-up-title,
.lang-th .game-over-title, .lang-th .panel-title, .lang-th .upgrade-name,
.lang-th .upgrade-cost, .lang-th .level-up-choice-name, .lang-th .combo-label,
.lang-th .xp-bar-text, .lang-th .ultimate-bar-text, .lang-th .go-stat-value {
    font-family: 'Noto Sans Thai', 'Orbitron', sans-serif !important;
    letter-spacing: 0;
}

/* Language toggle button */
.lang-toggle-container {
    position: absolute;
    top: 16px;
    right: 16px;
}
.lang-toggle-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    padding: 6px 14px;
    border: 1px solid rgba(0,229,255,0.4);
    background: rgba(0,229,255,0.1);
    color: #00e5ff;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.25s ease;
    pointer-events: auto;
}
.lang-toggle-btn:hover {
    background: rgba(0,229,255,0.25);
    border-color: #00e5ff;
    box-shadow: 0 0 12px rgba(0,229,255,0.3);
}
.lang-toggle-btn.th-mode {
    background: rgba(118,255,3,0.15);
    border-color: #76ff03;
    color: #76ff03;
}
.lang-toggle-btn.th-mode:hover {
    background: rgba(118,255,3,0.3);
    box-shadow: 0 0 12px rgba(118,255,3,0.3);
}

/* ===== MENU ===== */
.menu-content, .panel-content, .game-over-content { text-align: center; max-width: 600px; padding: 20px; }
.glitch { position: relative; animation: glitch-anim 3s infinite; }
@keyframes glitch-anim { 0%,95%,100% { transform: none; } 96% { transform: translate(-2px,1px); } 97% { transform: translate(2px,-1px); } }
.menu-buttons { display: flex; flex-direction: column; gap: 14px; margin: 20px auto; max-width: 280px; }
.menu-btn { font-family: 'Orbitron', sans-serif; font-size: 0.95rem; padding: 14px 32px; border: 1px solid rgba(0,229,255,0.3);
    background: rgba(0,229,255,0.05); color: #b0bec5; border-radius: 4px; cursor: pointer; letter-spacing: 2px;
    transition: all 0.25s ease; text-transform: uppercase; }
.menu-btn:hover { background: rgba(0,229,255,0.15); color: #fff; border-color: #00e5ff;
    box-shadow: 0 0 20px rgba(0,229,255,0.2); transform: translateY(-2px); }
.menu-btn.primary { background: linear-gradient(135deg, rgba(0,229,255,0.2), rgba(118,255,3,0.2));
    border-color: #76ff03; color: #76ff03; }
.menu-btn.primary:hover { background: linear-gradient(135deg, rgba(0,229,255,0.35), rgba(118,255,3,0.35));
    box-shadow: 0 0 30px rgba(118,255,3,0.3); }
.menu-stats { display: flex; justify-content: center; gap: 32px; margin-top: 20px; flex-wrap: wrap; }
.stat-label { font-family: 'Share Tech Mono', monospace; font-size: 0.75rem; color: #607d8b; display: block; }
.stat-value { font-family: 'Orbitron', sans-serif; font-size: 1.4rem; color: #ffea00; }

/* Difficulty selector */
.difficulty-selector { margin: 16px 0 0; }
.diff-label { font-family: 'Share Tech Mono', monospace; font-size: 0.7rem; color: #607d8b; letter-spacing: 3px; display: block; margin-bottom: 10px; }
.diff-buttons { display: flex; justify-content: center; gap: 8px; }
.diff-btn { font-family: 'Orbitron', sans-serif; font-size: 0.75rem; padding: 8px 18px; border-radius: 20px; cursor: pointer;
    border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color: #90a4ae;
    transition: all 0.2s ease; letter-spacing: 1px; }
.diff-btn:hover { transform: translateY(-1px); }
.diff-btn.diff-easy.active,  .diff-btn.diff-easy:hover  { border-color: #76ff03; background: rgba(118,255,3,0.12);  color: #76ff03; box-shadow: 0 0 12px rgba(118,255,3,0.2); }
.diff-btn.diff-medium.active,.diff-btn.diff-medium:hover { border-color: #ffea00; background: rgba(255,234,0,0.12);  color: #ffea00; box-shadow: 0 0 12px rgba(255,234,0,0.2); }
.diff-btn.diff-hard.active,  .diff-btn.diff-hard:hover   { border-color: #ef5350; background: rgba(239,83,80,0.12); color: #ef5350; box-shadow: 0 0 12px rgba(239,83,80,0.2); }

/* ===== HOW TO PLAY ===== */
.panel-title { font-family: 'Orbitron', sans-serif; font-size: 1.8rem; color: #00e5ff; margin-bottom: 30px; letter-spacing: 3px; }
.instructions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 30px; text-align: left; }
.instruction-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 6px; }
.key-group { display: flex; gap: 4px; }
.key { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px;
    background: rgba(0,229,255,0.1); border: 1px solid rgba(0,229,255,0.3); border-radius: 4px;
    font-family: 'Share Tech Mono', monospace; font-size: 0.75rem; color: #00e5ff; }

/* ===== UPGRADE PANEL ===== */
.upgrade-panel { max-width: 700px; }
.coins-display { font-family: 'Orbitron', sans-serif; font-size: 1.8rem; color: #ffea00; margin-bottom: 24px; }
.coin-icon { font-size: 1.4rem; margin-right: 8px; }
.upgrades-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 30px; }
.upgrade-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
    padding: 18px; text-align: center; transition: all 0.25s ease; cursor: pointer; }
.upgrade-card:hover { border-color: #00e5ff; background: rgba(0,229,255,0.05); transform: translateY(-2px); }
.upgrade-card.maxed { border-color: #76ff03; opacity: 0.6; cursor: default; }
.upgrade-icon { font-size: 2rem; margin-bottom: 8px; }
.upgrade-name { font-family: 'Orbitron', sans-serif; font-size: 0.8rem; color: #b0bec5; letter-spacing: 1px; }
.upgrade-level { font-family: 'Share Tech Mono', monospace; font-size: 0.75rem; color: #607d8b; margin: 6px 0; }
.upgrade-cost { font-family: 'Orbitron', sans-serif; font-size: 0.85rem; color: #ffea00; }
.upgrade-bar { width: 100%; height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.upgrade-bar-fill { height: 100%; background: linear-gradient(90deg, #00e5ff, #76ff03); transition: width 0.3s ease; }

/* ===== HUD ===== */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 50; display: none; }
.hud.active { display: block; }
.hud-top-left { position: absolute; top: 16px; left: 16px; }
.hud-top-center { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); }
.hud-top-right { position: absolute; top: 16px; right: 16px; text-align: right; }
.hud-bottom-left { position: absolute; bottom: 16px; left: 16px; }
.hud-bottom-center { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); }
.hud-bottom-right { position: absolute; bottom: 16px; right: 16px; }

/* Health */
.health-bar-container, .shield-bar-container { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.health-bar-label { font-family: 'Orbitron', sans-serif; font-size: 0.7rem; color: #ef5350; width: 20px; }
.health-bar-bg { width: 160px; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.shield-bg { }
.health-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ef5350, #ff7043); border-radius: 4px;
    transition: width 0.25s ease, background 0.3s ease; }
.health-bar-fill.low-hp { background: linear-gradient(90deg, #d50000, #ff1744); animation: hp-flash 0.6s infinite alternate; }
@keyframes hp-flash { from { opacity: 1; } to { opacity: 0.55; } }
.low-hp-pulse { animation: container-pulse 0.6s infinite alternate; }
@keyframes container-pulse { from { filter: none; } to { filter: drop-shadow(0 0 5px rgba(239,83,80,0.8)); } }
.shield-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #29b6f6, #4fc3f7); border-radius: 4px;
    transition: width 0.3s ease; }
.health-bar-text { font-family: 'Share Tech Mono', monospace; font-size: 0.7rem; color: #90a4ae; }

/* Wave & Score */
.wave-indicator { background: rgba(0,0,0,0.5); border: 1px solid rgba(0,229,255,0.2); border-radius: 6px; padding: 6px 20px; }
.wave-label { font-family: 'Share Tech Mono', monospace; font-size: 0.7rem; color: #607d8b; margin-right: 8px; }
.wave-number { font-family: 'Orbitron', sans-serif; font-size: 1.2rem; color: #00e5ff; }
.score-display { margin-bottom: 6px; }
.score-label { font-family: 'Share Tech Mono', monospace; font-size: 0.65rem; color: #607d8b; margin-right: 8px; }
.score-value { font-family: 'Orbitron', sans-serif; font-size: 1.3rem; color: #ffea00; }
.coins-hud { font-family: 'Orbitron', sans-serif; font-size: 0.9rem; color: #ffea00; }
.coin-icon-small { font-size: 0.9rem; margin-right: 4px; }

/* Minimap */
.minimap-container { width: 180px; height: 180px; border: 1px solid rgba(0,229,255,0.25); border-radius: 8px;
    overflow: hidden; background: rgba(0,20,0,0.7); }
#minimap-canvas { width: 100%; height: 100%; image-rendering: pixelated; }

/* Crosshair */
.crosshair { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 60; }
.crosshair-dot { width: 4px; height: 4px; background: rgba(255,255,255,0.9); border-radius: 50%;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.crosshair-line { position: absolute; background: rgba(255,255,255,0.5); }
.crosshair-line.top { width: 2px; height: 12px; top: -18px; left: 50%; transform: translateX(-50%); }
.crosshair-line.bottom { width: 2px; height: 12px; bottom: -18px; left: 50%; transform: translateX(-50%); }
.crosshair-line.left { width: 12px; height: 2px; left: -18px; top: 50%; transform: translateY(-50%); }
.crosshair-line.right { width: 12px; height: 2px; right: -18px; top: 50%; transform: translateY(-50%); }

/* Buff indicators */
.buff-indicators { display: flex; gap: 8px; }
.buff-item { display: flex; align-items: center; gap: 4px; padding: 4px 10px;
    background: rgba(0,0,0,0.6); border: 1px solid rgba(118,255,3,0.3); border-radius: 4px;
    font-family: 'Share Tech Mono', monospace; font-size: 0.75rem; color: #76ff03; animation: buff-pulse 1.5s infinite; }
@keyframes buff-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Cooldown */
.cooldown-indicator { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }

/* ===== QUIZ ===== */
.quiz-panel { background: rgba(5,15,30,0.97); border: 1px solid rgba(0,229,255,0.3); border-radius: 12px;
    padding: 28px; max-width: 520px; width: 92%; text-align: center; animation: quiz-appear 0.4s ease; }
@keyframes quiz-appear { from { transform: scale(0.8) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.quiz-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.quiz-icon { font-size: 1.8rem; }
.quiz-title { font-family: 'Orbitron', sans-serif; font-size: 1.2rem; color: #00e5ff; letter-spacing: 3px; }
.quiz-tts-btn { background: rgba(0,229,255,0.1); border: 1px solid rgba(0,229,255,0.25); border-radius: 6px;
    color: #00e5ff; font-size: 1.1rem; width: 34px; height: 34px; cursor: pointer; pointer-events: auto;
    transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.quiz-tts-btn:hover { background: rgba(0,229,255,0.2); box-shadow: 0 0 10px rgba(0,229,255,0.3); }
/* Meta row: difficulty badge + streak */
.quiz-meta { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-difficulty-badge { font-family: 'Share Tech Mono', monospace; font-size: 0.72rem; padding: 3px 12px;
    border-radius: 20px; letter-spacing: 1px; }
.diff-easy  { border: 1px solid #76ff03; color: #76ff03; background: rgba(118,255,3,0.08); }
.diff-medium{ border: 1px solid #ffea00; color: #ffea00; background: rgba(255,234,0,0.08); }
.diff-hard  { border: 1px solid #ef5350; color: #ef5350; background: rgba(239,83,80,0.08); }
.quiz-streak { font-family: 'Orbitron', sans-serif; font-size: 0.85rem; color: #ff9100;
    background: rgba(255,145,0,0.12); border: 1px solid rgba(255,145,0,0.3); border-radius: 20px;
    padding: 3px 12px; animation: streak-glow 1s infinite alternate; }
@keyframes streak-glow { from { box-shadow: 0 0 4px rgba(255,145,0,0.3); } to { box-shadow: 0 0 14px rgba(255,145,0,0.6); } }
.quiz-question { font-size: 1.1rem; line-height: 1.65; color: #eceff1; margin-bottom: 20px; min-height: 52px; }
.quiz-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.quiz-answer-btn { font-family: 'Rajdhani', sans-serif; font-size: 1rem; padding: 11px 14px; border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04); color: #cfd8dc; border-radius: 6px; cursor: pointer; pointer-events: auto;
    transition: all 0.2s ease; text-align: left; display: flex; align-items: center; gap: 8px; }
.quiz-answer-letter { font-family: 'Orbitron', sans-serif; font-size: 0.7rem; color: #607d8b;
    background: rgba(255,255,255,0.06); border-radius: 3px; padding: 2px 6px; min-width: 22px; text-align: center; }
.quiz-answer-btn:hover { border-color: #00e5ff; background: rgba(0,229,255,0.08); color: #fff; }
.quiz-answer-btn:hover .quiz-answer-letter { color: #00e5ff; }
.quiz-answer-btn.correct { border-color: #76ff03; background: rgba(118,255,3,0.15); color: #76ff03; }
.quiz-answer-btn.correct .quiz-answer-letter { color: #76ff03; background: rgba(118,255,3,0.2); }
.quiz-answer-btn.wrong { border-color: #ef5350; background: rgba(239,83,80,0.15); color: #ef5350; }
.quiz-result { font-family: 'Orbitron', sans-serif; font-size: 0.95rem; min-height: 26px; margin-bottom: 8px; }
.quiz-explanation { font-family: 'Rajdhani', sans-serif; font-size: 0.95rem; line-height: 1.5;
    color: #b0bec5; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-left: 3px solid #00e5ff; border-radius: 0 6px 6px 0; padding: 10px 14px;
    margin-bottom: 12px; text-align: left; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.quiz-timer-bar { width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.quiz-timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ffea00, #ff9100); transition: width 0.1s linear; }

/* ===== WAVE BANNER ===== */
.wave-banner { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 80; pointer-events: none;
    display: none; }
.wave-banner.active { display: block; animation: banner-in 0.5s ease, banner-out 0.5s ease 2s forwards; }
@keyframes banner-in { from { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes banner-out { to { transform: translate(-50%, -50%) scale(0.8); opacity: 0; } }
.wave-banner-text { font-family: 'Orbitron', sans-serif; font-size: clamp(2rem, 5vw, 4rem); color: #00e5ff;
    text-shadow: 0 0 40px rgba(0,229,255,0.5); display: block; }
.wave-banner-sub { font-family: 'Share Tech Mono', monospace; font-size: 1rem; color: #76ff03; }

/* ===== GAME OVER ===== */
.game-over-content {
    text-align: center;
    max-width: 650px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,0.3) transparent;
}
.game-over-content::-webkit-scrollbar { width: 6px; }
.game-over-content::-webkit-scrollbar-track { background: transparent; }
.game-over-content::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.3); border-radius: 3px; }

.game-over-title { font-family: 'Orbitron', sans-serif; font-size: clamp(1.5rem, 4vw, 2.5rem);
    background: linear-gradient(135deg, #ef5350, #ff7043); -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 20px; letter-spacing: 2px; }
.game-over-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.go-stat { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 10px; }
.go-stat-label { font-family: 'Share Tech Mono', monospace; font-size: 0.6rem; color: #607d8b; display: block; margin-bottom: 4px; }
.go-stat-value { font-family: 'Orbitron', sans-serif; font-size: 1.1rem; color: #ffea00; }
.game-over-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ===== DAMAGE FLASH ===== */
.damage-flash { position: fixed; inset: 0; background: radial-gradient(ellipse, transparent 40%, rgba(239,83,80,0.4));
    pointer-events: none; z-index: 90; opacity: 0; transition: opacity 0.1s ease; }
.damage-flash.active { opacity: 1; }

/* ===== MOBILE CONTROLS ===== */
.mobile-controls { display: none; position: absolute; bottom: 20px; left: 0; right: 0; pointer-events: auto; }
.joystick-container { position: absolute; bottom: 20px; left: 30px; }
.joystick-base { width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15); position: relative; }
.joystick-thumb { width: 50px; height: 50px; border-radius: 50%; background: rgba(0,229,255,0.3);
    border: 2px solid rgba(0,229,255,0.5); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.mobile-fire-btn { position: absolute; bottom: 30px; right: 30px; width: 80px; height: 80px; border-radius: 50%;
    background: rgba(239,83,80,0.3); border: 2px solid rgba(239,83,80,0.5); color: #ef5350;
    font-family: 'Orbitron', sans-serif; font-size: 0.8rem; cursor: pointer; }

/* ===== SKINS PANEL REDESIGN ===== */
.skins-container-split {
    max-width: 1000px;
    width: 95%;
    display: flex;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: rgba(5, 15, 30, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.skins-left {
    width: 400px;
    padding: 30px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    text-align: left;
}

.skins-grid-new {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
    overflow-y: auto;
    max-height: 60vh;
    padding-right: 10px;
}

.skins-grid-new::-webkit-scrollbar { width: 4px; }
.skins-grid-new::-webkit-scrollbar-thumb { background: rgba(0, 229, 255, 0.2); border-radius: 2px; }

.skin-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skin-card:hover { border-color: rgba(0, 229, 255, 0.3); background: rgba(255, 255, 255, 0.05); }
.skin-card.selected { border-color: #00e5ff; background: rgba(0, 229, 255, 0.08); box-shadow: 0 0 15px rgba(0, 229, 255, 0.2); }

.skin-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-emoji { font-size: 1.5rem; }
.skin-name { font-family: 'Orbitron', sans-serif; font-size: 0.6rem; color: #90a4ae; text-transform: uppercase; }
.skin-card.selected .skin-name { color: #00e5ff; }

.skins-right {
    flex-grow: 1;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
    display: flex;
    flex-direction: column;
    padding: 30px;
    position: relative;
}

.skin-preview-3d {
    width: 100%;
    height: 400px;
    position: relative;
    cursor: grab;
}

.skin-preview-3d:active { cursor: grabbing; }

.skin-preview-3d canvas {
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

.drag-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: #00e5ff;
    opacity: 0.6;
    pointer-events: none;
}

.skin-info-display {
    margin-top: auto;
    text-align: center;
}

#preview-skin-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: #fff;
    margin-bottom: 5px;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

#preview-skin-desc {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    color: #76ff03;
}

@media (max-width: 850px) {
    .skins-container-split { flex-direction: column; max-height: 95vh; }
    .skins-left { width: 100%; border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding: 20px; }
    .skins-grid-new { grid-template-columns: repeat(5, 1fr); max-height: 150px; }
    .skins-right { padding: 20px; height: 350px; }
}

/* ===== SETTINGS PANEL ===== */
.settings-subtitle { font-family: 'Share Tech Mono', monospace; font-size: 0.8rem; color: #607d8b;
    margin-bottom: 24px; }
.settings-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.settings-label { font-family: 'Orbitron', sans-serif; font-size: 0.75rem; color: #90a4ae; letter-spacing: 2px; text-align: left; }
.settings-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-btn { font-family: 'Share Tech Mono', monospace; font-size: 0.72rem; padding: 7px 14px;
    border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); color: #78909c;
    border-radius: 4px; cursor: pointer; transition: all 0.2s ease; letter-spacing: 1px; }
.settings-btn:hover { border-color: rgba(0,229,255,0.3); color: #cfd8dc; }
.settings-btn.active { border-color: #ffea00; background: rgba(255,234,0,0.1); color: #ffea00;
    box-shadow: 0 0 10px rgba(255,234,0,0.2); }

/* ===== BOSS HEALTH BAR ===== */
.boss-health-bar { margin-top: 8px; min-width: 280px; }
.boss-health-label { font-family: 'Orbitron', sans-serif; font-size: 0.75rem; color: #ce93d8;
    text-align: center; margin-bottom: 4px; letter-spacing: 2px; text-shadow: 0 0 10px rgba(156,0,255,0.6); }
.boss-health-bg { width: 100%; height: 10px; background: rgba(255,255,255,0.08); border-radius: 5px; overflow: hidden;
    border: 1px solid rgba(156,0,255,0.3); }
.boss-health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #9c00ff, #cc66ff);
    border-radius: 5px; transition: width 0.2s ease; box-shadow: 0 0 8px rgba(156,0,255,0.5); }

/* ===== COMBAT POWER-UP TOAST ===== */
.combat-pu-toast { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.pu-toast-item { font-family: 'Orbitron', sans-serif; font-size: 0.8rem; padding: 5px 14px;
    border-radius: 20px; border: 1px solid; animation: pu-bounce 0.4s ease, buff-pulse 1.5s infinite 0.4s;
    pointer-events: none; }
@keyframes pu-bounce { from { transform: scale(0.5) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.pu-toast-rapidfire { border-color: #ff6d00; color: #ff6d00; background: rgba(255,109,0,0.12); }
.pu-toast-shield    { border-color: #29b6f6; color: #29b6f6; background: rgba(41,182,246,0.12); }
.pu-toast-health    { border-color: #76ff03; color: #76ff03; background: rgba(118,255,3,0.12); }
.pu-toast-damage    { border-color: #ff1744; color: #ff1744; background: rgba(255,23,68,0.12); }

/* ===== ULTIMATE SYSTEM ===== */
.ultimate-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}
.ultimate-bar-bg {
    position: relative;
    width: 140px;
    height: 18px;
    background: rgba(255,255,255,0.08);
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid rgba(156,0,255,0.3);
}
.ultimate-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #9c00ff, #ff9100, #ffea00);
    border-radius: 9px;
    transition: width 0.3s ease;
}
.ultimate-bar-fill.full {
    animation: ultimate-glow 0.6s infinite alternate;
}
@keyframes ultimate-glow {
    from { filter: brightness(1); box-shadow: inset 0 0 6px rgba(255,234,0,0.4); }
    to { filter: brightness(1.4); box-shadow: inset 0 0 14px rgba(255,234,0,0.8); }
}
.ultimate-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    color: #fff;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
    letter-spacing: 2px;
    pointer-events: none;
}
.ultimate-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(156,0,255,0.12);
    border: 1px solid rgba(156,0,255,0.3);
    border-radius: 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    color: #cc66ff;
}
.ultimate-icon { font-size: 0.9rem; }

/* Ultimate Button */
.ultimate-btn {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    border: 2px solid rgba(156,0,255,0.3);
    background: rgba(156,0,255,0.1);
    color: #cc66ff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.25s ease;
    pointer-events: auto;
    margin-top: 8px;
}
.ultimate-btn:hover {
    background: rgba(156,0,255,0.2);
    border-color: rgba(156,0,255,0.6);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(156,0,255,0.3);
}
.ultimate-btn.ready {
    background: linear-gradient(135deg, rgba(156,0,255,0.35), rgba(255,145,0,0.25));
    border-color: #ffea00;
    color: #ffea00;
    animation: ultimate-btn-pulse 0.8s infinite alternate;
}
@keyframes ultimate-btn-pulse {
    from { box-shadow: 0 0 8px rgba(255,234,0,0.3); }
    to { box-shadow: 0 0 22px rgba(255,234,0,0.7); }
}
.ultimate-btn-icon { font-size: 1.2rem; }
.ultimate-btn-key {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    opacity: 0.7;
}

/* Ultimate Notification */
.ultimate-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 85;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    color: #ffea00;
    text-shadow: 0 0 30px rgba(255,234,0,0.8);
    pointer-events: none;
    animation: ultimate-notify 1s ease forwards;
    text-align: center;
}
@keyframes ultimate-notify {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ===== WEAPON DISPLAY ===== */
.weapon-display {
    display: flex;
    justify-content: center;
    margin-top: 4px;
    gap: 6px;
    align-items: center;
    pointer-events: none;
    min-height: 24px;
}
.weapon-display .weapon-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
}
.weapon-display .weapon-remaining {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 4px;
}

/* ===== COMBO DISPLAY ===== */
.combo-display {
    display: flex;
    justify-content: center;
    margin-top: 4px;
    min-height: 24px;
    pointer-events: none;
}
.combo-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    animation: combo-pop 0.3s ease;
    text-shadow: 0 0 12px currentColor;
    letter-spacing: 2px;
}
@keyframes combo-pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}
.combo-milestone {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 85;
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    pointer-events: none;
    animation: combo-milestone-anim 0.8s ease forwards;
    text-align: center;
}
@keyframes combo-milestone-anim {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
.combo-flash {
    animation: combo-flash-anim 0.15s ease;
}
@keyframes combo-flash-anim {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}

/* ===== XP BAR ===== */
.xp-bar-container {
    display: flex;
    justify-content: center;
    margin-top: 6px;
}
.xp-bar-bg {
    position: relative;
    width: 160px;
    height: 12px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(0,229,255,0.2);
}
.xp-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00e5ff, #76ff03);
    border-radius: 6px;
    transition: width 0.3s ease;
}
.xp-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.55rem;
    color: #fff;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
    letter-spacing: 1px;
    pointer-events: none;
}

/* ===== LEVEL UP OVERLAY ===== */
.level-up-panel {
    background: rgba(5,15,30,0.97);
    border: 2px solid rgba(118,255,3,0.4);
    border-radius: 14px;
    padding: 32px;
    max-width: 440px;
    width: 92%;
    text-align: center;
    animation: level-up-appear 0.5s ease;
    box-shadow: 0 0 40px rgba(118,255,3,0.15);
}
@keyframes level-up-appear {
    from { transform: scale(0.7) translateY(30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.level-up-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}
.level-up-icon {
    font-size: 2rem;
    animation: level-up-icon-pulse 1s infinite alternate;
}
@keyframes level-up-icon-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}
.level-up-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #76ff03, #ffea00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
}
.level-up-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: #76ff03;
    margin-bottom: 4px;
}
.level-up-prompt {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    color: #90a4ae;
    margin-bottom: 18px;
    margin-top: 12px;
}
.level-up-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.level-up-choice {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.05rem;
    padding: 14px 18px;
    border: 1px solid rgba(118,255,3,0.25);
    background: rgba(118,255,3,0.05);
    color: #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}
.level-up-choice:hover {
    border-color: #76ff03;
    background: rgba(118,255,3,0.12);
    color: #fff;
    transform: translateX(4px);
    box-shadow: 0 0 16px rgba(118,255,3,0.2);
}
.level-up-choice-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}
.level-up-choice-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: #76ff03;
    letter-spacing: 1px;
}
.level-up-choice-desc {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    color: #90a4ae;
    margin-top: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .instructions-grid { grid-template-columns: 1fr; }
    .quiz-answers { grid-template-columns: 1fr; }
    .game-over-stats { grid-template-columns: repeat(2, 1fr); }
    .minimap-container { width: 120px; height: 120px; }
    .skins-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .settings-btn-group { gap: 6px; }
    .boss-health-bar { min-width: 200px; }
    .game-over-content { max-height: 95vh; padding: 16px; }
    .lo-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (pointer: coarse) {
    body { cursor: auto; }
    .crosshair { display: none; }
    .mobile-controls { display: block; }
}

/* Learning Outcomes */
.learning-outcomes {
    margin-top: 16px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    width: 100%;
}

.lo-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #4fc3f7;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 1px;
}

.lo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.lo-card {
    background: rgba(255, 255, 255, 0.04);
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid #555;
    transition: transform 0.3s ease, background 0.3s ease;
}

.lo-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
}

.lo-card.status-green { border-left-color: #76ff03; box-shadow: inset 4px 0 12px rgba(118, 255, 3, 0.08); }
.lo-card.status-yellow { border-left-color: #ffea00; box-shadow: inset 4px 0 12px rgba(255, 234, 0, 0.08); }
.lo-card.status-red { border-left-color: #ff1744; box-shadow: inset 4px 0 12px rgba(255, 23, 68, 0.08); }

.lo-card-tag {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 3px;
    display: block;
    letter-spacing: 1px;
}

.lo-card-name {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 8px;
    display: block;
    line-height: 1.2;
}

.lo-card-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.lo-card-fill {
    height: 100%;
    width: 0;
    transition: width 1.5s cubic-bezier(0.1, 0.5, 0.2, 1);
}

.status-green .lo-card-fill { background: linear-gradient(90deg, #76ff03, #b2ff59); }
.status-yellow .lo-card-fill { background: linear-gradient(90deg, #ffea00, #ffff00); }
.status-red .lo-card-fill { background: linear-gradient(90deg, #ff1744, #ff5252); }

.lo-card-pct {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    text-align: right;
    display: block;
    color: rgba(255,255,255,0.7);
}

.lo-recommendation {
    font-family: 'Noto Sans Thai', sans-serif;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
    line-height: 1.4;
}

.lo-recommendation.perfect {
    color: #76ff03;
    font-weight: 700;
    font-size: 0.95rem;
    background: rgba(118, 255, 3, 0.08);
    border: 1px solid rgba(118, 255, 3, 0.15);
    animation: lo-glow-pulse 2s infinite;
}

@keyframes lo-glow-pulse {
    0% { box-shadow: 0 0 5px rgba(118, 255, 3, 0.15); }
    50% { box-shadow: 0 0 15px rgba(118, 255, 3, 0.3); }
    100% { box-shadow: 0 0 5px rgba(118, 255, 3, 0.15); }
}

@media (max-width: 600px) {
    .lo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .game-over-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .go-stat { padding: 8px; }
    .go-stat-value { font-size: 1rem; }
    .game-over-buttons { flex-direction: column; }
    .game-over-buttons .menu-btn { width: 100%; }
}

/* ===== TUTORIAL ===== */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    display: none;
    overflow: hidden;
}
.tutorial-overlay.active { display: block; }

.tutorial-spotlight {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    mask-image: radial-gradient(circle at 50% 50%, transparent 120px, black 180px);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 120px, black 180px);
}

.tutorial-content {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 90%;
    max-width: 600px;
}

.tutorial-instruction {
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 30px;
    border-radius: 12px;
    border-left: 5px solid #00e5ff;
    animation: tutorial-slide-up 0.5s ease;
}

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

.tutorial-keys {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.key-row { display: flex; gap: 8px; }

.tutorial-key {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #fff;
    transition: all 0.2s ease;
}

.tutorial-key.active {
    background: #00e5ff;
    border-color: #fff;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.8);
    transform: scale(0.95);
    color: #000;
}

.tutorial-skip {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: auto;
    font-family: 'Noto Sans Thai', sans-serif;
    transition: all 0.2s ease;
}

.tutorial-skip:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

/* Tutorial Ready Screen */
.ready-content {
    text-align: center;
}

.ready-tank-anim {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: ready-tank-drive 2s infinite ease-in-out;
}

@keyframes ready-tank-drive {
    0% { transform: translateX(-50px); opacity: 0; }
    50% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(50px); opacity: 0; }
}

.ready-title {
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 2.5rem;
    color: #76ff03;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(118, 255, 3, 0.4);
}

.ready-subtitle {
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 1.2rem;
    color: #b0bec5;
    margin-bottom: 40px;
}

/* Arrow pointer */
.tutorial-arrow {
    position: absolute;
    width: 60px;
    height: 60px;
    background: #ffea00;
    clip-path: polygon(40% 0%, 40% 70%, 10% 70%, 50% 100%, 90% 70%, 60% 70%, 60% 0%);
    z-index: 900;
    animation: arrow-float 0.6s infinite alternate;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(255, 234, 0, 0.5);
}

@keyframes arrow-float {
    from { transform: translateY(0); }
    to { transform: translateY(-20px); }
}

/* ===== ACHIEVEMENTS ===== */
.achievements-panel { max-width: 800px; width: 95%; }
.achievements-summary { font-family: 'Orbitron', sans-serif; color: #ffea00; margin-bottom: 20px; font-size: 1.1rem; }
.achievements-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); 
    gap: 16px; 
    max-height: 60vh; 
    overflow-y: auto; 
    padding: 10px;
    margin-bottom: 24px;
}
.achievement-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    text-align: left;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.achievement-card.locked { filter: grayscale(1); opacity: 0.6; }
.achievement-card.unlocked { 
    border-color: rgba(255, 234, 0, 0.3); 
    background: rgba(255, 234, 0, 0.03);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.achievement-icon { font-size: 2.5rem; flex-shrink: 0; }
.achievement-info { flex-grow: 1; }
.achievement-name { font-family: 'Orbitron', sans-serif; font-size: 0.9rem; color: #fff; margin-bottom: 4px; display: block; }
.unlocked .achievement-name { color: #ffea00; }
.achievement-desc { font-size: 0.8rem; color: #b0bec5; line-height: 1.4; }
.achievement-date { font-family: 'Share Tech Mono', monospace; font-size: 0.65rem; color: #607d8b; margin-top: 8px; display: block; }

.achievement-progress-container { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.05); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.achievement-progress-fill { height: 100%; background: #ffea00; width: 0%; transition: width 0.5s ease; }

/* Achievement Toasts */
.achievement-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    pointer-events: none;
}
.achievement-toast {
    background: rgba(5, 15, 30, 0.95);
    border: 2px solid #ffea00;
    border-radius: 12px;
    padding: 16px 20px;
    width: 320px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toast-slide-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: auto;
}
@keyframes toast-slide-in {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.achievement-toast.fade-out {
    animation: toast-fade-out 0.5s ease forwards;
}
@keyframes toast-fade-out {
    to { transform: translateX(20px); opacity: 0; }
}
.toast-icon { font-size: 2.2rem; }
.toast-body { flex-grow: 1; }
.toast-title { font-family: 'Orbitron', sans-serif; font-size: 0.85rem; color: #ffea00; display: block; margin-bottom: 2px; }
.toast-desc { font-size: 0.75rem; color: #eceff1; }

@media (max-width: 600px) {
    .achievements-grid { grid-template-columns: 1fr; }
    .achievement-toast { width: 280px; }
}
/* ===== REWARD SELECTION ===== */
#reward-selection-overlay { z-index: 110; }
.reward-selection-panel { background: rgba(5,15,30,0.98); border: 2px solid #ffea00; border-radius: 16px;
    padding: 32px; max-width: 480px; width: 92%; text-align: center; animation: reward-appear 0.6s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    box-shadow: 0 0 50px rgba(255, 234, 0, 0.15); }
@keyframes reward-appear { from { transform: scale(0.5) rotate(-5deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.reward-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.reward-icon-main { font-size: 2.2rem; animation: float 2s infinite ease-in-out; }
.reward-title { font-family: 'Orbitron', sans-serif; font-size: 1.6rem; color: #ffea00; letter-spacing: 3px; text-shadow: 0 0 20px rgba(255,234,0,0.3); }
.reward-subtitle { font-family: 'Share Tech Mono', monospace; font-size: 0.85rem; color: #76ff03; margin-bottom: 24px; }
.reward-choices { display: flex; flex-direction: column; gap: 12px; }
.reward-choice { font-family: 'Rajdhani', sans-serif; padding: 14px 20px; background: rgba(255,234,0,0.04);
    border: 1px solid rgba(255,234,0,0.25); border-radius: 10px; color: #e0e0e0; cursor: pointer; pointer-events: auto;
    transition: all 0.25s ease; display: flex; align-items: center; gap: 16px; text-align: left; }
.reward-choice:hover { background: rgba(255,234,0,0.12); border-color: #ffea00; transform: translateX(8px);
    box-shadow: 0 0 15px rgba(255,234,0,0.15); color: #fff; }
.reward-choice-icon { font-size: 1.8rem; width: 40px; text-align: center; }
.reward-choice-name { font-family: 'Orbitron', sans-serif; font-size: 0.85rem; color: #ffea00; letter-spacing: 1px; }
.reward-choice-desc { font-family: 'Share Tech Mono', monospace; font-size: 0.72rem; color: #90a4ae; margin-top: 2px; }

/* Quiz Progress HUD */
.hud-top-center { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); pointer-events: none; z-index: 10; }
.quiz-progress-hud { background: rgba(5, 15, 30, 0.75); backdrop-filter: blur(8px); border: 1px solid rgba(255, 234, 0, 0.4);
    padding: 8px 20px; border-radius: 20px; display: flex; align-items: center; gap: 12px; color: #ffea00;
    font-family: 'Orbitron', sans-serif; font-size: 0.95rem; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: all 0.3s ease; letter-spacing: 1px; }
.quiz-progress-hud.complete { border-color: #76ff03; color: #76ff03; box-shadow: 0 0 20px rgba(118, 255, 3, 0.4); transform: translateX(-50%) scale(1.05); }
.quiz-progress-icon { font-size: 1.2rem; }
/* ===== UPGRADE MENU REDESIGN ===== */
.upgrade-panel {
    max-width: 850px;
    width: 95%;
    background: rgba(5, 15, 30, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.upgrade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-circle-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.back-circle-btn:hover {
    background: #ef5350;
    border-color: #ef5350;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(239, 83, 80, 0.4);
}

.coins-display-large {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 234, 0, 0.1);
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255, 234, 0, 0.3);
}

.coins-display-large .coin-icon { font-size: 1.4rem; }
.coins-display-large #upgrade-coins {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    color: #ffea00;
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.4);
}

.upgrades-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-top: 10px;
}

.upgrades-scroll-area::-webkit-scrollbar { width: 6px; }
.upgrades-scroll-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.upgrades-scroll-area::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.3); border-radius: 3px; }

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.upgrade-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    overflow: hidden;
}

.upgrade-card:hover:not(.maxed) {
    background: rgba(0, 229, 255, 0.05);
    border-color: rgba(0, 229, 255, 0.4);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.upgrade-card.maxed {
    border-color: rgba(118, 255, 3, 0.3);
    background: rgba(118, 255, 3, 0.02);
}

.upgrade-icon {
    font-size: 2rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.2));
}

.upgrade-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.upgrade-level {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #90a4ae;
    margin-bottom: 12px;
}

.upgrade-cost {
    position: absolute;
    top: 20px;
    right: 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: #ffea00;
}

.upgrade-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-top: 15px;
    overflow: hidden;
}

.upgrade-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00e5ff, #76ff03);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.maxed .upgrade-bar-fill {
    background: #76ff03;
    box-shadow: 0 0 10px rgba(118, 255, 3, 0.5);
}

@media (max-width: 600px) {
    .upgrade-panel { padding: 15px; }
    .upgrades-grid { grid-template-columns: 1fr; }
    .upgrade-header { flex-direction: column; gap: 15px; align-items: flex-start; }
    .back-circle-btn { position: absolute; top: 15px; right: 15px; }
}

/* ===== LEADERBOARD ===== */
.leaderboard-panel {
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.leaderboard-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.lb-tab {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    padding: 8px 20px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
    color: #90a4ae;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.lb-tab:hover { border-color: rgba(0,229,255,0.4); color: #cfd8dc; }
.lb-tab.active {
    border-color: #ffea00;
    background: rgba(255,234,0,0.1);
    color: #ffea00;
    box-shadow: 0 0 10px rgba(255,234,0,0.2);
}

.leaderboard-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
    max-height: 50vh;
}

.leaderboard-scroll-area::-webkit-scrollbar { width: 4px; }
.leaderboard-scroll-area::-webkit-scrollbar-track { background: transparent; }
.leaderboard-scroll-area::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.3); border-radius: 2px; }

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Share Tech Mono', monospace;
}

.leaderboard-table thead th {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    color: #607d8b;
    letter-spacing: 1px;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    background: rgba(5,15,30,0.95);
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.2s ease;
}

.leaderboard-table tbody tr:hover { background: rgba(0,229,255,0.05); }

.leaderboard-table td {
    padding: 10px;
    font-size: 0.85rem;
    color: #cfd8dc;
}

.lb-rank { width: 40px; text-align: center; font-size: 1rem; }
.lb-name { font-weight: 600; color: #fff; }
.lb-score { color: #ffea00; font-weight: 700; text-align: right; }
.lb-wave { text-align: center; color: #00e5ff; }
.lb-quiz { text-align: center; color: #76ff03; }
.lb-date { text-align: right; color: #607d8b; font-size: 0.75rem; }
.lb-difficulty { text-align: center; }

.lb-diff-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.lb-diff-easy {
    background: rgba(118, 255, 3, 0.15);
    color: #76ff03;
    border: 1px solid rgba(118, 255, 3, 0.3);
}
.lb-diff-medium {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}
.lb-diff-hard {
    background: rgba(255, 82, 82, 0.15);
    color: #ff5252;
    border: 1px solid rgba(255, 82, 82, 0.3);
}

tr.rank-1 .lb-rank { font-size: 1.3rem; }
tr.rank-1 .lb-name { color: #ffd700; }
tr.rank-2 .lb-rank { font-size: 1.2rem; }
tr.rank-2 .lb-name { color: #c0c0c0; }
tr.rank-3 .lb-rank { font-size: 1.1rem; }
tr.rank-3 .lb-name { color: #cd7f32; }

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    color: #607d8b;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
}

.leaderboard-empty {
    text-align: center;
    padding: 40px;
    color: #78909c;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
}

/* Submit Score Section */
.submit-score-section {
    margin-top: 20px;
    padding: 16px;
    background: rgba(255,234,0,0.04);
    border: 1px solid rgba(255,234,0,0.15);
    border-radius: 10px;
}

.submit-score-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: #ffea00;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.submit-score-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.player-name-input {
    flex: 1;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    padding: 10px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}

.player-name-input:focus { border-color: #ffea00; }
.player-name-input::placeholder { color: #607d8b; }

.submit-score-result {
    margin-top: 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    min-height: 20px;
}

.submit-score-result.success { color: #76ff03; }
.submit-score-result.error { color: #ef5350; }
.submit-score-result.loading { color: #607d8b; }

@media (max-width: 600px) {
    .leaderboard-panel { max-height: 95vh; }
    .leaderboard-table { font-size: 0.75rem; }
    .leaderboard-table td, .leaderboard-table th { padding: 6px 4px; }
    .lb-date { display: none; }
    .submit-score-form { flex-direction: column; }
}

/* Volume Settings */
.volume-settings {
    padding: 16px;
    background: rgba(0, 229, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 10px;
}

.volume-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.volume-slider-row:last-child {
    margin-bottom: 0;
}

.volume-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: #00e5ff;
    min-width: 60px;
    letter-spacing: 1px;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #00e5ff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
    transition: transform 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #00e5ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.volume-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #fff;
    min-width: 40px;
    text-align: right;
}
}
