/* b2worktv TV UI. A fixed 1080×1920 (portrait) or 1920×1080 stage, scaled to
   fit by js/stage.js. Chrome 92 floor: no :has(), no container queries, no
   nesting. Motion budget (spec 5.3): transform and opacity only, no
   backdrop-filter, one static radial gradient, at most 6 composited 3D layers. */

/* ---------------------------------------------------------------- skins */
/* Harbour (dark, default). Daylight and Graphite redefine only these tokens.
   Values match design/explorations/cockpit-v2.html. */
:root {
  color-scheme: dark;
  --harbour: #0E1A2C; --sheet: #162540; --sheet-2: #1D3050; --rule: #2A4166; --glow: #152E4E;
  --chalk: #EDF1F7; --mist: #97A6BD; --dim: #5F7190;
  --code: #0A1322; --term-bg: #060B14; --term-fg: #C9D4E5; --term-line: #1B2A44;
  --amber: #FFB347; --amber-ink: #2B1A00; --amber-text: #FFB347; --amber-line: rgba(255, 179, 71, .6);
  --cyan: #5CD3F0; --cyan-ink: #03222B; --cyan-wash: rgba(92, 211, 240, .18);
  --sea: #5BD6A0; --flare: #FF6B5E;
  /* Transcript content hues. Amber stays "needs you" and cyan "tap this"; these only carry meaning in text:
     violet structure, sky names, rose values and warnings. */
  --violet: #B7A2FF; --violet-wash: rgba(183, 162, 255, .13);
  --sky: #8DBBFF; --sky-wash: rgba(141, 187, 255, .12);
  --rose: #FF93BD; --rose-wash: rgba(255, 147, 189, .12);
  --sea-wash: rgba(91, 214, 160, .12); --flare-wash: rgba(255, 107, 94, .13);
  --chip-idle: rgba(151, 166, 189, .12); --chip-work: rgba(237, 241, 247, .1); --chip-done: rgba(91, 214, 160, .12);
  --ui: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --voice: "Newsreader", Georgia, serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.2, .85, .25, 1);
  /* Reading palette (js/theme.js applyPalette overrides these; Classic here so first paint is right). */
  --p-h1: #B7A2FF; --p-h2: #8DBBFF; --p-h3: #FF93BD; --p-strong: #D6C9FF; --p-em: #B5D2FF; --p-code: #8DBBFF; --p-quote: #B7A2FF; --p-b1: #B7A2FF; --p-b2: #8DBBFF; --p-b3: #FF93BD; --p-num: #FF93BD; --p-th: #B7A2FF; --p-info: #8DBBFF; --p-key: #B7A2FF; --p-warn: #FF93BD; --p-kw: #B7A2FF; --p-lit: #FF93BD; --p-fn: #8DBBFF; --p-var: #E0A8FF; --p-wash: 0.13; --p-code-wash: rgba(141, 187, 255, 0.13); --p-th-wash: rgba(183, 162, 255, 0.13); --p-info-wash: rgba(141, 187, 255, 0.13); --p-key-wash: rgba(183, 162, 255, 0.13); --p-warn-wash: rgba(255, 147, 189, 0.13);
}
:root[data-skin="daylight"] {
  color-scheme: light;
  --harbour: #E9EEF4; --sheet: #FFFFFF; --sheet-2: #E3E9F1; --rule: #C9D3DF; --glow: #F8FAFC;
  --chalk: #0F1B2D; --mist: #4A5A71; --dim: #77859A;
  --code: #EEF2F7; --term-bg: #FAFBFD; --term-fg: #1B2636; --term-line: #D3DBE5;
  --amber-text: #9A5600; --amber-line: #E89A2C;
  --cyan: #0A7397; --cyan-ink: #FFFFFF; --cyan-wash: rgba(10, 115, 151, .14);
  --sea: #1B7F52; --flare: #C2362B;
  --violet: #5B3CC4; --violet-wash: rgba(91, 60, 196, .08);
  --sky: #1D5FBF; --sky-wash: rgba(29, 95, 191, .08);
  --rose: #B02A63; --rose-wash: rgba(176, 42, 99, .08);
  --p-h1: #5B3CC4; --p-h2: #1D5FBF; --p-h3: #B02A63; --p-strong: #3F2A94; --p-em: #1A4C96; --p-code: #1C5AB5; --p-quote: #5B3CC4; --p-b1: #5B3CC4; --p-b2: #1D5FBF; --p-b3: #B02A63; --p-num: #B02A63; --p-th: #5B3CC4; --p-info: #1D5FBF; --p-key: #5B3CC4; --p-warn: #B02A63; --p-kw: #5B3CC4; --p-lit: #B02A63; --p-fn: #1D5FBF; --p-var: #8A2BB8; --p-wash: 0.08; --p-code-wash: rgba(28, 90, 181, 0.08); --p-th-wash: rgba(91, 60, 196, 0.08); --p-info-wash: rgba(29, 95, 191, 0.08); --p-key-wash: rgba(91, 60, 196, 0.08); --p-warn-wash: rgba(176, 42, 99, 0.08);
  --sea-wash: rgba(27, 127, 82, .09); --flare-wash: rgba(194, 54, 43, .08);
  --chip-idle: rgba(74, 90, 113, .1); --chip-work: rgba(15, 27, 45, .07); --chip-done: rgba(27, 127, 82, .12);
}
:root[data-skin="graphite"] {
  color-scheme: dark;
  --harbour: #141416; --sheet: #1F1F23; --sheet-2: #2A2A2F; --rule: #3A3A41; --glow: #222226;
  --chalk: #EDEDEF; --mist: #A3A3AB; --dim: #6D6D75;
  --code: #151517; --term-bg: #0C0C0D; --term-fg: #D4D4D8; --term-line: #2A2A2F;
  --chip-idle: rgba(163, 163, 171, .12); --chip-work: rgba(237, 237, 239, .1);
  --violet: #B8A9F0; --sky: #9DBDF0; --rose: #F0A0BF;
}

