:root {
  color-scheme: dark;
  --background: #130f23;
  --panel: #201833;
  --border: #43345c;
  --text: #fbf4ff;
  --muted: #c6b7db;
  --gold: #ffda90;
}
body { background: radial-gradient(ellipse at 50% 0%, #2e2049, var(--background) 70%); color: var(--text); min-height: 100vh; min-height: 100svh; }
.layout { width: min(100%, 508px); padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); margin: auto; }
.is-playing .layout { display: flex; flex-direction: column; height: 100vh; height: 100svh; }
.is-playing .layout > main { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.is-playing .stage { flex: 1; min-height: 0; }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.top a { color: var(--muted); text-decoration: none; font-size: .89rem; font-weight: 750; }
.top a:hover { color: var(--text); }
button { border: 0; border-radius: 12px; font-weight: 750; }
button:disabled { opacity: .58; }
.primary { background: var(--gold); color: #261938; padding: 13px 22px; min-height: 46px; }
.primary:hover:not(:disabled) { background: #ffe6b2; }
.secondary { background: #312443; border: 1px solid var(--border); color: var(--text); padding: 8px 11px; }
.sound { min-height: 36px; font-size: .78rem; }
.sound[aria-pressed=true] { border-color: var(--gold); color: var(--gold); }
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 7px 0 11px; }
.hud > div { display: grid; gap: 4px; padding: 10px 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; text-align: center; }
.hud > div > span { font-size: .74rem; color: var(--muted); }
.hud strong { font-size: 1.2rem; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud small { font-size: .72rem; color: var(--muted); }
#lives { color: #ffa6bc; letter-spacing: .1em; }
.stage { position: relative; height: clamp(340px, 66vh, 590px); height: clamp(340px, 66svh, 590px); border: 1px solid var(--border); background: #1a1330; border-radius: 23px; overflow: hidden; }
#scene { position: absolute; inset: 0; }
#scene canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 12px; background: radial-gradient(ellipse, #231a3ce6 10%, #1a13302a 74%); }
.overlay img { border-radius: 19px; box-shadow: 0 0 40px #9d68e65e; }
.overlay h1 { font-size: clamp(2.4rem, 9vw, 3.5rem); letter-spacing: -.075em; margin: 12px 0 0; }
.overlay p { color: var(--muted); line-height: 1.55; margin: 8px 0 20px; }
#pause { color: var(--text); background: #1a1330e6; font-weight: 750; }
.overlay .status { margin: 8px 0 0; }
#challenge:empty, .status:empty { display: none; }
#challenge { max-width: 100%; margin-top: 10px; }
.hint { color: var(--muted); font-size: .82rem; text-align: center; margin: 14px 0 0; line-height: 1.55; }
.result { display: grid; gap: 12px; }
.result-score, .ranking { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 18px; }
.result-score { text-align: center; background: radial-gradient(ellipse at top, #493064, var(--panel) 82%); }
.result-score h1 { font-size: 1.65rem; margin: 5px 0; }
#result-cause { margin: 4px 0; color: var(--muted); font-size: .9rem; }
.total { margin: 10px 0 14px; font-variant-numeric: tabular-nums; }
.total strong { font-size: 3rem; font-weight: 850; color: var(--gold); }
.total span { color: var(--muted); }
.ranking h2 { font-size: 1.16rem; margin: 15px 0 10px; }
.save label { display: block; color: var(--muted); font-size: .83rem; margin-bottom: 6px; }
.save div { display: flex; gap: 7px; }
.save input { min-width: 0; flex: 1; padding: 9px 10px; background: #181126; border: 1px solid var(--border); color: var(--text); border-radius: 10px; }
.save button { white-space: nowrap; }
.status { color: var(--muted); font-size: .82rem; line-height: 1.45; margin: 9px 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #171024; padding: 4px; border-radius: 10px; }
.tabs button { background: transparent; color: var(--muted); min-height: 35px; font-size: .85rem; border-radius: 8px; }
.tabs button[aria-pressed=true] { background: #463463; color: var(--text); }
ol { margin: 6px 0 0; padding: 0; list-style: none; }
li { display: grid; grid-template-columns: 4em minmax(0, 1fr) auto; gap: 8px; padding: 8px 2px; align-items: center; border-bottom: 1px solid var(--border); }
li span:first-child { white-space: nowrap; }
li span:nth-child(2) { overflow-wrap: anywhere; }
li strong { color: var(--gold); }
