/* Plate Spinner — widget-local styles. Everything on stage is canvas; this
   file is the toolbar, the stage frame, and the overlay extras. The canvas
   reads the --ps-* variables at render time, so dark mode restyles the
   theatre without JS colour logic. The plate rim needs contrast BOTH ways:
   an edge line carries ceramic-white on the light stage, a rim-light
   carries it on the dark one. */

:root {
  --ps-bg: #f0e9dd;
  --ps-bg-edge: #e2d7c4;
  --ps-floor: #c9ba9f;
  --ps-pole: #8a6f4d;
  --ps-pole-hi: #a98d66;
  --ps-plate: #fdfcf8;
  --ps-plate-shade: #e3ddd0;
  --ps-plate-under: #cfc6b4;
  --ps-plate-band: #c47b4a;
  --ps-plate-rim: #b8afa0;
  --ps-warn: #d35427;
  --ps-shard: #efece4;
  --ps-spotlight: rgba(255, 244, 214, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ps-bg: #251c12;
    --ps-bg-edge: #19130b;
    --ps-floor: #382a1a;
    --ps-pole: #8a6a42;
    --ps-pole-hi: #ab8a5c;
    --ps-plate: #f5efe2;
    --ps-plate-shade: #cdbb9d;
    --ps-plate-under: #a08a6b;
    --ps-plate-band: #cf9552;
    --ps-plate-rim: #ffe9c4;
    --ps-warn: #f25c30;
    --ps-shard: #e8dcc4;
    --ps-spotlight: rgba(255, 209, 138, 0.22);
  }
}

.arena-ps {
  height: auto;
  min-height: 0;
  padding: 14px 0 18px;
  position: relative;
}

.ps-stage {
  width: min(100%, 560px);
  margin: 0 auto;
}

/* tap-only: the canvas owns its touches; the page scrolls around it */
#act {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 4;
  border-radius: 14px;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(15, 20, 32, 0.18);
}

/* --- overlay extras ---------------------------------------------------------------- */

.ps-saves-line { color: var(--muted); font-size: 0.9em; }

.ps-tier {
  font-style: italic;
  color: var(--muted);
  margin-top: 2px;
}

/* --- toolbar (house pattern, sound only) ------------------------------------------ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tool[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.tool svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool svg .fill { fill: currentColor; stroke: none; }

#soundBtn .icon-when-on { display: none; }
#soundBtn[aria-pressed="true"] .icon-when-on { display: initial; }
#soundBtn[aria-pressed="true"] .icon-when-off { display: none; }

.toolbar-spacer { flex: 1; }

.toolbar .hud-chip strong { font-variant-numeric: tabular-nums; }

#clock { min-width: 4.5ch; display: inline-block; } /* switch-panic lesson: no chip wobble */

kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  font-size: 0.85em;
}

/* results replace the stage on phones (house "ended" pattern) */
.arena-ps.ended .ps-stage { display: none; }
.arena-ps.ended { height: auto; }
.arena-ps.ended .overlay { position: static; min-height: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
