:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #110e25;
  color: #faeaca;
  --line: #453656;
  --gold: #ffd485;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 50% 25%, #302049, transparent 72%); min-height: 100svh; }
main { width: min(960px, 100% - 32px, max(660px, (100svh - 235px) * 1.6)); margin: auto; padding: 24px 0; }
.masthead, .controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.masthead { margin-bottom: 12px; }
.masthead a { color: var(--gold); text-decoration: none; font: 700 1rem ui-monospace, monospace; letter-spacing: .18em; }
.masthead a span { color: #faeaca; }
button { font: inherit; font-weight: 700; color: inherit; cursor: pointer; background: #2d203f; border: 1px solid #594363; border-radius: 8px; padding: 8px 13px; min-height: 44px; }
button:hover:not(:disabled) { background: #4a335b; }
button:active:not(:disabled), button.held { filter: brightness(1.45); }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.masthead button { font-size: .875rem; }
.cabinet { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #1a142e; box-shadow: 0 18px 65px #090517a0; }
.hud { padding: 10px 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; color: #d6c1df; font-size: .875rem; }
.hud strong { display: block; color: var(--gold); font: 700 1.25rem ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.stage { position: relative; overflow: hidden; border-block: 1px solid var(--line); }
canvas { display: block; width: 100%; height: auto; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #140d2860; padding: 10px; }
.overlay[hidden], [hidden] { display: none; }
.panel { text-align: center; border: 1px solid #ad7892; background: #211632f5; box-shadow: 0 12px 48px #10091aaa; border-radius: 16px; padding: clamp(10px, 4vw, 32px) clamp(12px, 6vw, 56px); }
.ornament { color: var(--gold); font-size: clamp(.9rem, 3vw, 1.55rem); }
h1 { font-size: clamp(1.4rem, 5.5vw, 3rem); margin: 0; letter-spacing: .04em; }
.panel p { margin: 8px 0 15px; color: #e3cde2; line-height: 1.55; font-size: clamp(.875rem, 2.9vw, 1rem); }
#action { color: #35213b; background: var(--gold); border-color: #ffe6a9; padding-inline: 19px; }
#action:hover { background: #ffe6ab; }
.notice { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); padding: 6px 15px; white-space: nowrap; background: #211632eb; color: var(--gold); border: 1px solid #ad7892; border-radius: 24px; pointer-events: none; }
.controls { padding: 9px 12px; }
.controls button { touch-action: none; user-select: none; }
.movement { display: flex; gap: 6px; }
.movement button { min-width: 44px; padding-inline: 8px; }
.fire { flex: 1; color: #ffe1a0; }
.keys { text-align: center; color: #d6c1df; font-size: .875rem; margin: 13px 0 0; }
.keys span { margin: 0 6px; }
kbd { font: inherit; color: #ffdfaa; }
@media (max-width: 480px) {
  main { width: calc(100% - 20px); padding: 12px 0; }
  .controls { padding-inline: 6px; }
  .hud { padding-inline: 4px; gap: 3px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  main { width: min(100% - 20px, max(390px, (100svh - 135px) * 1.6)); padding: 5px 0; }
  .masthead { margin-bottom: 4px; }
  .hud, .controls { padding-block: 3px; }
  .panel { padding-block: 8px; }
  .keys { display: none; }
}
