/* s2ar.dev — the toys' sheet (the interactive landing, 2026-10-31). A toy is a page at /toys/<key>/ that a tool
   card on the home frames in; it reads media/house/house.css first (the tokens, the type scale, the marks), and this
   sheet lays out the toy's frame and the controls the toys share: the head, the stage, the chips, the tiles, the
   readouts. Tokens only (tools/house_lint.py holds it). Each toy's own script adds nothing but classes named here. */

.toy-page { background: var(--ink); }
.toy { max-width: var(--max); margin: 0 auto; padding: var(--space-6) var(--gutter) var(--space-8); }
.toy-head { display: grid; gap: var(--space-2); margin: 0 0 var(--space-6); }
.toy-head .kicker { margin: 0; }
.toy-head h1 { font-size: var(--t-h2); line-height: 1.15; margin: 0; }
.toy-line { font-size: var(--t-body); color: var(--muted); max-width: 60em; margin: 0; }
.toy-stage { position: relative; display: grid; gap: var(--space-5); padding: var(--space-6); background: var(--panel); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: var(--radius-2); }
.toy-foot { margin: var(--space-6) 0 0; display: grid; gap: var(--space-3); font-size: var(--t-micro); color: var(--faint); }
.toy-real { margin: 0; max-width: 72ch; color: var(--muted); }
.toy-links { margin: 0; letter-spacing: .1em; text-transform: uppercase; }
.toy-links a { color: var(--muted); } .toy-links a:hover { color: var(--text); }

/* the controls the toys share */
.toy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.toy-row.between { justify-content: space-between; }
.chip { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--size-row-h-md); padding: 0 var(--space-5); border: 1px solid var(--line-strong); border-radius: var(--radius-chip); background: var(--panel2); color: var(--muted); font: inherit; font-size: var(--t-micro); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: background var(--motion-ui) var(--ease), color var(--motion-ui) var(--ease), border-color var(--motion-ui) var(--ease); }
.chip:hover { color: var(--text); background: color-mix(in srgb, var(--text) 4%, var(--panel2)); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.chip .swatch { width: var(--space-4); height: var(--space-4); border-radius: var(--radius-1); background: var(--tone, var(--accent)); }
.chip:disabled { opacity: .5; cursor: default; }
.field { font: inherit; font-size: var(--t-small); min-height: var(--size-row-h-md); padding: 0 var(--space-5); color: var(--text); background: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-button); min-width: 12em; }
.field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--accent); outline: none; }
.toy label { display: inline-flex; align-items: center; gap: var(--space-4); font-size: var(--t-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.toy input[type="range"] { accent-color: var(--accent); min-height: var(--size-row-h-sm); }
.readout { font-size: var(--t-micro); color: var(--muted); margin: 0; min-height: 1.4em; }
.readout code, .mono { font-family: var(--mono); color: var(--text); }
.readout.ok { color: var(--pass); } .readout.bad { color: var(--danger); } .readout.warn { color: var(--seal); }
.hint { font-size: var(--t-micro); color: var(--faint); margin: 0; }

/* tiles: a shelf of things (the desk's games, a deck of notes) */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.tile { display: grid; gap: var(--space-2); padding: var(--space-5) var(--space-6); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-2); transition: border-color var(--motion-ui) var(--ease); }
.tile:hover, .tile:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.tile[hidden] { display: none; }
.tile .title { font-size: var(--t-label); color: var(--text); }
.tile .line { font-size: var(--t-small); color: var(--muted); margin: 0; }
.tile .meta { font-size: var(--t-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.tile .meta b { color: var(--accent); font-weight: 400; }
.tile .toy-row { margin-top: var(--space-2); }

/* a stage that draws: a canvas or a video, in a plate */
.plate-box { position: relative; overflow: hidden; background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-2); }
.plate-box canvas, .plate-box video { display: block; width: 100%; height: auto; }

/* framed into the home: the toy's own head is the card's, so only the stage and the caption show */
.framed .toy-head { display: none; }
.framed .toy { padding-top: var(--space-5); }

/* StarLab's basin: the view in a plate, the materials and the readouts beside it */
.lab-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-6); align-items: start; }
.lab-plate { aspect-ratio: 16 / 10; }
.lab-view { width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
/* the view fills its plate whatever its pixel size (the toy renderer, 2026-11-03: the canvas draws at the device's pixels
   under a scale the view's own timing picks; the box, not the canvas, gives the shape) */
.plate-box .lab-view { height: 100%; }
/* ?stats=1: the view's numbers in its corner */
.stats { position: absolute; top: var(--space-3); right: var(--space-3); margin: 0; padding: var(--space-2) var(--space-3); background: var(--scrim); color: var(--text); font-family: var(--mono); font-size: var(--t-micro); line-height: 1.5; white-space: pre; pointer-events: none; border-radius: var(--radius-1); }
.lab-side { display: grid; gap: var(--space-5); }
.mats .chip { padding-left: var(--space-4); }
.readout .digest { letter-spacing: .04em; }
[data-loading] .lab-view { opacity: .4; }
@media (max-width: 900px) { .lab-grid { grid-template-columns: minmax(0, 1fr); } }

/* StarLore's deck: the note, its clozes and links, the grades, the clock */
.deck { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3); }
.deck small { color: var(--faint); letter-spacing: 0; text-transform: none; }
/* the chosen note's chip is on the accent: its small line takes the chip's ink, not the grey (1.26:1 until 2026-11-11) */
.deck [aria-pressed="true"] small, .deck [aria-checked="true"] small { color: inherit; }
.note { padding: var(--space-6) var(--space-7); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-2); max-width: 66ch; }
.note h2 { font-size: var(--t-title); margin: 0 0 var(--space-4); }
.note p { margin: var(--space-4) 0; line-height: 1.6; }
.note .tags { color: var(--faint); font-size: var(--t-micro); }
.tag { color: var(--accent); font-size: var(--t-micro); letter-spacing: .06em; }
.cloze { font: inherit; display: inline; padding: 0 var(--space-2); border: 0; border-bottom: 1px solid var(--accent); border-radius: 0; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); cursor: pointer; }
.cloze .cloze-a { display: none; } .cloze.open .cloze-q { display: none; } .cloze.open .cloze-a { display: inline; color: var(--accent); }
.wikilink { font: inherit; display: inline; padding: 0; border: 0; border-bottom: 1px solid var(--line-strong); background: none; color: var(--accent); cursor: pointer; }
.wikilink-x { color: var(--faint); border-bottom: 1px dotted var(--line-strong); }
.grades .chip[data-grade="1"]:hover { border-color: var(--danger); } .grades .chip[data-grade="4"]:hover { border-color: var(--pass); }
.clock { border-top: 1px solid var(--line); padding-top: var(--space-5); }

