:root {
  --night: #101139;
  --gold: #ffe77d;
  --floss: #ff387e;
  --lilac: #9995cb;
  --rail: #575391;
  --frame-width: min(100vw, calc(100vh * 16 / 9));
  --frame-height: min(100vh, 56.25vw);
  background: #000;
}
@supports (height: 100dvh) {
  :root {
    --frame-width: min(100vw, calc(100dvh * 16 / 9));
    --frame-height: min(100dvh, 56.25vw);
  }
}
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  background: #000;
}
.arcade {
  width: var(--frame-width);
  height: var(--frame-height);
  container-type: inline-size;
  display: grid;
  grid-template-rows: minmax(0, 1fr) max(26px, 6.4%);
  background: var(--night);
  color: #fff2c8;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
}
.cabinet, .meadow, .beat-belt { position: relative; }
.cabinet { display: grid; grid-template-rows: minmax(0, 695fr) minmax(0, 241fr); min-height: 0; }
.meadow {
  background: #149c93 url("./art/pasture.png") center / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.arcade #pasture, #track {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  image-rendering: pixelated;
}
.arcade #pasture { cursor: none; touch-action: none; }
.arcade #pasture:focus-visible { outline: 3px dashed var(--gold); outline-offset: -4px; }
.wallet {
  position: absolute;
  top: 4.7%;
  right: 13%;
  min-width: 14%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9em;
  padding: .12em .48em;
  background: var(--night);
  border: max(1px, .28cqw) solid var(--gold);
  color: var(--gold);
  font: bold max(12px, 2.9cqw)/1.15 Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  box-shadow: .1em .1em #171946;
  cursor: pointer;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wallet img { width: 1.12em; height: 1.12em; image-rendering: pixelated; }
.beat-belt {
  background: var(--night) url("./art/track.png") center / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.beat-voices {
  position: absolute;
  top: 13%;
  bottom: 15%;
  left: 3.7%;
  width: 7.5%;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 9%;
  align-items: stretch;
}
.beat-voices b {
  display: grid;
  place-items: center;
  border: max(1px, .25cqw) solid var(--rail);
  color: #8a87bf;
  font: 900 max(10px, 2.65cqw)/1 "Microsoft YaHei", sans-serif;
}
.beat-voices .active {
  background: var(--floss);
  color: #fff0ad;
  border-color: var(--floss);
  box-shadow: inset 0 -.12em #ca245e;
  position: relative;
}
.beat-voices .active::after {
  content: ""; position: absolute; left: 100%; top: 30%;
  border: .38em solid transparent; border-left-color: var(--floss);
}
.control-deck {
  width: 100%;
  display: flex;
  white-space: nowrap;
  align-items: center;
  gap: 1.6cqw;
  padding: 0 3.7%;
  color: #c0bddc;
  font-size: max(10px, .95cqw);
}
.play-mode { color: #fff0ad; font-weight: 800; }
.play-instruction { flex: 1; }
.combo-readout, #music-mark { white-space: nowrap; }
.combo-readout b, #tempo-bpm { font: bold 1.1em Consolas, monospace; color: var(--gold); }
.control-deck nav { display: flex; gap: 6px; margin-left: auto; }
.control-deck button {
  display: inline-flex; gap: .4em; align-items: center; justify-content: center;
  min-height: min(2.5cqw, 100%); padding: .28em .85em; border: 1px solid var(--rail);
  background: #1c1d49; color: #eeeacf; font-weight: 650;
}
.control-deck button:hover, .control-deck button:focus-visible { border-color: var(--gold); color: var(--gold); }
.control-deck #shop-open { color: var(--gold); }
.control-deck button img { width: 1.3em; image-rendering: pixelated; }
.control-deck .muted { color: #aaa6c5; text-decoration: line-through; }
.shop-dialog, .modal-card {
  --paper: #17183d; --ink: #fff1c5; --white: #24254d; --muted: #cac6e0; --line: #4d4a79;
  --green: #f4d267;
  color: var(--ink); background: var(--paper);
  border: 3px solid var(--rail); border-radius: 0; box-shadow: 6px 6px #090b24;
}
.shop-dialog { width: min(490px, calc(var(--frame-width) - 22px)); max-height: calc(var(--frame-height) - 20px); padding: clamp(16px, 3vw, 28px); }
.shop-dialog::backdrop, .modal {
  inset: 0;
  margin: auto;
  width: var(--frame-width);
  height: var(--frame-height);
}
.modal-card { max-height: 100%; }
.toast { bottom: calc((100% - var(--frame-height)) / 2 + 12px); max-width: calc(var(--frame-width) - 20px); }
.save-warning {
  inset-inline: calc((100% - var(--frame-width)) / 2 + 8px);
  bottom: calc((100% - var(--frame-height)) / 2 + 8px);
}
.shop-dialog::backdrop, .modal-scrim { background: #080b28ba; }
.shop-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.shop-heading h1 { margin: 0; color: var(--gold); font-size: 23px; }
.shop-heading .icon-button, .modal-heading .icon-button { color: var(--gold); border-radius: 0; font-size: 24px; }
.shop-dialog .mode-switch { width: fit-content; background: #25264c; border-radius: 0; }
.shop-dialog .mode-switch button { color: #e3dfef; border-radius: 0; }
.shop-dialog .mode-switch .selected { background: var(--gold); color: var(--night); font-weight: 750; }
.shop-status { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #c4c1dc; margin: 14px 0; }
.shop-dialog :is(.growth-card,.rhythm-unlock,.lab-tools,.upgrade-card), .modal-card .rhythm-settings {
  background: #22234c; border: 1px solid var(--line); border-radius: 0; color: var(--ink);
}
.shop-dialog :is(.growth-card p,.growth-stages,.rhythm-unlock span,.upgrade-info small,.session-strip span,.upgrade-level,.howto), .modal-card :is(.microcopy,.settings-note,.window-summary) { color: #c4c1dc; }
.shop-dialog .growth-stages { margin: 12px 0; }
.growth-stages>span { flex-direction: column; }
.growth-stages img { width: 44px; height: 34px; object-fit: contain; image-rendering: pixelated; }
.shop-dialog .growth-card-title>span, .shop-dialog .upgrade-icon { background: #30305c; color: #ffdf89; border-radius: 0; }
.shop-dialog .upgrade-list { display: grid; grid-template-columns: 1fr; }
.shop-dialog .upgrade-card { grid-template-columns: auto 1fr auto; min-height: 56px; gap: 10px; padding: 6px 10px; }
.shop-dialog .upgrade-price { grid-column: auto; }
.shop-dialog .affordable { border-color: var(--gold); }
.shop-dialog .upgrade-price, .shop-dialog .rhythm-unlock button, .modal-card .primary-button {
  background: var(--gold); color: #241a38; border-radius: 0;
}
.shop-dialog button:disabled .upgrade-price, .shop-dialog .rhythm-unlock button:disabled { color: #d1cde0; background: #454465; }
.shop-score { display: grid; gap: 6px; font-size: 12px; padding-top: 14px; }
.save-status { color: #b3b0cd; font-size: 11px; }
.modal-card .score-sequence { background: #191a3b; border-color: var(--line); }
.modal-card .window-presets button[aria-pressed=true], .modal-card .secondary-button { background: #37375f; color: #fff2c8; }
.toast { color: #fff1c5; background: #191a3e; border: 2px solid var(--gold); border-radius: 0; }
@container (max-width: 600px) {
  .control-deck { padding-inline: 2%; gap: 2%; }
  .control-deck nav { gap: 3px; }
  .control-deck button { padding: .2em .45em; }
}
@container (max-width: 470px) {
  .play-instruction { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
