/* One Page Toys — shared toy chrome, direction B "tinted by the toy" (owner, 2026-10-24).
 *
 * One structure for the furniture every toy repeats (the start/end card, its button, eyebrow, body
 * and hint line, the score bar), coloured by each toy's own accent. A toy opts in with
 * <html class="tc"> and this sheet loaded AFTER its own styles.css, and sets its look with a few
 * variables in its own :root:
 *   --tc-accent   the toy's signature colour (button fill, eyebrow, tint)       required
 *   --tc-on       text on the button (dark on a light accent, white on a dark)  default #0b0b0e
 *   --tc-display  the title face (keeps the toy's own display font)             default inherit
 *   --tc-ground   the dark the card is tinted from                              default #0a0b0e
 * Everything else stays the toy's own: its world, its canvas, its icon buttons.
 *
 * ⚠ Self-contained on purpose: no url() and no @import. The iPhone app copies this file on its own,
 *   and anything it points at in assets/ would not exist there. Fonts come from the toy's own import
 *   (add Geist to it) or the app's bundle; the stacks below fall back to the system face.
 */
/* defaults at zero specificity (:where), so a toy's own :root values always win; the derived
   colours below are recomputed from whatever the toy set */
:where(html.tc) {
  --tc-on: #0b0b0e;
  --tc-display: inherit;
  --tc-ground: #0a0b0e;
}
html.tc {
  --tc-body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tc-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --tc-ink: #f2f2f5;
  --tc-card: color-mix(in srgb, var(--tc-accent) 13%, var(--tc-ground) 87%);
  --tc-edge: color-mix(in srgb, var(--tc-accent) 42%, transparent);
  --tc-text: color-mix(in srgb, var(--tc-accent) 12%, #d6d6dc 88%);
  --tc-faint: color-mix(in srgb, var(--tc-accent) 30%, #8a8a90 70%);
}

/* ---------- the start / end card ---------- */
html.tc .overlay {
  /* clear of the notch and the home bar; a card taller than the screen scrolls from its top */
  padding: max(20px, calc(env(safe-area-inset-top) + 12px)) max(16px, env(safe-area-inset-right))
           max(20px, calc(env(safe-area-inset-bottom) + 12px)) max(16px, env(safe-area-inset-left));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  align-items: flex-start;
}
html.tc .overlay .panel {
  width: min(100%, 380px); max-width: 380px; margin: auto;
  padding: 26px 22px 20px; text-align: center;
  background: var(--tc-card);
  border: 1px solid var(--tc-edge); border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 60px color-mix(in srgb, var(--tc-accent) 16%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
html.tc .panel__eyebrow {
  margin: 0 0 8px; font: 500 11px/1.3 var(--tc-mono); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--tc-accent);
}
html.tc .panel__title {
  margin: 0 0 12px; font-family: var(--tc-display);
  font-size: clamp(30px, 8.6vw, 40px); line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance;
}
/* a little more room once there is more screen: the title stays on one line, the card's extras fit */
@media (min-width: 600px) {
  html.tc .overlay .panel { width: min(100%, 440px); max-width: 440px; padding: 30px 28px 22px; }
}
html.tc .panel__text {
  margin: 0 0 20px; font: 400 15px/1.5 var(--tc-body); letter-spacing: 0; color: var(--tc-text);
  text-wrap: pretty;
}
html.tc .panel__text b { color: var(--tc-ink); font-weight: 600; }

/* the one primary action: full width, a thumb-sized 50px, the toy's colour */
html.tc .overlay .play-btn {
  display: block; width: 100%; min-height: 50px; padding: 0 24px;
  font: 600 16px/50px var(--tc-body); letter-spacing: 0;
  color: var(--tc-on); background: var(--tc-accent);
  border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--tc-accent) 40%, transparent);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
html.tc .overlay .play-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
html.tc .overlay .play-btn:active { transform: translateY(1px); filter: brightness(0.96); }
html.tc .overlay .play-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tc-ground), 0 0 0 5px var(--tc-accent); }

/* the hint under the button: readable, and in the toy's tint */
html.tc .panel__keys {
  margin: 14px 0 0; font: 400 11.5px/1.5 var(--tc-mono); letter-spacing: 0.04em; color: var(--tc-faint);
  text-wrap: balance;
}
/* the shared "Share this toy" line sits quietly under the card's action */
html.tc .overlay .opt-share { color: var(--tc-faint); font-family: var(--tc-body); }

/* ---------- the score bar ---------- */
html.tc .hud {
  top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--tc-accent) 10%, rgba(8, 9, 12, 0.8) 90%);
  border: 1px solid color-mix(in srgb, var(--tc-accent) 36%, transparent);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
html.tc .hud__k { font-family: var(--tc-mono); letter-spacing: 0.16em; color: var(--tc-faint); }
html.tc .hud__cell span:last-child { font-variant-numeric: tabular-nums; }

/* ---------- short landscape (a phone on its side; the iPhone app locks some toys wide, 874 x 402) ----------
   A portrait-sized card is taller than the screen there. Go wide instead: a broader card so the copy wraps
   to fewer lines, tighter type and spacing, a slimmer button. Toys with an illustration or a picker add
   their own rules under the same query. Desktop and portrait phones never match it. */
@media (orientation: landscape) and (max-height: 500px) {
  html.tc .overlay {
    padding-top: max(10px, calc(env(safe-area-inset-top) + 8px));
    padding-bottom: max(10px, calc(env(safe-area-inset-bottom) + 6px));
  }
  html.tc .overlay .panel { width: min(100%, 680px); max-width: 680px; padding: 14px 26px 12px; }
  html.tc .panel__eyebrow { margin-bottom: 4px; font-size: 10.5px; }
  html.tc .panel__title { font-size: 30px; margin-bottom: 6px; }
  html.tc .panel__text { font-size: 14px; line-height: 1.42; margin-bottom: 10px; }
  html.tc .overlay .play-btn { min-height: 44px; font-size: 15px; line-height: 44px; max-width: 360px; margin-inline: auto; }
  html.tc .panel__keys { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html.tc .overlay .play-btn { transition: none; }
  html.tc .overlay .play-btn:hover, html.tc .overlay .play-btn:active { transform: none; }
}