/* StarTune's grid: a row a voice, a button a step, the one sounding lit */
.seq { display: grid; gap: var(--space-2); overflow-x: auto; }
.seq-row { display: grid; grid-template-columns: var(--size-row-h-lg) repeat(16, minmax(var(--space-7), 1fr)); gap: var(--space-1); align-items: center; }
.seq-name { font-size: var(--t-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--tone, var(--muted)); }
.step { font: inherit; font-size: var(--t-micro); min-height: var(--size-row-h-md); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-1); background: var(--panel2); color: var(--ink); cursor: pointer; transition: background var(--motion-ui) var(--ease); }
.step:nth-child(4n+2) { border-left-color: var(--line-strong); }
.step[aria-pressed="true"] { background: var(--tone, var(--accent)); border-color: var(--tone, var(--accent)); }
.step.now { outline: 2px solid var(--text); outline-offset: -2px; }
.still .step.now { outline: 0; }
.song { margin: 0; padding: var(--space-5) var(--space-6); background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-2); font-size: var(--t-micro); line-height: 1.5; color: var(--muted); max-height: calc(var(--size-row-h-tile) * 3); overflow: auto; }
.toy details > summary { cursor: pointer; font-size: var(--t-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-3); }

/* StarSaga's reel: the 9:16 stage, two videos crossfading, a caption low on the frame, the timeline beside it */
.reel-wrap { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-6); align-items: start; }
.reel { aspect-ratio: 9 / 16; width: 100%; max-width: calc(var(--size-row-h-tile) * 3.5); height: auto; margin: 0 auto; }
.reel-video, .reel-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--motion-dissolve) var(--ease); }
.reel-poster { opacity: 1; }
.reel[data-reel-playing] .reel-poster { opacity: 0; }
.reel-video.on { opacity: 1; }
.reel[data-realise="hard_cut"] .reel-video { transition: none; }
.reel.black::before { content: ""; position: absolute; inset: 0; background: var(--ink); z-index: 2; }
.reel-caption { position: absolute; left: var(--space-5); right: var(--space-5); bottom: var(--space-7); z-index: 3; margin: 0; padding: var(--space-3) var(--space-4); background: color-mix(in srgb, var(--ink) 72%, transparent); color: var(--text); font-size: var(--t-small); text-align: center; border-radius: var(--radius-1); }
.reel-caption.empty { display: none; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.clip { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-4); align-items: center; padding: var(--space-4); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-2); }
.clip .thumb { grid-row: span 2; width: var(--size-row-h-tile); height: auto; border-radius: var(--radius-1); border: 1px solid var(--line); }
.clip .clip-title { font-size: var(--t-small); color: var(--text); }
.clip .field { width: 100%; min-width: 0; }
.clip .cut { grid-column: 1 / -1; }
.clip .toy-row { grid-column: 2; }

