/* The Ride — projector. The Stitch stage (dark), on a fixed 1440×810 grid scaled to the window. */
html, body { height: 100%; overflow: hidden; background: #000; }
#viewport { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; background: var(--d-surface-lowest); }
#stage {
  position: relative; width: 1440px; height: 810px; flex: none; overflow: hidden;
  transform: scale(var(--scale, 1)); transform-origin: center;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--d-surface); color: var(--d-on-surface); font-family: var(--f-ui);
}
.muted { color: var(--d-on-surface-variant); }
.pcb { color: var(--pc-bright); }
.saffron { color: var(--lakshmi-bright); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-md); }
.row.between { justify-content: space-between; flex-wrap: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc-bright); flex: none; }
.dot.pulse { animation: pulse 1.6s ease-in-out infinite; margin-right: var(--g-xs); }
@keyframes pulse { 50% { opacity: .35; } }

/* Layers cross-fade (the card, the backdrop) */
.layer { transition: opacity var(--enter), transform var(--enter); }
.layer.entering { opacity: 0; transform: translateY(8px); }
.layer.leaving { opacity: 0; position: absolute; pointer-events: none; }
#backdrop .layer.entering { transform: none; }

/* ---------------------------------------------------------------- backdrop: one world (public/js/scenes.js)
   Every backdrop is drawn at 1600×900 (80 px past each side, 45 px above the stage): its horizon lands on
   stage y 455 and its near ground meets the road at y 694. Far and near layers, the sun between them, then one
   grade for every scene: the same contrast, saturation and horizon haze, a light tint toward the stop's persona,
   and a little darker when the room is running late (--late, 0…1). No global scrim: cards carry their own. */
#backdrop {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; --par: 0;
  filter: saturate(.8) contrast(.92) brightness(calc(.96 - var(--late, 0) * .24));
  transition: filter 1.6s ease;
}
#backdrop .layer { position: absolute; inset: 0; transition-duration: 900ms; }
#backdrop .far-wrap, #backdrop .near-wrap { position: absolute; left: -80px; top: -45px; width: 1600px; height: 900px; transition: transform 1.4s var(--glide-ease); }
/* Parallax: when the convoy moves along the stop, the near layer shifts more than the far one */
#backdrop .far-wrap { transform: translateX(calc(var(--par) * -0.015px)); }
#backdrop .near-wrap { transform: translateX(calc(var(--par) * -0.05px)); }
/* Arriving: the new scene settles in from the direction of travel */
#backdrop .layer.entering .far-wrap { transform: translateX(calc(var(--par) * -0.015px + 12px)); }
#backdrop .layer.entering .near-wrap { transform: translateX(calc(var(--par) * -0.05px + 40px)); }
#backdrop .far, #backdrop .near { position: absolute; inset: 0; background-repeat: no-repeat; background-size: 1600px 900px; opacity: 0; transition: opacity 600ms ease; }
#backdrop .far.ok, #backdrop .near.ok { opacity: 1; }
/* Stopped: the scene holds still (nothing competes with the story); the far layer is a touch soft */
#backdrop .far { filter: blur(1px); }
#backdrop .sun { position: absolute; width: 0; height: 0; }
#backdrop .sun::before { content: ""; position: absolute; left: -280px; top: -280px; width: 560px; height: 560px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--light, #fff) 50%, transparent), color-mix(in srgb, var(--light, #fff) 14%, transparent) 55%, transparent); mix-blend-mode: screen; opacity: .8; }

#backdrop .haze { position: absolute; left: 0; right: 0; top: 330px; height: 250px; background: linear-gradient(transparent, color-mix(in srgb, var(--light, #fff) 20%, transparent) 50%, transparent); mix-blend-mode: screen; pointer-events: none; }
#backdrop .tint { position: absolute; inset: 0; background: var(--pc); opacity: .12; mix-blend-mode: soft-light; }
/* A soft vignette keeps the eye on the card and the convoy */
#backdrop .layer::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 70% at 50% 48%, transparent 55%, rgb(10 8 6 / .38)); pointer-events: none; }
#backdrop .dusk { position: absolute; inset: 0; background: #0b1030; opacity: calc(var(--late, 0) * .3); mix-blend-mode: multiply; transition: opacity 1.6s ease; }
/* Riding: the leg's panorama (3840×1080, seamless; one tile is 3200 px here) pans past, far slower than near */
#backdrop .pano .far, #backdrop .pano .near { background-repeat: repeat-x; background-size: auto 900px; }
.riding #backdrop .pano .near { animation: pan 10s linear infinite; }
.riding #backdrop .pano .far { animation: pan 34s linear infinite; }
@keyframes pan { from { background-position: 0 0; } to { background-position: -3200px 0; } }

#hud, #main, #road { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- HUD */
#hud { display: flex; align-items: center; justify-content: space-between; gap: var(--g-md); padding: var(--g-md) var(--section) var(--g-sm); min-height: 72px; background: linear-gradient(rgb(16 14 11 / .5), rgb(16 14 11 / .18) 70%, transparent); }
#hud.lobby { padding-top: var(--g-lg); }
.hud-l { display: flex; flex-direction: column; gap: var(--g-xs); min-width: 0; }
.hud-l.row { flex-direction: row; gap: var(--g-md); }
.hud-l .chapter { color: var(--pc-bright); letter-spacing: 1px; font-size: 16px; }
/* The story so far: one slim line, each persona's part in their colour */
.story-strip { font: 500 15px/20px var(--f-ui); color: var(--d-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 980px; }
.story-strip [data-p] { color: var(--pc-bright); }
.hud-r { display: flex; align-items: center; gap: var(--g-md); flex: none; }
.chip { display: inline-flex; align-items: center; gap: var(--g-sm); padding: var(--g-xs) var(--g-md); border-radius: var(--r-full); background: var(--d-surface-container); border: 1px solid var(--d-outline-variant); white-space: nowrap; }
.chip.big { padding: var(--g-sm) var(--g-lg); gap: var(--g-md); background: rgb(30 27 24 / .95); }
.chip.big .dot { width: 12px; height: 12px; background: var(--crew-bright); }
.chip.big b { color: var(--crew-bright); }
.chip b { font-weight: 500; }
.chip.host .dot { background: var(--lakshmi-bright); }
.chip.join { border-radius: var(--r-lg); background: var(--l-surface-lowest); color: var(--l-on-surface); border: 0; padding: var(--g-xs) var(--g-sm); }
.qr-mini { width: 40px; height: 40px; display: block; }

.qr-mini svg, .qr-box svg, .qr-big svg { width: 100%; height: 100%; display: block; }
.join-t { display: flex; flex-direction: column; }
.join-t .mono-md { color: var(--l-on-surface-variant); }

/* ---------------------------------------------------------------- the stage card */
#main { padding: var(--g-md) var(--section); display: grid; align-items: center; }
#main > .layer { grid-area: 1 / 1; min-width: 0; }
.card {
  width: 100%; padding: var(--g-lg) var(--g-xl); border-radius: var(--r-xl); background: rgb(30 27 24 / .9); border: 1px solid var(--d-outline-variant); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  /* A soft local scrim: the card darkens only the scene right around it */
  box-shadow: 0 0 0 1px rgb(0 0 0 / .2), 0 24px 140px 56px rgb(12 10 8 / .42);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: center; gap: var(--g-xl); transform-origin: center;
}
.col-main { grid-column: span 8; display: flex; flex-direction: column; gap: var(--g-md); min-width: 0; }
.card.sites-look .col-main { grid-column: 1 / -1; }
.story:empty, [data-head]:empty, .after:empty, .guessed:empty, .status:empty, [data-qn]:empty { display: none; }

.meter { width: 100%; height: 8px; border-radius: var(--r-full); background: var(--d-surface-highest); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--pc-bright); transform-origin: left; transition: transform 250ms linear; }
[data-clock].paused { animation: pulse 1.2s ease-in-out infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------------------------------------------------------------- lobby */
#main[data-layout="lobby"] { padding: var(--g-md) var(--section); }
.lobby { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--g-xl); align-items: center; }
.lobby-l { grid-column: span 8; display: flex; flex-direction: column; gap: var(--g-md); }
.qr-card { grid-column: 9 / -1; justify-self: end; padding: var(--g-lg); border-radius: var(--r-xl); background: var(--l-surface-lowest); color: var(--l-on-surface); border: 1px solid var(--l-outline-variant); display: flex; flex-direction: column; align-items: center; gap: var(--g-sm); text-align: center; }
.qr-big { width: 208px; height: 208px; padding: var(--g-sm); border-radius: var(--r-lg); border: 1px solid var(--l-outline-variant); }
.qr-card.hands { padding: var(--g-xl); max-width: 320px; }
.qr-card.hands > .ic { font-size: 96px; color: var(--crew); }

/* ---------------------------------------------------------------- prologue (cold open, title, who's riding, ignition) */
@keyframes rev { 50% { filter: brightness(1.6); transform: scaleY(1.3); } }
/* One line at a time: the prologue and the story beats sit in a compact card, centred over the scene */
.card.prologue { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--g-md); max-width: 1040px; justify-self: center; }
.prologue [data-title]:empty { display: none; }
.prologue [data-line] { font: 600 36px/46px var(--f-display); color: var(--d-on-surface); }
.prologue [data-title]:not(:empty) + [data-line] { font: 600 26px/34px var(--f-ui); color: var(--d-on-surface-variant); }
.prologue [data-line].long { font: 600 28px/40px var(--f-display); text-align: left; }
.meter.rev { display: none; width: 360px; height: 12px; }
.meter.rev i { background: var(--crew-bright); transform: none; width: 100%; }
[data-beat="ignite"] .meter.rev, [data-beat="fired"] .meter.rev { display: block; }
[data-beat="ignite"] .meter.rev i { animation: idle-rev 1.2s ease-in-out infinite alternate; }
[data-beat="fired"] .meter.rev i { animation: rev 600ms ease-in-out 3; }
@keyframes idle-rev { from { transform: scaleX(.35); } to { transform: scaleX(.5); } }
.meter.rev i { transform-origin: left; }

/* ---------------------------------------------------------------- arrive and ride cards */
.card.arrive { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--g-sm); max-width: 760px; justify-self: center; }
.card.ride { display: flex; flex-direction: column; align-items: center; gap: var(--g-sm); max-width: 640px; justify-self: center; text-align: center; }
.card.ride .mono-lg { color: var(--lakshmi-bright); font-size: 32px; line-height: 40px; }
.card.ride .ic { font-size: 40px; }

/* ---------------------------------------------------------------- Stop 1: the two websites */
.card.sites-q .col-main { grid-column: span 5; }
.card.sites-q .col-q { grid-column: span 7; }
.sites { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--g-md); perspective: 1600px; }
.site-in { position: relative; display: grid; transition: transform 800ms var(--glide-ease); transform-style: preserve-3d; }
.site:nth-child(2) .site-in { transition-delay: 160ms; }
.sites.flipped .site-in { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; padding: var(--g-md); border-radius: var(--r-lg); background: var(--d-surface-container); border: 1px solid color-mix(in srgb, var(--pc-bright) 50%, transparent); display: flex; flex-direction: column; gap: var(--g-sm); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face .ic { font-size: 20px; }
.face.back { transform: rotateY(180deg); background: color-mix(in srgb, var(--pc) 15%, var(--d-surface-container)); border-color: var(--pc-bright); justify-content: flex-start; }
.shot { padding: var(--g-xs); border-radius: var(--r-md); background: var(--d-surface-lowest); border: 1px solid var(--d-outline-variant); display: flex; flex-direction: column; gap: var(--g-xs); }
.shot .row { padding: 0 var(--g-xs) var(--g-xs); }
.frame { height: 160px; border-radius: var(--r-sm); overflow: hidden; background: var(--l-surface-lowest); border: 1px solid var(--d-outline-variant); position: relative; }
.sites.big .frame { height: 190px; }
.frame img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.frame iframe { position: absolute; top: 0; left: 0; width: 1280px; border: 0; transform-origin: 0 0; pointer-events: none; }
.back-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--g-sm); word-break: break-all; }
.back-in .ic.big { font-size: 48px; }
.back-in dl { align-self: stretch; text-align: left; }
.back-in dl { display: flex; flex-direction: column; gap: var(--g-sm); }
.guessed { font: 500 18px/26px var(--f-ui); }
.guessed b { font-weight: 600; }

