/* The demo page (web/twin.html), in enactra.ai's look: its paper, ink and signal yellow, Schibsted Grotesk.
   One bold thing: the signal yellow, on the line between the twin and the real camera and on the live dot. Everything else stays quiet. */
:root {
  --paper: #f6f7f8;
  --wash: #e2e6e9;
  --card: #ffffff;
  --ink: #000000;
  --ink-2: #5b636b;
  --line: #c9cfd4;
  --signal: #f2c230;
  --scrim: rgba(12, 14, 16, 0.5);
  --lift: 0 18px 50px rgba(16, 20, 24, 0.16), 0 2px 6px rgba(16, 20, 24, 0.06);
  --gutter: clamp(16px, 4vw, 56px);
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17191c; --wash: #0d0f11; --card: #202327; --ink: #ffffff; --ink-2: #9aa2aa; --line: #363c42;
    --scrim: rgba(0, 0, 0, 0.6); --lift: 0 18px 50px rgba(0, 0, 0, 0.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17191c; --wash: #0d0f11; --card: #202327; --ink: #ffffff; --ink-2: #9aa2aa; --line: #363c42;
  --scrim: rgba(0, 0, 0, 0.6); --lift: 0 18px 50px rgba(0, 0, 0, 0.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  background-image: radial-gradient(120% 90% at 78% 82%, var(--wash) 0%, var(--paper) 62%);
  color: var(--ink);
  font-family: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* --- the column: the picture as large as the window allows, everything aligned to it ------------------------------- */
.page {
  --w: min(100%, 1600px);
  padding: 0 var(--gutter) 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.page > * { width: var(--w); }
/* the fold: the header, the title, the panes and the controls in one window (a laptop's too), the footer under it. The
   panes have what the rest leaves (.stage), never more than the column's width gives them; a window too short for
   that scrolls */
.fold { display: flex; flex-direction: column; max-height: max(100dvh, 520px); padding: 14px 0 10px; container-type: inline-size; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; display: block; }

.top .status { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.top .feed { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.top .feed button {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 5px 11px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: color .15s, background-color .15s;
}
.top .feed button:hover { color: var(--ink); }
.top .feed button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.top .feed button[hidden], .top .feed button:not([aria-pressed="true"]) .pulse { display: none; }
.top .feed:not(.one) button[aria-pressed="true"] .pulse { border-color: currentColor; }
.top .feed.one { border: 0; background: none; padding: 0; }   /* (no replay feed: the one button is the status) */
.top .feed.one button { padding: 0; background: none; color: var(--ink); cursor: default; }
.top .status-time { color: var(--ink-2); font-weight: 400; margin-left: 6px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-2); position: relative; flex: none; }
.top .status[data-kind="live"] .pulse { background: var(--signal); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }
.top .status[data-kind="live"] .pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--signal);
  animation: ping 2.4s cubic-bezier(.2, .6, .3, 1) infinite;
}
.top .status[data-kind="replay"] .pulse { background: transparent; border: 2px solid var(--ink-2); }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* the title and its one line, side by side */
.intro { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; margin: 14px 0 12px; }
.intro h1 { margin: 0; font-size: clamp(26px, 2.3vw, 36px); font-weight: 500; line-height: 1.1; letter-spacing: -0.028em; }
.intro .lede { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.4; }

/* --- the two panes: the twin left, the camera right; each keeps its shape, the row is as tall as the larger ----------- */
/* The row's height: the larger pane's (--rowk: its share of the row), from the column's width (100cqw: .fold), and no
   more than the fold leaves the stage (100cqh: .stage). Where the window is short the panes are narrower (--pw), centred */
.stage {
  --split: 0.6; --div: 18px; --hint: 28px; --rowk: max(var(--split), 1 - var(--split));
  --pw: min(100%, calc((100cqh - var(--hint)) * 16 / 9 / var(--rowk) + var(--div)));
  flex: 0 1 auto; height: calc((100cqw - var(--div)) * var(--rowk) * 9 / 16 + var(--hint)); min-height: 240px; container-type: size;
}
.stage:is(.novideo, .video-late) { --rowk: 1; --div: 0px; }
.panes { --crop: 0.1; position: relative; display: flex; align-items: center; width: var(--pw); margin-inline: auto; }
.pane { position: relative; border-radius: 14px; overflow: hidden; background: var(--wash); isolation: isolate; }
#view3d { flex: 0 0 calc((100% - var(--div)) * var(--split)); container: pane3d / inline-size; }
#videoBox { flex: 0 0 calc((100% - var(--div)) * (1 - var(--split))); background: #0d0f11; }
#sim { position: relative; z-index: 1; display: block; width: 100%; aspect-ratio: 16 / 9; }
#video { display: block; width: 100%; aspect-ratio: 16 / 9; }
#videoBox:not(:has(#video)) { aspect-ratio: 16 / 9; }   /* (its shape before the video is there: nothing moves when it comes) */
/* --crop (.panes): the camera burns its location into its picture, bottom left, so the server serves the video cropped
   (data/cameras/<camera>.json serve_crop, r2s/privacy.py serve_crop: the same share off the width and the height, from
   the top right, so it stays 16:9 and the date and time stay). The 3D is cut alike, so the Camera view still frames what
   the video does: drawn 1 / (1 - crop) larger, the pane hides the rest (not in a game: there it fills the window).
   Keep it equal to serve_crop. */
#sim { transform-origin: top right; transform: scale(calc(1 / (1 - var(--crop)))); }
/* a feed served whole (web/config.js FEED_SERVED_CROP: the replay): its video cut here by the same share, as the 3D */
.panes[data-vcrop="page"] #video { transform-origin: top right; transform: scale(calc(1 / (1 - var(--crop)))); }
.dragging, .dragging * { cursor: col-resize !important; user-select: none; }
.dragging #sim, .dragging #video { pointer-events: none; }

/* the line: over both panes (z-index), so its grip, wider than the gap, shows whole over the seam */
.divider { flex: 0 0 var(--div); align-self: stretch; position: relative; z-index: 2; cursor: col-resize; touch-action: none; }
.divider::before { content: ""; position: absolute; top: 12%; bottom: 12%; left: 50%; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--line); transition: background-color .15s; }
.divider .grip {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); transition: transform .15s, background-color .15s, color .15s, border-color .15s;
}
.divider .grip::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }   /* (46 px to grab: a finger) */
.divider .grip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.divider:hover::before, .dragging .divider::before, .divider:focus-visible::before { background: var(--signal); }
.divider:hover .grip, .dragging .divider .grip, .divider:focus-visible .grip { background: var(--signal); border-color: var(--signal); color: #000; transform: scale(1.1); }
.divider:focus-visible { outline: none; }

.tag {
  position: absolute; z-index: 4; top: 12px; left: 12px; padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: rgba(14, 16, 18, 0.62); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
}

/* the weak-link notice (web/telemetry.js): one calm line at the foot of the 3D's pane, never over the camera's picture */
.net-note {
  position: absolute; z-index: 4; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 5px 11px; border-radius: 8px;
  max-width: calc(100% - 24px); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(14, 16, 18, 0.62); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
}
.net-note[hidden] { display: none; }
/* ?debug=1 (web/telemetry.js): the page's numbers */
.tel-panel {
  position: fixed; z-index: 50; left: 8px; bottom: 8px; margin: 0; padding: 8px 10px; max-width: calc(100vw - 16px); overflow-x: auto;
  border-radius: 8px; background: rgba(0, 0, 0, 0.78); color: #e8eaec; font: 11px/1.45 ui-monospace, Menlo, monospace; pointer-events: none;
}

/* the cover (web/ui/app.js): a card in the middle of each pane while what they show (re)loads, then both shown at once.
   The first time the panes are empty under it (the same calm wash, the camera's black too); a reload keeps their last
   pictures, dimmed. A pane whose part is in (.in) has its bar full until the other's is */
.loading {
  position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 8px 12px 10px;
  border-radius: 10px; background: rgba(14, 16, 18, 0.62); color: #fff; font-size: 13px; backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); display: grid; gap: 7px; min-width: 190px; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s;
}
.covered .loading { opacity: 1; visibility: visible; transition: opacity .4s; }
.loading .bar { order: 2; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.2); overflow: hidden; position: relative; }
.loading .bar::after { content: ""; position: absolute; inset: 0 70% 0 0; background: var(--signal); animation: slide 1.4s ease-in-out infinite; }
.loading.in .bar::after { inset: 0; animation: none; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
#sim, #video, .still { transition: opacity .4s; }
#videoBox { transition: background-color .4s; }
.covered #sim, .covered #video, .covered .still { opacity: .35; }
.covered:not(.shown) #sim, .covered:not(.shown) #video { opacity: 0; }
.covered:not(.shown) #videoBox { background: var(--wash); }
.still { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: contain; }
.still ~ #video { visibility: hidden; }   /* (the new stream under the last picture, until both are in) */
body.playing .loading { display: none; }

/* no video (the stream blocked or turned off), or none yet when the 3D was shown (.video-late): the twin has the row
   (its width, not --split: the line's drag sets that inline, web/ui/app.js) */
:is(.novideo, .video-late) #view3d { flex-basis: 100%; }
:is(.novideo, .video-late) :is(#videoBox, .divider) { display: none; }

.hint {
  width: var(--pw); height: calc(var(--hint) - 8px); margin: 8px auto 0; padding: 0 2px; color: var(--ink-2); font-size: 13.5px;
  line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- the views: over the 3D (they move only it), top right; a narrow 3D has them top left, two by two, for its tag --- */
.views {
  position: absolute; z-index: 4; top: 10px; right: 10px; display: flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: rgba(14, 16, 18, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .4s;
}
.views button {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer;
  color: rgba(255, 255, 255, 0.82); transition: color .15s, background-color .15s;
}
.views button:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.views button[aria-pressed="true"] { background: #fff; color: #000; }
.views button:focus-visible { outline-color: #fff; }
.covered .views { opacity: 0; visibility: hidden; }   /* (not under the cover: the 3D they move is not there yet) */
@container pane3d (max-width: 420px) {
  .tag { display: none; }
  .views { top: 8px; left: 8px; right: auto; display: grid; grid-template-columns: repeat(2, auto); }
  .views button { padding: 4px 8px; font-size: 12px; }
}
@container pane3d (max-width: 220px) {
  .views { top: 4px; left: 4px; padding: 2px; }
  .views button { padding: 3px 5px; font-size: 11px; }
}
@container pane3d (max-width: 150px) { .views { display: none; } }   /* (too small to hold them: the keys 1-4 still work) */

/* --- the controls: one line under the panes - the styles (those that fit; the rest under "…"), the light, the games --- */
.dock { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 6px; flex-wrap: wrap; }
.pick-wrap { position: relative; }
.look { flex: 1 1 600px; min-width: 0; display: flex; gap: 10px; align-items: center; }
.look-label { flex: none; color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
#moodLabel { margin-left: 8px; }
.styles { flex: 1 1 auto; min-width: 0; display: flex; gap: 6px; align-items: center; }
.style-row { position: relative; flex: 0 1 auto; min-width: 0; display: flex; gap: 6px; overflow: hidden; }
.style-row .sw-tile, .sw-more {
  height: 38px; flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px 0 7px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.style-row .sw-tile[hidden] { display: none; }
.style-row .sw-tile .sw { width: 22px; height: 22px; border-radius: 5px; }
.style-row .sw-tile:hover, .sw-more:hover, .sw-more[aria-expanded="true"] { border-color: var(--ink); color: var(--ink); }
.style-row .sw-tile[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.style-row .sw-tile[aria-pressed="true"] .sw { box-shadow: none; }
.sw-more { padding: 0 11px; cursor: pointer; }
.sw-more svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.sw-more.on { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 -3px 0 var(--signal); }
.cta {
  height: 38px; display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; cursor: pointer; font-size: 14.5px;
  font-weight: 500; white-space: nowrap; border: 0; background: var(--ink); color: var(--paper); padding: 0 16px 0 12px; transition: opacity .2s;
}
.cta:hover { opacity: .82; }
.cta[aria-busy="true"] { opacity: .6; cursor: progress; }   /* (picked before the 3D is in: web/ui/games.js) */
.cta-icon { font-size: 17px; line-height: 1; }
.games { flex: none; display: flex; gap: 8px; }
/* a game's button and its board's (🏆, web/ui/games.js), as one split button */
.game { display: flex; gap: 2px; }
.game .cta { border-radius: 10px 0 0 10px; }
.cta-board {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 0 10px 10px 0;
  background: var(--ink); color: var(--paper); font-size: 16px; line-height: 1; cursor: pointer; transition: opacity .2s;
}
.cta-board:hover { opacity: .82; }

.pop {
  position: absolute; z-index: 20; bottom: calc(100% + 10px); left: 0; width: 372px; padding: 16px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--lift);
}
.pop[hidden] { display: none; }

.sw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; }
.sw-tile[hidden] { display: none; }
.sw-tile { display: grid; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font-size: 13px; color: var(--ink-2); }
.sw-tile .sw { height: 46px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); transition: box-shadow .15s; }
.sw-tile:hover .sw { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 0 2px var(--line); }
.sw-tile[aria-pressed="true"] { color: var(--ink); font-weight: 500; }
.sw-tile:focus-visible { outline: none; }
.sw-tile:focus-visible .sw { outline: 2px solid var(--ink); outline-offset: 2px; }
.sw-tile[aria-pressed="true"] .sw { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }

.chips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 38px; border: 1px solid var(--line); background: var(--card); padding: 0 13px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: color .15s, background-color .15s, border-color .15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn {
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font-size: 15px; font-weight: 500;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-quiet { background: transparent; }
.btn[aria-pressed="false"] { color: var(--ink-2); text-decoration: line-through; }

/* the styles' swatches: what each looks like, drawn in CSS */
.sw { display: block; background: #9aa; }
.sw-real { background: linear-gradient(#cdd7df 0 40%, #5f86a3 40% 58%, #d8c9a6 58% 74%, #8d8f8c 74%); }
.sw-toon { background: linear-gradient(#9fdcff 0 40%, #1f8ee0 40% 58%, #ffd95a 58% 74%, #6b6f7a 74%); }
.sw-comic { background: radial-gradient(circle, #1b1b1b 1.3px, transparent 1.6px) 0 0 / 6px 6px, linear-gradient(#ffe066 0 50%, #ff6b4a 50%); }
.sw-clay { background: radial-gradient(70% 90% at 30% 20%, #ffffff, #d3d1cc); }
.sw-sketch { background: repeating-linear-gradient(-45deg, transparent 0 4px, rgba(60, 60, 60, .35) 4px 5px), #f3f0e8; }
.sw-blueprint { background: linear-gradient(rgba(255, 255, 255, .28) 1px, transparent 1px) 0 0 / 9px 9px, linear-gradient(90deg, rgba(255, 255, 255, .28) 1px, transparent 1px) 0 0 / 9px 9px, #1d4f9e; }
.sw-thermal { background: linear-gradient(90deg, #12063f, #6a1b8f 30%, #e0452d 62%, #ffd447 85%, #fffbe0); }
.sw-pixel { background: conic-gradient(from 90deg at 50% 50%, #3e8948 0 25%, #f77622 0 50%, #124e89 0 75%, #feae34 0) 0 0 / 12px 12px; }
.sw-mini { background: linear-gradient(#e7f0d8, #9fcf8b 45%, #f2d27e 70%, #e7f0d8); filter: saturate(1.2); }
.sw-neonrain { background: repeating-linear-gradient(100deg, transparent 0 7px, rgba(120, 200, 255, .35) 7px 8px), linear-gradient(#0d0b2a, #2a0f4a 60%, #ff2fa0 61%, #2a0f4a 64%); }
.sw-ascii { background: #0c0f0c; position: relative; }
.sw-tile .sw-ascii::after { content: "#@%"; position: absolute; inset: 0; display: grid; place-items: center; color: #7dff8a; font: 600 13px/1 ui-monospace, Menlo, monospace; }
.style-row .sw-ascii::after { content: "#"; font-size: 12px; }

/* --- dialogs (a game's result) ----------------------------------------------------------------------------- */
.dlg {
  padding: 0; border: 0; border-radius: 18px; background: var(--card); color: var(--ink); box-shadow: var(--lift);
  width: min(780px, calc(100vw - 32px)); max-height: min(88dvh, 820px); overflow: auto;
}
.dlg::backdrop { background: var(--scrim); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.dlg[open] { animation: rise .22s cubic-bezier(.2, .7, .3, 1); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.dlg-title:focus { outline: none; }
.dlg-title { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.dlg-x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; flex: none; }
.dlg-x:hover { background: var(--wash); }
.dlg-x svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.dlg-result { width: min(460px, calc(100vw - 32px)); }
.dlg .result { padding: 4px 22px 22px; }
.result-score { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 18px; }
.result-value { font-size: 64px; font-weight: 500; line-height: 1; letter-spacing: -0.035em; }
.result-unit { font-size: 17px; color: var(--ink-2); }
.result-form { display: flex; gap: 8px; }
.result-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); font: inherit; font-size: 16px;
}
.result-form input:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: transparent; }
.result-form .btn { height: 44px; }
.result-note { margin: -8px 0 14px; min-height: 1.45em; font-size: 15px; line-height: 1.45; }
.result-saved { margin: 0; height: 44px; display: flex; align-items: center; font-weight: 500; }   /* (the form's height: nothing moves) */
.board-title { margin: 22px 0 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.board { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.board li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 7px 8px; border-bottom: 1px solid var(--line);
}
.board li.me { background: var(--signal); color: #000; border-radius: 8px; border-bottom-color: transparent; }
.board-rank { color: var(--ink-2); }
.board li.me .board-rank { color: #000; }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-weight: 500; }
.board-empty { display: block !important; color: var(--ink-2); padding: 14px 8px !important; }
.board-gap { display: block !important; padding: 2px 8px !important; color: var(--ink-2); border-bottom: 0 !important; line-height: 1; }
.result-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* --- footer ------------------------------------------------------------------------------------------------------- */
/* one line: the notice · the copyright · the contact. Narrow: one item a line, no dots (a dot never starts a line) */
.foot { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.foot > * { white-space: nowrap; }
.foot > * + *::before { content: "·"; display: inline-block; padding: 0 10px; color: var(--ink-2); }
.foot a { text-decoration: none; color: inherit; }
.foot a:hover { color: var(--ink); }

/* --- a game playing (web/twin_games.js): the twin fills the window, the game's HUD over it ------------------------ */
body.playing { overflow: hidden; }
body.playing :is(.fold, .stage, #view3d) { container-type: normal; }   /* (no containment: the panes' fixed places are the window's) */
body.playing #view3d { position: fixed; inset: 0; z-index: 30; border-radius: 0; }
body.playing #sim { width: 100vw; height: 100vh; aspect-ratio: auto; clip-path: none; transform: none; }
body.playing #view3d > :not(#sim) { display: none; }
/* the camera over the game, top right under the game's bar (its HUD: top left, the stick bottom left, the basket bottom right) */
body.playing #videoBox {
  position: fixed; z-index: 65; top: 62px; right: 12px; width: clamp(180px, 24vw, 380px); border-radius: 10px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 10px 30px rgba(0, 0, 0, 0.35);
}
body.playing #videoBox .tag { top: 8px; left: 8px; font-size: 12px; padding: 3px 8px; }
body.playing.pip-off #videoBox, body.playing .divider { display: none; }
.pip-btn { display: none; }
body.playing .pip-btn {
  display: block; position: fixed; z-index: 66; top: 70px; right: 20px; width: auto; padding: 4px 10px; border: 0; border-radius: 7px; cursor: pointer;
  background: rgba(14, 16, 18, 0.62); color: #fff; font: 500 12px "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
body.playing.pip-off .pip-btn { top: 62px; right: 12px; padding: 7px 12px; font-size: 13px; background: rgba(23, 25, 28, 0.82); }
body.playing .pip-btn:hover { background: rgba(14, 16, 18, 0.85); }
#gameLayer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#gameLayer > * { pointer-events: auto; }
#gameLayer a[href="./"] { display: none !important; }   /* (a game's link to the games' hub: here it only ends the game, as the bar does) */
#gameLayer #game, #gameLayer #game canvas, #gameLayer .kit-labels, #gameLayer #loading { pointer-events: none !important; background: none !important; }
#gameBar {
  position: fixed; z-index: 60; top: 12px; right: 12px; display: flex; gap: 12px; align-items: center; padding: 6px 6px 6px 14px;
  border-radius: 12px; background: rgba(23, 25, 28, 0.82); color: #fff; font: 14px "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#gameBar b { font-weight: 500; }
#gameBar button { font: inherit; font-weight: 500; color: #000; background: var(--signal); border: 0; border-radius: 8px; padding: 7px 12px; cursor: pointer; }
#gameBar button:hover { filter: brightness(1.05); }
.gameToast {
  position: fixed; z-index: 70; left: 50%; bottom: 40px; transform: translateX(-50%); background: #b42318; color: #fff;
  padding: 10px 16px; border-radius: 10px; font: 14px "Schibsted Grotesk", sans-serif;
}

/* --- narrower ----------------------------------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .page { --w: 100%; padding: 0 16px 22px; }
  .fold { max-height: none; padding: 16px 0 0; container-type: normal; }
  .brand { font-size: 16px; gap: 9px; }
  .brand svg { width: 22px; height: 22px; }
  .top .status { font-size: 13px; gap: 7px; }
  .top .status-time { margin-left: 2px; }
  .top .status:not([data-kind="live"]) .status-time { display: none; }
  .top .feed:not(.one) + .status-time { display: none; }
  .top .feed button { padding: 5px 9px; font-size: 13px; }
  .intro { margin: 16px 0 14px; }
  .intro h1 { font-size: 28px; }
  .intro .lede { font-size: 14.5px; }
  .stage { width: calc(100% + 32px); height: auto; min-height: 0; margin-inline: -16px; container-type: normal; }
  .panes { flex-direction: column; gap: 8px; --split: 1 !important; --div: 0px; width: auto; }
  .pane { border-radius: 0; }
  #view3d, #videoBox { flex: none; width: 100%; }
  #view3d { container-type: normal; }
  .divider { display: none; }
  .hint { width: auto; height: auto; min-height: 1.4em; margin: 10px 16px 0; padding: 0; font-size: 13px; line-height: 1.4; white-space: normal; }
  /* the views: a strip under the 3D's picture, in its pane, one finger each */
  .views {
    position: relative; top: auto; right: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
    padding: 8px 16px 0; border-radius: 0; background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .views button {
    min-height: 40px; padding: 0 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink-2); font-size: 14.5px;
  }
  .views button:hover { color: var(--ink); background: var(--card); }
  .views button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .views button:focus-visible { outline-color: var(--ink); }
  .tag { top: 8px; left: 8px; font-size: 12px; padding: 4px 8px; }
  .net-note { bottom: 8px; font-size: 12px; padding: 4px 9px; }
  .dock { display: grid; gap: 10px; margin-top: 12px; }
  .pick-wrap { position: static; }
  .look { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }   /* (each name over its line) */
  #moodLabel { margin: 6px 0 0; }
  .style-row .sw-tile, .sw-more, .cta { height: 42px; }
  .cta-board { width: 42px; height: 42px; }
  .chip { flex: 1 1 auto; padding: 0 10px; }
  .games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game .cta { flex: 1; min-width: 0; }
  .cta { justify-content: center; padding: 0 10px; gap: 7px; font-size: 14.5px; }
  .pop {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; border-radius: 18px 18px 0 0; border-width: 1px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
  .sw-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 90dvh; }
  .dlg-head { padding: 18px 16px 4px; }
  .dlg .result { padding-inline: 16px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .result-value { font-size: 46px; }
  .result-score { margin-bottom: 14px; }
  .foot { margin-top: 32px; }
  .foot > :first-child { flex-basis: 100%; white-space: normal; }   /* the notice its own line(s), then © · contact */
  .foot > :nth-child(2)::before { content: none; }
}
@media (max-width: 380px) {
  .game .cta-icon { display: none; }   /* (a 360 px phone: "Flower parade" and its 🏆 fit in half the row) */
}
/* a phone in a game, upright or on its side: the bar is a strip across the top and the game's top inset (where its HUD,
   help and cards start: parade.html --top) is under it; the camera and its button sit bottom right, over the basket
   (the stick: bottom left); a game's card (its intro, help, pause, end) has the screen, the camera waits under it; whatever
   is tapped is at least 40 px */
@media (max-width: 640px), (max-height: 480px) {
  body.playing { --bar: 48px; --bar-top: calc(8px + env(safe-area-inset-top)); --edge: calc(8px + env(safe-area-inset-right)); }
  #gameBar {
    top: var(--bar-top); left: calc(8px + env(safe-area-inset-left)); right: var(--edge); height: var(--bar); padding: 4px 4px 4px 14px;
    justify-content: space-between;
  }
  #gameBar .bar-where { display: none; }
  #gameBar button { height: 40px; padding: 0 14px; }
  body.playing #gameLayer { --top: calc(var(--bar-top) + var(--bar) + 8px); }
  body.playing #videoBox { top: auto; right: var(--edge); bottom: calc(132px + env(safe-area-inset-bottom)); width: min(44vw, 240px); }
  body.playing #videoBox .tag { display: none; }
  body.playing .pip-btn, body.playing.pip-off .pip-btn {
    top: auto; right: var(--edge); bottom: calc(86px + env(safe-area-inset-bottom)); height: 40px; padding: 0 14px; font-size: 13px;
    border-radius: 10px; background: rgba(23, 25, 28, 0.82);
  }
  body.playing:has(#gameLayer :is(.veil, #help):not([hidden])) :is(#videoBox, .pip-btn) { visibility: hidden; }
  /* (kit/livemode.js's badge, real or simulated traffic: under the bar on the right, not over it) */
  body.playing #liveBadge { top: calc(var(--bar-top) + var(--bar) + 6px) !important; left: auto !important; right: var(--edge); transform: none !important;
    max-width: 46vw; font-size: 10.5px !important; }
  .dlg-x { width: 40px; height: 40px; }
}
/* a phone on its side: the result card tighter, so its score, the name to save and the top of the board fit at once (the rest scrolls) */
@media (max-height: 480px) {
  .dlg { max-height: calc(100dvh - 16px); }
  .dlg-head { padding-top: 12px; }
  .result-score { margin: 0 0 12px; }
  .result-value { font-size: 44px; }
  .board-title { margin-top: 14px; }
  .result-actions { margin-top: 12px; }
}

/* a finger: whatever is tapped (the views, the controls under the panes) is at least 40 px high */
@media (pointer: coarse) {
  .views button, .chip, .style-row .sw-tile, .sw-more, .cta { min-height: 40px; }
  .cta-board { min-width: 40px; min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