/* ---------------------------------------------------------------- page, rotation, stage */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--harbour);
  color: var(--chalk);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

/* Page rotation for a portrait-mounted or upside-down TV (setRotation, ?rotate=),
   from b2cast (D10). For quarter turns the body becomes a box the size of the
   rotated screen, centred and turned; fixed layers fill it because a transformed
   ancestor is the containing block for position: fixed. */
body[data-rotate="90"],
body[data-rotate="270"] {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100vh;
  height: 100vw;
}
body[data-rotate="90"] { transform: translate(-50%, -50%) rotate(90deg); }
body[data-rotate="270"] { transform: translate(-50%, -50%) rotate(270deg); }
body[data-rotate="180"] { transform: rotate(180deg); }

#media-layer { position: fixed; inset: 0; background: #000; visibility: hidden; }
body.media-visible #media-layer { visibility: visible; }
cast-media-player { position: absolute; inset: 0; width: 100%; height: 100%; }

#viewport { position: fixed; inset: 0; overflow: hidden; background: var(--harbour); }
body.media-visible #viewport { visibility: hidden; }

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--harbour);
  font-family: var(--ui);
}
body[data-orient="portrait"] #stage { width: 1080px; height: 1920px; }
/* The one background layer: static, never animated. */
#stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1100px 900px at 50% 30%, var(--glow) 0%, transparent 70%);
  pointer-events: none;
}

.ms {
  font-family: "Material Symbols Rounded";
  font-weight: 400;
  font-style: normal;
  font-size: 1.15em;
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
  letter-spacing: normal;
  text-transform: none;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  vertical-align: middle;
  overflow: hidden;
}
.ms.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------------------------------------------------------------- chrome: bar, summary, reconnect */
.tvbar {
  position: absolute; left: 72px; right: 72px; top: 64px; z-index: 5;
  display: flex; align-items: baseline; justify-content: space-between;
  transition: opacity .3s;
}
.brand { font-size: 30px; font-weight: 700; }
.brand i { font-style: normal; color: var(--mist); font-weight: 400; }
.clock { font-size: 30px; color: var(--mist); font-variant-numeric: tabular-nums; }
.sum { position: absolute; left: 72px; top: 124px; font-size: 30px; color: var(--mist); z-index: 5; }
.sum em { font-style: normal; color: var(--amber-text); }

.tvconn {
  position: absolute; left: 0; right: 0; top: 0; height: 72px; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  background: var(--sheet-2); color: var(--chalk); font-size: 28px;
  transform: translateY(-100%);
  transition: transform .45s var(--ease);
}
.tvconn .ms { font-size: 34px; }
.tv-reconnecting .tvconn { transform: none; }
.tv-reconnecting .tvbar { opacity: 0; }

/* ---------------------------------------------------------------- views */
.tvview { position: absolute; inset: 0; transition: opacity .45s, transform .55s var(--ease); }
.tvview.pre { opacity: 0; }
.board.pre { transform: translateY(-60px) scale(.97); }
.rview.pre { transform: translateY(560px) scale(.86); }
.pair.pre { transform: scale(.97); }

/* pair */
.pair { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 120px; gap: 28px; }
.pair .ms { font-size: 160px; color: var(--cyan); }
.pair h2 { font-size: 72px; margin: 0; line-height: 1.1; }
.pair p { font-size: 36px; color: var(--mist); margin: 0; line-height: 1.4; max-width: 30ch; }
.pair small { font-size: 28px; color: var(--dim); }
.pair .kqr { border-radius: 24px; display: block; }

