:root {
  --ink: #fff6fb;
  --dim: rgba(255, 246, 251, .72);
  --machine: #62f2ff;
  --astral: #ffb3dc;
  --gold: #ffd27a;
  --panel: rgba(16, 10, 28, .78);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07050d; color: var(--ink); font-family: var(--font); overflow: hidden; }
#stage {
  position: absolute; inset: 0; margin: auto;
  width: min(100vw, calc(100vh * 16 / 9)); height: min(100vh, calc(100vw * 9 / 16));
  container-type: size;
}
canvas { width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

#hud { position: absolute; inset: 0; pointer-events: none; font-size: 1.4cqw; }
.player { position: absolute; top: 2cqh; display: flex; align-items: center; gap: .8cqw; }
.player img { width: 4.6cqw; height: 4.6cqw; border-radius: 50%; border: .2cqw solid; background: rgba(0,0,0,.3); }
.player b { display: block; font-size: 1.25cqw; letter-spacing: .1em; text-shadow: 0 0 .5cqw rgba(0,0,0,.8); }
.player span { display: flex; gap: .35cqw; margin-top: .3cqw; }
.player span b { font-size: 1cqw; color: var(--dim); }
.player i { width: 1.1cqw; height: 1.1cqw; transform: rotate(45deg); border: .14cqw solid currentColor; opacity: .5; }
.player i.on { background: currentColor; opacity: 1; box-shadow: 0 0 .6cqw currentColor; }
.leo { left: 2cqw; color: var(--machine); }
.astra { right: 2cqw; color: var(--astral); }
.astra > div { text-align: right; }
.astra span { justify-content: flex-end; }
#goal { position: absolute; top: 2.2cqh; left: 50%; transform: translateX(-50%); text-align: center; font-size: 1.5cqw; font-weight: 600;
  text-shadow: 0 0 .6cqw rgba(0,0,0,.9); white-space: nowrap; }
#goal span { font-size: .95cqw; color: var(--dim); margin-right: .8cqw; font-weight: 400; }
#goal em { display: block; font-style: normal; font-size: 1.05cqw; color: var(--dim); font-weight: 400; margin-top: .3cqw; }
#clock { position: absolute; right: 2cqw; top: 11cqh; font-size: 1cqw; color: var(--dim); font-variant-numeric: tabular-nums; }
#anchor { position: absolute; left: 50%; bottom: 3cqh; transform: translateX(-50%); font-size: 1.15cqw; color: var(--gold);
  padding: .4cqw 1.2cqw; border-radius: 99px; border: .12cqw solid transparent; opacity: 0; transition: opacity .2s; }
#anchor.on { opacity: 1; border-color: rgba(255,210,122,.6); background: rgba(40,26,8,.55); }
#hint { position: absolute; left: 50%; bottom: 9cqh; transform: translateX(-50%); width: min(60cqw, 900px);
  background: var(--panel); border: .12cqw solid rgba(255,179,220,.45); border-radius: 1cqw; padding: 1.2cqw 1.6cqw;
  font-size: 1.3cqw; line-height: 1.6; backdrop-filter: blur(6px); }
#hint b { display: block; color: var(--gold); margin-bottom: .3cqw; }
#hint small { display: block; margin-top: .4cqw; font-size: .9cqw; color: var(--dim); }

#beat { position: absolute; left: 0; right: 0; top: 13cqh; text-align: center; font-size: 2.8cqw; font-weight: 700; letter-spacing: .3em;
  pointer-events: none; opacity: 0; transform: translateY(1cqh); transition: opacity .5s, transform .5s;
  text-shadow: 0 0 1.6cqw rgba(255,179,220,.6), 0 0 .4cqw rgba(0,0,0,.9); }
#beat.show { opacity: 1; transform: none; }
#beat small { display: block; font-size: 1.2cqw; letter-spacing: .4em; color: var(--dim); font-weight: 400; }
#beat em { display: block; font-style: normal; font-size: 1.4cqw; letter-spacing: .1em; color: var(--dim); font-weight: 400; margin-top: .6cqw; }

#menu { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.4cqh;
  background: radial-gradient(ellipse at center, rgba(10,6,20,.35), rgba(5,3,10,.82)); }
#menu.end { justify-content: flex-end; padding-bottom: 7cqh; background: none; }
#title { text-align: center; }
#title h1 { margin: 0; font-size: 6cqw; letter-spacing: .35em; text-indent: .35em; font-weight: 800;
  background: linear-gradient(90deg, var(--machine), #fff, var(--astral)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 1.2cqw rgba(255,179,220,.45)); }
#title p { margin: .4cqw 0 0; font-size: 1.4cqw; letter-spacing: .4em; color: var(--dim); }
.items { display: flex; flex-direction: column; gap: 1cqh; min-width: 34cqw; }
#menu.end .items { flex-direction: row; }
#menu button { font: inherit; font-size: 1.55cqw; color: var(--ink); background: var(--panel); border: .12cqw solid rgba(255,255,255,.16);
  border-radius: .8cqw; padding: 1cqw 2cqw; cursor: pointer; text-align: left; transition: transform .12s, border-color .12s; }
#menu button.sel { border-color: var(--gold); box-shadow: 0 0 1.2cqw rgba(255,210,122,.35); transform: translateX(.5cqw); }
#menu.end button.sel { transform: translateY(-.3cqw); }
#controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 1cqw 4cqw; font-size: 1.05cqw; color: var(--dim); max-width: 80cqw; }
#controls h3 { margin: 0 0 .4cqw; font-size: 1.1cqw; color: var(--ink); }
#controls dl { display: grid; grid-template-columns: auto auto; gap: .2cqw 1.4cqw; margin: 0; }
#controls dt { text-align: right; }
#controls dd { margin: 0; color: var(--ink); white-space: pre; }
#controls .pad { flex-basis: 100%; text-align: center; margin: .6cqw 0 0; }

#end { position: absolute; left: 50%; top: 10cqh; transform: translateX(-50%); width: 44cqw; background: var(--panel);
  border: .12cqw solid rgba(255,210,122,.5); border-radius: 1.2cqw; padding: 1.6cqw 2.4cqw; font-size: 1.2cqw; backdrop-filter: blur(8px); }
#end h2 { margin: 0 0 .6cqw; text-align: center; letter-spacing: .3em; color: var(--gold); font-size: 2.4cqw; }
#end .total { text-align: center; margin: 0 0 1cqw; }
#end table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#end th { font-weight: 400; color: var(--dim); text-align: left; padding: .3cqw 0; }
#end td { padding: .3cqw 0; border-top: .08cqw solid rgba(255,255,255,.08); }
#end td + td, #end th + th { text-align: right; }
#saved { text-align: center; color: var(--dim); font-size: .95cqw; margin: .8cqw 0 0; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6cqw; color: var(--dim); }
