:root {
  --sol: #ffd257;
  --sol-deep: #f08f1e;
  --luna: #b3c0ff;
  --luna-deep: #6570e6;
  --ink: #0b0e2b;
  --panel: rgba(19, 23, 66, 0.94);
  --line: rgba(179, 192, 255, 0.28);
  --text: #eef0ff;
  --muted: #a4abd8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05061a;
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  user-select: none;
}

#stage {
  position: absolute;
  width: 960px;
  height: 640px;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--ink);
}

#game { display: block; width: 960px; height: 640px; }

.hidden { display: none !important; }

/* ── 아이콘 ── */
.ico { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; border-radius: 50%; }
.ico.sun { background: var(--sol); box-shadow: 0 0 0 2px rgba(255, 210, 87, 0.35), 0 0 10px rgba(255, 190, 70, 0.8); }
.ico.moon { background: transparent; box-shadow: inset -4px -1px 0 0 var(--luna); transform: rotate(-20deg); }

/* ── HUD ── */
#hud {
  position: absolute; left: 0; top: 0; width: 960px; height: 32px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  background: rgba(8, 10, 36, 0.72);
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
}
#hud-stage { width: 300px; color: #dfe4ff; white-space: nowrap; }
.hud-mid { display: flex; gap: 8px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 10px;
  border-radius: 11px; background: rgba(255, 255, 255, 0.08);
  font-variant-numeric: tabular-nums;
}
.chip b { font-weight: 800; }
.chip.sol { color: var(--sol); }
.chip.luna { color: var(--luna); }
.chip.time { min-width: 74px; justify-content: center; color: #fff; }
.hud-btns { width: 300px; display: flex; gap: 6px; justify-content: flex-end; }
.hud-btns button {
  height: 22px; padding: 0 9px; border-radius: 11px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.hud-btns button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); }

/* ── 힌트 ── */
#hint {
  position: absolute; left: 50%; top: 44px; transform: translate(-50%, -8px);
  max-width: 760px; padding: 9px 18px; border-radius: 18px;
  background: rgba(8, 10, 36, 0.82); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.45; text-align: center; color: #e6e9ff;
  opacity: 0; pointer-events: none; transition: opacity 0.5s, transform 0.5s;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 화면 공통 ── */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  background:
    radial-gradient(520px 380px at 12% 108%, rgba(255, 170, 100, 0.42), transparent 70%),
    radial-gradient(420px 320px at 86% 8%, rgba(150, 170, 255, 0.3), transparent 70%),
    linear-gradient(180deg, #090c28 0%, #1f2360 58%, #55336d 100%);
}
.screen.overlay { background: rgba(5, 6, 26, 0.66); }

.eyebrow { margin: 0 0 6px; font-size: 14px; font-weight: 600; letter-spacing: 0.18em; color: var(--muted); }
h1 { margin: 0; font-size: 84px; line-height: 1; font-weight: 900; letter-spacing: -0.02em; }
h1 .t-sol { color: var(--sol); text-shadow: 0 0 28px rgba(255, 190, 70, 0.55); }
h1 .t-luna { color: var(--luna); text-shadow: 0 0 28px rgba(150, 170, 255, 0.6); }
h1 .amp { font-size: 52px; font-weight: 500; color: #fff; opacity: 0.75; }
.sub { margin: 10px 0 0; font-size: 20px; font-weight: 700; letter-spacing: 0.4em; text-indent: 0.4em; color: #e6e9ff; }
#title-chars { width: 320px; height: 150px; margin: 4px 0 2px; }
h2 { margin: 0 0 18px; font-size: 34px; font-weight: 900; letter-spacing: -0.01em; }
.foot { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* ── 버튼 ── */
.btn {
  min-width: 220px; height: 46px; padding: 0 28px; margin-top: 10px;
  border-radius: 23px; border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.06); color: var(--text);
  font: inherit; font-size: 17px; font-weight: 800; cursor: pointer;
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.6); }
.btn:active { transform: translateY(0); }
.btn.primary {
  border: 0; color: #3a1d00;
  background: linear-gradient(180deg, #ffe07a, #ffab2e);
  box-shadow: 0 6px 22px rgba(255, 170, 46, 0.4);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffe993, #ffb84a); }
.btn:focus-visible, .stage-card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ── 조작 안내 ── */
.controls { display: flex; gap: 14px; margin-top: 22px; }
.card {
  width: 300px; padding: 12px 16px 14px; border-radius: 16px;
  background: rgba(8, 10, 36, 0.5); border: 1px solid var(--line); text-align: left;
}
.card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.card.sol h3 { color: var(--sol); }
.card.luna h3 { color: var(--luna); }
.card h3 small { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; }
.card p { margin: 0; font-size: 13px; color: #d5d9f7; white-space: nowrap; }
kbd {
  display: inline-block; min-width: 24px; height: 24px; margin: 0 3px 0 8px; padding: 0 6px;
  border-radius: 6px; background: #eef0ff; color: #171a4a; box-shadow: 0 2px 0 #8e97d6;
  font: 800 13px/24px ui-monospace, "Cascadia Mono", Consolas, monospace; text-align: center;
}
kbd:first-child { margin-left: 0; }
kbd + kbd { margin-left: 0; }

/* ── 스테이지 선택 ── */
#stage-grid { display: grid; grid-template-columns: repeat(4, 180px); gap: 14px; }
.stage-card {
  height: 138px; padding: 12px 10px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: rgba(8, 10, 36, 0.55); border: 1.5px solid var(--line); color: var(--text);
  font: inherit; cursor: pointer; transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.stage-card:hover:not(.locked) { transform: translateY(-3px); border-color: var(--sol); background: rgba(30, 34, 90, 0.8); }
.stage-card .num { font-size: 34px; font-weight: 900; line-height: 1; color: #fff; }
.stage-card .name { font-size: 15px; font-weight: 700; }
.stage-card .stars { font-size: 18px; letter-spacing: 0.12em; color: var(--sol); }
.stage-card .best { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-card.locked { opacity: 0.42; cursor: default; }
.stage-card.locked .stars { font-size: 13px; letter-spacing: 0; color: var(--muted); }

/* ── 패널 (일시정지/클리어) ── */
.panel {
  width: 380px; padding: 28px 30px 30px; border-radius: 24px;
  background: var(--panel); border: 1.5px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column; align-items: center;
}
.panel .btn { width: 100%; }
#clear-stars { font-size: 46px; line-height: 1; letter-spacing: 0.1em; color: var(--sol); text-shadow: 0 0 24px rgba(255, 190, 70, 0.6); }
dl { width: 100%; margin: 18px 0 8px; display: grid; grid-template-columns: 1fr auto; row-gap: 8px; font-size: 15px; }
dt { text-align: left; color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
