/* Drum Kit.

   One dark stage, one slim bar with three picture controls, and nothing else on
   screen. Everything else the child sees is painted on the canvas.
   The bar's height is the same number as CONTROL_BAR_H in js/kit.js: the kit's
   layout is measured against the space the bar leaves behind. */

:root {
  color-scheme: dark;
  --curtain: #1a2d43;
  --curtain-top: #22364e;
  --ink: #f1e5c8;
  --focus: #ffd98a;
  --bar: 60px; /* keep in step with CONTROL_BAR_H */
  --inset: var(--sandpit-inset-top, 0px);
  font-family: ui-rounded, "SF Pro Rounded", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background: var(--curtain);
  color: var(--ink);
}

body { min-width: 320px; }

button { font: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Bound the page at the root and let the toy fill what is left.

   The launcher floats a back link over the top-left corner and pads the body
   to clear it. This toy used to set its own viewport height *and* apply the
   same inset again, so the two stacked: at 1024x768 the canvas ran to y=828 in
   a 768px window and the lower drums were cut off, which scrollHeight could
   not catch because the overflow was hidden.

   With body height bounded to the window, .toy is 100% of the body's content
   box - already reduced by whatever padding the launcher added - and the inset
   is therefore applied exactly once, by the shell. Standalone, the body has no
   padding and the toy simply fills the window; --sandpit-inset-top is absent
   and there is no floating pill to clear. */
html, body { height: 100%; }
body { overflow: hidden; }

.toy {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.bar {
  flex: 0 0 var(--bar);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 clamp(10px, 2vw, 22px);
  background: linear-gradient(180deg, var(--curtain-top), var(--curtain));
}

.ctl {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(241, 229, 200, 0.24);
  background: rgba(241, 229, 200, 0.07);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.ctl:hover { background: rgba(241, 229, 200, 0.13); }
.ctl:active { transform: scale(0.955); }
.ctl:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.ctl[aria-pressed="true"] {
  background: rgba(255, 217, 138, 0.20);
  border-color: rgba(255, 217, 138, 0.55);
  color: var(--focus);
}

.ctl__icon {
  display: none;
  width: 26px;
  height: 26px;
}

.ctl[data-mode="play"] [data-icon="play"],
.ctl[data-mode="pause"] [data-icon="pause"],
.ctl[data-mode="sound"] [data-icon="sound"],
.ctl[data-mode="muted"] [data-icon="muted"],
.ctl[data-mode="again"] [data-icon="restart"] {
  display: block;
}

.rink {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  /* The stage swallows taps so a child's hand never scrolls the page. */
  touch-action: none;
  /* Safari paints its own grey wash over anything you touch. On the stage
     that wash covers every drum at once, so every press flashed the whole
     screen. The stage answers the child in its own pixels, so the wash is
     turned off here and on the canvas below. */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.rink canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

@media (prefers-reduced-motion: reduce) {
  .ctl { transition: none; }
  .ctl:active { transform: none; }
}

@media (min-width: 700px) and (pointer: coarse) {
  .ctl { width: 58px; height: 58px; border-radius: 16px; }
  .ctl__icon { width: 30px; height: 30px; }
  .bar { gap: 14px; }
}