/* the reel made true (starsaga-production F5): a cut's incoming clip lies over the outgoing one (`.prev`) while it
   plays; the stage plays iris, slide and wipe as the app does and says which cuts it only dissolves */
.reel.shown .reel-poster { opacity: 0; }
.reel-video.on { z-index: 1; }
/* ★ the stage gives the shape, not the media (F5b, 2026-11-05): `.plate-box video`'s height: auto outranked the
   clip's 100%, so a landscape loop played as a band across the top of the 9:16 (334 × 217 of 334 × 595) */
.plate-box .reel-video, .plate-box .reel-world { height: 100%; }
.reel-video.prev { opacity: 1; z-index: 0; transition: none; }
.reel.white::before { content: ""; position: absolute; inset: 0; background: var(--text); z-index: 2; }
.reel[data-realise="iris"] .reel-video { opacity: 1; clip-path: circle(0% at 50% 50%); transition: clip-path var(--motion-camera) var(--ease); }
.reel[data-realise="iris"] .reel-video.on, .reel[data-realise="iris"] .reel-video.prev { clip-path: circle(75% at 50% 50%); }
.reel[data-realise="panel_slide"] .reel-video { opacity: 1; transform: translateX(100%); transition: transform var(--motion-camera) var(--ease); }
.reel[data-realise="panel_slide"] .reel-video.on, .reel[data-realise="panel_slide"] .reel-video.prev { transform: none; }
.reel[data-realise="gutter_wipe"] .reel-video { opacity: 1; clip-path: inset(0 100% 0 0); transition: clip-path var(--motion-camera) var(--ease); }
.reel[data-realise="gutter_wipe"] .reel-video.on, .reel[data-realise="gutter_wipe"] .reel-video.prev { clip-path: inset(0); }
.reel[data-realise="hold_cut"] .reel-video { transition: none; }
.reel-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ink); opacity: 0; z-index: 1; }
.reel-still.on { opacity: 1; }
.reel-card { position: absolute; inset: 0; z-index: 2; margin: 0; display: grid; place-items: center; padding: var(--space-6); background: var(--panel2); color: var(--muted); font-size: var(--t-small); text-align: center; }
.reel-card[hidden] { display: none; }
.reel-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; margin-top: var(--space-4); }
.reel-controls .scrub-label { display: grid; gap: var(--space-1); font-size: var(--t-micro); color: var(--muted); }
.reel-scrub { width: 100%; accent-color: var(--accent); }
.reel-controls .readout { font-family: var(--mono); font-size: var(--t-micro); color: var(--text); }
.cut-note { margin-top: var(--space-3); }
.clip .times { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.num-field { display: grid; gap: var(--space-1); font-size: var(--t-micro); color: var(--muted); }
.num-field .num { width: calc(var(--space-7) * 4); }
.clip.placeholder { border-style: dashed; }
.card-thumb { display: grid; place-items: center; width: var(--size-row-h-tile); height: calc(var(--size-row-h-tile) * .65); background: var(--ink); color: var(--muted); }
.picks { margin-top: var(--space-4); flex-wrap: wrap; }
.file-label { position: relative; overflow: hidden; cursor: pointer; }
.file-pick { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.download .readout { color: var(--muted); font-size: var(--t-micro); }

/* the live world (starsaga-production F5b): while it is open the stage is a viewfinder on the web engine's world, and
   a shot is a clip. A drag across turns the world; on a phone a swipe up or down still scrolls the page */
.reel-world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 4; opacity: 0; pointer-events: none; background: var(--ink); touch-action: pan-y; }
.reel[data-world] .reel-world { opacity: 1; pointer-events: auto; cursor: grab; }
.reel[data-world] .reel-caption, .reel[data-world] .reel-card { visibility: hidden; }
.reel[data-world-loading] .reel-world { opacity: .4; }
.reel[data-shooting]::after { content: ""; position: absolute; inset: 0; z-index: 5; border: 2px solid var(--danger); border-radius: inherit; pointer-events: none; }
.reel-controls[hidden], .cut-note[hidden], .world-controls[hidden] { display: none; }
.world-controls { display: grid; gap: var(--space-3); margin-top: var(--space-4); }
.world-controls .readout { font-family: var(--mono); font-size: var(--t-micro); color: var(--text); }
.world-controls .readout.bad { color: var(--danger); }
.chip.rec::before { content: "●"; color: var(--danger); margin-right: var(--space-2); }
.chip.rec:disabled::before { color: var(--muted); }
.saga { margin-top: var(--space-4); flex-wrap: wrap; }

@media (max-width: 640px) {
  .reel-wrap { grid-template-columns: minmax(0, 1fr); }
  /* ★ a phone's sequencer (M of the phones program, 2026-11-05): the sixteen steps as two bars of eight, each step a
     thumb wide, the voice's name spanning both rows */
  .seq-row { grid-template-columns: max-content repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; }
  .seq-name { grid-row: span 4; letter-spacing: 0; padding-right: var(--space-3); }
  .step { min-height: calc(var(--size-row-h-md) + var(--space-5)); }
  .step:nth-child(4n+2) { border-left-color: var(--line-strong); }
  .reel-controls { grid-template-columns: minmax(0, 1fr); }
  .reel-controls .scrub-label { grid-column: 1 / -1; }
  .toy { padding: var(--space-5) var(--space-5) var(--space-7); }
  .toy-stage { padding: var(--space-5); }
  .note { padding: var(--space-5); }
  .tile { padding: var(--space-4) var(--space-5); }
}
/* a thumb's reach: the toys' controls stand 44 px on a coarse pointer (house.css's rule, for this sheet's own) */
@media (pointer: coarse) {
  .chip, .field, .toy input[type="range"], .reel-scrub, .file-label, .toy details > summary { min-height: calc(var(--size-row-h-md) + var(--space-5)); }
  .chip, .reel-scrub { min-width: calc(var(--size-row-h-md) + var(--space-5)); }
  .toy details > summary { display: flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .chip, .tile { transition: none; }
}

/* behind the home (the world behind the whole home, 2026-11-03): ?backdrop=1 lays the toy as a backdrop; the view
   is the whole frame, the controls dock low, the head, the caption and the tape go */
.backdrop, .backdrop body { height: 100%; overflow: hidden; }
.backdrop .toy { max-width: none; padding: 0; height: 100%; }
.backdrop .toy-head, .backdrop .toy-foot, .backdrop .toy details, .backdrop .lab-side label, .backdrop .lab-side .hint { display: none; }
.backdrop .toy-stage { position: absolute; inset: 0; display: block; padding: 0; background: transparent; border: 0; border-radius: 0; }
.backdrop .lab-grid { display: block; height: 100%; }
.backdrop .lab-plate { position: absolute; inset: 0; aspect-ratio: auto; border: 0; border-radius: 0; }
.backdrop .lab-side { position: absolute; left: var(--gutter); right: var(--gutter); bottom: var(--space-6); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); pointer-events: none; }
.backdrop .lab-side > * { pointer-events: auto; }
.backdrop .lab-side .readout { flex-basis: 100%; }
.backdrop .mats .chip, .backdrop .toy-row .chip { background: var(--scrim); }
.backdrop .chip[aria-pressed="true"] { background: var(--accent); }
.backdrop [data-loading] .lab-view { opacity: 1; }
.backdrop .readout.warn { position: absolute; left: var(--gutter); top: var(--space-6); }
