:root {
  --bg: #0a0a14;
  --bg-2: #11111f;
  --ink: #eef0ff;
  --ink-soft: #9aa0c8;
  --pink: #ff3d7f;
  --cyan: #3df0c8;
  --amber: #ffb627;
  --blue: #5b9bff;
  --line: #23253f;
}
/* ===== 3-way theme (Light/Dark/System) — base :root above = native DARK. Opposite (light) WCAG-aware auto-generated (contrast-solving ink/accent vs worst-case surface). ===== */
:root[data-theme="light"]{
  --bg: #f4f4f6;
  --bg-2: #f5f5f6;
  --ink: #0220ff;
  --ink-soft: #5f69a8;
  --pink: #a50038;
  --cyan: #097a61;
  --amber: #936200;
  --blue: #0060f5;
  --line: rgba(0,0,0,0.10);
}











* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Rajdhani", system-ui, sans-serif;
  background: radial-gradient(1000px 600px at 50% -10%, #1a1330 0%, transparent 55%), var(--bg);
  color: var(--ink); overflow: hidden; user-select: none;
}
.app { max-width: 480px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* HUD */
.hud { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.hud-left { display: flex; flex-direction: column; }
.title { font-family: "Orbitron", sans-serif; font-weight: 800; font-size: 22px; letter-spacing: .06em; }
.title .tap, .panel h1 .tap, .panel h2 .tap { color: var(--cyan); }
.sub { font-size: 12px; color: var(--ink-soft); letter-spacing: .04em; }
.hud-right { display: flex; gap: 18px; }
.meter { text-align: right; }
.meter .k { display: block; font-size: 10px; letter-spacing: .15em; color: var(--ink-soft); }
.meter b { font-family: "Orbitron", sans-serif; font-size: 22px; font-weight: 600; }

.gauge { height: 6px; margin: 0 16px; background: #1c1c30; border-radius: 4px; overflow: hidden; }
.gauge i { display: block; height: 100%; width: 70%; background: linear-gradient(90deg, var(--pink), var(--cyan)); border-radius: 4px; transition: width .12s linear; }

/* Stage */
.stage { position: relative; flex: 1; margin: 10px 0 0; }
#field {
  width: 100%; height: 100%; display: block;
  background: linear-gradient(180deg, #0c0c1a, #07070f);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.judge-pop {
  position: absolute; left: 50%; top: 46%; transform: translateX(-50%);
  font-family: "Orbitron", sans-serif; font-weight: 800; font-size: 30px; letter-spacing: .04em;
  opacity: 0; pointer-events: none;
}
.judge-pop.show { animation: jp .36s ease-out; }
.judge-pop.perfect { color: var(--cyan); text-shadow: 0 0 18px var(--cyan); }
.judge-pop.good { color: var(--amber); text-shadow: 0 0 14px var(--amber); }
.judge-pop.miss { color: var(--pink); text-shadow: 0 0 14px var(--pink); }
@keyframes jp { 0% { opacity: 0; transform: translateX(-50%) scale(.7); } 30% { opacity: 1; transform: translateX(-50%) scale(1.05); } 100% { opacity: 0; transform: translateX(-50%) scale(1); } }

.lane-keys { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.lk {
  height: 74px; border: 0; border-top: 2px solid var(--line); border-right: 1px solid var(--line);
  background: rgba(255,255,255,0.03); color: var(--ink-soft);
  font-family: "Orbitron", sans-serif; font-weight: 700; font-size: 20px; cursor: pointer; transition: background .08s;
}
.lk:last-child { border-right: 0; }
.lk:nth-child(1) { color: var(--pink); } .lk:nth-child(2) { color: var(--amber); }
.lk:nth-child(3) { color: var(--cyan); } .lk:nth-child(4) { color: var(--blue); }
.lk.act { background: rgba(255,255,255,0.12); }

/* Overlays */
.overlay { position: absolute; inset: 0; background: rgba(6,6,14,.82); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; z-index: 10; }
.overlay[hidden] { display: none; }
.panel { text-align: center; max-width: 360px; width: 100%; }
.panel h1 { font-family: "Orbitron", sans-serif; font-weight: 800; font-size: 40px; letter-spacing: .05em; }
.panel h2 { font-family: "Orbitron", sans-serif; font-size: 22px; margin-top: 6px; }
.lead { color: var(--ink-soft); margin: 16px 0 22px; font-size: 15px; line-height: 1.6; }
.lead b { color: var(--ink); }
.diff { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.diff-btn {
  flex: 1; padding: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-soft);
  font-family: inherit; font-weight: 700; font-size: 16px; border-radius: 12px; cursor: pointer; transition: all .15s;
}
.diff-btn.is-on { background: linear-gradient(150deg, var(--pink), #d62b69); color: #fff; border-color: transparent; }
.keys-hint { font-size: 13px; color: var(--ink-soft); margin-bottom: 20px; }
kbd { display: inline-block; background: #1c1c30; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; margin: 0 2px; font-family: "Orbitron", sans-serif; font-size: 12px; }
.play-btn {
  font-family: "Orbitron", sans-serif; font-weight: 700; font-size: 20px; letter-spacing: .04em;
  background: linear-gradient(150deg, var(--cyan), #1fbf9c); color: #04140f; border: 0; border-radius: 14px;
  padding: 15px 40px; cursor: pointer; box-shadow: 0 12px 30px -12px rgba(61,240,200,.8);
}
.play-btn:hover { filter: brightness(1.06); }
.best { margin-top: 16px; font-size: 13px; color: var(--amber); }

.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 9; pointer-events: none;
  font-family: "Orbitron", sans-serif; font-weight: 800; font-size: 120px; color: #fff; text-shadow: 0 0 40px var(--cyan);
}
.countdown[hidden] { display: none; }

.rank {
  font-family: "Orbitron", sans-serif; font-weight: 800; font-size: 90px; line-height: 1;
  background: linear-gradient(150deg, var(--cyan), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rank[data-rank="S"] { background: linear-gradient(150deg, var(--amber), var(--pink)); -webkit-background-clip: text; background-clip: text; }
.rank[data-rank="D"] { background: linear-gradient(150deg, #888, #555); -webkit-background-clip: text; background-clip: text; }
.rstats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 20px 0 24px; }
.rs { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; }
.rs span { display: block; font-size: 11px; color: var(--ink-soft); letter-spacing: .06em; }
.rs b { font-family: "Orbitron", sans-serif; font-size: 20px; font-weight: 600; }

/* 언어 스위처 (다크 테마 대응) */
.switch-row { display: flex; justify-content: center; margin-bottom: 14px; }
.i18n-switch {
  --i18n-switch-bg: rgba(255,255,255,.07);
  --i18n-switch-border: rgba(255,255,255,.16);
  --i18n-switch-fg: rgba(255,255,255,.92);
  --i18n-switch-active-bg: rgba(61,240,200,.22);
  --i18n-switch-active-fg: var(--cyan);
  --i18n-switch-menu-bg: #14142a;
  --i18n-switch-menu-border: var(--line);
}

/* light-mode overrides for hardcoded backgrounds (refinement) */
:root[data-theme="light"] body{ background: var(--bg); }
:root[data-theme="light"] .gauge{ background: rgba(14,14,40,.10); }
