:root { --paper: #ECEAE4; --ink-c: #121212; --green: #146B3A; --deep: #0B3D24; --red: #DC3B1C; --ink: #121212; --ground: #ECEAE4; --pad: 20px; --top-h: 64px; --control-radius: 5px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
/* hidden means gone, whatever display a class gives the element */
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* body is a size container so type can scale with the stage (cqw, cqh) */
body { container-type: size; background: var(--ground); font-family: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.45; color: var(--ink); -webkit-font-smoothing: antialiased; touch-action: pinch-zoom; transition: color .6s ease, background-color .6s ease; }
body.still, body.still * { transition: none !important; animation: none !important; }
:root { --work-paper: color-mix(in srgb, var(--paper) 60%, white); }
canvas, #glow { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#still { image-rendering: pixelated; transition: opacity .35s ease; }
body[data-scene="gl"] #still, body[data-scene="gl"] #glow { visibility: hidden; transition: visibility 0s .38s; }
#gl { visibility: hidden; opacity: 0; transition: opacity .38s ease; }
body[data-scene="gl"] #gl { visibility: visible; opacity: 1; }
body[data-scene="gl"] #gl.turnable { cursor: grab; }
body[data-scene="gl"] #gl.dragging { cursor: grabbing; }
.orbit { display: none; position: fixed; z-index: 3; top: calc(var(--top-h, 64px) + 9px); right: var(--pad); width: 44px; height: 44px; place-items: center; border: 1px solid color-mix(in srgb, var(--ink) 26%, transparent); border-radius: 50%; font-size: 24px; line-height: 1; transition: background-color .22s ease, color .22s ease; }
body[data-scene="gl"]:not([data-room], .still) .orbit { display: grid; }
.orbit:hover { background: var(--ink); color: var(--ground); }
#err { position: fixed; top: 0; left: 0; right: 0; z-index: 99; background: var(--red); color: #fff; font-size: 12px; padding: 4px 8px; display: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
bdi { unicode-bidi: isolate; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top, .bottom { position: fixed; left: 0; right: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; padding: 0 var(--pad); pointer-events: none; }
.top { top: 0; height: calc(var(--top-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
.bottom { bottom: 0; height: 60px; }
.mark-box { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mark { font-weight: 700; font-size: 16px; letter-spacing: -0.03em; white-space: nowrap; }
.stale { font-size: 11px; font-weight: 600; opacity: .72; white-space: nowrap; }
.stale::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 6px; vertical-align: 0.1em; background: var(--red); }
.hint, .sound, .idx, .nav { font-size: 12px; font-weight: 500; letter-spacing: 0.01em; }
.side { display: inline-flex; align-items: center; gap: 16px; pointer-events: auto; }
.nav { position: relative; color: inherit; text-decoration: none; font-weight: 600; height: 40px; display: inline-flex; align-items: center; white-space: nowrap; }
.nav[hidden] { display: none; }
.nav:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.file i { display: none; width: 6px; height: 6px; margin-left: 6px; background: var(--red); }
.file.dot i { display: block; }
body[data-room] .side { visibility: hidden; }
.hint { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; opacity: .6; }
.sound { pointer-events: auto; display: inline-flex; align-items: center; gap: 9px; height: 40px; opacity: .8; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.bars b { width: 2px; height: 4px; background: currentColor; opacity: .55; }
.bars b:nth-child(2) { height: 8px; }
.bars b:nth-child(3) { height: 6px; }
.sound[aria-pressed="true"] .bars b { opacity: 1; animation: bar 0.9s steps(4) infinite; }
.sound[aria-pressed="true"] .bars b:nth-child(2) { animation-delay: -.3s; }
.sound[aria-pressed="true"] .bars b:nth-child(3) { animation-delay: -.6s; }
@keyframes bar { 0%, 100% { height: 2px; } 50% { height: 10px; } }
.sound span { min-width: 4.6em; text-align: left; }
.steps { list-style: none; display: flex; gap: 6px; }
.steps li { width: 6px; height: 6px; background: currentColor; opacity: .22; transition: opacity .5s, transform .5s; }
.steps li.on { opacity: 1; transform: scale(1.34); }

.copy { position: fixed; z-index: 2; left: var(--pad); right: var(--pad); bottom: clamp(58px, 9.2cqh, 78px); pointer-events: none; }
body.loading .copy, body.loading .bottom { visibility: hidden; }
.idx { margin-bottom: 14px; opacity: calc(.72 * var(--reveal, 1)); font-variant-numeric: tabular-nums; word-spacing: 0.12em; }
.idx::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 9px; vertical-align: 0.08em; background: currentColor; }
.idx:empty { display: none; }
h1 { font-weight: 700; font-size: var(--ts, clamp(36px, min(14.4cqw, 6.65cqh), 68px)); letter-spacing: -0.035em; line-height: 1; overflow-wrap: anywhere; }
#title, #body { opacity: var(--reveal, 1); }
h1 .line { display: block; white-space: nowrap; width: max-content; }
h1 bdi.line { white-space: normal; width: auto; }
.body { font-size: 15px; line-height: 1.45; max-width: 23em; margin-top: 16px; font-weight: 400; overflow-wrap: anywhere; }
.body .line { display: block; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: clamp(16px, 2.8cqh, 24px); }
.act { pointer-events: auto; min-height: clamp(46px, 6.2cqh, 52px); max-width: 100%; padding: 8px 20px 8px 22px; display: inline-flex; align-items: center; gap: 16px; border-radius: var(--control-radius); background: var(--ink); color: var(--ground); font-size: 15px; font-weight: 650; letter-spacing: -.008em; line-height: 1.25; text-align: start; transition: background-color .45s ease, color .45s ease, transform .3s cubic-bezier(.2, .8, .2, 1), opacity .4s; }
.act[hidden] { display: none; }
.act:hover { transform: translateY(-2px); }
.act:active { transform: translateY(0) scale(.98); }
.act.main { background: var(--red); color: #fff; }
body[data-ground="3"] .act.main { background: var(--ink); color: var(--ground); }
.act.quiet { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 40%, transparent); padding: 0 20px; }
.act.locked { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px currentColor; cursor: default; opacity: .78; }
.act.locked:hover { transform: none; }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 12px; }
.links:empty { display: none; }
.links button { pointer-events: auto; min-height: 44px; font-size: 14px; font-weight: 650; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.noscript { position: fixed; z-index: 7; left: var(--pad); right: var(--pad); bottom: 80px; font-size: 18px; font-weight: 600; line-height: 1.35; }
/* icons are drawn with square shadows: everything is pixels */
.px { position: relative; width: 15px; height: 15px; flex: none; }
.px::before { content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 3px; box-shadow: 6px 0 0 currentColor, 9px 3px 0 currentColor, 0 6px 0 currentColor, 3px 6px 0 currentColor, 6px 6px 0 currentColor, 9px 6px 0 currentColor, 12px 6px 0 currentColor, 9px 9px 0 currentColor, 6px 12px 0 currentColor; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.act:hover .px::before { transform: translateX(3px); }
.act.locked .px::before { box-shadow: 3px 0 0 currentColor, 6px 0 0 currentColor, 9px 0 0 currentColor, 3px 3px 0 currentColor, 9px 3px 0 currentColor, 0 6px 0 currentColor, 3px 6px 0 currentColor, 6px 6px 0 currentColor, 9px 6px 0 currentColor, 12px 6px 0 currentColor, 0 9px 0 currentColor, 3px 9px 0 currentColor, 9px 9px 0 currentColor, 12px 9px 0 currentColor, 0 12px 0 currentColor, 3px 12px 0 currentColor, 6px 12px 0 currentColor, 9px 12px 0 currentColor, 12px 12px 0 currentColor; transform: none; }
/* labels pinned under figurines of the scene: names stay HTML, never pixels */
.tags { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.tag { position: absolute; transform: translate(-50%, 6px); font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; white-space: nowrap; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.tag small { display: block; font-size: 10px; font-weight: 500; opacity: .7; font-variant-numeric: tabular-nums; }

@media (max-width: 359px) {
  :root { --pad: 16px; }
  .side { gap: 12px; }
  .hint { display: none; }
  .act, .act.quiet { min-height: 44px; padding-inline: 12px; font-size: 14px; gap: 8px; }
  .acts { gap: 8px; }
  .links { margin-top: 7px; }
}
/* 200% text on a phone: the links go under the wordmark instead of over it */
@container (max-width: 259px) { body:not([data-room]) .top { flex-direction: column; align-items: flex-start; justify-content: flex-end; height: 72px; } .side { height: 28px; } .nav { height: 28px; } }

@media (min-aspect-ratio: 4/5) {
  :root { --pad: clamp(24px, 5.3vw, 112px); --top-h: 92px; --foot-h: 84px; }
  .bottom { height: var(--foot-h); }
  .mark { font-size: clamp(16px, 1.25cqw, 22px); }
  .hint, .sound, .idx, .nav { font-size: clamp(12px, 0.9cqw, 15px); }
  .side { gap: 26px; }
  .copy { left: var(--pad); right: auto; top: var(--top-h); bottom: var(--foot-h); width: min(39cqw, 860px); display: flex; flex-direction: column; justify-content: center; }
  .idx { margin-bottom: clamp(12px, 2.4cqh, 24px); }
  h1 { font-size: var(--ts, min(7.8cqw, 12.5cqh, 148px)); }
  .body { font-size: clamp(15px, 1.12cqw, 20px); line-height: 1.5; max-width: 24.5em; margin-top: clamp(16px, 2.9cqh, 30px); }
  .acts { margin-top: clamp(20px, 3.8cqh, 34px); }
  .act { min-height: 56px; padding-inline: 26px 24px; }
  .act.quiet { padding-inline: 24px; }
  .links button { font-size: clamp(13px, 0.95cqw, 15px); }
  .tag { font-size: 12px; max-width: 120px; }
}
/* a phone on its side: thin bars, so the copy keeps most of the height */
@media (min-aspect-ratio: 4/5) and (max-height: 540px) {
  :root { --top-h: 60px; --foot-h: 56px; }
  .idx { margin-bottom: 8px; }
  .body { margin-top: 10px; }
  .acts { margin-top: 14px; }
  .act { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .act, .steps li, #still, #gl, .orbit { transition-duration: .01s; } .sound[aria-pressed="true"] .bars b { animation: none; height: 8px; } }
