/* Tokens: defined once here (spec section 4). */
:root {
  --bg: #030304;
  --ink: #ece7dc;
  --dim: #8d897f;
  --light: #f0dca4;      /* our light, and anything the player has understood */
  --other: #9fd0e6;      /* their light */
  --alarm: #e0705a;
  --panel: #0f1115;
  --line: #2a2e36;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

#app { position: fixed; left: 0; top: 0; width: 100%; height: 100dvh; }
.pane { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: stretch; justify-content: center; }

/* ---- text mode: the game's narration and what the player types.
   It is a text adventure, so nothing here looks like a conversation: no bubbles, no sender.
   The look of messages is kept for people who message the player (spec 5.4). */
.text {
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0;
  background: var(--panel);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.tx-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
/* The game's mark: a disc cut with slits. */
.mark { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--light); flex: none; opacity: .85;
  background: repeating-linear-gradient(90deg, transparent 0 3px, var(--light) 3px 4.5px) center / 15px 14px no-repeat; }
.tx-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--light); }
.icon { width: 40px; height: 40px; border-radius: 50%; color: var(--dim); font-size: 22px; line-height: 1; display: grid; place-items: center; flex: none; }
.icon svg { width: 18px; height: 18px; }
.icon:focus-visible { background: #1b1e24; color: var(--ink); }
@media (hover: hover) { .icon:hover { background: #1b1e24; color: var(--ink); } }

.tx-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 12px;
  scrollbar-width: thin; scrollbar-color: #2c313a transparent;
}
.tx-body::before { content: ""; flex: 1; }   /* pushes a short page to the bottom */
.line { margin: 0; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; animation: rise .25s ease-out; }
.line.say { color: var(--ink); }
/* Their Light is told in their colour, from the right. Noise slips as it is read (spec 8.2). */
.line.tone-other { color: var(--other); text-align: right; }
.line.tone-noise { animation: rise .25s ease-out, slip 2.4s steps(2, jump-none) 1; }
@keyframes slip { 0%, 100% { opacity: 1; transform: none; } 40% { opacity: .55; transform: translateX(2px); } 60% { opacity: .85; transform: translateX(-1px); } }
.card.ending h2 { font-size: clamp(22px, 6vw, 32px); }
.line.you { color: var(--light); font-family: var(--mono); font-size: 15px; margin-top: 10px; }
.line.you::before { content: "\203A\00A0"; color: var(--dim); }
/* A reply the player may choose, offered by number. */
.line.choice { color: var(--light); padding-left: 14px; margin-top: -4px; }
.line.clue { color: #a8a294; font-size: 14.5px; border-left: 2px solid #4a4638; padding-left: 10px; }
.line.sys { align-self: center; color: var(--dim); font-size: 12px; }
/* A message from a person (spec 5.4): their name, and a bubble. Never narration. */
.line.msg { align-self: flex-start; display: flex; flex-direction: column; gap: 2px; max-width: 82%; margin: 6px 0 2px; padding: 8px 13px 9px; border-radius: 14px 14px 14px 4px; background: #1d2730; color: #e6edf1; font-size: 15.5px; line-height: 1.4; }
.line.msg b { font-size: 12px; letter-spacing: .07em; color: #8fb6cc; font-weight: 600; }
/* A stage's one status, at the right of the bar: a countdown. */
.tx-status { margin-left: auto; align-self: center; padding: 0 6px; font-family: var(--mono); font-size: 13px; letter-spacing: .08em; color: #ff8f63; text-align: right; line-height: 1.25; }
.tx-status span { display: inline-block; white-space: nowrap; }
.tx-status span + span { margin-left: 12px; }
@media (max-width: 520px) { .play.long-status .tx-status { font-size: 11px; letter-spacing: .02em; } .play.long-status .tx-status span + span { margin-left: 8px; } }
/* Under the picture, the handset's tools have the bar's first row, and a stage's status the second. */
.play.folded.has-status .tx-head { flex-wrap: wrap; row-gap: 6px; }
.play.folded.has-status .tx-status { order: 9; flex-basis: 100%; margin-left: 0; padding: 0 2px; text-align: left; }
.play.folded .tx-tools { overflow-x: auto; scrollbar-width: none; }
.play.folded .tx-tools::-webkit-scrollbar { display: none; }
@media (max-width: 520px) { .tool { padding: 6px 9px; letter-spacing: .03em; } .play.folded .tx-tools { gap: 6px; } .play.folded .tx-head { gap: 10px; padding-left: 12px; padding-right: 12px; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.more { position: absolute; left: 50%; bottom: 122px; transform: translateX(-50%); background: var(--light); color: #1b1710; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

.chips { display: flex; gap: 8px; padding: 8px 12px 0; overflow-x: auto; flex: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid #3a3f49; border-radius: 16px; padding: 7px 13px; font-size: 14px; color: var(--ink); background: #171a20; white-space: nowrap; }
.chip:active { background: var(--light); color: #1b1710; border-color: var(--light); }
.chip.back { color: var(--dim); }
.chip.suggest, .chip.reply { border-color: #5a5340; color: var(--light); }
.chip.hint { color: var(--dim); }
.chip.digit { min-width: 38px; text-align: center; font-family: var(--mono); }
.chip:focus-visible, .pad .chip:focus { outline: 2px solid var(--light); outline-offset: 2px; }
/* With a pad, the button in focus is plain to see wherever it is. */
.pad button:focus { outline: 2px solid var(--light); outline-offset: 2px; }

.tx-input { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px 16px; flex: none; border-top: 1px solid var(--line); margin-top: 8px; }
.tx-prompt { color: var(--light); font-family: var(--mono); font-size: 20px; line-height: 1; flex: none; }
.tx-field {
  flex: 1; min-width: 0; height: 42px; border: 0; padding: 0 4px;
  background: transparent; color: var(--light); font-family: var(--mono); font-size: 16px; outline: none; caret-color: var(--light);
}
.tx-field::placeholder { color: #5d616b; }
.send { width: 38px; height: 38px; border-radius: 50%; background: #2c313a; color: #6a6f7a; display: grid; place-items: center; flex: none; }
.send.ready { background: var(--light); color: #1b1710; }
.send svg { width: 17px; height: 17px; }

/* ---- sheets over the text: the end of what is built, and the pause */
.card, .sheet { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 24px; }
.card, .sheet { background: var(--bg); animation: fade .3s ease-out; }
.card h2, .sheet h2 { margin: 0; font-size: clamp(18px, 5vw, 24px); line-height: 1.5; font-weight: 300; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; color: var(--light); }
.card p, .sheet p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--dim); max-width: 22em; }
.card small { color: var(--dim); font-size: 13px; letter-spacing: .08em; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 10px; }
.btn { border: 1px solid var(--light); color: var(--light); border-radius: 24px; padding: 12px 30px; font-size: 16px; letter-spacing: .12em; text-transform: uppercase; }
.btn:focus-visible { background: var(--light); color: #1b1710; outline: none; }
@media (hover: hover) { .btn:hover { background: var(--light); color: #1b1710; outline: none; } }
.btn.quiet { border-color: #3a3f49; color: var(--dim); }
.btn.quiet:focus-visible { background: #23272e; color: var(--ink); }
@media (hover: hover) { .btn.quiet:hover { background: #23272e; color: var(--ink); } }
.btn.small { padding: 8px 18px; font-size: 13px; }
.btn.danger { border-color: var(--alarm); color: var(--alarm); }
.btn.danger:focus-visible { background: var(--alarm); color: #1b1710; }
@media (hover: hover) { .btn.danger:hover { background: var(--alarm); color: #1b1710; } }
.btn:disabled { opacity: .35; cursor: default; }
.btns.col { flex-direction: column; align-items: stretch; min-width: 220px; }

/* ---- the lobby: where a session is started, resumed and left. It says nothing about the game. */
.lobby { width: 100%; height: 100%; overflow-y: auto; background: var(--bg); display: flex; justify-content: center;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom)); }
.lob-in { width: 100%; max-width: 460px; margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mark.big { width: 54px; height: 54px; border-width: 2px; background-size: 27px 26px; }
.lobby h1 { margin: 0 0 6px; font-size: clamp(24px, 8.4vw, 36px); font-weight: 300; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; color: var(--light); }
.lob-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.lob-row { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.lob-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.lob-meta b { font-size: 15px; font-weight: 600; }
.lob-meta span { font-size: 12.5px; color: var(--dim); }
.lob-meta i { font-size: 13px; color: #a8a294; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lob-ask { flex: 1; font-size: 14px; text-align: left; }
.lob-full { margin: 0; font-size: 13px; color: var(--dim); text-align: center; }
.lob-notes { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.45; color: var(--dim); text-align: center; }
.lob-prefs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.lob-sound { font-size: 13px; letter-spacing: .08em; color: var(--dim); padding: 8px 14px; border-radius: 16px; }
.lob-sound:focus-visible { color: var(--ink); background: #1b1e24; }
@media (hover: hover) { .lob-sound:hover { color: var(--ink); background: #1b1e24; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- one session on screen: the world, with the text under it or beside it (spec 4, Layout).
   .dark    nothing has been named yet: text alone, over black
   .folded  the world is walked: the text has folded down into the handset
   .log     the folded text has been opened again
   .short   an on-screen keyboard is up
   Tall screens stack the world over the text. Wide screens put the text on the left of it. */
.play { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--bg); --ease: cubic-bezier(.6, 0, .2, 1); }
.text-host { display: contents; }
.world { position: absolute; left: 0; top: 0; width: 100%; height: 42%; overflow: hidden; background: var(--bg); touch-action: none; user-select: none; -webkit-user-select: none; transition: height 1.4s var(--ease); }
.w-gl { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.play .text { position: absolute; left: 0; top: 42%; width: 100%; height: 58%; padding-top: 0; border-top: 1px solid var(--line); transition: top 1.4s var(--ease), height 1.4s var(--ease); }
.play.dark .world, .play.no-world .world { height: 0; }
.play.dark .text, .play.no-world .text { top: 0; height: 100%; border-top: 0; padding-top: env(safe-area-inset-top); }
.play.folded .world { height: 50%; }
.play.folded .text { top: 50%; height: 50%; }
.play.short .world { height: 30%; }
.play.short .text { top: 30%; height: 70%; }
.play.short.folded .world { height: 46%; }
.play.short.folded .text { top: 46%; height: 54%; }
.play.short.dark .world { height: 0; }
.play.short.dark .text { top: 0; height: 100%; }
/* ?fast, for the tools: no transitions at all, so nothing is ever caught half-shown. */
.play.fast, .play.fast * { transition: none !important; animation-duration: .01s !important; }

/* The handset's buttons live in the text's header, and show once the world is walked. */
.tx-tools { display: none; gap: 8px; flex: 1; min-width: 0; }
.play.folded .tx-tools { display: flex; }
.play.folded .tx-name { display: none; }
.tool { font-size: 13px; letter-spacing: .06em; color: var(--ink); border: 1px solid #3a3f49; border-radius: 16px; padding: 7px 13px; white-space: nowrap; }
.tool:focus-visible, .tool.on { border-color: var(--light); color: var(--light); outline: none; }
@media (hover: hover) { .tool:hover { border-color: var(--light); color: var(--light); outline: none; } }
.tool.log { display: none; }

.hs-panel { position: absolute; z-index: 5; left: 8px; right: 8px; bottom: calc(50% + 8px); display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6); animation: rise .2s ease-out; }
.hs-panel[hidden] { display: none; }
.play.short .hs-panel { bottom: calc(54% + 8px); }
.tool .badge, .hs-who .badge { display: inline-block; min-width: 17px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--light); color: #15130e; font-size: 11px; font-weight: 700; line-height: 17px; letter-spacing: 0; text-align: center; }
.tool[hidden] { display: none; }
/* Messages: a conversation for each who has written, as bubbles (spec 5.4). */
.hs-who { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 8px; border-bottom: 1px solid var(--line); }
.hs-who button { font-size: 12.5px; letter-spacing: .06em; color: #8fb6cc; border: 1px solid #2c3a44; border-radius: 14px; padding: 5px 11px; }
.hs-who button.on, .hs-who button:focus-visible { border-color: #8fb6cc; color: #e6edf1; outline: none; }
.hs-thread { display: flex; flex-direction: column; gap: 6px; max-height: min(46vh, 420px); overflow-y: auto; padding: 8px 2px 4px; }
.hs-from { margin: 0 0 2px 4px; font-size: 12px; letter-spacing: .07em; color: #8fb6cc; font-weight: 600; }
.hs-msg { align-self: flex-start; max-width: 88%; margin: 0; padding: 8px 13px 9px; border-radius: 14px 14px 14px 4px; background: #1d2730; color: #e6edf1; font-size: 15px; line-height: 1.4; }
/* Map: the rooms walked, joined by their doors. The room he is in is lit. */
.hs-map svg { display: block; max-width: 100%; height: auto; margin: 4px auto; }
.hs-map .room rect { fill: #14171d; stroke: #4a505b; stroke-width: 1.5; }
.hs-map .room text { fill: var(--dim); font-family: var(--sans); font-weight: 500; letter-spacing: .02em; text-anchor: middle; }
.hs-map .room.here rect { fill: #2c2717; stroke: var(--light); }
.hs-map .room.here text { fill: var(--light); }
.hs-map .door { stroke: #6a707b; stroke-width: 3; stroke-linecap: round; }
.hs-map .door.shut { stroke: #4a505b; stroke-dasharray: 3 4; }
.hs-map .lock path { stroke: var(--alarm); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.hs-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; }
.hs-row b { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.hs-none { margin: 0; padding: 8px 10px; font-size: 14px; color: var(--dim); }

/* ---- over the world: prompts, captions, a held item, the dark at a threshold */
.w-over { position: absolute; inset: 0; pointer-events: none; }
.w-fade { position: absolute; inset: 0; z-index: 1; background: var(--bg); opacity: 0; transition: opacity .9s ease; }
.w-fade.on { opacity: 1; }
.w-fade.cut { transition: none; }
/* A threshold: the next place opens as a slit of light that widens from the middle. */
.w-slit { position: absolute; inset: 0; z-index: 1; }
.w-slit i { position: absolute; top: 0; bottom: 0; width: 50.5%; background: var(--bg); transition: transform .8s var(--ease); }
.w-slit i:first-child { left: 0; }
.w-slit i:last-child { right: 0; }
.w-slit.open i:first-child { transform: translateX(-100%); }
.w-slit.open i:last-child { transform: translateX(100%); }
.w-hint { position: absolute; left: 50%; top: 12%; transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100% - 32px); text-align: center; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--light); text-shadow: 0 1px 4px #000, 0 0 16px #000; animation: fade .6s ease-out; }
/* On a tall screen the log is right under the picture, so it needs no caption. */
.w-caption { display: none; }
.w-prompts { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 8px; padding: 26px 10px 10px; pointer-events: auto; background: linear-gradient(transparent, rgba(3,3,4,.82) 45%); animation: fade .25s ease-out; }
.pr-names, .pr-verbs { display: flex; flex-wrap: wrap; gap: 6px; }
.pr-name { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); padding: 6px 9px; border-radius: 6px; background: rgba(15,17,21,.8); }
.pr-name.on { color: #1b1710; background: var(--light); }
.pr { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid #4a4638; border-radius: 10px; background: rgba(15,17,21,.9); color: var(--ink); font-size: 15px; white-space: nowrap; }
.pr:active { border-color: var(--light); color: var(--light); }
@media (hover: hover) { .pr:hover { border-color: var(--light); color: var(--light); } }
.pr.reply { white-space: normal; text-align: left; line-height: 1.3; padding-top: 8px; padding-bottom: 8px; }
.pr.dim { opacity: .42; }
.w-text { position: absolute; z-index: 3; top: 58px; right: 12px; max-width: min(300px, 72%); display: flex; flex-direction: column; gap: 3px; padding: 9px 13px 10px; border-radius: 14px 14px 4px 14px; background: rgba(29,39,48,.94); color: #e6edf1; font-size: 15px; line-height: 1.4; box-shadow: 0 8px 30px rgba(0,0,0,.5); pointer-events: none; }
.w-text[hidden] { display: none; }
.w-text b { font-size: 12px; letter-spacing: .07em; color: #8fb6cc; font-weight: 600; }
.w-text p { margin: 0; }
.w-text.in { animation: rise .3s ease-out; }
.pr kbd { display: none; font-family: var(--mono); font-size: 12px; font-weight: 600; color: #1b1710; background: var(--light); border-radius: 4px; padding: 2px 6px; }
.pr.sub { border-style: dashed; color: var(--light); }
.pr.sub.on { border-style: solid; border-color: var(--light); background: var(--light); color: #1b1710; }
/* How to move, shown when the world is first walked. A desktop is shown the keys, which fade
   once they have been used. A touch screen is given a stick to drag, which stays. */
.w-keys { position: absolute; right: 10px; bottom: 10px; display: grid; grid-template-columns: auto auto; gap: 8px 14px; padding: 12px 14px 10px; border-radius: 12px; background: rgba(8,9,12,.72); border: 1px solid var(--line); animation: arrive .7s var(--ease) both; transition: opacity .8s ease; }
.w-keys.going { opacity: 0; }
/* The view is the player's to change: a button in the corner goes to the next camera. */
.w-view { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; pointer-events: auto; border: 1px solid #3a3f49; border-radius: 18px; background: rgba(8,9,12,.72); color: var(--ink); font-size: 13px; letter-spacing: .06em; }
.w-view[hidden] { display: none; }
.w-view b { font: 600 12px var(--mono); color: var(--dim); }
.w-view kbd { font: 600 11px var(--mono); color: #1b1710; background: var(--light); border-radius: 4px; padding: 1px 5px; }
.w-view:active, .w-view.want { border-color: var(--light); color: var(--light); }
@media (hover: hover) { .w-view:hover { border-color: var(--light); color: var(--light); } }
@media (pointer: coarse) { .w-view kbd { display: none; } .w-view { min-height: 44px; padding: 0 16px; } }
.w-keyset { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(2, 30px); gap: 4px; }
.w-keyset kbd { display: grid; place-items: center; font-family: var(--mono); font-size: 13px; color: var(--light); border: 1px solid #5a5340; border-radius: 6px; background: rgba(15,17,21,.9); transition: background .08s, color .08s; }
.w-keyset kbd[data-move="up"] { grid-column: 2; grid-row: 1; }
.w-keyset kbd[data-move="left"] { grid-column: 1; grid-row: 2; }
.w-keyset kbd[data-move="down"] { grid-column: 2; grid-row: 2; }
.w-keyset kbd[data-move="right"] { grid-column: 3; grid-row: 2; }
.w-keyset kbd.on { background: var(--light); color: #1b1710; border-color: var(--light); }
.w-keys p { grid-column: 1 / -1; margin: 0; text-align: center; font-size: 12px; letter-spacing: .06em; color: var(--dim); }
.w-keys b { font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--light); margin-right: 4px; }
.w-stick { position: absolute; right: 12px; bottom: 12px; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; pointer-events: auto; touch-action: none; border: 1.5px solid rgba(240,220,164,.6); background: rgba(8,9,12,.5); animation: arrive .7s var(--ease) both; }
.w-stick::after { content: ""; position: absolute; inset: -1.5px; border-radius: 50%; border: 1.5px solid var(--light); opacity: 0; animation: ping 1.4s ease-out .5s 3; pointer-events: none; }
.w-stick i { width: 46px; height: 46px; border-radius: 50%; background: rgba(240,220,164,.85); box-shadow: 0 2px 10px rgba(0,0,0,.6); transition: transform .12s ease-out; }
.w-stick.held { border-color: var(--light); }
.w-stick.held i { background: var(--light); transition: none; }
@keyframes arrive { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes ping { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.3); } }
/* Along the foot of a tall picture, prompts leave the corner to the controls. */
.world.stick-on .w-prompts { padding-right: 128px; }
.world.keys-on .w-prompts { padding-right: 246px; }
.w-held { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 20px 16px; text-align: center; animation: fade .4s ease-out; }
.w-held > * { pointer-events: auto; }
.w-face { margin: 0; max-width: 30em; font-size: 16px; line-height: 1.45; color: var(--ink); text-shadow: 0 1px 4px #000, 0 0 18px #000; }
.w-held .btns { margin-top: 0; }
.w-held .btn { background: rgba(15,17,21,.85); }
.w-held .btn:focus-visible { background: var(--light); }
@media (hover: hover) { .w-held .btn:hover { background: var(--light); } }

/* ---- an instrument (spec 5.6). It lies over the world for as long as he stands at it. */
/* The text, and the handset's buttons in it, stay in reach above it. */
.play .text { z-index: 4; }
.station, .cn-station, .ln-station { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 12px 10px; background: rgba(4,5,5,.9); color: var(--ink); animation: fade .35s ease-out; touch-action: manipulation; }
.station[hidden], .cn-station[hidden], .ln-station[hidden] { display: none; }
.st-head, .cn-head, .ln-head { width: 100%; max-width: 860px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.st-title, .cn-title, .ln-title { margin: 0; font: 600 12px var(--mono); letter-spacing: .14em; color: var(--light); white-space: nowrap; }
.st-meter { display: flex; align-items: center; gap: 3px; }
.st-meter span { font: 600 10px var(--mono); letter-spacing: .12em; color: var(--dim); margin-right: 6px; }
.st-meter i { width: 9px; height: 13px; border-radius: 2px; background: #24231c; }
.st-meter i.on { background: var(--light); }
.st-screen { flex: 1; min-height: 0; width: 100%; max-width: 860px; position: relative; }
.st-screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.st-read { margin: 0; min-height: 1.4em; font: 13px/1.4 var(--mono); color: var(--light); text-align: center; }
.st-says { display: none; }
.st-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; width: 100%; max-width: 860px; padding-top: 8px; border-top: 1px solid var(--line); }
.st-wheel { display: flex; align-items: center; gap: 6px; }
.st-wheel span { font: 600 11px var(--mono); letter-spacing: .12em; color: var(--dim); }
.st-wheel output { min-width: 2.2em; text-align: center; font: 600 18px var(--mono); color: var(--light); }
.st-wheel button { width: 40px; height: 40px; border: 1px solid #5a5340; border-radius: 20px; color: var(--light); font-size: 22px; line-height: 1; background: rgba(15,17,21,.9); }
.st-lock { height: 40px; padding: 0 18px; border: 1px solid var(--light); border-radius: 20px; color: var(--light); font: 600 13px var(--mono); letter-spacing: .16em; background: rgba(15,17,21,.9); }
.st-foot, .cn-foot, .ln-foot { display: flex; gap: 8px; justify-content: center; }
.st-foot button, .cn-foot button, .ln-foot button { height: 32px; padding: 0 14px; border: 1px solid #3a3f49; border-radius: 16px; color: var(--dim); font-size: 13px; background: rgba(15,17,21,.9); }
.station kbd, .cn-station kbd, .ln-station kbd { display: none; margin-left: 8px; font: 600 11px var(--mono); color: var(--dim); }
.station button:focus-visible, .cn-station button:focus-visible, .ln-station button:focus-visible { outline: 2px solid var(--light); outline-offset: 2px; }
@media (hover: hover) { .cn-station button:hover, .ln-station button:hover { border-color: var(--light); color: var(--light); } .ln-burn:hover { background: var(--light); color: #1b1710; } .station button:hover { border-color: var(--light); color: var(--light); } .st-lock:hover { background: var(--light); color: #1b1710; } }
.cn-station button:active, .station button:active, .ln-station button:active { background: var(--light); color: #1b1710; }
/* A narrow screen: the name and the meter share one line, so both are set closer. */
@media (max-width: 480px) { .st-title { letter-spacing: .05em; } .st-meter { gap: 2px; } .st-meter i { width: 7px; } .st-meter span { letter-spacing: .04em; margin-right: 4px; } }
/* Locked: only the picture and what was said. A touch or a key puts it away. */
.station.locked .st-controls, .station.locked .st-foot { visibility: hidden; }
.station.locked .st-read { font-size: 15px; letter-spacing: .2em; text-transform: uppercase; }
/* Nothing else in the picture is in reach while he is at the rail. */
.world.at-station .w-prompts, .world.at-station .w-caption, .world.at-station .w-hint { display: none; }

/* ---- wide screens: the world fills the page, and the text is a column at its left.
   The same condition is written in js/play.js. */
@media (min-aspect-ratio: 1/1) and (min-width: 600px) {
  .play .world, .play.dark .world, .play.folded .world, .play.short .world, .play.short.folded .world, .play.short.dark .world { height: 100%; transition: none; }
  .play.no-world .world { height: 0; }
  .play .text, .play.short .text, .play.short.folded.log .text {
    left: 24px; top: 24px; width: min(460px, 46vw); height: calc(100% - 48px);
    border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6);
    transition: left 1.2s var(--ease), top 1.5s var(--ease), height 1.5s var(--ease), width 1.5s var(--ease);
  }
  /* Before anything has been named there is only the text, in the middle of the dark. */
  .play.dark .text, .play.no-world .text, .play.short.dark .text { left: calc(50% - min(230px, 23vw)); top: 24px; height: calc(100% - 48px); padding-top: 0; border-top: 1px solid var(--line); }
  /* Folded: the text has slid down into a bar at the foot of the picture. */
  .play.folded .text, .play.short.folded .text { top: calc(100% - 80px); height: 56px; width: calc(300px + var(--tools-extra, 0px)); }
  .play.folded.has-status:not(.log) .text { width: calc(410px + var(--tools-extra, 0px)); }
  .play.folded.long-status:not(.log) .text { width: calc(620px + var(--tools-extra, 0px)); }
  .play.folded.has-status .tx-tools { flex: none; }
  .play.folded.has-status .tx-head { flex-wrap: nowrap; }
  .play.folded.has-status .tx-status { order: 0; flex-basis: auto; margin-left: auto; padding: 0 6px; text-align: right; }
  .play.folded.log .text { top: 24px; height: calc(100% - 48px); width: min(460px, 46vw); }
  .play.folded .tx-body, .play.folded .chips, .play.folded .tx-input, .play.folded .more { transition: opacity .5s ease, visibility .5s; }
  .play.folded:not(.log) .tx-body, .play.folded:not(.log) .chips, .play.folded:not(.log) .tx-input, .play.folded:not(.log) .more { opacity: 0; visibility: hidden; }
  /* Opened, the log can be typed in at once: it fades in, but is never hidden while it does, so L puts the keyboard in its field. */
  .play.folded.log .tx-body, .play.folded.log .chips, .play.folded.log .tx-input, .play.folded.log .more { transition: opacity .5s ease; }
  .play.folded:not(.log) .tx-head { border-bottom-color: transparent; }
  .tool.log { display: block; }
  .hs-panel, .play.short .hs-panel { left: 24px; right: auto; width: 340px; bottom: 90px; }
  .hs-map, .play.short .hs-map { width: min(560px, calc(100vw - 48px)); }
  .hs-messages, .play.short .hs-messages { width: 380px; }

  /* The caption stays readable over the dark at a threshold. */
  .w-caption { display: block; z-index: 2; position: absolute; left: calc(348px + var(--tools-extra, 0px)); right: 24px; bottom: 30px; max-width: 660px; margin: 0 auto; text-align: center; animation: fade .3s ease-out; }
  .play.has-status .w-caption { left: calc(458px + var(--tools-extra, 0px)); }
  .play.long-status .w-caption { left: calc(668px + var(--tools-extra, 0px)); }
  .play.log .w-caption { left: calc(48px + min(460px, 46vw)); }
  /* The map is wider than the bar: the caption keeps clear of it while it is open. */
  .play.hs-map-open .w-caption { left: calc(48px + min(560px, 100vw - 48px)); }
  .world.stick-on .w-caption { right: 140px; }
  .world.keys-on .w-caption { right: 270px; }
  .w-keys { right: 24px; bottom: 24px; }
  .w-stick { right: 22px; bottom: 22px; }
  .world.stick-on .w-prompts, .world.keys-on .w-prompts { padding-right: 0; }
  .w-caption b.who { display: block; margin: 0 0 3px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--light); text-shadow: 0 1px 3px #000, 0 0 14px #000; }
  .w-caption p { margin: 0 0 4px; font-size: 18px; line-height: 1.45; color: var(--ink); text-shadow: 0 1px 3px #000, 0 0 18px #000, 0 0 30px #000; }
  .w-hint { top: 10%; }
  /* Prompts hang beside the thing they belong to. The world places them. */
  .w-prompts { right: auto; bottom: auto; top: 0; width: max-content; max-width: 380px; padding: 0; background: none; }
  .pr { min-height: 38px; padding: 0 12px 0 8px; }
  .pr kbd { display: block; }
  .pr.sub { padding-left: 12px; }
  .w-held { padding-bottom: 34px; }
  .w-face { font-size: 18px; }
  /* The instrument has the whole page, less the foot where the folded text sits. */
  .station, .cn-station, .ln-station { padding: 28px 24px 96px; gap: 12px; }
  .ln-title { font-size: 14px; }
  .ln-read { font-size: 16px; }
  .ln-controls { gap: 10px 28px; padding-top: 14px; }
  .st-title { font-size: 14px; }
  .st-meter i { width: 12px; height: 16px; }
  .st-meter span { font-size: 11px; }
  .st-read { font-size: 16px; }
  .st-says { display: block; min-height: 3.2em; max-width: 720px; text-align: center; }
  .st-says p { margin: 0 0 2px; font-size: 16px; line-height: 1.45; color: var(--ink); }
  .st-controls { gap: 10px 28px; padding-top: 14px; }
  .station kbd, .cn-station kbd, .ln-station kbd { display: inline; }
  .play.log .station, .play.log .cn-station, .play.log .ln-station { padding-left: calc(48px + min(460px, 46vw)); }
}
/* A wide screen that is not tall, such as a phone held sideways: the picture on the left,
   its wheels on the right. */
@media (min-aspect-ratio: 1/1) and (min-width: 600px) and (max-height: 520px) {
  .station { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 6px 16px; padding: 10px 16px 70px; align-items: center; justify-items: center; }
  .st-head { grid-column: 1 / -1; }
  .st-screen { grid-column: 1; grid-row: 2 / 5; align-self: stretch; height: auto; }
  .st-read { grid-column: 2; grid-row: 2; align-self: end; font-size: 14px; }
  .st-says { display: none; }
  .st-controls { grid-column: 2; grid-row: 3; border-top: 0; padding-top: 0; gap: 8px 14px; }
  .st-foot { grid-column: 2; grid-row: 4; align-self: start; }
}
/* The flight-deck panel (spec 5.6, Console): the card on the left, the window, lamps, switches and
   the plate on the right, her voice under them. */
.cn-station { flex-direction: column; align-items: center; }
.cn-station:not([hidden]) { display: flex; }
.cn-ticks { font: 600 13px var(--mono); letter-spacing: .14em; color: #ff8f63; }
.cn-body { flex: 1; min-height: 0; width: 100%; max-width: 860px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 12px; }
.cn-card { margin: 0; padding: 10px 12px; list-style: none; overflow: auto; background: #e8e0c8; color: #2a2620; border-radius: 6px; font: 12px/1.55 var(--mono); }
.cn-card li { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.cn-card li .dots { flex: 1; min-width: 6px; border-bottom: 1px dotted #8d8573; margin: 0 2px; transform: translateY(-3px); }
.cn-card li.rule, .cn-card li.under { white-space: normal; }
.cn-card li i { font-style: normal; color: #6b2d1c; margin-left: 6px; }
.cn-card li.rule { margin-top: 6px; color: #6d6656; }
.cn-card li.under { margin-top: 6px; padding-top: 6px; border-top: 1px solid #a89f88; white-space: normal; }
.cn-card li.done { color: #5a5446; }
.cn-right { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.cn-window { width: 100%; flex: 1; min-height: 40px; border-radius: 6px; border: 1px solid #2a2f33; }
.cn-lamps { display: flex; justify-content: space-between; gap: 6px; padding: 0 4px; }
.cn-lamp { width: 22px; height: 22px; border-radius: 11px; border: 1px solid #3a3f49; background: #1b1d1f; }
.cn-lamp.on { animation: beat 1s steps(2, jump-none) infinite; }
.cn-lamp.on.steady { animation: none; background: #ffc46b; box-shadow: 0 0 8px #ffc46b; }
.cn-lamp.on.odd { animation: none; background: #3a2a1a; }
.cn-lamp.on.odd.lit { background: #ffc46b; box-shadow: 0 0 10px #ffc46b; }
@keyframes beat { from { background: #ffc46b; box-shadow: 0 0 8px #ffc46b; } to { background: #3a2a1a; box-shadow: none; } }
.cn-switches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cn-switch { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 40px; padding: 0 8px; overflow: hidden; overflow-wrap: break-word; border: 1px solid #4a4638; border-radius: 8px; background: rgba(15,17,21,.95); color: var(--ink); font: 600 11px var(--mono); letter-spacing: .06em; text-align: left; }
.cn-switch kbd { display: inline !important; margin: 0; color: var(--dim); }
.cn-switch.dead { color: #6d6a62; }
.cn-switch.latched { border-color: #7a6a3a; color: #1b1710; background: var(--light); }
.cn-switch.latched kbd { color: #4a4430; }
.cn-station .cn-switch.latched:hover, .cn-station .cn-switch.latched:active { color: #1b1710; background: var(--light); }
.cn-switch.out { opacity: .4; }
.cn-switch.next { border-color: var(--light); box-shadow: 0 0 0 1px var(--light); }
.cn-switch.unlit { opacity: .25; }
.cn-ref { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cn-plate, .cn-item { min-height: 36px; padding: 0 12px; border: 1px solid #5a5340; border-radius: 18px; background: rgba(15,17,21,.95); color: var(--light); font: 600 11px var(--mono); letter-spacing: .08em; }
.cn-plate:disabled { color: var(--dim); border-color: #3a3f49; }
.cn-use { display: flex; flex-wrap: wrap; gap: 6px; }
.cn-use[hidden] { display: none; }
.cn-replies { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; max-width: 860px; }
.cn-replies[hidden] { display: none; }
.cn-replies .pr kbd { display: inline; margin: 0 6px 0 0; }
.cn-voice { margin: 0; width: 100%; max-width: 860px; font: 13px/1.4 var(--mono); color: var(--light); }
@media (max-height: 560px), (max-width: 520px) { .cn-window { display: none; } .cn-body { gap: 8px; } .cn-card { padding: 8px; font-size: 10px; line-height: 1.45; } .cn-switch { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-height: 40px; padding: 2px 5px; font-size: 9.5px; letter-spacing: 0; line-height: 1.15; } .cn-switch kbd { font-size: 9px; } .cn-lamp { width: 18px; height: 18px; } }
/* The helm (spec 5.6, Lens): the sight, his bars under it, then HEADING, RING and BURN. */
.ln-home { font: 600 13px var(--mono); letter-spacing: .14em; color: var(--light); white-space: nowrap; }
.ln-screen { flex: 1; min-height: 0; width: 100%; max-width: 860px; position: relative; touch-action: none; }
.ln-screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ln-read { margin: 0; min-height: 1.4em; max-width: 860px; font: 13px/1.4 var(--mono); color: var(--light); text-align: center; }
.ln-replies { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; max-width: 860px; }
.ln-replies[hidden] { display: none; }
.ln-replies .pr kbd { display: inline; margin: 0 6px 0 0; }
.ln-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; width: 100%; max-width: 860px; padding-top: 8px; border-top: 1px solid var(--line); }
.ln-wheel, .ln-ring { display: flex; align-items: center; gap: 6px; }
.ln-wheel span, .ln-ring span { font: 600 11px var(--mono); letter-spacing: .12em; color: var(--dim); }
.ln-wheel output, .ln-ring output { min-width: 2.6em; text-align: center; font: 600 18px var(--mono); color: var(--light); }
.ln-wheel button { width: 40px; height: 40px; border: 1px solid #5a5340; border-radius: 20px; color: var(--light); font-size: 22px; line-height: 1; background: rgba(15,17,21,.9); touch-action: none; }
.ln-burn { height: 40px; padding: 0 18px; border: 1px solid var(--light); border-radius: 20px; color: var(--light); font: 600 13px var(--mono); letter-spacing: .16em; background: rgba(15,17,21,.9); }
.ln-burn:disabled { opacity: .4; }
.ln-station.clean .ln-ring output { color: #1b1710; background: var(--light); border-radius: 4px; }
@media (max-width: 480px) { .ln-title, .ln-home { letter-spacing: .05em; font-size: 11px; } .ln-read { font-size: 12px; } .ln-foot { flex-wrap: wrap; } }
/* A finger has no keys to press. */
@media (pointer: coarse) { .pr kbd, .station kbd, .cn-station kbd, .ln-station kbd { display: none; } .pr { min-height: 44px; padding: 0 14px; } }

@media (prefers-reduced-motion: reduce) {
  .line, .card, .hs-panel, .w-prompts, .w-held, .w-hint, .w-keys, .w-stick, .w-stick::after, .station, .cn-station, .ln-station, .sheet, .w-text.in, .w-caption, .cn-lamp.on { animation: none; }
  /* The panel's lamps hold their light. The one out of step still blinks his count, slowly: it is a clue. */
  .cn-lamp.on { background: #ffc46b; box-shadow: 0 0 6px #ffc46b; }
  .world, .play .text, .w-fade { transition-duration: .01s; }
}

.lob-cloud { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; font-size: 14px; }
.lob-cloud-status { flex-basis: 100%; line-height: 1.5; }
.lob-cloud-status:empty { display: none; }
