:root {
  --ink: #241631;
  --paper: #f7eedc;
  --orange: #ffac4b;
  --pink: #ed9bea;
  --green: #d9fa74;
  font-family: Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100% - 32px, 1100px); margin: clamp(18px, 5vw, 52px) auto; }
.masthead, .scoreboard, .toolbar { display: flex; align-items: center; justify-content: space-between; }
.masthead { margin-bottom: 19px; gap: 12px; }
.brand { font-size: clamp(20px, 4.5vw, 43px); font-weight: 950; font-style: italic; letter-spacing: -.075em; white-space: nowrap; }
.brand > span:last-child { margin-left: .14em; color: #673387; }
.brand-icon { display: inline-grid; place-items: center; width: 1.23em; height: 1.23em; background: var(--ink); color: var(--green); border-radius: .23em; font-style: normal; font-size: .7em; margin-right: .25em; }
button { color: inherit; background: #fffbef; border: 1px solid #a494a6; border-radius: 7px; padding: 8px 12px; cursor: pointer; font: 700 13px Arial, sans-serif; white-space: nowrap; }
button:hover:not(:disabled) { border-color: #673387; background: #f4dff3; }
button:focus-visible { outline: 3px solid #9b58bc; outline-offset: 3px; }
button:disabled { opacity: .42; cursor: default; }
.cabinet { border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 6px 0 #24163126; }
.scoreboard { background: var(--ink); color: #fff9ed; padding: 13px clamp(9px, 3vw, 28px); gap: 6px; }
.driver, .target, .toolbar { font: 700 11px/1 monospace; letter-spacing: .045em; }
.driver { display: flex; align-items: center; gap: clamp(5px, 1.5vw, 14px); flex: 1; white-space: nowrap; }
.driver:last-child { justify-content: flex-end; }
.driver strong { color: #fff9ed; font: italic 900 clamp(20px, 3.5vw, 34px)/1 Arial, sans-serif; }
.chip { width: 9px; height: 9px; background: currentColor; border-radius: 50%; }
.orange { color: var(--orange); }
.pink { color: var(--pink); }
.target { text-align: center; color: var(--green); }
.target small { display: block; margin-top: 5px; color: #cfbed7; font: inherit; font-size: 9px; }
.stage { position: relative; overflow: hidden; background: #241a2e; }
canvas { width: 100%; height: auto; display: block; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #1a102549; padding: 8px; }
[hidden] { display: none !important; }
.menu { text-align: center; padding: clamp(10px, 2.1vw, 26px); width: min(100%, 395px); background: #fff7e6; border: 2px solid var(--ink); border-radius: 13px; box-shadow: 6px 7px 0 #21132ac4; }
h1 { font-size: clamp(29px, 5.5vw, 67px); line-height: .81; margin: .03em 0 .2em; letter-spacing: -.09em; font-weight: 950; font-style: italic; }
.menu p { font-size: clamp(12px, 1.8vw, 15px); line-height: 1.35; margin: .65em 0 .85em; }
.choices { display: flex; justify-content: center; gap: 6px; margin-bottom: 7px; }
.choices button[aria-pressed="true"] { color: #fff7e6; border-color: var(--ink); background: #573067; }
.players button { font-size: 12px; padding-block: 6px; }
.primary { background: var(--green); color: var(--ink); border-color: var(--ink); min-width: 160px; }
.primary span { margin-left: 12px; }
.announcement { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font: italic 950 clamp(26px, 7vw, 74px)/1 Arial, sans-serif; color: var(--green); text-shadow: 0 3px 0 var(--ink), 0 0 16px var(--ink); text-align: center; }
.announcement:empty { display: none; }
.toolbar { background: #32233e; color: #e3d5e6; flex-wrap: wrap; gap: 10px; padding: 11px 14px; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 21px; margin-left: 3px; background: var(--ink); border: 1px solid #715d7c; border-radius: 4px; font: inherit; }
.actions { display: flex; gap: 6px; margin-left: auto; }
.actions button { color: #fff9ed; background: #241631; border-color: #715d7c; }
.touch { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 12px; }
.touch div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.touch button { min-width: 42px; height: 42px; touch-action: none; user-select: none; }
.touch button:active { background: var(--green); }
@media (max-width: 700px) {
  canvas { height: max(250px, calc((100vw - 36px) / 2)); }
  #hint { order: 2; width: 100%; }
}
@media (max-width: 380px) {
  .chip { display: none; }
}

.header-actions { display: flex; gap: 6px; }
#motion-status { margin-block: 5px 8px; }
#motion-options [aria-pressed="true"] { background: #425725; }
body.immersive { background: #241631; }
.immersive main {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.immersive .masthead {
  background: #f7eedc;
  padding: 5px 12px;
  margin: 0;
  flex: none;
}
.immersive .brand { font-size: clamp(18px, 3.5vw, 27px); }
.immersive .cabinet {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.immersive .scoreboard, .immersive .toolbar { flex: none; padding-block: 7px; }
.immersive .stage { flex: 1; min-height: 0; }
.immersive canvas { width: 100%; height: 100%; }
.immersive .touch { padding: 4px 10px; margin: 0; background: #f7eedc; }
.immersive .overlay { overflow: auto; }
@media (max-height: 460px) {
  .immersive .menu { padding: 8px; }
  .immersive .menu h1 { font-size: 27px; }
}
@media (max-width: 480px) {
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .header-actions button { padding-inline: 7px; font-size: 11px; }
  body:not(.immersive) canvas { min-height: 305px; }
}
