:root {
  --bg: #0a0a14; --bg2: #0e0e1a; --bg3: #12121f;
  --text: #ffffff; --text2: #9ca3af; --text3: #6b7280;
  --accent: #22c55e; --accent-glow: rgba(34,197,94,0.3);
  --purple: #8b5cf6; --blue: #3b82f6; --red: #ef4444; --amber: #f59e0b; --pink: #ec4899;
  --border: rgba(255,255,255,0.08);
  --glass: rgba(10,10,20,0.85); --glass-border: rgba(255,255,255,0.1);
}
[data-theme="ocean"] { --bg: #041420; --bg2: #062030; --bg3: #083040; --accent: #06b6d4; --accent-glow: rgba(6,182,212,0.3); --purple: #0ea5e9; --blue: #38bdf8; }
[data-theme="forest"] { --bg: #071408; --bg2: #0a1e0c; --bg3: #0d2810; --accent: #4ade80; --accent-glow: rgba(74,222,128,0.3); --purple: #a3e635; --blue: #22d3ee; }
[data-theme="sunset"] { --bg: #1a0a08; --bg2: #241008; --bg3: #2e1608; --accent: #f97316; --accent-glow: rgba(249,115,22,0.3); --purple: #f43f5e; --blue: #fb923c; }
[data-theme="mono"] { --bg: #111; --bg2: #1a1a1a; --bg3: #222; --accent: #fff; --accent-glow: rgba(255,255,255,0.2); --purple: #aaa; --blue: #888; }

* { margin:0; padding:0; box-sizing:border-box; }
body { background: var(--bg); overflow: hidden; font-family: 'Inter', sans-serif; color: var(--text); user-select: none; }
canvas { display: block; position: fixed; top: 0; left: 0; z-index: 1; }

/* Screens */
.screen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.screen.hide { display: none; }

/* Menu */
.menu-bg { position: absolute; inset: 0; background: var(--bg); }
.menu-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 40%, rgba(34,197,94,0.08) 0%, transparent 50%), radial-gradient(circle at 70% 60%, rgba(139,92,246,0.08) 0%, transparent 50%); animation: bgPulse 8s ease-in-out infinite alternate; }
@keyframes bgPulse { to { opacity: 0.5; } }
.menu-content { position: relative; z-index: 2; text-align: center; max-width: 480px; width: 100%; padding: 40px 20px; }
.game-title { font-size: clamp(56px, 10vw, 88px); font-weight: 900; background: linear-gradient(135deg, var(--accent), #86efac, var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; margin-bottom: 8px; animation: titleGlow 3s ease-in-out infinite alternate; }
@keyframes titleGlow { to { filter: brightness(1.2); } }
.tagline { color: var(--text2); font-size: 18px; font-weight: 500; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 48px; }

/* Buttons */
.menu-buttons { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.btn { border: none; padding: 16px 32px; border-radius: 14px; font-size: 17px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all 0.3s; display: block; width: 100%; }
.btn.primary { background: var(--accent); color: #000; box-shadow: 0 0 30px var(--accent-glow); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 40px var(--accent-glow); filter: brightness(1.1); }
.btn.secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: rgba(255,255,255,0.08); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn.ghost:hover { color: var(--text); border-color: var(--text2); }

/* Menu stats */
.menu-stats { display: flex; justify-content: center; gap: 40px; }
.mstat { display: flex; flex-direction: column; align-items: center; }
.mstat-val { font-size: 28px; font-weight: 900; color: var(--accent); }
.mstat-lbl { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

/* Panel (Mode, Settings, Pause, etc.) */
.panel { background: var(--glass); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid var(--glass-border); border-radius: 24px; padding: 40px; max-width: 600px; width: 90%; max-height: 85vh; overflow-y: auto; }
.panel h2 { font-size: 28px; font-weight: 800; margin-bottom: 24px; text-align: center; }

/* Mode cards */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.mode-card { background: var(--bg3); border: 2px solid var(--border); border-radius: 16px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.3s; }
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 30px var(--accent-glow); }
.mode-card.selected { border-color: var(--accent); background: rgba(34,197,94,0.1); }
.mode-icon { font-size: 36px; margin-bottom: 8px; }
.mode-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.mode-card p { font-size: 12px; color: var(--text2); line-height: 1.4; }

/* Difficulty */
.diff-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.diff-row label { font-weight: 600; font-size: 14px; white-space: nowrap; }
.diff-row select, .setting-row select { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-family: inherit; flex: 1; }
.diff-row select option, .setting-row select option { background: var(--bg); }

/* How to play */
.how-panel { max-width: 650px; }
.how-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.how-step { display: flex; gap: 16px; align-items: flex-start; padding: 14px; background: var(--bg3); border-radius: 12px; }
.how-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #000; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.how-step h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.how-step p { font-size: 13px; color: var(--text2); line-height: 1.5; }
.shortcut-grid { margin-bottom: 20px; }
.shortcut-grid h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.shortcut { font-size: 13px; color: var(--text2); margin-bottom: 6px; }
kbd { background: var(--bg3); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; font-family: inherit; font-weight: 700; font-size: 12px; color: var(--accent); margin-right: 4px; }

/* Settings */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.setting-row label { font-weight: 600; font-size: 14px; }
input[type="range"] { -webkit-appearance: none; background: var(--bg3); height: 6px; border-radius: 3px; outline: none; flex: 1; max-width: 200px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

/* HUD */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,0.7), transparent); }
#hud.hide { display: none; }
.hud-left, .hud-right { display: flex; gap: 20px; }
.hud-item { display: flex; flex-direction: column; align-items: center; }
.hlbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.hval { font-size: 26px; font-weight: 900; }
.hud-center { flex: 1; display: flex; justify-content: center; }

/* Combo display */
.combo-display { background: linear-gradient(135deg, var(--accent), var(--purple)); padding: 6px 18px; border-radius: 20px; animation: comboPop 0.4s ease-out; pointer-events: none; }
.combo-display.hide { display: none; }
#comboText { font-size: 16px; font-weight: 900; color: #000; }
@keyframes comboPop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Pause */
.pause-panel { text-align: center; max-width: 320px; }
.pause-panel .btn { margin-bottom: 10px; }

/* Game Over */
.over-panel { text-align: center; max-width: 400px; }
.over-label { font-size: 18px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 3px; }
.over-score { font-size: 72px; font-weight: 900; color: var(--accent); margin: 10px 0; text-shadow: 0 0 40px var(--accent-glow); }
.over-stats { display: flex; justify-content: center; gap: 24px; margin: 16px 0 20px; }
.ostat { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--text3); }
.ostat span { font-size: 22px; font-weight: 800; color: var(--text); }
.over-best { color: var(--text3); font-size: 14px; margin-bottom: 24px; }
.over-btns .btn { margin-bottom: 8px; }

/* Scrollbar */
.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Responsive */
@media (max-width: 500px) {
  .mode-grid { grid-template-columns: 1fr; }
  .game-title { font-size: 48px; }
  .panel { padding: 24px; }
}