/* board: a shallow deck, every title legible */
/* usage limits: slim, read-only; calm until 75, then the warning rose, then flare (amber stays "needs you") */
.limits { position: absolute; left: 72px; right: 72px; top: 172px; display: flex; flex-wrap: wrap; gap: 6px 36px; align-items: center; font-size: 24px; color: var(--mist); font-variant-numeric: tabular-nums; z-index: 5; }
.limits[hidden] { display: none; }
.lim { --tone: var(--sky); display: inline-flex; align-items: center; gap: 12px; }
.lim.warn { --tone: var(--rose); }
.lim.crit { --tone: var(--flare); }
.lim b { color: var(--chalk); font-weight: 700; }
.lim .lb { width: 150px; height: 10px; border-radius: 5px; background: var(--chip-idle); overflow: hidden; display: inline-block; }
.lim .lb i { display: block; height: 100%; background: var(--tone); border-radius: 5px; }
.lim em { font-style: normal; color: var(--tone); font-weight: 700; }
.lim small { font-size: 1em; color: var(--dim); }
.limold { color: var(--dim); }
.limits.old .lim { opacity: .55; }
.deck { position: absolute; left: 72px; right: 72px; top: 220px; bottom: 72px; perspective: 2600px; perspective-origin: 50% 0; }
.sheetc {
  position: absolute; left: 0; right: 0; top: 0;
  border-radius: 32px; background: var(--sheet); border: 2px solid var(--rule);
  padding: 38px 48px; overflow: hidden;
  transition: transform .55s var(--ease), opacity .4s;
}
.sheetc::after {
  content: ""; position: absolute; inset: 0; background: var(--harbour);
  opacity: var(--k, 0); pointer-events: none; transition: opacity .4s;
}
.sheetc.waiting { border-color: var(--amber-line); }
/* The kiosk remote's focus ring: cyan ("tap this"), inside the sheet so no neighbour hides it, readable on all three skins. */
body[data-mode="kiosk"] .sheetc.focus { outline: 6px solid var(--cyan); outline-offset: -6px; }
.rtx.kscroll { justify-content: flex-start; }
.sheetc .hd { display: flex; align-items: center; }
.model { flex: 0 1 auto; min-width: 0; max-width: 520px; overflow: hidden; text-overflow: ellipsis; font-size: 24px; color: var(--sky); background: var(--chip-idle); border-radius: 999px; padding: 4px 16px; white-space: nowrap; }
.branch { flex: none; font-family: var(--mono); font-size: 24px; color: var(--mist); background: var(--chip-idle); border-radius: 999px; padding: 4px 16px; white-space: nowrap; }
.sheetc .hd > * + * { margin-left: 20px; }
.sheetc .nm { font-size: 52px; font-weight: 700; letter-spacing: -.01em; line-height: 1.05; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state {
  display: inline-flex; align-items: center; font-size: 26px; font-weight: 500;
  padding: 8px 18px; border-radius: 999px; white-space: nowrap; flex: none;
  color: var(--mist); background: var(--chip-idle);
}
.state::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: currentColor; margin-right: 12px; }
.state.working { color: var(--chalk); background: var(--chip-work); }
.sheetc.working .state.working::before, .rview .state.working::before { animation: pulse 1.6s ease-in-out infinite; }
.state.waiting { color: var(--amber-ink); background: var(--amber); }
.state.done { color: var(--sea); background: var(--chip-done); }
.state.idle::before { background: none; box-shadow: inset 0 0 0 3px currentColor; }
.state.error { color: var(--flare); background: var(--chip-idle); }
.sheetc .act { font-size: 30px; color: var(--mist); margin-top: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheetc .act b { color: var(--chalk); font-weight: 500; }
.sheetc.front .act { font-size: 34px; white-space: normal; margin-top: 22px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sheetc .last {
  font-family: var(--voice); font-size: 36px; line-height: 1.4; margin-top: 22px; max-width: 28ch;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sheetc .nowl { display: flex; align-items: center; font-size: 28px; color: var(--mist); margin-top: 28px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.sheetc .nowl .ms { font-size: 32px; margin-right: 14px; flex: none; }
.sheetc .nowl.waiting { color: var(--amber-text); }
.sheetc .nowl.done { color: var(--sea); }
.sheetc .nowl.error { color: var(--flare); }
.sheetc .host { flex: none; font-size: 24px; color: var(--mist); background: var(--chip-idle); border-radius: 999px; padding: 4px 16px; white-space: nowrap; }
.sheetc.unreach { opacity: .55; }
.filtered { position: absolute; left: 72px; right: 72px; bottom: 28px; text-align: center; font-size: 26px; color: var(--mist); }
.filtered em { font-style: normal; color: var(--amber-text); }
.more { position: absolute; left: 72px; right: 72px; bottom: 72px; text-align: center; font-size: 28px; color: var(--dim); }
.empty { position: absolute; left: 72px; right: 72px; top: 220px; bottom: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty .ms { font-size: 140px; color: var(--dim); }
.empty h2 { font-size: 56px; margin: 28px 0 0; line-height: 1.1; }
.empty p { font-size: 36px; color: var(--mist); margin: 28px 0 0; line-height: 1.4; max-width: 30ch; }

/* reader: the sheet expanded; the back face is the live terminal */
.rview { perspective: 3200px; }
.reader { position: absolute; left: 48px; right: 48px; top: 200px; bottom: 48px; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.reader.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 32px; -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden; }
.front { background: var(--sheet); border: 2px solid var(--rule); padding: 44px 56px 40px; display: flex; flex-direction: column; }
.reader.drafting .front { padding-bottom: 230px; }
.reader.unreach .face { opacity: .55; }
.rh { display: flex; align-items: center; padding-bottom: 26px; border-bottom: 2px solid var(--rule); flex: none; }
.rh .who { min-width: 0; flex: 1; margin-right: 20px; }
.rh .nm { font-size: 56px; font-weight: 700; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh .pth { font-size: 26px; color: var(--mist); font-family: var(--mono); margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtx {
  flex: 1; min-height: 0; overflow: hidden; padding-top: 32px;
  display: flex; flex-direction: column; justify-content: flex-end;
  -webkit-mask-image: linear-gradient(transparent, #000 160px);
}
.rtx > * { flex-shrink: 0; }
.rtx > * + * { margin-top: 28px; }
.rtx .you { font-size: 32px; color: var(--mist); line-height: 1.35; padding-left: 28px; border-left: 4px solid var(--dim); white-space: pre-wrap; overflow-wrap: break-word; }
.rtx .you.quiet { border-color: transparent; color: var(--dim); }
.rtx .you .say { white-space: pre-wrap; }
.rtx .you > * + * { margin-top: 14px; }
.rtx .you.sys { border-left-color: transparent; padding-left: 0; }
.rtx .note { display: flex; align-items: baseline; gap: 16px; font-size: 24px; line-height: 1.3; color: var(--dim); white-space: normal; }
.rtx .note .lb { flex: none; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 20px; color: var(--violet); background: var(--violet-wash); border-radius: 999px; padding: 2px 16px; }
.rtx .note .tt { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mist); }
.rtx .note .ln { flex: none; font-size: 20px; color: var(--dim); }
.rtx .you .rep { white-space: normal; padding-left: 24px; border-left: 4px solid var(--violet); }
.rtx .you .rep > .cl { margin-top: 18px; color: var(--chalk); font-size: 34px; max-width: 36ch; }
.rtx .gap { align-self: center; text-align: center; font-size: 22px; line-height: 1.3; color: var(--mist); letter-spacing: .02em; }
.rtx .chips { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.rtx .chip { display: inline-flex; align-items: center; gap: 10px; font-size: 24px; color: var(--sky); background: var(--chip-idle); border-radius: 999px; padding: 4px 18px; }
.rtx .chip .ms, .rtx .file > .ms, .rtx .file .ph .ms { font-size: 1.2em; }
.rtx .file { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 28px; color: var(--mist); }
.rtx .file .nm { color: var(--sky); font-weight: 600; overflow-wrap: anywhere; }
.rtx .file .sz { color: var(--dim); font-size: 24px; }
.rtx .file .cap { flex-basis: 100%; font-size: 30px; color: var(--chalk); line-height: 1.35; white-space: pre-wrap; overflow-wrap: break-word; }
.rtx .file.img { display: block; }
.rtx .file.img .ph { display: inline-flex; align-items: center; gap: 12px; color: var(--sky); }
.rtx .file.img img { max-width: 100%; max-height: 600px; border-radius: 12px; display: block; }
.rtx .file.img .cap { margin-top: 12px; }
.rtx .cl { font-family: var(--voice); font-weight: 500; font-size: 40px; line-height: 1.4; max-width: 31ch; overflow-wrap: break-word; }
.rtx .cl * { margin: 0; }
.rtx .cl > * + * { margin-top: 18px; }
.rtx .cl > h1 + *, .rtx .cl > h2 + *, .rtx .cl > h3 + * { margin-top: 10px; }
.rtx .cl > * + h1, .rtx .cl > * + h2, .rtx .cl > * + h3 { margin-top: 30px; }
.rtx .cl h1, .rtx .cl h2, .rtx .cl h3 { font-family: var(--ui); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.rtx .cl h1 { font-size: 46px; color: var(--p-h1); padding-bottom: 8px; border-bottom: 3px solid var(--p-h1); }
.rtx .cl h2 { font-size: 40px; color: var(--p-h2); }
.rtx .cl h3 { font-size: 30px; text-transform: uppercase; letter-spacing: .06em; color: var(--p-h3); }
.rtx .cl b { font-weight: 700; color: var(--p-strong); }
.rtx .cl i { color: var(--p-em); }
.rtx .cl h1 b, .rtx .cl h2 b, .rtx .cl h3 b, .rtx .cl th b, .rtx .cl h1 i, .rtx .cl h2 i, .rtx .cl h3 i, .rtx .cl th i { color: inherit; }
.rtx .cl .lk b, .rtx .cl .lk i, .rtx .cl .lk code { color: inherit; }
.rtx .cl s { color: var(--mist); }
.rtx .cl .lk { color: var(--cyan); text-decoration: underline; text-decoration-color: var(--cyan-wash); text-underline-offset: 6px; }
.rtx .cl ul, .rtx .cl ol { padding-left: 1.3em; }
.rtx .cl li + li, .rtx .cl li > ul, .rtx .cl li > ol { margin-top: 8px; }
.rtx .cl li::marker { font-family: var(--ui); font-weight: 700; }
.rtx .cl ul.d1 > li::marker { color: var(--p-b1); }
.rtx .cl ul.d2 > li::marker { color: var(--p-b2); }
.rtx .cl ul.d3 > li::marker { color: var(--p-b3); }
.rtx .cl ol.num > li::marker { color: var(--p-num); }
.rtx .cl ul ul, .rtx .cl ol ul { list-style-type: circle; }
.rtx .cl li.task { list-style: none; position: relative; }
.rtx .cl .box { position: absolute; left: -1.15em; top: .3em; width: .7em; height: .7em; box-sizing: border-box; border: 3px solid var(--mist); border-radius: 6px; }
.rtx .cl .box.on { background: var(--sea); border-color: var(--sea); }
.rtx .cl blockquote { padding: 6px 0 6px 28px; border-left: 4px solid var(--p-quote); color: var(--mist); font-style: italic; }
.rtx .cl hr { border: 0; height: 2px; background: var(--rule); margin-top: 28px; margin-bottom: 10px; }
.rtx .cl code { font-family: var(--mono); font-size: .8em; color: var(--p-code); background: var(--p-code-wash); border-radius: 8px; padding: 2px 8px; }
.rtx .cl pre { color: var(--term-fg); }
.rtx .cl pre { position: relative; font-family: var(--mono); font-size: 24px; line-height: 1.45; background: var(--code); border-radius: 16px; padding: 18px 24px; white-space: pre-wrap; overflow: hidden; }
.rtx .cl pre .lang { position: absolute; top: 10px; right: 18px; font-family: var(--ui); font-size: 18px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--p-h3); }
.rtx .cl pre .k { color: var(--p-kw); }
.rtx .cl pre .s { color: var(--sea); }
.rtx .cl pre .n { color: var(--p-lit); }
.rtx .cl pre .c { color: var(--dim); font-style: italic; }
.rtx .cl pre .f { color: var(--p-fn); }
.rtx .cl pre .v { color: var(--p-var); }
.rtx .cl pre .a { color: var(--sea); }
.rtx .cl pre .d { color: var(--flare); }
.rtx .cl pre .h { color: var(--p-var); }
.rtx .cl .callout { border-radius: 16px; padding: 18px 24px; border-left: 6px solid var(--tone); background: var(--tone-wash); }
.rtx .cl .callout > * + * { margin-top: 12px; }
.rtx .cl .callout .ct { color: var(--tone); font-family: var(--ui); font-weight: 700; font-size: .7em; letter-spacing: .08em; text-transform: uppercase; }
.rtx .cl .callout.info { --tone: var(--p-info); --tone-wash: var(--p-info-wash); }
.rtx .cl .callout.key { --tone: var(--p-key); --tone-wash: var(--p-key-wash); }
.rtx .cl .callout.warn { --tone: var(--p-warn); --tone-wash: var(--p-warn-wash); }
.rtx .cl .callout.bad { --tone: var(--flare); --tone-wash: var(--flare-wash); }
.rtx .cl table { border-collapse: collapse; font-family: var(--ui); font-size: 26px; line-height: 1.35; background: var(--code); border-radius: 16px; overflow: hidden; }
.rtx .cl th, .rtx .cl td { padding: 12px 22px; text-align: left; vertical-align: top; }
.rtx .cl th { font-weight: 700; color: var(--p-th); background: var(--p-th-wash); border-bottom: 2px solid var(--rule); }
.rtx .cl tbody tr:nth-child(even) td { background: var(--chip-work); }
.rtx .cl td { border-top: 1px solid var(--term-line); }
.rtx .cl th.right, .rtx .cl td.right { text-align: right; }
.rtx .cl th.center, .rtx .cl td.center { text-align: center; }
.rtx .tool { font-family: var(--mono); font-size: 26px; color: var(--mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtx .tool b { color: var(--chalk); font-weight: 600; }
.rtx .tool b.look { color: var(--sky); }
.rtx .tool b.change { color: var(--violet); }
.rtx .tool b.run { color: var(--rose); }
.rtx .ok { color: var(--sea); }
.rtx .bad { color: var(--flare); }
.rtx .rn { color: var(--dim); }
.rtx > .tool + .cmd { margin-top: 6px; padding-left: 36px; font-family: var(--mono); font-size: 22px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtx .diff { font-family: var(--mono); font-size: 22px; line-height: 1.45; background: var(--code); border-radius: 16px; padding: 20px 26px; white-space: pre; overflow: hidden; }
.rtx * + .diff { margin-top: 14px; }
.diff .a { color: var(--sea); }
.diff .d { color: var(--flare); }
.diff .c { color: var(--dim); }
.raskw { flex: 0 1 auto; min-height: 0; overflow: hidden; } /* the status line below never gets pushed off the face */
.rask { border-radius: 28px; background: var(--amber); color: var(--amber-ink); padding: 34px 44px; margin-top: 28px; }
.rask h3 { margin: 0 0 14px; font-size: 30px; font-weight: 700; }
.rask .q { font-size: 36px; font-weight: 500; line-height: 1.3; margin-bottom: 18px; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.rask code { display: block; font-family: var(--mono); font-size: 30px; background: rgba(43, 26, 0, .12); border-radius: 14px; padding: 16px 22px; margin-bottom: 16px; white-space: pre-wrap; overflow-wrap: break-word; }
.rask p { margin: 0; font-size: 26px; opacity: .85; }
.rask.notice p { font-size: 32px; font-weight: 500; opacity: 1; line-height: 1.3; }
.rask .hdr { font-size: 22px; font-weight: 700; margin-left: 16px; padding: 4px 14px; border-radius: 999px; background: rgba(43, 26, 0, .14); vertical-align: 3px; }
.rask .pdiff { font-family: var(--mono); font-size: 22px; line-height: 1.45; background: rgba(43, 26, 0, .1); border-radius: 14px; padding: 14px 22px; margin: -4px 0 16px; white-space: pre; overflow: hidden; }
.pdiff .d { opacity: .6; }
.pdiff .c { opacity: .7; }
.pdiff .a { font-weight: 600; }
.rask .o { display: flex; align-items: center; font-size: 32px; padding: 12px 0; }
.rask .o .k { width: 48px; height: 48px; border-radius: 50%; background: rgba(43, 26, 0, .14); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; flex: none; margin-right: 16px; }
.rask .o.sel .k { background: var(--amber-ink); color: var(--amber); }
.rask .o.sel .l { font-weight: 700; }
.rask .o .l { min-width: 0; overflow-wrap: break-word; }
.rask .o .s { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; font-size: 24px; opacity: .75; margin-top: 2px; font-weight: 400; }
/* Several questions on one card (v1.29.0): a header row per part, tighter type so four fit the face. */
/* Flex, not grid gap: Chrome 92 has both, but flex keeps the columns equal when a question is long. */
.rask .qgrid { display: flex; flex-wrap: wrap; margin: 0 -18px 4px; }
.rask .qcol { flex: 1 1 460px; min-width: 0; padding: 0 18px; margin-bottom: 8px; }
.rask .qpart .hdr { margin-left: 0; }
.rask .qpart .multi { font-size: 20px; margin-left: 12px; opacity: .75; }
.rask .q.qm { font-size: 30px; margin: 8px 0 6px; -webkit-line-clamp: 3; }
.rask .q.qm ~ .o { font-size: 28px; padding: 6px 0; }
.rask .o.mo .k { border-radius: 10px; } /* not .ms: that is the icon font class */
.rask .o:last-of-type { margin-bottom: 12px; }
.rnow { display: flex; align-items: center; font-size: 30px; color: var(--mist); padding-top: 28px; margin-top: 28px; border-top: 2px solid var(--rule); font-variant-numeric: tabular-nums; flex: none; white-space: nowrap; overflow: hidden; }
.rnow .ms { font-size: 36px; margin-right: 16px; flex: none; }
.rnow .t, .nowl .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rnow .qd { flex: none; margin-left: auto; padding-left: 24px; color: var(--mist); font-size: 26px; }
.rnow.waiting { color: var(--amber-text); }
.rnow.done { color: var(--sea); }
.rnow.error { color: var(--flare); }

.back { background: var(--term-bg); border: 2px solid var(--term-line); transform: rotateY(180deg); }
.back .tbody { position: absolute; left: 34px; right: 34px; top: 30px; bottom: 70px; overflow: hidden; }
.back .status {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52px; padding: 0 34px;
  background: var(--sheet-2); color: var(--chalk); font-family: var(--mono); font-size: 22px;
  display: flex; align-items: center; justify-content: space-between; white-space: nowrap;
}
.back .status span { flex: none; }
.back .status .tl { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.back .ttabs { position: absolute; left: 34px; right: 34px; top: 20px; height: 44px; display: flex; gap: 12px; overflow: hidden; }
.back .ttabs:empty { display: none; }
.back.hastabs .tbody { top: 82px; }
.ttab { flex: none; max-width: 280px; font-family: var(--mono); font-size: 22px; line-height: 44px; padding: 0 20px; border-radius: 999px; color: var(--mist); background: var(--chip-idle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttab.on { color: var(--cyan); background: var(--cyan-wash); }
.back .tclosed { position: absolute; left: 34px; right: 34px; top: 82px; bottom: 70px; display: flex; align-items: center; justify-content: center; font-family: var(--voice); font-size: 44px; color: var(--mist); text-align: center; background: var(--term-bg); }
.back .xterm .xterm-viewport { overflow-y: hidden; }

/* ---------------------------------------------------------------- browser windows: a live screencast of one of b2studio's windows */
.bwin { position: absolute; left: 48px; right: 48px; top: 200px; bottom: 48px; background: var(--term-bg); border: 2px solid var(--term-line); overflow: hidden; }
.bwin .ttabs { position: absolute; left: 34px; right: 34px; top: 20px; height: 44px; display: flex; gap: 12px; overflow: hidden; }
.bwin .ttabs:empty { display: none; }
.baddr { position: absolute; left: 34px; right: 34px; top: 76px; height: 52px; display: flex; align-items: center; gap: 24px; font-family: var(--mono); font-size: 22px; white-space: nowrap; overflow: hidden; }
.baddr .bt { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--chalk); }
.baddr .bu { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--mist); }
.bload { position: absolute; left: 0; top: 130px; height: 4px; width: 100%; background: var(--cyan); opacity: 0; transform: scaleX(.12); transform-origin: left; }
.bload.on { opacity: 1; transform: scaleX(.8); transition: transform 6s var(--ease); }
.bbody { position: absolute; left: 0; right: 0; top: 134px; bottom: 0; background: #000; }
.bbody img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
.bbody img:not([src]) { visibility: hidden; }
.bstate { position: absolute; left: 0; right: 0; top: 134px; bottom: 0; display: flex; align-items: center; justify-content: center; font-family: var(--voice); font-size: 44px; color: var(--mist); text-align: center; padding: 0 60px; background: var(--term-bg); }
.bstate.live { opacity: 0; visibility: hidden; }
.btoast { position: absolute; left: 50%; bottom: 40px; max-width: 80%; transform: translateX(-50%); padding: 16px 32px; border-radius: 999px; background: var(--cyan); color: var(--cyan-ink); font-size: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bwin.notabs .baddr { top: 20px; }
.bwin.notabs .bload { top: 74px; }
.bwin.notabs .bbody, .bwin.notabs .bstate { top: 78px; }

.draft {
  position: absolute; left: 24px; right: 24px; bottom: 24px; border-radius: 28px;
  background: var(--chalk); color: var(--harbour); padding: 30px 44px;
  transform: translateY(130%); opacity: 0;
  transition: transform .45s var(--ease), opacity .3s;
}
.draft.on { transform: none; opacity: 1; }
.draft .lbl { font-size: 24px; opacity: .7; margin-bottom: 8px; }
.draft .txt { font-size: 40px; line-height: 1.3; overflow-wrap: break-word; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.draft .txt::after { content: ""; display: inline-block; width: 4px; height: 42px; background: var(--harbour); margin-left: 6px; vertical-align: -6px; animation: pulse 1s steps(2) infinite; }

/* ---------------------------------------------------------------- workflows: the reader's runs face and the board's run line */
/* Replaces only the transcript body. Newest at the top, so it reads from the top and the stage height clips the old. */
.rtx.wf { justify-content: flex-start; -webkit-mask-image: none; padding-top: 28px; }
.wfr { border-radius: 28px; background: var(--sheet-2); border: 2px solid var(--rule); padding: 26px 34px; }
.wfr.running { border-color: var(--cyan); }
.wfr .ms { flex: none; }
.wfr.done .ms, .wfa.done .ms { color: var(--sea); }
.wfr.failed .ms, .wfa.failed .ms { color: var(--flare); }
.wfr.running .ms, .wfa.running .ms { color: var(--chalk); }
.wfr.stopped .ms, .wfa.stopped .ms { color: var(--dim); }
.wfr:not(.open) { display: flex; align-items: center; padding-top: 20px; padding-bottom: 20px; }
.wfr:not(.open) .ms { font-size: 40px; margin-right: 20px; }
.wfr:not(.open) .wfname { flex: 1 1 auto; min-width: 0; font-size: 32px; }
.wfr:not(.open) .wfst { flex: none; margin-left: 24px; font-size: 24px; color: var(--mist); }
.wfr:not(.open) .wftally { flex: 0 1 auto; min-width: 0; margin-left: 24px; font-size: 24px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfr:not(.open) .wft { margin-left: 24px; }
.wfhd { display: flex; align-items: flex-start; }
.wfhd .ms { font-size: 64px; margin-right: 24px; }
.wfx { flex: 1; min-width: 0; }
.wfname { font-family: var(--voice); font-weight: 600; font-size: 44px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfdesc { font-size: 28px; line-height: 1.35; color: var(--mist); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wfmeta { font-size: 26px; line-height: 1.35; color: var(--dim); margin-top: 10px; font-variant-numeric: tabular-nums; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wfmeta b { font-weight: 600; color: var(--mist); }
.wfph { display: flex; margin-top: 22px; overflow: hidden; }
.wfph span { flex: none; font-family: var(--mono); font-size: 22px; color: var(--mist); background: var(--chip-idle); border-radius: 999px; padding: 4px 18px; margin-right: 12px; white-space: nowrap; }
.wfbar { display: flex; align-items: center; height: 12px; margin-top: 22px; overflow: hidden; }
.wfbar .wfs { flex: 1 1 0; max-width: 44px; height: 12px; border-radius: 6px; margin-right: 4px; background: var(--dim); }
.wfs.done { background: var(--sea); }
.wfs.failed { background: var(--flare); }
.wfs.running { background: var(--chalk); opacity: .75; }
.wfs.stopped { background: var(--dim); opacity: .6; }
.wfmore { flex: none; margin-left: 8px; font-family: var(--mono); font-size: 22px; line-height: 12px; color: var(--dim); }
.wferr { font-family: var(--mono); font-size: 24px; line-height: 1.4; color: var(--flare); margin-top: 18px; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wfag { margin-top: 14px; }
.wfa { display: flex; align-items: flex-start; padding: 16px 0; border-top: 2px solid var(--rule); }
.wfn { flex: none; width: 44px; margin-right: 20px; text-align: right; font-family: var(--mono); font-size: 24px; line-height: 34px; color: var(--dim); }
.wfm { flex: 1; min-width: 0; }
.wfl { font-family: var(--mono); font-weight: 600; font-size: 28px; line-height: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfsub { font-size: 22px; color: var(--dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wfans { font-family: var(--voice); font-size: 28px; line-height: 1.35; color: var(--mist); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wft { flex: none; font-size: 24px; line-height: 34px; color: var(--dim); font-variant-numeric: tabular-nums; margin-left: 20px; white-space: nowrap; }
.wfa .ms { font-size: 34px; margin-left: 14px; }
.wfdrop { font-size: 24px; color: var(--dim); margin-top: 6px; padding-top: 14px; border-top: 2px solid var(--rule); }
.wfempty { text-align: center; padding: 140px 40px 0; }
.wfempty h2 { font-family: var(--voice); font-size: 56px; margin: 0; line-height: 1.1; }
.wfempty p { font-size: 36px; color: var(--mist); margin: 28px auto 0; line-height: 1.4; max-width: 30ch; }
/* board: the run line under a sheet's activity */
.wfline { display: flex; align-items: center; margin-top: 14px; overflow: hidden; }
.wfline .ms { flex: none; font-size: 30px; color: var(--mist); margin-right: 14px; }
.wfq { flex: none; font-size: 26px; color: var(--mist); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wfline .wfbar { flex: 1; min-width: 0; max-width: 420px; height: 10px; margin: 0 0 0 20px; }
.wfline .wfbar .wfs { height: 10px; max-width: 28px; }

/* ---------------------------------------------------------------- landscape stage */
body[data-orient="landscape"] .pair p, body[data-orient="landscape"] .empty p { max-width: 40ch; }
body[data-orient="landscape"] .sheetc .last { max-width: 60ch; -webkit-line-clamp: 2; }
body[data-orient="landscape"] .rtx .cl { max-width: 60ch; }
/* A receding sheet shows only its title band here, so its run line moves up beside the chip. */
/* Landscape is 1080 tall: the open run's head and older runs take a left column, its agents the right,
   so the list is not cut off below the head. display:contents lifts head and body into the grid. */
body[data-orient="landscape"] .rtx.wf { display: grid; grid-template-columns: 640px minmax(0, 1fr); grid-template-rows: repeat(5, auto) minmax(0, 1fr); grid-auto-flow: row dense; column-gap: 40px; align-content: stretch; overflow: hidden; }
body[data-orient="landscape"] .rtx.wf > .wfr { grid-column: 1; margin-top: 0; margin-bottom: 20px; align-self: start; }
body[data-orient="landscape"] .rtx.wf > .wfr.open { display: contents; }
body[data-orient="landscape"] .rtx.wf > .wfr:not(.open) .wftally { display: none; }
body[data-orient="landscape"] .rtx.wf .wfhead { grid-column: 1; grid-row: 1; align-self: start; margin-bottom: 20px; border-radius: 28px; background: var(--sheet-2); border: 2px solid var(--rule); padding: 26px 34px; }
body[data-orient="landscape"] .rtx.wf .wfhead.running { border-color: var(--cyan); }
body[data-orient="landscape"] .rtx.wf .wfbody { grid-column: 2; grid-row: 1 / -1; min-height: 0; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 90px), transparent); }
body[data-orient="landscape"] .rtx.wf .wfag { margin-top: 0; }
body[data-orient="landscape"] .rtx.wf .wfag .wfa:first-child { border-top: 0; padding-top: 0; }
body[data-orient="landscape"] .rtx.wf .wfhd .ms { font-size: 52px; margin-right: 20px; }
body[data-orient="landscape"] .rtx.wf .wfname { font-size: 40px; }
body[data-orient="landscape"] .sheetc:not(.front) .wfline { position: absolute; top: 48px; right: 290px; margin: 0; max-width: 560px; }
body[data-orient="landscape"] .sheetc:not(.front) .wfline .wfbar { flex: none; width: 200px; }

/* ---------------------------------------------------------------- reduced motion: cross-fades only */
@media (prefers-reduced-motion: reduce) {
  .reader, .sheetc, .draft, .tvview, .tvconn { transition: opacity .2s !important; }
  .tvview.pre, .draft { transform: none !important; }
  .tvconn { transform: none; opacity: 0; }
  .tv-reconnecting .tvconn { opacity: 1; }
  .reader.flipped .front { opacity: 0; }
  .ms.spin, .state::before, .draft .txt::after { animation: none !important; }
}

/* ---------------------------------------------------------------- LAN band (contract v1.28.0) */
/* Rose, a warning: its own row under the summary line, so it never overlaps the summary, the clock or the voice band. */
.tvlan {
  position: absolute; left: 72px; top: 164px; z-index: 6; width: fit-content; max-width: calc(100% - 144px);
  font-size: 24px; color: var(--rose); background: var(--rose-wash); border: 2px solid var(--rose); border-radius: 999px;
  padding: 6px 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
  opacity: 0; transform: translateY(-12px);
  transition: transform .45s var(--ease), opacity .3s;
}
.tvlan b { letter-spacing: .06em; }
.tv-lan .tvlan { opacity: 1; transform: none; }
.tv-lan .deck { top: 240px; }
.tv-lan .reader { top: 220px; }
.tv-reconnecting .tvlan { opacity: 0; }
.lan { flex: none; font-size: 24px; font-weight: 700; letter-spacing: .06em; color: var(--rose); background: var(--rose-wash); border: 2px solid var(--rose); border-radius: 999px; padding: 2px 14px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .tvlan { transform: none; transition: opacity .2s !important; }
}

/* ---------------------------------------------------------------- voice band (contract v1.17.0) */
.tvvoice {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 0 72px 56px; pointer-events: none;
  opacity: 0; transform: translateY(100%);
  transition: transform .45s var(--ease), opacity .3s;
}
.tv-voice .tvvoice { opacity: 1; transform: none; }
.vband { background: var(--sheet-2); color: var(--chalk); border: 3px solid var(--cyan); border-radius: 28px; padding: 28px 40px; }
.vband.draft { border-color: var(--amber-line); }
.vstate { display: flex; align-items: center; gap: 18px; font-size: 28px; color: var(--cyan); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.vstate em { font-style: normal; font-weight: 400; color: var(--mist); text-transform: none; letter-spacing: 0; }
.vdot { width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); flex: none; }
.vband.thinking .vdot, .vband.speaking .vdot { animation: vpulse 1.2s ease-in-out infinite; }
@keyframes vpulse { 50% { opacity: .35; } }
.vheard { font-family: var(--voice); font-size: 40px; line-height: 1.35; margin-top: 14px; overflow-wrap: break-word; }
.vsay { font-size: 30px; line-height: 1.35; margin-top: 10px; color: var(--mist); overflow-wrap: break-word; }
.vdraft { margin-top: 18px; padding-top: 16px; border-top: 2px solid var(--amber-line); }
.vdl { font-size: 26px; color: var(--amber-text); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.vdt { font-family: var(--voice); font-size: 36px; line-height: 1.35; margin-top: 8px; overflow-wrap: break-word; }
@media (prefers-reduced-motion: reduce) {
  .tvvoice { transform: none; transition: opacity .2s !important; }
  .vband .vdot { animation: none !important; }
}