/* ---------------------------------------------------------------- the road */
#road { display: flex; flex-direction: column; }
#lane { position: relative; height: 148px; z-index: 2; }
/* The verge: roadside grass, stones, kerbs, shrubs and milestones for the region, in the backdrop's own ground
   colour; it overlaps the backdrop above and the asphalt below, so there is no seam */
#verge { position: absolute; left: 0; right: 0; bottom: -18px; height: 120px; pointer-events: none; }
#verge .layer { position: absolute; inset: 0; background-repeat: repeat-x; background-size: 1440px 120px; transition: opacity 900ms; }
#verge .layer.entering { transform: none; }
.riding #verge .layer { animation: verge 3s linear infinite; }
@keyframes verge { to { background-position: -1440px 0; } }
#convoy { position: absolute; inset: 0; }
/* Riders ride on the asphalt (wheels a third of the way into the road), in front of the verge */
.rider { position: absolute; left: 0; bottom: -36px; width: 176px; display: flex; flex-direction: column; align-items: center; transform: translateX(var(--x, 0)); transition: transform var(--glide), opacity var(--glide); }
.rider.lead { width: 192px; }
.tagrow { display: flex; align-items: center; gap: var(--g-sm); margin-bottom: var(--g-xs); }
.rider .tagrow .tag { margin-bottom: 0; }
.rider.lead .tagrow { align-self: flex-start; margin-left: 12px; }
.bikebox { position: relative; width: 100%; display: block; }
/* Shared light: a rim in the scene's light colour on the lit side, and a soft shadow on the road away from it */
.bike { filter: drop-shadow(calc(var(--lx, 0) * 2.5px) -2px 1.5px color-mix(in srgb, var(--light, #fff) 70%, transparent)) drop-shadow(0 0 6px color-mix(in srgb, var(--light, #fff) 18%, transparent)); }
.rider .shadow { position: absolute; left: 11%; right: 11%; bottom: 2px; height: 16px; border-radius: 50%; background: radial-gradient(closest-side, rgb(0 0 0 / .55), rgb(0 0 0 / .2) 60%, transparent); transform: translateX(calc(var(--lx, 0) * -22px)) scaleX(1.12); filter: blur(1.5px); }
.rider .tag { display: inline-flex; align-items: center; gap: var(--g-xs); padding: var(--g-xs) var(--g-md); border-radius: var(--r-full); background: var(--pc); color: var(--pc-on); white-space: nowrap; transition: background var(--glide), color var(--glide); }
.rider .tag .ic { font-size: 14px; }
.bike { width: 100%; height: 112px; overflow: visible; }
.bike .tank, .bike .jacket { fill: var(--pc); stroke: var(--pc-bright); stroke-width: 2; }
.bike .jacket { stroke-width: 1.5; }
.bike .arm { stroke: var(--pc-bright); }
.bike .helmet { fill: var(--pc-bright); stroke: #161310; }
.bike .beam { opacity: .18; }
.rider.waiting { opacity: .7; transform: translateX(var(--x, 0)) translateY(-10px) scale(.94); }
.rider.waiting .tag { background: var(--d-surface-container); color: var(--pc-bright); border: 1px dashed var(--pc-bright); }
.rider.joined { animation: join 900ms var(--glide-ease); }
@keyframes join { 0% { transform: translateX(var(--x)) translateY(-10px) scale(.94); } 45% { transform: translateX(calc(var(--x) + 40px)) translateY(-18px); } 100% { transform: translateX(var(--x)); } }
#convoy.roll-in .rider { animation: roll 1.4s var(--glide-ease) both; }
@keyframes roll { from { transform: translateX(calc(var(--x) - 1100px)); } }
/* Riding: wheels spin, bodies bob, the beam brightens */
.riding .wheel { animation: spin .45s linear infinite; }
.riding .bike .body { animation: bob .5s ease-in-out infinite alternate; }
.riding .bike .beam { opacity: .3; }
.rider:nth-child(2n) .body { animation-delay: -.2s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { to { transform: translateY(-2px); } }
.rider.rev .bike { animation: shake .09s linear infinite; }
@keyframes shake { 50% { transform: translate(1px, -1px); } }
/* Ambient: the parked convoy breathes a little */
#stage:not(.riding) .rider:not(.waiting) .bike .body { animation: idle 2.4s ease-in-out infinite alternate; }
@keyframes idle { to { transform: translateY(-1px); } }

#sign { position: absolute; right: var(--section); bottom: var(--g-xs); }
#sign.beside { right: auto; left: 0; transform: translateX(var(--x)); }
#sign.arriving { animation: arrive linear both; }
@keyframes arrive { from { transform: translateX(560px); opacity: 0; } 15% { opacity: 1; } to { transform: none; } }
.milestone { padding: var(--g-sm) var(--g-md); border-radius: var(--r-md); background: var(--d-surface-container); border: 1px solid var(--pc-bright); display: flex; flex-direction: column; align-items: center; }
.milestone .mono-md { color: var(--pc-bright); font-weight: 600; }
.milestone .ic { color: var(--pc-bright); font-size: 20px; }

/* The asphalt, leaning a little toward the scene's ground colour, lit faintly at its far edge */
#strip {
  position: relative; z-index: 1; height: 56px; display: flex; align-items: center; padding: 0 var(--g-lg);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--ground, #2d2926) 30%, #34312d) 0, color-mix(in srgb, var(--ground, #2d2926) 22%, #26231f) 100%);
  box-shadow: inset 0 18px 18px -14px color-mix(in srgb, var(--light, #fff) 10%, transparent), inset 0 -2px 0 rgb(255 255 255 / .05);
  transition: background 900ms;
}
#strip i { display: block; width: 100%; height: 3px; margin-top: 10px; background: repeating-linear-gradient(90deg, rgb(251 216 140 / .55) 0 22px, transparent 22px 44px); }
.riding #strip i { animation: dashes .08s linear infinite; }
@keyframes dashes { to { background-position: -44px 0; } }

#foot { display: flex; align-items: center; justify-content: space-between; gap: var(--g-lg); padding: var(--g-md) var(--section); background: rgb(22 19 16 / .95); min-height: 60px; }
#route { display: flex; align-items: center; gap: var(--g-md); min-width: 0; }
#foot.lobby #route { flex: 1; justify-content: space-between; }
.stops { display: flex; align-items: center; gap: var(--g-md); }
.stopname { display: inline-flex; align-items: center; gap: var(--g-xs); color: var(--d-on-surface-variant); white-space: nowrap; }
.stopname .ic { font-size: 16px; }
.stopname.done { color: var(--crew-bright); }
.stopname.now { padding: var(--g-xs) var(--g-md); border-radius: var(--r-full); background: var(--pc); color: var(--pc-on); gap: var(--g-sm); }
.stopname.now .dot { background: var(--pc-on); }
.sep { color: var(--d-outline); }

/* ---------------------------------------------------------------- the PIN dialog (presenter only) */
.modal { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgb(16 14 11 / .7); }
.modal-box { width: 480px; padding: var(--g-lg); border-radius: var(--r-xl); background: var(--l-surface); color: var(--l-on-surface); display: flex; flex-direction: column; gap: var(--g-sm); }
.modal-box h3 { font: 600 24px/30px var(--f-display); }
.modal-box p { font: 400 15px/22px var(--f-ui); color: var(--l-on-surface-variant); }
.modal-box input { font: 600 24px var(--f-mono); padding: var(--g-sm) var(--g-md); border: 1px solid var(--l-outline); border-radius: var(--r-md); background: var(--l-surface-lowest); }
.modal-box .err { min-height: 20px; color: var(--l-error); font: 600 14px var(--f-ui); }
.modal-box .row { justify-content: flex-end; }
.modal-box button { font: 600 14px var(--f-ui); padding: var(--g-sm) var(--g-lg); border-radius: var(--r-md); border: 1px solid var(--l-outline-variant); background: var(--l-surface-low); min-height: 44px; }
.modal-box button.go { background: var(--l-primary); color: var(--l-on-primary); border-color: var(--l-primary); }
.state-msg { display: flex; flex-direction: column; gap: var(--g-md); }

/* Host mode: the presenter clicks the room's answer on the stage */
[data-beat="vote"] .opt[data-o], [data-beat="locked"] .opt[data-o] { cursor: pointer; }

/* ---------------------------------------------------------------- the big join QR (Q): over any screen, display only */
#joinqr { position: absolute; inset: 0; z-index: 18; display: grid; place-items: center; background: rgb(16 14 11 / .86); color: var(--d-on-surface); transition: opacity var(--enter); }
#joinqr.hidden { opacity: 0; pointer-events: none; visibility: hidden; }
.jq-in { display: flex; flex-direction: column; align-items: center; gap: var(--g-sm); text-align: center; }
/* About 60% of the stage height; the white padding is the quiet zone (over 4 modules) so phones scan from the back */
.jq-card { width: 486px; height: 486px; padding: 36px; box-sizing: border-box; border-radius: var(--r-xl); background: #fff; box-shadow: 0 16px 48px rgb(0 0 0 / .5); }
.jq-card svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.jq-url { margin-top: var(--g-md); font: 600 52px/60px var(--f-mono); letter-spacing: .01em; color: #fff; }
.jq-line { display: flex; gap: var(--g-lg); align-items: baseline; font: 500 26px/34px var(--f-ui); color: var(--d-on-surface-variant); }
.jq-n { font: 600 26px/34px var(--f-mono); color: var(--crew-bright); }
.jq-n:empty { display: none; }
.jq-vote { min-height: 24px; font: 600 18px/24px var(--f-mono); color: var(--lakshmi-bright); }

/* ---------------------------------------------------------------- the presenter's dock (mouse only; auto-hides) */
#viewport:not(.cursor-on) { cursor: none; }
#dock {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; max-width: min(1100px, calc(100vw - 32px));
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--g-sm);
  color: var(--d-on-surface); font: 500 14px/20px var(--f-ui);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity var(--enter), transform var(--enter);
}
.dock-on #dock { opacity: 1; transform: none; pointer-events: auto; }
/* One box: the notes or placeholders panel, the presenter's messages, then the controls */
.d-box { display: flex; flex-direction: column; gap: var(--g-xs); padding: var(--g-xs); border-radius: 24px; background: rgb(16 14 11 / .95); border: 1px solid var(--d-outline-variant); box-shadow: 0 8px 32px rgb(0 0 0 / .45); max-width: 100%; }
.d-msgs { display: flex; flex-direction: column; gap: var(--g-xs); padding: var(--g-xs) var(--g-sm) 0; }
.d-bar { display: flex; align-items: center; gap: var(--g-xs); }
.d-btn { display: inline-flex; align-items: center; gap: var(--g-xs); min-height: 40px; padding: var(--g-sm) var(--g-md); border-radius: var(--r-full); color: var(--d-on-surface); white-space: nowrap; transition: background var(--state); }
.d-btn .ic { font-size: 20px; }
.d-btn:hover:not(:disabled), .d-btn.on { background: var(--d-surface-highest); }
.d-btn:disabled { opacity: .4; cursor: default; }
.d-btn.go { background: var(--crew); color: #fff; font-weight: 600; padding-right: var(--g-lg); }
.d-btn.go:hover:not(:disabled) { background: #11877e; }
.d-btn.warn, .d-btn.amber { color: var(--lakshmi-bright); }
.d-btn.amber.here { background: rgb(217 119 6 / .2); }
.d-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lakshmi-bright); }
.d-dot.on { background: var(--meera-bright); }
.d-sep { width: 1px; height: 24px; background: var(--d-outline-variant); margin: 0 var(--g-xs); }
.d-toast, .d-flag { padding: 6px var(--g-md); border-radius: var(--r-md); background: var(--d-surface-container); max-width: 640px; }
.d-flag { color: var(--lakshmi-bright); background: rgb(217 119 6 / .14); }
.d-panel { padding: var(--g-sm) var(--g-md); border-radius: 18px; background: var(--d-surface-low); display: flex; flex-direction: column; gap: var(--g-sm); max-height: 50vh; max-width: 640px; overflow: auto; }
.d-panel .muted { color: var(--d-on-surface-variant); }
.d-panel ul { display: flex; flex-direction: column; gap: var(--g-xs); }
.d-panel li { display: flex; justify-content: space-between; gap: var(--g-md); }
.d-panel li.here { color: var(--lakshmi-bright); }
.d-panel .mono { font-family: var(--f-mono); color: var(--d-on-surface-variant); }
.d-panel a { color: var(--crew-bright); display: inline-flex; align-items: center; gap: 4px; margin-right: var(--g-md); }

/* ================================================================ the trip (engine.js) */
/* The dashboard on the lead motorcycle: arrival (clock face, time, early or late), fuel, hidden costs, labelled */
.dash { display: none; position: relative; align-items: stretch; gap: 8px; padding: 4px 14px 5px 8px; border-radius: var(--r-lg); background: rgb(16 14 11 / .92); border: 1px solid var(--d-outline-variant); white-space: nowrap; box-shadow: 0 4px 16px rgb(0 0 0 / .35); }
.trip-on .dash { display: inline-flex; }
.dcell { display: flex; flex-direction: column; gap: 0; }
.dl { font: 600 15px/18px var(--f-ui); letter-spacing: .6px; text-transform: uppercase; color: var(--d-on-surface-variant); }
.dv { display: inline-flex; align-items: center; gap: 6px; font: 600 18px/24px var(--f-mono); font-variant-numeric: tabular-nums; }
.dash .dt { color: var(--meera-bright); }
.dash.late .dt { color: var(--lakshmi-bright); }
.dlate { font: 500 15px/20px var(--f-ui); color: var(--meera-bright); }
.dash.late .dlate { color: var(--lakshmi-bright); }
.dash .df { color: var(--d-on-surface); }
.dash .dh { color: var(--d-on-surface); }
.dash.owed .dh { color: #FBBF24; }
.dash .dclock { width: 22px; height: 22px; }
.dash .dsep { width: 1px; align-self: stretch; background: var(--d-outline-variant); }
.dash .dfuel { font-size: 18px; color: var(--lakshmi-bright); }
.dash .dwarn { font-size: 18px; opacity: .45; }
.dash.owed .dwarn { opacity: 1; }
.dash.bump { animation: bump 700ms var(--glide-ease); }
@keyframes bump { 30% { transform: scale(1.12); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lakshmi-bright) 40%, transparent), 0 4px 16px rgb(0 0 0 / .35); } }
.dchips { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); pointer-events: none; }
.chips.float { flex-wrap: nowrap; animation: floatup 3s var(--glide-ease) forwards; }
@keyframes floatup { 0% { opacity: 0; transform: translateY(10px); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.clockface { width: 26px; height: 26px; flex: none; }
.clockface .face { fill: #f6efe6; stroke: #1e1b18; stroke-width: 1.5; }
.clockface .ticks line { stroke: #3e4947; stroke-width: 1.5; stroke-linecap: round; }
.clockface .hh, .clockface .mh { stroke: #1e1b18; stroke-linecap: round; transform-origin: 20px 20px; transition: transform 1.2s cubic-bezier(.3, 0, .2, 1); }
.clockface .hh { stroke-width: 3; }
.clockface .mh { stroke-width: 2; stroke: #c2410c; }
.clockface .pin { fill: #1e1b18; }

/* Effect chips: green = time saved, amber = time added, red-orange = rupees and bolts */
.chips { display: inline-flex; flex-wrap: wrap; gap: var(--g-sm); }
.fx { display: inline-flex; align-items: center; gap: 6px; padding: 2px 14px; border-radius: var(--r-full); font: 600 18px/28px var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; border: 1px solid; background: rgb(16 14 11 / .9); }
.warn-ic { display: inline-grid; place-items: center; width: 1em; height: 1em; border-radius: 50%; background: #F59E0B; color: #1E1B18; font: 800 .72em/1 var(--f-ui); flex: none; }
.fx.saved { color: #4ade80; border-color: rgb(74 222 128 / .55); background: color-mix(in srgb, #4ade80 14%, rgb(16 14 11 / .9)); }
.fx.added { color: #fbbf24; border-color: rgb(251 191 36 / .55); background: color-mix(in srgb, #fbbf24 14%, rgb(16 14 11 / .9)); }
.fx.rupees { color: #fb8a5a; border-color: rgb(251 138 90 / .6); background: color-mix(in srgb, #fb8a5a 14%, rgb(16 14 11 / .9)); }
.fx.bolt { color: #fb8a5a; border-color: rgb(251 138 90 / .6); background: color-mix(in srgb, #fb8a5a 14%, rgb(16 14 11 / .9)); }
.fx .warn-ic { background: #fb8a5a; }
.chips.big .fx { font-size: 20px; line-height: 30px; padding: 4px 18px; }
.chips.big .fx { animation: chipin 500ms var(--glide-ease) both; }
.chips.big .fx:nth-child(2) { animation-delay: 120ms; }
.chips.big .fx:nth-child(3) { animation-delay: 240ms; }
@keyframes chipin { from { opacity: 0; transform: translateY(8px) scale(.9); } }

/* ---------------------------------------------------------------- hidden costs: the badge on a bike, and the card when one comes due */
.bolts { position: absolute; left: 22%; top: 18%; display: flex; flex-direction: column; gap: 4px; }
.boltb { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 3px; border-radius: var(--r-full); background: rgb(16 14 11 / .9); border: 1.5px solid #F59E0B; color: #FBBF24; font: 600 12px/18px var(--f-ui); white-space: nowrap; box-shadow: 0 0 14px rgb(245 158 11 / .5); animation: wobble 1.7s ease-in-out infinite; transform-origin: 12px 50%; }
.boltb .warn-ic { font-size: 18px; }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-1px); } }
.boltb.new { animation: boltin 700ms var(--glide-ease) 700ms both, wobble 1.7s ease-in-out 1.4s infinite; }
@keyframes boltin { from { transform: scale(0) rotate(-180deg); opacity: 0; } 70% { transform: scale(1.3); } }
.boltb.falling { animation: boltfall 1.2s cubic-bezier(.45, 0, .9, .45) forwards; }
@keyframes boltfall { 0% { transform: none; } 18% { transform: translateY(-10px) rotate(-30deg); } 100% { transform: translate(-36px, 90px) rotate(-300deg); opacity: 0; } }

#detour { position: absolute; left: 0; bottom: -6px; width: 132px; height: 150px; transform: translateX(var(--x, 1100px)); opacity: 0; pointer-events: none; transition: opacity 300ms; }
#detour.on { opacity: 1; }
#detour svg { width: 100%; height: 100%; display: block; transform-origin: 50% 100%; filter: drop-shadow(calc(var(--lx, 0) * 2px) -2px 1px color-mix(in srgb, var(--light, #fff) 60%, transparent)); }
#detour.swing svg { animation: swing 1.6s cubic-bezier(.3, 0, .3, 1) 250ms both; }
@keyframes swing { 0% { transform: rotate(-88deg); opacity: 0; } 30% { transform: rotate(14deg); opacity: 1; } 50% { transform: rotate(-7deg); } 68% { transform: rotate(3.5deg); } 84% { transform: rotate(-1.5deg); } 100% { transform: none; } }
#convoy.jolt .bikebox { animation: jolt 600ms cubic-bezier(.3, 0, .2, 1); }
@keyframes jolt { 0% { transform: none; } 18% { transform: translateX(16px) rotate(-3deg); } 38% { transform: translateX(-6px) rotate(1.5deg); } 60% { transform: translateX(3px); } 100% { transform: none; } }

/* ---------------------------------------------------------------- rules */
.card.rules { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--g-lg); max-width: 1000px; justify-self: center; }
.rule-lines { display: flex; flex-direction: column; gap: var(--g-md); text-align: left; }
.rule-lines li { display: flex; align-items: center; gap: var(--g-md); animation: rise 500ms var(--glide-ease) both; animation-delay: calc(var(--k) * 380ms + 200ms); }
.rule-lines li > span:last-child { font: 500 26px/34px var(--f-ui); }
.rule-ic { width: 34px; height: 34px; font-size: 32px; flex: none; color: var(--lakshmi-bright); }
.rule-ic.warn-ic { font-size: 34px; color: #1E1B18; }
.rule-lines li:last-child > span:last-child { font-weight: 600; color: #FBBF24; }

/* ---------------------------------------------------------------- detour card */
.card.detour { display: flex; flex-direction: column; gap: var(--g-md); max-width: 1040px; justify-self: center; }
.card.detour .display-md { color: #FBBF24; text-transform: uppercase; letter-spacing: 3px; }
.card.detour .msg { font: 600 32px/42px var(--f-display); color: var(--d-on-surface); }
.card.detour .pill .warn-ic { font-size: 18px; }

/* ---------------------------------------------------------------- petrol pump: the dashboard, large */
.card.dash-card { display: flex; flex-direction: column; gap: var(--g-lg); max-width: 1100px; justify-self: center; align-items: center; }
.kicker { letter-spacing: 2px; font-size: 16px; }
.readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g-md); width: 100%; }
.readout { display: flex; align-items: center; justify-content: center; gap: var(--g-md); padding: var(--g-lg); border-radius: var(--r-xl); background: var(--d-surface-container); border: 1px solid var(--d-outline-variant); }
.readout > div { display: flex; flex-direction: column; gap: 2px; }
.readout b { font: 700 44px/52px var(--f-display); color: var(--meera-bright); }
.readout.late b { color: var(--lakshmi-bright); }
.readout.fuel b, .readout.hc b { color: var(--d-on-surface); }
.readout.hc.owed { border-color: #F59E0B; }
.readout.hc.owed b { color: #FBBF24; }
.r-label { font: 600 14px/18px var(--f-mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--d-on-surface-variant); }
.r-sub { font: 500 18px/24px var(--f-mono); color: var(--d-on-surface-variant); }
.readout.late .r-sub { color: var(--lakshmi-bright); }
.readout .big-clock { width: 72px; height: 72px; }
.readout .big-ic { font-size: 56px; color: var(--lakshmi-bright); }
.readout .big-warn { font-size: 52px; opacity: .4; }
.readout.hc.owed .big-warn { opacity: 1; }
.card.dash-card .prompt { font: 600 36px/46px var(--f-display); color: var(--d-on-surface); text-align: center; }

/* ---------------------------------------------------------------- the trip ledger and routes */
.card.ledger, .card.routes { display: flex; flex-direction: column; gap: var(--g-sm); }
/* The ledger: the totals on the left, one row per choice and per hidden cost on the right */
.card.ledger { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); align-items: center; gap: var(--g-lg); }
.ledger-head { display: flex; flex-direction: column; gap: var(--g-md); }
.ledger-head > div { display: flex; flex-direction: column; gap: 2px; }
.ledger-head .ok { color: var(--meera-bright); }
.ledger-head .warn { color: var(--lakshmi-bright); }
.ledger-head .stat b { color: var(--d-on-surface); }
.ledger-rows { display: flex; flex-direction: column; gap: 6px; }
.ledger-rows { gap: 4px !important; }
.ledger-rows li { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: var(--g-md); padding: 5px var(--g-md); border-radius: var(--r-md); background: var(--d-surface-container); border-left: 3px solid var(--pc-bright); font: 400 18px/24px var(--f-ui); }
.ledger-rows li.broke { border-left-color: #F59E0B; background: color-mix(in srgb, #F59E0B 9%, var(--d-surface-container)); }
.ledger-rows .where { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ledger-rows li.broke .where { color: #FBBF24; }
.ledger-rows .what b { color: var(--pc-bright); margin-right: 4px; font-family: var(--f-mono); }
.ledger-head .stat b.headline-lg { font-size: 32px; line-height: 40px; }
.route-chart { width: 100%; max-height: 160px; height: auto; display: block; }
.route-chart .axis { font: 500 13px var(--f-mono); fill: var(--d-on-surface-variant); }
.route-chart .tick { stroke: var(--d-outline-variant); stroke-dasharray: 2 4; }
.route-chart .ideal { stroke: var(--d-outline); stroke-dasharray: 6 6; }
.route-chart .rt { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; opacity: .85; stroke-dasharray: 2000; animation: draw 1.6s var(--glide-ease) both; }
.route-chart .rt.careful { animation-delay: .15s; }
.route-chart .rt.shortcut { animation-delay: .3s; }
.route-chart .rt.over-cautious { animation-delay: .5s; }
.route-chart .rt.room { stroke-width: 6; opacity: 1; animation-delay: .8s; filter: drop-shadow(0 0 6px rgb(255 255 255 / .45)); }
@keyframes draw { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }
.rt.optimal { stroke: var(--meera-bright); } .rt-end.optimal, .route-card.optimal .nm { fill: var(--meera-bright); color: var(--meera-bright); }
.rt.careful { stroke: #80D5CB; } .rt-end.careful, .route-card.careful .nm { fill: #80D5CB; color: #80D5CB; }
.rt.shortcut { stroke: #fb8a5a; } .rt-end.shortcut, .route-card.shortcut .nm { fill: #fb8a5a; color: #fb8a5a; }
.rt.over-cautious { stroke: var(--arif-bright); } .rt-end.over-cautious, .route-card.over-cautious .nm { fill: var(--arif-bright); color: var(--arif-bright); }
.rt.room { stroke: #fff8ec; } .rt-end.room { fill: #fff8ec; font-weight: 700; }
.rt-end { font: 600 14px var(--f-mono); }
.route-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--g-sm); }
.route-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 8px var(--g-md); border-radius: var(--r-lg); background: var(--d-surface-container); border: 1px solid var(--d-outline-variant); }
.route-card .nm { font: 600 18px/24px var(--f-ui); }
.route-card .rc-time { font: 700 28px/34px var(--f-display); }
.route-card .rc-meta { color: var(--d-on-surface-variant); font-size: 16px; }
.route-card p { font: 400 15px/20px var(--f-ui); color: var(--d-on-surface); }
.route-card.is-room { border: 2px solid #fff8ec; box-shadow: 0 0 20px -4px rgb(255 255 255 / .4); padding: 7px calc(var(--g-md) - 1px); }
.room-tag { position: absolute; top: 8px; right: var(--g-md); font: 600 13px/18px var(--f-ui); color: #161310; background: #fff8ec; padding: 0 8px; border-radius: var(--r-full); }
.room-key { display: inline-flex; align-items: center; gap: var(--g-sm); color: #fff8ec; }
.room-key i { width: 28px; height: 6px; border-radius: 3px; background: #fff8ec; box-shadow: 0 0 6px rgb(255 255 255 / .5); }
#main:has(.card.routes), #main:has(.card.ledger) { align-items: start; padding-top: var(--g-sm); }
.card.routes .headline-lg { font-size: 28px; line-height: 34px; }
.room-key { font-size: 16px; }

.card.closing { max-width: 1100px; }
.card.signoff h1 { color: var(--crew-bright); }
.closing-lines { display: flex; flex-direction: column; align-items: center; gap: var(--g-md); text-align: center; }
.closing-lines li { font: 600 32px/42px var(--f-display); color: var(--d-on-surface); animation: rise 600ms var(--glide-ease) both; animation-delay: calc(var(--k) * 500ms + 200ms); }
.closing-lines li:last-child { color: var(--crew-bright); }
.closing-more { display: none; font: 500 24px/34px var(--f-ui); color: var(--d-on-surface); padding: var(--g-sm) var(--g-lg); border-radius: var(--r-lg); background: rgb(45 212 191 / .1); border: 1px solid rgb(45 212 191 / .45); animation: rise 600ms var(--glide-ease) both; }
.card.closing.more .closing-more { display: flex; flex-direction: column; align-items: center; }

/* ---------------------------------------------------------------- cold open: four cards, turned one by one */
.card.coldcards { display: flex; flex-direction: column; align-items: center; gap: var(--g-md); }
.cc-grid { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--g-lg); perspective: 1400px; }
.coldcards.n3 { max-width: 1180px; justify-self: center; }
.coldcards.n3 .cc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cc { position: relative; transition: opacity 500ms ease, filter 500ms ease; }
.coldcards.focus .cc:not(.just) { opacity: .35; filter: saturate(.3); }
.cc-in { position: relative; display: grid; min-height: 330px; transition: transform 1200ms cubic-bezier(.34, 1.4, .5, 1); transform-style: preserve-3d; }
.cc.flipped .cc-in { transform: rotateY(180deg); }
.cc.just { animation: cclift 1500ms cubic-bezier(.3, 0, .2, 1); z-index: 2; }
@keyframes cclift { 0% { transform: none; } 30% { transform: translateY(-28px) scale(1.14); } 75% { transform: translateY(-10px) scale(1.06); } 100% { transform: none; } }
.cc.just .cc-back { animation: ccglow 2000ms ease-out; }
@keyframes ccglow { 0% { box-shadow: 0 0 0 0 transparent; } 35% { box-shadow: 0 0 60px 8px color-mix(in srgb, var(--pc-bright) 55%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.cc.just .cc-line { animation: hook 900ms 700ms var(--glide-ease) both; }
@keyframes hook { from { opacity: 0; transform: scale(1.25); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.cc-face { grid-area: 1 / 1; padding: var(--g-lg) var(--g-md); border-radius: var(--r-xl); backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; text-align: center; }
.cc-av { width: 72px; height: 72px; font-size: 34px; margin-bottom: var(--g-xs); }
.cc-name { font: 700 30px/36px var(--f-display); color: var(--d-on-surface); }
.cc-role { color: var(--pc-bright); letter-spacing: 1px; }
.cc-front { background: linear-gradient(160deg, var(--d-surface-high), var(--d-surface-lowest)); border: 1px solid var(--d-outline-variant); }
.cc-front .cc-name { color: var(--d-outline); letter-spacing: 4px; }
.cc-front .cc-role { color: var(--d-on-surface-variant); }
.avatar.mystery { background: var(--d-surface-highest); border: 2px dashed var(--d-outline); color: var(--d-outline); font: 700 44px/1 var(--f-display); }
.cc-bars { display: flex; flex-direction: column; gap: 10px; width: 80%; margin-top: var(--g-md); }
.cc-bars i { height: 12px; border-radius: 6px; background: var(--d-surface-highest); }
.cc-bars i:last-child { width: 60%; align-self: center; }
.cc.next .cc-front { animation: ccwait 2.2s ease-in-out infinite; }
@keyframes ccwait { 50% { border-color: var(--d-outline); box-shadow: 0 0 28px -6px rgb(255 255 255 / .3); } }
.cc-back { transform: rotateY(180deg); justify-content: center; background: var(--d-surface-container); border: 1.5px solid color-mix(in srgb, var(--pc-bright) 75%, transparent); }
.cc-line { margin-top: var(--g-sm); font: 600 26px/34px var(--f-display); color: #fff8ec; }
/* The role: a pill in the persona's colour, so who they are reads at a glance */
.cc-tag { display: inline-block; padding: 2px 12px; border-radius: var(--r-full); background: color-mix(in srgb, var(--pc) 35%, transparent); border: 1px solid var(--pc-bright); color: var(--pc-bright); font: 600 16px/24px var(--f-ui); letter-spacing: .3px; }
.cc-tag.sm { font-size: 14px; line-height: 20px; padding: 1px 10px; }
.cc-place { color: var(--d-on-surface-variant); letter-spacing: 1px; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--pc); color: var(--pc-on); font-size: 28px; }
/* ---------------------------------------------------------------- the line after the cards */
.card.coldline { gap: var(--g-md); }
.cl-row { display: flex; justify-content: center; gap: var(--section); }
.cl-who { display: flex; flex-direction: column; align-items: center; gap: var(--g-sm); color: var(--d-on-surface); animation: rise 600ms var(--glide-ease) both; animation-delay: calc(var(--k) * 180ms); }
.cl-av { width: 72px; height: 72px; font-size: 36px; }
.cl-line { font: 700 40px/50px var(--f-display); color: #fff8ec; max-width: 1000px; animation: rise 900ms 900ms var(--glide-ease) both; }
.cl-you { font: 800 52px/62px var(--f-display); max-width: 1100px; color: #fff8ec; filter: drop-shadow(0 0 22px rgb(255 248 236 / .35)); animation: youin 1100ms 1900ms var(--glide-ease) both; }
@keyframes youin { 0% { opacity: 0; transform: scale(1.18); filter: blur(6px); } 60% { opacity: 1; transform: scale(.98); filter: drop-shadow(0 0 30px rgb(255 248 236 / .6)); } 100% { transform: none; filter: drop-shadow(0 0 22px rgb(255 248 236 / .35)); } }
/* ---------------------------------------------------------------- Stop 1: website */
.sites.one { grid-template-columns: minmax(0, 1fr); }
.sites.big.one { max-width: 760px; width: 100%; justify-self: center; align-self: center; }
.sites.big.one .frame { height: 200px; }
.card.sites-look .site { cursor: pointer; transition: transform var(--state); }
.card.sites-look .site:hover { transform: translateY(-3px); }
.card.sites-look .col-main { align-items: center; }

/* Foreground website: independent of, and never participating in, the bottom road layout */
#stage.focus-site #road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 264px;
  z-index: 3;
}
#stage.focus-site #hud { z-index: 4; }
#stage.focus-site #main {
  position: absolute;
  left: 72px;
  right: 72px;
  top: 84px;
  bottom: 264px;
  z-index: 5;
  padding: 0;
  display: block;
}
#stage.focus-site #main > .layer { height: 100%; }
.card.site-focus {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-color: var(--crew-bright);
  box-shadow: 0 30px 120px 30px rgb(0 0 0 / .6);
  animation: sfin 700ms var(--glide-ease) both;
}
@keyframes sfin { from { transform: scale(.6) translateY(40px); opacity: 0; } }
.sf-bar { flex: none; display: flex; align-items: center; gap: var(--g-md); padding: var(--g-sm) var(--g-md); background: var(--d-surface-high); border-bottom: 1px solid var(--d-outline-variant); }
.sf-dots { display: flex; gap: 6px; }
.sf-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--d-outline); }
.sf-dots i:nth-child(1) { background: #f87171; } .sf-dots i:nth-child(2) { background: #fbbf24; } .sf-dots i:nth-child(3) { background: #4ade80; }
.sf-url { flex: 1; display: inline-flex; align-items: center; gap: 6px; padding: 4px var(--g-md); border-radius: var(--r-full); background: var(--d-surface-lowest); color: var(--d-on-surface); }
.sf-scroll { flex: 1; min-height: 0; overflow-y: auto; background: #faf7f2; scrollbar-width: thin; }
.sf-scroll img { display: block; width: 100%; height: auto; }

/* Lobby: the title and line sit on the game's dark card, readable on any sky */
.lobby-l { padding: var(--g-xl); border-radius: var(--r-xl); background: rgb(30 27 24 / .86); border: 1px solid var(--d-outline-variant); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 24px 140px 56px rgb(12 10 8 / .38); }
.lobby-l .muted { color: var(--d-on-surface); opacity: .85; }
.lobby { align-items: center; }


/* ================================================================ v5: the question card, the stop's own cards, the palace */
/* A question: the persona's situation on the left, the question on the right (listen → vote → locked → reveal).
   The layout never changes between those beats, so nothing jumps. Text stays at 18 CSS px or more (24 px at 1080p). */
.card.qcard { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--g-lg); align-items: stretch; }
.situ { display: flex; flex-direction: column; gap: var(--g-sm); padding: var(--g-md) var(--g-lg); border-radius: var(--r-lg); background: var(--d-surface-container); border-left: 4px solid var(--pc-bright); }
.situ-head { display: flex; align-items: center; gap: var(--g-md); }
.situ-av { width: 56px; height: 56px; font-size: 28px; }
.situ-who { display: flex; flex-direction: column; }
.situ-who b { font: 700 30px/36px var(--f-display); color: var(--pc-bright); }
.situ-who span { font: 600 18px/24px var(--f-ui); color: var(--d-on-surface-variant); }
.situ-place { font: 500 16px/22px var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--d-on-surface-variant); padding-bottom: var(--g-sm); border-bottom: 1px solid var(--d-outline-variant); }
.situ-facts { display: flex; flex-direction: column; gap: 10px; }
.situ-facts li { position: relative; padding-left: 22px; font: 500 19px/26px var(--f-ui); color: var(--d-on-surface); }
.situ-facts li::before { content: ""; position: absolute; left: 3px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--d-on-surface-variant); }
.col-q { display: flex; flex-direction: column; gap: 8px; min-width: 0; justify-content: center; }
.q-top { display: flex; align-items: center; justify-content: space-between; gap: var(--g-md); min-height: 32px; }
.q-n { font: 600 18px/24px var(--f-mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--pc-bright); }
.status { display: inline-flex; align-items: center; gap: var(--g-md); margin-left: auto; }
.st-label { display: inline-flex; align-items: center; gap: 6px; font: 600 18px/24px var(--f-ui); }
.st-label .ic { font-size: 22px; }
.st-clock { font: 600 26px/30px var(--f-mono); font-variant-numeric: tabular-nums; }
.st-voted { font: 500 18px/24px var(--f-mono); color: var(--d-on-surface-variant); }
.st-label.chose[data-t] { padding: 2px 12px; border-radius: var(--r-full); background: var(--d-surface-highest); }
.story { font: 400 20px/28px var(--f-ui); color: var(--d-on-surface); }
.story.context { font-style: italic; color: var(--d-on-surface-variant); }
.story.solo { font: 600 30px/40px var(--f-display); color: var(--d-on-surface); }
.q-head { font: 600 32px/40px var(--f-display); color: var(--d-on-surface); }
.q-meter { height: 10px; }
.q-meter i { background: var(--pc-bright); }
/* The timer bar shows while voting; its room is kept after, so the answers never move */
[data-beat="locked"] .q-meter, [data-beat="reveal"] .q-meter { visibility: hidden; }
[data-beat="listen"] .q-meter, [data-beat="listen"] .opts, [data-beat="listen"] .q-top { display: none; }

/* Answers: the share of votes fills each card from the left */
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px var(--g-sm); }
.opt { position: relative; overflow: visible; padding: 17px var(--g-md) 12px; border-radius: var(--r-lg); background: var(--d-surface-container); border: 2px solid var(--d-outline-variant); transition: border-color var(--state), box-shadow var(--state); }
.opt .fill { position: absolute; inset: 0 auto 0 0; border-radius: 14px 0 0 14px; width: var(--p, 0%); background: rgb(255 255 255 / .09); transition: width var(--glide); pointer-events: none; }
.opt-top { position: relative; display: flex; align-items: center; gap: var(--g-sm); min-height: 48px; }
.opt .key { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--d-surface-highest); font: 600 17px/1 var(--f-mono); color: var(--d-on-surface); }
.opt .t { flex: 1; font: 500 18px/24px var(--f-ui); color: var(--d-on-surface); }
.opt .pct { flex: none; font: 600 18px/24px var(--f-mono); color: var(--d-on-surface-variant); }
.opt .tags { position: absolute; top: -38px; right: -2px; /* from the answer row: 17 px padding, 2 px border, then half the tag above the border */ display: inline-flex; z-index: 1; }
.tag { box-shadow: 0 0 0 2px rgb(30 27 24); padding: 2px 10px; border-radius: var(--r-full); font: 600 15px/22px var(--f-ui); background: var(--d-surface-highest); color: var(--d-on-surface); animation: chipin 500ms var(--glide-ease) both; }
@keyframes chipin { from { opacity: 0; transform: translateY(8px) scale(.9); } }
/* Host mode: the presenter's pick while voting */
.opt.picked { border-color: var(--pc-bright); }
/* Locked: the leading answer is marked; a tie is dashed amber */
.opt.lead { border-color: var(--pc-bright); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc-bright) 20%, transparent); }
.opt.lead .t { font-weight: 600; }
.opt.lead .pct { color: var(--pc-bright); }
.opt.lead .fill { background: color-mix(in srgb, var(--pc-bright) 18%, transparent); }
.tag.lead { background: var(--pc-bright); color: var(--pc-on); }
[data-p="lakshmi"] .tag.lead { color: #161310; }
.tag.pick { background: var(--d-on-surface); color: rgb(30 27 24); margin-left: 6px; }
.opt.tie { border: 2px dashed var(--lakshmi-bright); }
.tie-note { font: 600 20px/28px var(--f-ui); color: var(--lakshmi-bright); }
/* Reveal: the room's choice, coloured by its type (smart green, careful teal, over-cautious indigo, shortcut orange) */
.opt.chosen { border-color: var(--tc, var(--d-on-surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 22%, transparent); }
.opt.chosen .t { font-weight: 600; }
.opt.chosen .fill { background: color-mix(in srgb, var(--tc) 16%, transparent); }
[data-t="smart"] { --tc: #4ADE80; }
[data-t="careful"] { --tc: #2DD4BF; }
[data-t="over-cautious"] { --tc: #A5B4FC; }
[data-t="shortcut"] { --tc: #FB8A5A; }
[data-t="answer"] { --tc: #4ADE80; }
.tag[data-t] { color: var(--tc); }
.st-label.chose { color: var(--tc); }
[data-beat="reveal"] .opt:not(.chosen) { opacity: .5; }
.outcome { display: flex; align-items: center; flex-wrap: wrap; gap: var(--g-sm) var(--g-md); }
.outcome-line { flex: 1 1 360px; font: 600 20px/27px var(--f-ui); color: var(--tc); }
.chips.big .fx { animation: chipin 500ms var(--glide-ease) both; }
.chips.big .fx:nth-child(2) { animation-delay: 120ms; }
.chips.big .fx:nth-child(3) { animation-delay: 240ms; }
/* The guess: who built it */
.reveal-note { font: 600 22px/30px var(--f-ui); color: #4ADE80; }
.reveal-line { font: 700 26px/34px var(--f-display); color: var(--d-on-surface); animation: rise 700ms 1.2s var(--glide-ease) both; }
.card.sites-q { align-items: center; gap: var(--g-lg); }
.card.sites-look { max-width: 1000px; justify-self: center; }
.card.sites-look .story.solo { text-align: center; }

/* One idea on a card: the takeaway, the handover (the lead-in in the persona's colour) */
.card.solo { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--g-md); max-width: 1080px; justify-self: center; }
.solo-text { font: 700 38px/48px var(--f-display); color: var(--d-on-surface); }
.lead-in { font: 600 32px/42px var(--f-display); }
.card.handover .lead-in + .solo-text { font: 600 26px/34px var(--f-ui); color: var(--d-on-surface-variant); }

/* A stop's own card: a title and short bullets; the last line (Insight Out) arrives on the next click */
.card.info { display: flex; flex-direction: column; gap: var(--g-md); max-width: 1120px; justify-self: center; }
.info-title { font: 700 34px/42px var(--f-display); color: var(--d-on-surface); }
.info-bullets { display: flex; flex-direction: column; gap: 10px; }
.info-bullets li { position: relative; padding-left: 26px; font: 500 22px/30px var(--f-ui); color: var(--d-on-surface); animation: rise 500ms var(--glide-ease) both; animation-delay: calc(var(--k) * 260ms + 150ms); }
.info-bullets li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--pc-bright); }
.tok { display: inline-block; padding: 0 10px; border-radius: var(--r-sm); font: 600 19px/28px var(--f-mono); }
.tok.from { background: var(--d-surface-highest); color: var(--d-on-surface-variant); text-decoration: line-through; text-decoration-color: rgb(255 255 255 / .35); }
.tok.to { background: color-mix(in srgb, var(--pc-bright) 22%, transparent); color: var(--pc-bright); }
.tok-arrow { margin: 0 8px; color: var(--d-on-surface-variant); }
.info-foot { font: 500 20px/28px var(--f-ui); font-style: italic; color: var(--d-on-surface-variant); }
.info-more { display: none; align-items: center; gap: var(--g-lg); padding-top: var(--g-md); border-top: 1px solid var(--d-outline-variant); }
.card.info.more .info-more { display: flex; animation: rise 600ms var(--glide-ease) both; }
.ins-line { flex: 1; font: 600 28px/38px var(--f-display); color: var(--d-on-surface); }
/* "Insight Out", highlighted in the design system's teal, not the browser's yellow */
.ins-mark { background: color-mix(in srgb, var(--crew-bright) 20%, transparent); color: var(--crew-bright); padding: 0 .2em; border-radius: var(--r-sm); box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* That night: one line per row, the outcome of the room's own choices */
.card.night { display: flex; flex-direction: column; gap: var(--g-sm); max-width: 1080px; justify-self: center; }
.night-rows { display: flex; flex-direction: column; gap: var(--g-sm); }
.night-rows li { display: grid; grid-template-columns: auto 170px 1fr; align-items: center; gap: var(--g-md); padding: 8px var(--g-lg); border-radius: var(--r-lg); background: var(--d-surface-container); border-left: 4px solid var(--pc-bright); animation: rise 600ms var(--glide-ease) both; animation-delay: calc(var(--k) * 600ms + 200ms); }
.n-av { width: 48px; height: 48px; font-size: 24px; }
.n-label { font: 600 18px/24px var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--pc-bright); }
.n-text { font: 600 28px/36px var(--f-display); color: var(--d-on-surface); }
.night-rows [data-tone="bad"] .n-text { color: #FB8A5A; }
.night-rows [data-tone="mixed"] .n-text { color: #FBBF24; }
.night-rows [data-tone="good"] .n-text { color: #4ADE80; }
.night-line { font: 500 22px/30px var(--f-ui); color: var(--d-on-surface-variant); text-align: center; animation: rise 600ms 2.2s var(--glide-ease) both; }

/* The gathering: the three, and the line that ties them together */
.card.gather { display: flex; flex-direction: column; gap: var(--g-lg); max-width: 1180px; justify-self: center; }
.travellers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g-md); }
.trav { display: flex; flex-direction: column; gap: var(--g-sm); padding: var(--g-md) var(--g-lg); border-radius: var(--r-xl); background: var(--d-surface-container); border: 2px solid var(--pc-bright); animation: rise 500ms var(--glide-ease) both; animation-delay: calc(var(--k) * 300ms); }
.trav .who { display: flex; align-items: center; gap: var(--g-sm); }
.trav .who > span { display: flex; flex-direction: column; }
.trav .who b { font: 700 26px/32px var(--f-display); }
.t-role { font: 600 16px/22px var(--f-ui); color: var(--pc-bright); }
.t-av { width: 48px; height: 48px; font-size: 24px; }
.t-line { font: 600 26px/34px var(--f-display); color: var(--d-on-surface); }
.gather-line { font: 500 22px/32px var(--f-ui); color: var(--d-on-surface); text-align: center; animation: rise 700ms 1.2s var(--glide-ease) both; }

/* ================================================================ v5 · Question 4 and the polish pass */
/* Voting stays open until the presenter locks it: at 0 the label says so */
.st-up { display: none; color: var(--lakshmi-bright); }
.card.times-up .st-open { display: none; }
.card.times-up .st-up { display: inline-flex; }
.card.times-up .st-clock { color: var(--lakshmi-bright); }

/* A three-voice stop: the team card (one compact row per persona, appearing one by one on LISTEN) */
.situ.team { border-left-color: var(--crew-bright); }
.team-rows { display: flex; flex-direction: column; gap: var(--g-md); }
.team-rows li { display: grid; grid-template-columns: auto 1fr; gap: var(--g-sm) var(--g-md); align-items: start; padding-left: 10px; border-left: 3px solid var(--pc-bright); }
.team-rows b { font: 700 22px/28px var(--f-display); color: var(--pc-bright); }
.team-rows p { font: 500 19px/26px var(--f-ui); color: var(--d-on-surface); }
.tm-av { width: 40px; height: 40px; font-size: 20px; }
[data-beat="listen"] .team-rows li { animation: rise 500ms var(--glide-ease) both; animation-delay: calc(var(--k) * 600ms + 200ms); }
.q-head.place-head { font: 700 44px/52px var(--f-display); }
/* Team pills: three small colour dots and the names */
.tdots { display: inline-flex; gap: 3px; }
.tdots i { width: 9px; height: 9px; border-radius: 50%; background: var(--pc-bright); box-shadow: 0 0 0 1.5px rgb(16 14 11 / .6); }
.team-pill { gap: var(--g-sm); }
/* The three in the convoy glow a little during their stop */
.team-stop .rider:is([data-p="meera"], [data-p="lakshmi"], [data-p="arif"]) .bike { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--pc-bright) 55%, transparent)); }

/* Late joiners: a medium QR code by the road while the first two votes are open */
#joinbig { position: absolute; right: 190px; bottom: 6px; display: flex; align-items: center; gap: var(--g-md); padding: var(--g-sm) var(--g-md) var(--g-sm) var(--g-sm); border-radius: var(--r-lg); background: var(--l-surface-lowest); color: var(--l-on-surface); box-shadow: 0 8px 28px rgb(0 0 0 / .4); opacity: 0; transform: translateY(12px); transition: opacity var(--enter), transform var(--enter); pointer-events: none; }
#joinbig.on { opacity: 1; transform: none; }
.jb-qr { width: 120px; height: 120px; }
.jb-qr svg { width: 100%; height: 100%; display: block; }
.jb-t { display: flex; flex-direction: column; gap: 2px; }
.jb-t b { font: 700 22px/28px var(--f-display); }
.jb-t span { font: 500 16px/22px var(--f-mono); color: var(--l-on-surface-variant); }

/* A hidden cost: the DETOUR sign stands where the milestone was */
#stage[data-beat="detour"] #sign { opacity: 0; transition: opacity 300ms; }

/* Bengaluru: the voice beside the website, so the card fits without scaling */
.sl-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--g-xl); align-items: center; }
.card.sites-look .story.solo { text-align: left; }
.card.sites-look { max-width: 1180px; }
.card.sites-q { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.card.sites-q .col-main, .card.sites-q .col-q { grid-column: auto; }

/* That night and the routes: the room's own, marked */
.card.night .room-tag { position: static; }
.routes-foot { font: 600 22px/30px var(--f-display); text-align: center; color: var(--d-on-surface); }

/* ================================================================ v5-final · Arif's spreadsheet, hidden costs */
/* Arif's spreadsheet: invented sample records, drawn like a real spreadsheet (light, grid lines, column letters) */
.xsheet { position: relative; display: inline-flex; flex-direction: column; max-width: 100%; border-radius: var(--r-md); background: #fff; color: #1e1b18; border: 1px solid #c9ccd1; box-shadow: 0 6px 24px rgb(0 0 0 / .35); overflow: hidden; outline: 4px solid transparent; outline-offset: 3px; transition: outline-color .6s ease, box-shadow .6s ease; }
.xs-bar { display: flex; align-items: center; gap: 10px; padding: 3px 10px; min-height: 28px; background: #f1f3f4; border-bottom: 1px solid #dadce0; color: #3c4043; font: 600 15px/20px var(--f-ui); transition: background .6s ease, color .6s ease; }
.xs-file { display: inline-flex; align-items: center; gap: 6px; }
.xs-file .ic { font-size: 17px; color: #188038; }
.xs-tag { padding: 0 9px; border-radius: var(--r-full); background: #fde68a; color: #78350f; font: 600 13px/20px var(--f-ui); }
.xs-mode { display: none; margin-left: auto; align-items: center; gap: 6px; font: 600 15px/20px var(--f-ui); animation: rise 500ms 1.4s var(--glide-ease) both; }
.xs-mode .ic { font-size: 16px; }
.xsheet[data-mode="B"] .xs-mode[data-for="B"], .xsheet[data-mode="C"] .xs-mode[data-for="C"], .xsheet[data-mode="D"] .xs-mode[data-for="D"] { display: inline-flex; }
.xs-scroll { overflow: hidden; }
.xsheet table { border-collapse: collapse; font: 500 17px/22px var(--f-ui); }
.xsheet th, .xsheet td { border: 1px solid #dadce0; padding: 0 10px; height: 22px; white-space: nowrap; text-align: left; }
.xs-letters th { height: 18px; background: #f8f9fa; color: #5f6368; font: 500 13px/18px var(--f-ui); text-align: center; }
.xsheet tr > th:first-child { width: 28px; padding: 0 6px; background: #f8f9fa; color: #5f6368; font: 500 13px/18px var(--f-ui); text-align: center; }
.xs-head td { font-weight: 700; background: #eef6f1; }
.xsheet td:is([data-c="phone"], [data-c="location"], [data-c="cattle"]) { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.xsheet td[data-c="cattle"] { text-align: right; }
/* Every version of a value is stacked in its cell; the mode picks one, column by column (0.6 s each) */
.cv { display: grid; }
.sv { grid-area: 1 / 1; transition: opacity .6s ease, transform .6s ease; transition-delay: calc(var(--c, 0) * .3s); }
.sv.rm, .sv.lab { opacity: 0; transform: translateY(6px); }
.sv.rm { color: #9aa0a6; font: italic 500 15px/22px var(--f-ui); }
.sv.lab { color: #1d4ed8; font-weight: 600; font-family: var(--f-ui); }
.xsheet:is([data-mode="A"], [data-mode="leak"]) td:is([data-c="name"], [data-c="phone"]) .full,
.xsheet[data-mode="B"] td:is([data-c="name"], [data-c="phone"], [data-c="location"]) .full { opacity: 0; transform: translateY(-6px); }
.xsheet:is([data-mode="A"], [data-mode="leak"]) td:is([data-c="name"], [data-c="phone"]) .rm,
.xsheet[data-mode="B"] td[data-c="phone"] .rm,
.xsheet[data-mode="B"] td:is([data-c="name"], [data-c="location"]) .lab { opacity: 1; transform: none; }
.xsheet[data-mode="leak"] .sv { transition: none; }
/* C: the full table, framed: our own computer, offline */
.xsheet[data-mode="C"] { outline-color: var(--crew-bright); box-shadow: 0 0 0 10px rgb(45 212 191 / .12), 0 6px 24px rgb(0 0 0 / .35); }
.xsheet[data-mode="C"] .xs-bar { background: var(--crew); color: #fff; }
.xsheet[data-mode="C"] .xs-file .ic { color: #fff; }
/* D: greyed out, checked by hand */
.xsheet table { transition: filter .6s ease, opacity .6s ease; }
.xsheet[data-mode="D"] table { filter: grayscale(1); opacity: .35; }
.xsheet[data-mode="D"] .xs-bar { background: #e5e7eb; }
/* The leak (hidden cost 3): locations pulse, the two-family village is still identifiable, the file was shared */
.xs-flagc { display: none; }
.xsheet[data-mode="leak"] .xs-flagc { display: table-cell; border: 0; background: #fff; padding: 0 8px; }
.xs-flag { vertical-align: middle; }
.xs-flag span { display: inline-block; padding: 2px 10px; border-radius: var(--r-full); background: #dc2626; color: #fff; font: 600 14px/20px var(--f-ui); }
.xsheet[data-mode="leak"] tr.small td:not(.xs-flagc) { background: #fee2e2; }
.xsheet[data-mode="leak"] td[data-c="location"] .full { animation: locpulse 1.4s ease-in-out infinite; }
@keyframes locpulse { 50% { color: #dc2626; text-shadow: 0 0 10px rgb(220 38 38 / .5); } }
.xs-stamp { position: absolute; left: 38%; top: 46%; padding: 4px 18px; border: 4px solid #dc2626; border-radius: 8px; color: #dc2626; background: rgb(255 255 255 / .7); font: 800 30px/1 var(--f-ui); letter-spacing: 4px; text-transform: uppercase; transform: rotate(-12deg) scale(1.8); opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.xsheet[data-mode="leak"] .xs-stamp { opacity: .9; transform: rotate(-12deg); transition-delay: 1s; }

/* The hidden-cost card: HIDDEN COST and the chips, the message large (the leaked spreadsheet under it, at Jhansi) */
.card.detour { gap: 14px; }
.detour-top { display: flex; align-items: center; justify-content: space-between; gap: var(--g-lg); flex-wrap: wrap; }
.card.detour .display-md { display: inline-flex; align-items: center; gap: 14px; }
.dt-warn { font-size: 40px; }
.card.detour .msg { font: 600 34px/44px var(--f-display); }
.card.detour.with-sheet { max-width: 1240px; padding: 18px var(--g-xl); gap: 12px; }
.card.detour.with-sheet .msg { font-size: 28px; line-height: 36px; }
.detour-sheet { display: flex; justify-content: center; }

/* Dashboard labels on the lead bike: 16 CSS px (21 px at 1080p) */
.dl { font-size: 16px; line-height: 19px; }
/* The stamp lands in the sheet's blank corner, above the flag, so the data stays readable */
.xs-stamp { left: auto; right: 14px; top: 92px; font-size: 24px; padding: 4px 14px; border-width: 3px; }
.xs-stamp { right: 10px; top: 40px; font-size: 20px; letter-spacing: 3px; padding: 3px 12px; }
.xsheet[data-mode="leak"] .xs-stamp { transform: rotate(-8deg); }

/* ================================================================ v5-final · layout fixes */
/* A question: one focused situation card on the left (about 38%), the question on the right; the card is as tall as
   its content and sits in the middle of the space above the road */
.card.qcard { display: grid; grid-template-columns: minmax(0, 38fr) minmax(0, 62fr); gap: var(--g-lg); align-items: start; padding: 20px 28px; }
.qcard .situ { gap: 4px; padding: var(--g-md) var(--g-lg); border-left-width: 3px; }
.qcard .situ-head { margin-bottom: 6px; }
.qcard .situ-av { width: 60px; height: 60px; font-size: 30px; }
.qcard .situ-who b { font: 700 34px/40px var(--f-display); }
.qcard .situ-who span { font: 600 17px/24px var(--f-ui); color: var(--d-on-surface-variant); }
.qcard .situ-facts { gap: 0; }
.qcard .situ-facts li { padding: 10px 0 10px 22px; font: 500 19px/26px var(--f-ui); }
.qcard .situ-facts li::before { top: 21px; }
.qcard .situ-facts li + li { border-top: 1px solid var(--d-outline-variant); }
/* Arif: the spreadsheet under its label */
.qcard.has-sheet { grid-template-columns: auto minmax(0, 1fr); padding: 14px 24px; }
.situ.sheet-col { padding: 12px 14px; gap: 10px; }
.sheet-label { display: flex; align-items: center; gap: 10px; font: 600 19px/24px var(--f-ui); color: var(--d-on-surface); }
.sheet-label b { font: 700 26px/30px var(--f-display); color: var(--pc-bright); }
.sl-av { width: 40px; height: 40px; font-size: 20px; }
.qcard .xsheet table { font-size: 16.5px; }
.qcard .xsheet th, .qcard .xsheet td { padding: 0 7px; }
/* The team: three rows, avatar, name, their line */
.qcard .situ.team { gap: var(--g-sm); }
.qcard .team-rows li + li { padding-top: var(--g-sm); }
/* The right column: Question n of 4, the question, the status row (timer and bar), four full-width answers */
.qcard .col-q { gap: 10px; justify-content: flex-start; }
.qcard .q-n { font: 600 16px/22px var(--f-mono); }
.qcard .q-head { font: 600 30px/38px var(--f-display); }
.qcard .q-head.place-head { font: 700 40px/48px var(--f-display); }
.q-status { display: flex; align-items: center; gap: var(--g-md); min-height: 30px; }
.q-status .status { flex: none; margin-left: 0; }
.q-status .q-meter { flex: 1; min-width: 80px; }
.qcard .opts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.qcard .opt { padding: 9px 14px 7px; }
.qcard .opt-top { min-height: 30px; }
.qcard .opt .t { font: 500 19px/24px var(--f-ui); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qcard .opt .tags { position: static; }
.qcard .after { display: flex; align-items: center; min-height: 34px; }
.qcard .outcome { flex-wrap: nowrap; gap: var(--g-md); }
.qcard .chips.big .fx { font-size: 17px; line-height: 26px; padding: 2px 14px; }
.qcard .outcome-line { flex: 1 1 auto; min-width: 0; font: 600 19px/26px var(--f-ui); }
[data-beat="listen"] .qcard .q-status, [data-beat="listen"] .qcard .after { display: none; }
#main:has(.card.qcard) { padding-top: 8px; padding-bottom: 8px; }

/* The cold open: no container, the stage darkened, a soft spotlight behind three floating cards */
#backdrop::before { content: ""; position: absolute; inset: 0; z-index: 6; background: #0b0907; opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
#stage[data-beat="cold"] #backdrop::before { opacity: .7; }
.card.coldcards { position: relative; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; gap: var(--g-lg); }
.card.coldcards::before { content: ""; position: absolute; left: 50%; top: 42%; width: 1200px; height: 560px; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgb(255 232 196 / .17), rgb(255 232 196 / .06) 55%, transparent); pointer-events: none; z-index: -1; }
.cc-face { background: #1b1815; }
.cc-front { border: 1px solid var(--d-outline-variant); box-shadow: 0 18px 50px rgb(0 0 0 / .55); }
.cc-back { border: 1.5px solid color-mix(in srgb, var(--pc-bright) 60%, transparent); box-shadow: 0 0 40px -4px color-mix(in srgb, var(--pc-bright) 38%, transparent), 0 18px 50px rgb(0 0 0 / .55); }
.cc-av { width: 96px; height: 96px; font-size: 46px; }
.avatar.mystery { font-size: 56px; }
.cc-name { font: 700 38px/44px var(--f-display); }
.cc-place, .cc-front .cc-role { color: #f3e6cf; }
.cc-line { font: 600 27px/35px var(--f-display); color: #fff6e6; }
/* Flipping: the turning card lifts, the others dim to 40%; turned cards settle at 85%; only the next one pulses */
.coldcards.focus .cc:not(.just) { opacity: .4; filter: none; }
.cc.flipped:not(.just) { opacity: .85; }
/* After the third card: all three dim, the line comes in under them */
.coldcards.final .cc { opacity: .4; }
.cc-final { display: none; font: 700 40px/50px var(--f-display); color: #fff6e6; text-align: center; text-shadow: 0 0 24px rgb(255 240 210 / .25); }
.coldcards.final .cc-final { display: block; animation: rise 900ms 300ms var(--glide-ease) both; }

/* The dashboard's change chips float just below it (over the road), never up into the stage card */
.dchips { left: auto; right: 0; bottom: auto; top: calc(100% + 8px); transform: none; }
.chips.float { animation-name: floatdown; }
@keyframes floatdown { 0% { opacity: 0; transform: translateY(-8px); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(8px); } }
.card.qcard { align-items: stretch; }
.qcard .col-q { align-self: center; }
.qcard .opt .tags { display: none; } /* the type goes in the outcome row, "Leading" in the status row: answers never change width */
.qcard .xsheet td:is([data-c="phone"], [data-c="location"], [data-c="cattle"]) { font-family: var(--f-ui); font-variant-numeric: tabular-nums; }
.st-lead { font: 600 18px/24px var(--f-ui); color: var(--pc-bright); }
.fx.type { color: var(--tc); border-color: color-mix(in srgb, var(--tc) 60%, transparent); background: color-mix(in srgb, var(--tc) 14%, rgb(16 14 11 / .9)); font-family: var(--f-ui); }
.qcard .after { min-height: 64px; align-items: flex-start; }
.qcard .outcome { flex-direction: column; align-items: flex-start; gap: 6px; }
.qcard .outcome-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.qcard.has-sheet .col-q { gap: 8px; }
.qcard.has-sheet .q-head { font-size: 28px; line-height: 36px; }
.card.qcard { padding: 16px 26px; }
.qcard.has-sheet { padding: 12px 22px; gap: 20px; }
.qcard .xsheet th, .qcard .xsheet td { padding: 0 5px; }
.situ.sheet-col { justify-content: center; padding: 10px 12px; }
#main:has(.card.qcard) { padding-top: 4px; padding-bottom: 4px; }
.qcard.has-sheet .q-head { font-size: 27px; line-height: 34px; }
.qcard.has-sheet .q-status { min-height: 28px; }
.qcard.has-sheet .opt .t { font-size: 18px; }

/* ================================================================ v5-final · prologue story, rider cards, who pays */
/* Today's ride: three lines on the prologue card, one per click; earlier lines dim, the newest is bright */
.prologue [data-line]:empty { display: none; }
.card.prologue.story { align-items: flex-start; text-align: left; max-width: 1100px; }
.story-lines { display: flex; flex-direction: column; gap: 14px; }
.story-lines li { font: 600 36px/46px var(--f-display); color: var(--d-on-surface); visibility: hidden; opacity: 0; transition: opacity .6s ease; }
.story-lines li.long { font-size: 28px; line-height: 38px; }
.story-lines li.on { visibility: visible; opacity: .5; }
.story-lines li.now { opacity: 1; animation: rise 600ms var(--glide-ease) both; }
/* One header on every rider card; the team's three dots stand in for the avatar */
.qcard .situ-head .tdots { flex-direction: column; gap: 5px; padding: 0 8px; }
.qcard .situ-head .tdots i { width: 15px; height: 15px; }
.qcard .situ.team .situ-who b { font-size: 28px; line-height: 34px; color: var(--d-on-surface); }
.situ.sheet-col { justify-content: flex-start; }
/* The situation screen already shows the question (and the answers, quiet), so nothing moves when voting opens */
.qcard .col-q { align-self: start; }
[data-beat="listen"] .qcard .opts { display: grid; opacity: .5; }
[data-beat="listen"] .qcard .q-status, [data-beat="listen"] .qcard .after { display: flex; visibility: hidden; }
/* Who pays a hidden cost: the rider (their avatar) or the team (three dots) */
.detour-who { display: inline-flex; align-items: center; gap: 8px; padding: 4px 16px 4px 4px; border-radius: var(--r-full); background: color-mix(in srgb, var(--pc) 28%, rgb(16 14 11 / .9)); border: 1px solid var(--pc-bright); color: var(--pc-bright); font: 600 19px/26px var(--f-ui); white-space: nowrap; }
.detour-who .tdots { padding-left: 10px; }
.detour-who .tdots i { width: 12px; height: 12px; }
.dw-av { width: 32px; height: 32px; font-size: 17px; }
/* Unrevealed lines take no room; the card's top stays put as lines arrive (it grows downward, clear of the road) */
.story-lines li:not(.on) { display: none; }
#main:has(.card.prologue.story) { align-items: start; padding-top: 64px; }

/* ================================================================ v5-final · the left card as a quick-reference panel */
/* Sized to its content, its top level with "Question n of 4"; three sizes only: the name (Playfair 34), the values
   (Poppins 20), the role line and the labels (16, muted). Nothing wraps. */
.card.qcard { align-items: start; }
.qcard .situ { padding: 32px; gap: 32px; border-left-width: 3px; }
.qcard .situ-head { margin: 0; gap: 16px; }
.qcard .situ-av { width: 56px; height: 56px; font-size: 28px; }
.qcard .situ-who { gap: 2px; }
.qcard .situ-who b { font: 700 34px/40px var(--f-display); white-space: nowrap; }
.qcard .situ-who span { font: 500 16px/22px var(--f-ui); color: var(--d-on-surface-variant); white-space: nowrap; }
.meta { display: flex; flex-direction: column; gap: 20px; }
.meta > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: baseline; gap: 16px; }
.meta dt { font: 500 16px/22px var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--d-on-surface-variant); white-space: nowrap; }
.meta dd { font: 400 20px/28px var(--f-ui); color: var(--d-on-surface); white-space: nowrap; }
/* The team: its name and the town; the three voices as before */
.qcard .situ.team { gap: 24px; }
.qcard .situ.team .situ-who b { font-size: 34px; line-height: 40px; color: var(--pc-bright); }
/* Arif: the header, room to breathe, then the spreadsheet */
.qcard .situ.sheet-col { padding: 24px; gap: 24px; }
/* The rider's card is centred against the question and its answers; the outcome has its own row under the answers */
.card.qcard { grid-template-rows: auto auto; row-gap: 10px; }
.qcard .situ { grid-column: 1; grid-row: 1; align-self: center; }
.qcard .col-q { grid-column: 2; grid-row: 1; }
.qcard .q-after { grid-column: 2; grid-row: 2; }
.qcard .situ.team { padding: 24px 28px; gap: 20px; }
.qcard .situ.team { grid-row: 1 / span 2; align-self: start; } /* the team card is taller than the question: it spans the outcome row too */
.qcard .situ.sheet-col { padding: 20px 16px; gap: 24px; }
.q-status { flex-wrap: nowrap; white-space: nowrap; }
.q-status .q-meter { min-width: 40px; }
.qcard.has-sheet { row-gap: 8px; }

/* The optional Insight Out QR: the "Join the ride" card's style, smaller; beside the Insight Out line and the sign-off */
.io-qr { flex: none; display: flex; align-items: center; gap: var(--g-md); padding: var(--g-sm) var(--g-md) var(--g-sm) var(--g-sm); border-radius: var(--r-lg); background: var(--l-surface-lowest); color: var(--l-on-surface); box-shadow: 0 8px 28px rgb(0 0 0 / .4); text-align: left; }
.io-code { width: 96px; height: 96px; }
.io-code svg { width: 100%; height: 100%; display: block; }
.io-qr .jb-t span { font-family: var(--f-ui); font-weight: 500; }
.card.signoff.with-qr { flex-direction: row; justify-content: center; gap: var(--section); max-width: 1100px; }
/* The cold-open hooks stay at two lines (the longer Meera and Arif lines) */
.coldcards.n3 { max-width: 1300px; }
.cc-line { font-size: 24px; line-height: 32px; }

/* ================================================================ v6 · building an early-warning system */
/* The route bar: five two-line nodes (place; its build steps in Red Hat Mono), evenly spaced with equal connectors,
   all the same height so nothing shifts as the highlight moves; the current one is a filled pill in its rider's colour */
#foot { padding-top: 8px; padding-bottom: 8px; }
#route { flex: 1; }
#route .stops { flex: 1; display: flex; align-items: center; gap: 0; }
.rnode { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 44px; padding: 0 16px; border-radius: 22px; color: var(--d-on-surface-variant); white-space: nowrap; opacity: .7; }
.rnode.done { color: var(--crew-bright); opacity: 1; }
.rnode.now { background: var(--pc); color: var(--pc-on); opacity: 1; }
.rn-name { font: 600 14px/20px var(--f-ui); }
.rn-steps { display: flex; align-items: center; gap: 5px; min-height: 16px; font: 500 12px/16px var(--f-mono); opacity: .85; }
.rs { display: inline-flex; align-items: center; gap: 4px; }
.rs-dot { opacity: .6; }
.bi { display: inline-grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; font: 800 8px/1 var(--f-ui); font-style: normal; color: #161310; }
.bi.ok { background: #4ADE80; }
.bi.cut { background: #F59E0B; }
.rlink { flex: 1 1 0; height: 1px; margin: 0 8px; background: var(--d-outline); }
.st-lead.tie-note { color: var(--lakshmi-bright); }

/* Takeaway + Lead: one card, two columns about half each, top-aligned, a thin divider; the takeaway (Playfair) is the
   largest text. The left column fades in, then the right. */
.card.bridge { display: grid; grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr); gap: 0 40px; align-items: start; padding: 36px 44px; max-width: 1240px; justify-self: center; }
.br-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; animation: rise 700ms var(--glide-ease) both; }
.br-take { animation-delay: 150ms; }
.br-lead { animation-delay: 900ms; }
.br-div { align-self: stretch; background: var(--d-outline-variant); }
.br-label { font: 500 14px/20px var(--f-mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--d-on-surface-variant); }
.br-text { font: 700 40px/50px var(--f-display); color: var(--d-on-surface); }
.br-io { display: flex; align-items: center; gap: 20px; padding-top: 8px; }
.br-ins { flex: 1; font: 500 20px/28px var(--f-ui); color: var(--d-on-surface-variant); }
.br-io .io-code { width: 84px; height: 84px; }
.br-choice { position: relative; padding-left: 20px; font: 500 22px/32px var(--f-ui); color: var(--d-on-surface); }
.br-choice::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--pc-bright); }
.br-next { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 4px; }
.br-next p { font: 400 20px/30px var(--f-ui); color: var(--d-on-surface-variant); }
.br-next b { font-weight: 600; color: var(--d-on-surface); }

/* The routes at the palace: the chart full width, the room's line and totals, one line under it */
.card.routes-only { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 24px 32px; }
.sy-l { font: 500 14px/20px var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--d-on-surface-variant); }
.sy-kicker { color: var(--pc-bright); }
.routes-only .route-chart { width: auto; max-width: 100%; max-height: none; height: auto; align-self: center; }
.route-chart .axis, .route-chart .rt-end { font-size: 14px; }
.route-chart .rt-dot { fill: #fff8ec; animation: chipin 500ms 1.8s var(--glide-ease) both; }
.sy-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; font: 500 14px/20px var(--f-ui); color: var(--d-on-surface-variant); }
.sy-key li { display: inline-flex; align-items: center; gap: 6px; }
.sy-key i { width: 18px; height: 3px; border-radius: 2px; background: currentColor; }
.sy-key .optimal i { background: var(--meera-bright); }
.sy-key .careful i { background: #80D5CB; }
.sy-key .shortcut i { background: #fb8a5a; }
.sy-key .over-cautious i { background: var(--arif-bright); }
.sy-key .room { color: #fff8ec; font-weight: 600; }
.sy-key .room i { height: 6px; background: #fff8ec; box-shadow: 0 0 6px rgb(255 255 255 / .5); }
.sy-key .is-room { color: #fff8ec; font-weight: 600; }
.sy-foot { text-align: center; font: 600 20px/28px var(--f-display); color: var(--d-on-surface); }

/* The character intro: one centred card in the lead-in style (avatar, name in the persona's colour, role, 1–2 lines) */
.card.intro { gap: 14px; max-width: 980px; padding: 36px 48px; }
.in-av { width: 72px; height: 72px; font-size: 36px; }
.in-dots .tdots { gap: 8px; } .in-dots .tdots i { width: 18px; height: 18px; }
.in-who { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.in-who b { font: 700 40px/48px var(--f-display); color: var(--pc-bright); }
.in-who span { font: 500 18px/24px var(--f-ui); color: var(--d-on-surface-variant); }
.in-lines { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.card.intro .lead-in { font: 600 28px/38px var(--f-display); color: var(--d-on-surface); animation: rise 700ms var(--glide-ease) both; animation-delay: calc(var(--k) * 700ms + 300ms); }

/* The early-warning system you designed: one calm card, four rows (label, the room's meaning), fading in one by one */
.card.design { display: flex; flex-direction: column; gap: 24px; max-width: 1000px; justify-self: center; padding: 36px 56px; }
.ds-title { font: 700 36px/44px var(--f-display); color: var(--d-on-surface); }
.ds-rows { display: flex; flex-direction: column; gap: 14px; }
.ds-rows li { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: baseline; gap: 24px; padding-top: 14px; border-top: 1px solid var(--d-outline-variant); animation: rise 700ms var(--glide-ease) both; animation-delay: calc(var(--k) * 700ms + 300ms); }
.ds-l { font: 500 15px/22px var(--f-mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--d-on-surface-variant); }
.ds-m { font: 500 24px/32px var(--f-ui); color: var(--d-on-surface); white-space: nowrap; }

/* Today's ride: one composed card. Three sizes: the headline (Playfair 40), the panel and mission text (Poppins 22),
   labels and chips (Red Hat Mono 14). Every part keeps its room, so nothing shifts as it appears; nothing dims. */
.card.prologue.story { align-items: stretch; text-align: left; max-width: 1080px; padding: 36px 48px 0; gap: 0; overflow: hidden; }
#main:has(.card.prologue.story) { align-items: center; padding-top: var(--g-md); }
.card.prologue.story [data-title], .card.prologue.story [data-line], .card.prologue.story .meter { display: none; }
.pro-story { display: flex; flex-direction: column; gap: 28px; }
.pro-story.hidden { display: none; }
.ps-part { visibility: hidden; opacity: 0; transition: opacity .6s ease; }
.ps-part.on { visibility: visible; opacity: 1; animation: rise 600ms var(--glide-ease) both; }
.ps-label { display: inline-flex; align-items: center; gap: 8px; font: 500 14px/20px var(--f-mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--d-on-surface-variant); }
.ps-ic { font-size: 16px; }
svg.ps-ic { color: var(--crew-bright); }
.ps-head { margin-top: 8px; font: 700 40px/50px var(--f-display); color: var(--d-on-surface); }
.ps-panels { display: grid; grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr); gap: 0 40px; align-items: start; }
.ps-panels .ps-part { display: flex; flex-direction: column; gap: 10px; }
.ps-div { align-self: stretch; background: var(--d-outline-variant); }
.ps-text { font: 500 22px/32px var(--f-ui); color: var(--d-on-surface); }
.ps-mission { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 4px -48px 0; padding: 22px 48px 26px; background: rgb(255 246 230 / .06); border-top: 1px solid var(--d-outline-variant); }
.ps-chips { display: inline-flex; gap: 8px; }
.ps-chip { padding: 2px 12px; border-radius: var(--r-full); border: 1px solid rgb(255 246 230 / .35); font: 500 14px/22px var(--f-mono); color: #fff6e6; }
/* The mission links to the bar: its four steps glow softly for a moment */
#foot.glow .rs { animation: stepglow 1.5s ease both; border-radius: var(--r-full); }
@keyframes stepglow { 0%, 100% { box-shadow: none; color: inherit; } 30%, 70% { box-shadow: 0 0 0 3px rgb(255 246 230 / .25), 0 0 14px rgb(255 246 230 / .45); color: #fff6e6; background: rgb(255 246 230 / .12); } }
/* Rider card rows: the label column fits the longest label; a long value may take a second line (never more) */
.meta > div { grid-template-columns: 136px minmax(0, 1fr); gap: 16px; }
.meta dd { white-space: normal; }
.qcard .situ-who .situ-line { margin-top: 6px; white-space: normal; }
/* Q4 (a two-line question beside the team card): tighter gaps in the question column so the card stays clear of the road */
.card.qcard:has(.situ.team) { padding-top: 10px; padding-bottom: 10px; row-gap: 6px; }
.qcard:has(.situ.team) .col-q { gap: 6px; }
.qcard .situ.team { gap: 14px; }

/* A hidden cost: the small label and the chips, then the title (who pays · what broke, Playfair), then the text */
.dt-label { display: inline-flex; align-items: center; gap: 10px; font: 600 16px/22px var(--f-mono); letter-spacing: 2px; text-transform: uppercase; color: #FBBF24; }
.dt-label .dt-warn { font-size: 22px; }
.dt-title { font: 700 40px/50px var(--f-display); color: var(--d-on-surface); }
.dt-who { color: var(--pc-bright); }
.card.detour .msg { font: 500 24px/34px var(--f-ui); color: var(--d-on-surface-variant); }
.card.detour.with-sheet .dt-title { font-size: 32px; line-height: 40px; }
.card.detour.with-sheet .msg { font-size: 20px; line-height: 28px; }
