/* Muse design tokens (docs/research/muse-design.md, dark scope). The table itself is canvas content. */
:root{
  --bg:#181819;
  --surface:#1f1f20;        /* wash / agent bubble */
  --surface-2:#28292b;      /* fill-primary */
  --surface-3:#323435;      /* raised */
  --surface-4:#383b3d;
  --border:rgba(255,255,255,.12);
  --text:#ffffff;
  --muted:rgba(242,247,255,.53);
  --faint:rgba(241,246,255,.38);
  --accent:#1793ff;
  --accent-hover:#82b4ff;
  --accent-soft:#4b93ff;
  --accent-bg:#4b93ff1f;
  --accent-line:#4b93ff40;
  --accent2:#7ea1ff;
  --gradient:linear-gradient(#7cc9ff,#0088ff);
  --user-bubble:#0074e8;
  --agent-bubble:#252628;
  --success:#07b123; --success-bg:#22c55e26;
  --danger:#fa4758; --danger-strong:#c01f37;
  --warning:#f1916e;
  --dialog:rgba(56,56,56,.8);
  --overlay:rgba(0,0,0,.4);
  --r-8:8px; --r-12:12px; --r-16:16px; --r-20:20px; --r-24:24px; --r-28:28px; --r-pill:999px;
  --font:"Optimistic",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --ease:cubic-bezier(.4,0,.2,1); --dur:150ms;
  --spring:cubic-bezier(.34,1.56,.64,1); --ease-out:cubic-bezier(.2,.8,.2,1);
  /* legacy aliases (inline styles in JS) */
  --mute:var(--muted); --ink:var(--text);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
[hidden]{display:none!important}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);
  font:400 15px/20px var(--font);-webkit-font-smoothing:antialiased;overscroll-behavior:none;overflow:hidden}

/* ---------- buttons ---------- */
button{font:inherit;font-weight:500;color:inherit;border:1px solid transparent;background:var(--surface-2);border-radius:var(--r-pill);
  padding:9px 16px;cursor:pointer;touch-action:manipulation;user-select:none;-webkit-user-select:none;
  transition:background var(--dur) var(--ease),opacity var(--dur) var(--ease),transform var(--dur) var(--ease)}
button:hover{background:var(--surface-3)}
/* press feedback is a Web Animations spring (js/anim.js pressable) */
button:focus-visible{outline:2px solid var(--accent-soft);outline-offset:2px}
button.primary{background:var(--accent);color:#fff;font-weight:600}
button.primary:hover{background:#2f9bff}
button.secondary{background:var(--surface-2);color:var(--text)}
button.secondary:hover{background:var(--surface-3)}
.sheet button.secondary{background:var(--surface-3)}
.sheet button.secondary:hover{background:var(--surface-4)}
button.xl{width:100%;padding:15px 20px;font-size:17px;line-height:22px;border-radius:var(--r-16)}
button.icon{width:36px;height:36px;padding:0;display:grid;place-items:center;font-size:18px;line-height:1;background:transparent;color:var(--muted)}
button.icon:hover{background:var(--surface-2);color:var(--text)}
button.link{background:none;border:none;color:var(--accent-soft);padding:4px 2px;font-size:13px;border-radius:var(--r-8)}
button.link:hover{background:none;color:var(--accent-hover)}
.pill{display:inline-flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:500;color:var(--muted);
  background:var(--surface-2);border-radius:var(--r-pill);padding:4px 10px;white-space:nowrap}
.pill.accent{background:var(--accent-bg);color:var(--accent-hover);box-shadow:inset 0 0 0 1px var(--accent-line)}

/* ---------- layout ---------- */
/* The table gets every spare pixel: the header is two short lines and there is nothing under the table (round 20: the
   controls strip and the caption row are gone; spin, reactions and the wait chip float over the stage). The stage runs to
   the bottom safe area with a small margin (js/render.js fits the table to #stage). */
#app{display:flex;flex-direction:column;height:100vh;height:100dvh;max-width:1600px;margin:0 auto;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 6px) env(safe-area-inset-left)}
header{display:grid;grid-template-columns:1fr auto 1fr;gap:8px;align-items:stretch;padding:8px 12px 4px}
/* a player card: name on line one; group label + remaining balls share line two */
.pcard{background:var(--surface);border-radius:var(--r-16);padding:8px 12px;min-width:0;display:flex;flex-wrap:wrap;align-items:center;column-gap:6px;
  box-shadow:inset 0 0 0 1px transparent;transition:box-shadow var(--dur) var(--ease),background var(--dur) var(--ease)}
.pcard .who{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;min-width:0;flex:1 0 100%}
.pcard .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pcard .grp{font-size:12px;line-height:16px;color:var(--muted);margin-top:3px;flex:0 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pcard .rack{display:flex;flex-wrap:nowrap;gap:3px;margin-top:3px;min-height:13px;flex:none}
/* whose turn it is: the active card is lit (accent ring + glow), the other one steps back */
.pcard{transition:box-shadow var(--dur) var(--ease),background var(--dur) var(--ease),opacity 220ms var(--ease)}
.pcard.active{background:var(--surface-2);box-shadow:inset 0 0 0 2px var(--accent),0 0 0 3px var(--accent-bg),0 6px 22px rgba(23,147,255,.28)}
header:has(.pcard.active) .pcard:not(.active){opacity:.55}
/* the Muse's shot clock: a ring round its avatar that drains (--clk 1 -> 0), red for the last 5 s (main.js watch) */
#museAva{position:relative}
#cardMuse.clocking #museAva::after{content:"";position:absolute;inset:-4px;border-radius:50%;pointer-events:none;
  background:conic-gradient(var(--ring,var(--accent)) calc(var(--clk,1)*1turn),rgba(255,255,255,.16) 0);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2.5px));mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2.5px))}
#cardMuse.clocking.urgent{--ring:var(--danger)}
#cardMuse.clocking.urgent #museAva::after{animation:clockPulse 1s var(--ease) infinite}
@keyframes clockPulse{50%{transform:scale(1.12)}}
.pcard.muse{text-align:right;flex-direction:row-reverse}.pcard.muse .who{flex-direction:row-reverse}
.ava{width:26px;height:26px;border-radius:50%;flex:none;display:grid;place-items:center;font-size:14px;font-weight:600;line-height:1;color:#fff;
  background:var(--surface-3) center/cover no-repeat}
.ava.me{background:var(--gradient)}
.ava.big{width:64px;height:64px;font-size:30px;cursor:pointer}
.ava.xl{width:64px;height:64px;font-size:26px}
.ava.neutral{background:radial-gradient(circle at 35% 30%,var(--surface-4),var(--surface-2) 70%);box-shadow:inset 0 0 0 1px var(--border)}
.mb{width:13px;height:13px;border-radius:50%;display:inline-block;box-shadow:inset -2px -2px 3px rgba(0,0,0,.35)}
.mid{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:56px}
#score{display:flex;align-items:baseline;gap:5px;font-size:17px;line-height:22px;font-weight:600;font-variant-numeric:tabular-nums}
#score span{color:var(--faint);font-weight:400}
#liveTag{padding:1px 8px;font-size:11px;line-height:14px;font-weight:600}
#menuBtn{width:32px;height:28px}
#stage{flex:1;min-height:0;position:relative}
#cv{position:absolute;inset:0;width:100%;height:100%;touch-action:none;display:block;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}

/* effects overlays (js/anim.js): full screen, click-through, above the modals */
#fxcv,#rivecv{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:25;display:block}
#rivecv{z-index:24}

/* the power bar (js/shot-control.js; docs/research/feel/controls.md B): a cue stick in a slot on the right edge of the stage
   (body.hand-left: the left edge). The touch target is 48 px wide, the slot 18 px; press anywhere on it and drag down: the stick
   slides down px for px, the fill grows above its tip. Tip at the top (light chalk, ivory ferrule), maple shaft, a silver joint,
   a dark butt with a red wrap. .cancel = the finger is 60 px off the bar (letting go cancels). */
#rail{position:absolute;right:0;top:50%;transform:translateY(-50%);height:min(62%,300px);width:36px;z-index:3;
  display:flex;flex-direction:column;align-items:center;gap:5px;touch-action:none;cursor:ns-resize;user-select:none;-webkit-user-select:none;
  opacity:.92;transition:opacity var(--dur) var(--ease)}
#rail:hover,#rail.live{opacity:1}
#rail b{font-size:11px;line-height:14px;font-weight:700;color:var(--muted);font-variant-numeric:tabular-nums;transition:color var(--dur) var(--ease);
  text-shadow:0 1px 2px rgba(0,0,0,.6);min-width:30px;text-align:center}
#rail.live b{color:var(--text)}
#rail .track{flex:1;width:18px;border-radius:var(--r-pill);background:rgba(12,12,13,.82);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.16),inset 0 2px 6px rgba(0,0,0,.7),0 2px 10px rgba(0,0,0,.4);overflow:hidden;position:relative}
#rail .fill{position:absolute;inset:0;transform-origin:50% 0;transform:scaleY(0);border-radius:inherit;
  background:linear-gradient(#7cc9ff,#1793ff 45%,#f1916e 80%,#fa4758);opacity:.9;will-change:transform}
#rail .stick{position:absolute;left:50%;top:3px;bottom:0;width:10px;margin-left:-5px;text-decoration:none;will-change:transform;
  clip-path:polygon(28% 0,72% 0,100% 100%,0 100%);border-radius:3px 3px 0 0;
  background:linear-gradient(#cfe3f2 0 5px,#f6f1e4 5px 13px,#efd8a8 13px,#e2bf83 42%,#d2a865 56%,#c9ccd1 56% 58%,#3f2618 58%,#2a180e 70%,
    #7a1e22 70% 80%,#24150c 80%,#140b06 100%)}
#rail .stick::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(0,0,0,.28),rgba(255,255,255,.28) 40%,rgba(0,0,0,.22))}
#rail.hot .track{box-shadow:inset 0 0 0 1px rgba(250,71,88,.7),inset 0 2px 6px rgba(0,0,0,.7),0 0 14px rgba(250,71,88,.4)}
#rail.cancel .track{opacity:.45}
#rail.cancel b{color:var(--danger)}
body.hand-left #rail{right:auto;left:0}

/* ball in hand: a hand on the cue ball (js/shot-control.js puts it at the ball, translate in stage px) */
#bihHand{position:absolute;left:0;top:0;z-index:2;width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;display:grid;place-items:center;
  background:rgba(24,24,25,.82);box-shadow:0 0 0 1.5px rgba(242,193,78,.9),0 2px 6px rgba(0,0,0,.45);pointer-events:none}

/* system toasts (errors / instructions only) */
#toast{position:absolute;left:50%;top:8px;transform:translate(-50%,-4px);background:var(--dialog);
  -webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);
  padding:8px 14px;border-radius:var(--r-pill);font-size:13px;line-height:18px;font-weight:500;white-space:nowrap;max-width:94%;overflow:hidden;text-overflow:ellipsis;
  opacity:0;transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease);pointer-events:none;z-index:2}
#toast.show{opacity:1;transform:translate(-50%,0)}
/* a foul, named plainly (a scratch, the wrong ball first, no ball hit): red, with a small pop */
#toast.foul{background:#7a1f26;color:#fff;font-weight:700}
#toast.foul.show{animation:foulPop .42s cubic-bezier(.34,1.56,.64,1)}
@keyframes foulPop{0%{transform:translate(-50%,-4px) scale(.86)}100%{transform:translate(-50%,0) scale(1)}}

/* the wait chip, at the top of the table (round 20; was the strip under it) */
#waitChip{position:absolute;left:0;right:0;margin:0 auto;top:8px;z-index:2;width:max-content;max-width:min(340px,calc(100% - 24px));
  display:flex;flex-direction:column;align-items:center;gap:2px;text-align:center;
  background:var(--dialog);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);box-shadow:inset 0 0 0 1px var(--border);
  border-radius:var(--r-16);padding:6px 14px;font-size:13px;line-height:18px;animation:fade 200ms var(--ease)}
#waitMsg{font-weight:600;color:var(--text);font-variant-numeric:tabular-nums}
#waitMsg:empty{display:none}
#waitMsg.urgent{color:#ff8a80}
#waitNote{color:var(--muted);font-size:12px;line-height:16px;max-width:300px}
#waitBtns,#rematchLine{display:flex;align-items:center;justify-content:center;gap:4px 12px;flex-wrap:wrap}
#waitBtns button.link,#rematchLine button.link{font-size:13px;font-weight:600;padding:2px 2px}
#rematchLine{color:var(--muted)}
/* while the chip is up, a toast sits under it */
#stage.chip #toast{top:var(--chip-h,52px)}

/* floating round buttons: spin on the left edge, opposite the power bar (body.hand-left: the right edge); reactions bottom right */
.fab{position:absolute;bottom:8px;z-index:3;width:44px;height:44px;padding:0;border-radius:50%;display:grid;place-items:center;
  background:rgba(24,24,25,.72);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);box-shadow:inset 0 0 0 1px var(--border),0 4px 14px rgba(0,0,0,.35);
  font-size:20px;line-height:1}
.fab:hover{background:rgba(40,41,43,.85)}
#spinBtn{left:2px;bottom:21%}   /* between the side pocket and the corner pocket, near the left thumb */
body.hand-left #spinBtn{left:auto;right:2px}
#reactBtn{right:8px}
/* the spin button is a little cue ball with the spin dot on it */
#spinBtn::before{content:"";position:absolute;inset:6px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff,#d9d4c7 70%)}
#spinBtn i{position:absolute;width:8px;height:8px;border-radius:50%;background:#d62828;left:50%;top:50%;transform:translate(-50%,-50%);box-shadow:0 0 0 1.5px rgba(255,255,255,.7)}
#spinBtn.on::after{content:"";position:absolute;inset:-2px;border-radius:50%;box-shadow:0 0 0 2px var(--accent)}
/* the popovers they open */
.pop{position:absolute;bottom:56px;z-index:4;background:rgba(40,41,43,.92);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);
  box-shadow:0 12px 32px rgba(0,0,0,.45),inset 0 0 0 1px var(--border);border-radius:var(--r-20);animation:rise 260ms var(--spring) both}
/* the spin overlay: a large cue ball over the middle of the table (GamePigeon / 8 Ball Pool) */
#spinPop{inset:0;margin:auto;width:max-content;height:max-content;display:flex;flex-direction:column;align-items:center;gap:6px;
  padding:18px 20px 10px;font-size:13px;line-height:18px;color:var(--muted);z-index:5}
#spinLbl{min-width:96px;text-align:center;color:var(--text);font-weight:600;font-size:15px;line-height:20px;margin-top:6px;font-variant-numeric:tabular-nums}
.spin-hint{font-size:12px;line-height:16px}
#spinReset{font-size:13px;padding:6px 10px}
#reactBar{right:8px;display:flex;gap:2px;padding:3px}
#reactBar button{width:38px;height:38px;padding:0;background:transparent;font-size:20px;line-height:1;display:grid;place-items:center}
#reactBar button:hover{background:var(--surface-3)}
.floatmoji{position:fixed;z-index:30;font-size:30px;line-height:1;pointer-events:none;transform:translate(-50%,-50%);
  animation:floatoff 1.5s var(--ease) forwards}
@keyframes floatoff{0%{opacity:0;transform:translate(-50%,-50%) scale(.6)}15%{opacity:1;transform:translate(-50%,-70%) scale(1.15)}
  100%{opacity:0;transform:translate(-20%,140%) scale(1)}}

/* Ren's speech bubble (js/presence.js placeBubble): one line inside the header, over the second line of Ren's card, tail up at its
   avatar; never over the felt. .full = the whole line, opened by a tap on a cut-off one. */
#bubble{position:fixed;z-index:9;max-width:200px;background:var(--agent-bubble);color:var(--text);
  border-radius:var(--r-12);padding:2px 9px;font-size:13px;line-height:18px;font-weight:500;
  box-shadow:0 4px 14px rgba(0,0,0,.4),inset 0 0 0 1px var(--border);
  opacity:0;transform:translateY(-2px) scale(.98);transform-origin:var(--tail,80%) 0;
  transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease);cursor:pointer}
#bubble.show{opacity:1;transform:none}
#bubble .tail{position:absolute;top:-4px;left:calc(var(--tail,80%) - 5px);width:10px;height:10px;background:var(--agent-bubble);
  transform:rotate(45deg);border-radius:2px 0 0 0;box-shadow:inset 1px 1px 0 var(--border)}
#bubble .txt{position:relative;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#bubble.full{padding:6px 11px;font-size:14px;line-height:19px}
#bubble.full .txt{white-space:normal}

/* the spin picker (inside #spinPop): tap or drag the red dot; it stays on the vertical axis (follow/draw only, ui.js SPIN_2D),
   reaching 0.77 of the radius; double-tap or Centre resets */
#spin{width:min(184px,52vw);height:min(184px,52vw);border-radius:50%;position:relative;flex:none;cursor:pointer;touch-action:none;
  background:radial-gradient(circle at 34% 28%,#fff,#f1ede3 45%,#cfc9ba 80%,#b9b2a2);box-shadow:0 10px 26px rgba(0,0,0,.45),inset -6px -8px 18px rgba(0,0,0,.12)}
#spin::before{content:"";position:absolute;inset:11.5%;border-radius:50%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}   /* the dot's reach: 0.77 of the radius */
#spin .axis{position:absolute;left:50%;top:11.5%;bottom:11.5%;width:1px;background:rgba(0,0,0,.18)}
#spin i{position:absolute;width:22px;height:22px;border-radius:50%;background:#d62828;left:50%;top:50%;transform:translate(-50%,-50%);
  box-shadow:0 0 0 3px rgba(255,255,255,.85),0 2px 6px rgba(0,0,0,.35)}

/* ---------- modals / cards ---------- */
.modal{position:fixed;inset:0;background:var(--overlay);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);
  display:grid;place-items:center;z-index:10;padding:16px;animation:fade 200ms var(--ease)}
@keyframes fade{from{opacity:0}to{opacity:1}}
.sheet{position:relative;background:rgba(40,41,43,.9);-webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px);
  border-radius:var(--r-24);padding:20px;width:min(420px,100%);max-height:90vh;overflow:auto;
  box-shadow:0 24px 64px rgba(0,0,0,.45),inset 0 0 0 1px var(--border);animation:rise 420ms var(--spring) both}
@keyframes rise{from{opacity:0;transform:translateY(16px) scale(.94)}to{opacity:1;transform:none}}
@keyframes popin{0%{opacity:0;transform:scale(.6)}60%{opacity:1;transform:scale(1.06)}100%{opacity:1;transform:none}}
.sheet.center{text-align:center}
.sheet h2{margin:0 0 8px;font-size:20px;line-height:26px;font-weight:600}
.sheet p{margin:0 0 12px;font-size:15px;line-height:20px}
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin:-4px -6px 10px 0}
.sheet-head h2{margin:0}
.muted{color:var(--muted)}
.hint{color:var(--muted);font-size:13px!important;line-height:18px!important;margin:8px 0 16px!important}
.label{font-size:13px;line-height:18px;font-weight:500;color:var(--muted);margin:0 0 8px}
.mono{font:13px/18px ui-monospace,Menlo,monospace;overflow-wrap:anywhere;color:var(--accent-hover);background:var(--surface);border-radius:var(--r-12);padding:10px 12px}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.actions>button{flex:1;padding:12px 16px;border-radius:var(--r-16)}
.opp{display:flex;align-items:center;gap:12px}
.opp input[type=text]{flex:1;min-width:0;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--r-12);padding:11px 12px;font:inherit;outline:none;
  transition:border-color var(--dur) var(--ease)}
.opp input[type=text]:focus{border-color:var(--accent)}
.seg{display:flex;background:var(--surface);border-radius:var(--r-pill);padding:3px;gap:2px}
.seg button{flex:1;border:none;background:transparent;padding:8px 12px;color:var(--muted)}
.seg button:hover{background:var(--surface-2);color:var(--text)}
.seg button.on{background:var(--surface-4);color:var(--text);font-weight:600}
.seg+.label{margin-top:16px} /* a second labelled segment (the Muse's skill under Pocket size) */
#msgText{width:100%;height:40vh;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--r-12);padding:12px;font:13px/1.4 ui-monospace,Menlo,monospace;resize:none}

/* Home (round 25, row F: docs/design-row-f). No blur: the table sits lit at the top of the screen (js/demo.js plays shots on it on the
   landing and the invite steps), a soft spotlight over it, a dark fade into the card; one card anchored at the bottom (max 420 px,
   centred on a desktop) that is the invite flow, in place. --home-card-h (the card + the links, set by js/presence.js) places both. */
.faceoff{display:flex;align-items:center;justify-content:center;gap:20px;margin-bottom:18px}
.faceoff .side{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:15px;min-width:72px}
.faceoff .side b{font-weight:600}
.faceoff .vs{font-size:13px;color:var(--faint);font-weight:500;margin-bottom:26px}
:root{--home-blue:#1f6feb;--home-card:#1a1c20;--home-line:#2a2d33;--home-text2:#c9cdd4;--home-quiet:#9aa0aa;--home-green:#6fdc9a;--home-green-dk:#1f6a43;--home-bg:#0c0d0f}
body:has(#startModal:not([hidden])){background:var(--home-bg)}
body:has(#startModal:not([hidden])) header{display:none}
/* the stage above the card: a desktop / landscape table sits over the card's top 120 px; a phone in portrait gets the whole
   portrait table at full width, its foot (where the demo plays) at the top, the card over its lower half */
:root{--home-overlap:70px;--home-fade:80px}
body:has(#startModal:not([hidden])) #stage{flex:none;height:max(220px,calc(100dvh - var(--home-card-h,400px) + var(--home-overlap)))}
@media (orientation:portrait) and (max-width:700px){
  :root{--home-fade:150px}
  body:has(#startModal:not([hidden])) #stage{height:min(calc(100dvh - 8px),calc(100vw * 1.842 + 12px))}
}
.modal.home{background:none;-webkit-backdrop-filter:none;backdrop-filter:none;display:block;padding:0;animation:fade 260ms var(--ease)}
.home-shade{position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(ellipse 75% 55% at 50% 26%,rgba(0,0,0,0) 0,rgba(0,0,0,0) 38%,rgba(6,7,8,.42) 100%),
    linear-gradient(to bottom,rgba(12,13,15,0) 0,rgba(12,13,15,0) calc(100% - var(--home-card-h,400px) - var(--home-fade)),var(--home-bg) calc(100% - var(--home-card-h,400px) + 40px))}
#homeMenu{position:absolute;top:calc(env(safe-area-inset-top) + 10px);right:12px;z-index:2;background:rgba(12,13,15,.55);color:var(--text);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
#homeMenu:hover{background:rgba(40,41,43,.85)}
.home-wrap{position:absolute;left:14px;right:14px;bottom:calc(env(safe-area-inset-bottom) + 14px);margin:0 auto;max-width:420px;
  display:flex;flex-direction:column;align-items:stretch;gap:14px}
.home-card{position:relative;background:var(--home-card);border:1px solid var(--home-line);border-radius:26px;padding:26px 22px 22px;
  display:flex;flex-direction:column;gap:18px;text-align:center;max-height:calc(100dvh - 90px);overflow:auto;
  box-shadow:0 24px 64px rgba(0,0,0,.45);animation:rise 420ms var(--spring) both}
.home-card .faceoff{gap:18px;margin:0}
.home-card .faceoff .side{gap:8px;font-size:14px}
.home-card .faceoff .side b{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-card .faceoff .vs{color:var(--home-quiet);margin-bottom:24px}
.home-card .ava.xl{width:76px;height:76px;font-size:30px;font-weight:700}
.home-card .ava.me{background:var(--home-blue)}
.seat{position:relative;display:block;width:76px;height:76px}
.seat-ring,.seat-tick{display:none}
/* the Muse not added yet: the default picture greyed out (landing, step 1, step 2) */
.home-card:is([data-step=landing],[data-step=copy],[data-step=wait]) #homeMuseAva{filter:grayscale(1);opacity:.55;animation:none} /* no pop-in: its fill would own the opacity */
.home-card:is([data-step=landing],[data-step=copy],[data-step=wait]) .faceoff .side:last-child b{color:var(--home-text2)}
/* the invite steps: smaller faces, no names (F2, F3) */
.home-card:is([data-step=copy],[data-step=wait]) .faceoff .vs{margin:0}
.home-card:is([data-step=copy],[data-step=wait]) .faceoff .side b{display:none}
.home-card:is([data-step=copy],[data-step=wait]) .ava.xl,.home-card:is([data-step=copy],[data-step=wait]) .seat{width:60px;height:60px;font-size:24px}
/* step 2: a ring turns round the greyed Muse while the page waits for it */
.home-card[data-step=wait] .seat-ring{display:block;position:absolute;inset:-5px;border-radius:50%;border:4px solid transparent;
  border-top-color:#8ab8ff;border-right-color:#8ab8ff;animation:seatSpin 1.1s linear infinite}
@keyframes seatSpin{to{transform:rotate(360deg)}}
/* joined: in colour, a green ring and a tick */
.home-card[data-step=joined] #homeMuseAva{box-shadow:0 0 0 4px var(--home-green)}
.home-card[data-step=joined] .seat-tick{display:grid;place-items:center;position:absolute;right:-4px;bottom:-4px;width:28px;height:28px;border-radius:50%;
  background:var(--home-green-dk);border:3px solid var(--home-card);animation:popin 420ms var(--spring) 160ms both}
/* the step header: back, STEP n OF 2, two segments */
.step-head{display:flex;align-items:center;gap:8px;margin:-4px 0 -6px}
.step-head .back{width:44px;height:44px;margin-left:-10px;border-radius:12px;color:var(--home-text2)}
.step-label{flex:1;text-align:left;font-size:14px;font-weight:600;color:var(--home-quiet);letter-spacing:.02em}
.step-bar{display:flex;gap:6px}
.step-bar i{width:22px;height:5px;border-radius:3px;background:#3a3e46}
.home-card[data-step=copy] .step-bar i:first-child{background:var(--home-blue)}
.home-card[data-step=wait] .step-bar i:first-child{background:var(--home-green-dk)}
.home-card[data-step=wait] .step-bar i:last-child{background:var(--home-blue)}
.home-pane{display:flex;flex-direction:column;gap:8px;animation:paneIn 320ms var(--ease-out) both}
@keyframes paneIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.home-title{margin:0;font-size:25px;line-height:1.2;font-weight:700;letter-spacing:-.01em}
#paneLanding .home-title{font-size:min(27px,7.2vw);line-height:1.25;text-wrap:balance}
/* the Muse wordmark stand-in: swap this one class for the real wordmark */
.muse-word{font-family:Pacifico,cursive;font-weight:400;font-size:32px;line-height:1;color:#1877f2;letter-spacing:0}
.home-sub{margin:0;font-size:15px;line-height:1.45;color:var(--home-text2)}
.home-card button.xl,.home-card .btn.xl{height:58px;margin-top:10px;border:0;border-radius:16px;background:var(--home-blue);color:#fff;font-size:18px;font-weight:600;padding:0 20px}
.home-card button.xl:hover,.home-card .btn.xl:hover{background:#2f7cf5}
.btn{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;font-weight:600;cursor:pointer;user-select:none;-webkit-user-select:none;
  transition:background var(--dur) var(--ease)}
.btn:focus-visible{outline:2px solid var(--accent-soft);outline-offset:2px}
.home-next{margin:8px 0 0;font-size:14px;color:var(--home-quiet)}
.copied-line{margin:0;display:flex;align-items:center;justify-content:center;gap:8px;font-size:14px;font-weight:600;color:var(--home-green)}
.wait-line{margin:10px 0 0;display:flex;align-items:center;justify-content:center;gap:14px;font-size:14px;color:var(--home-text2)}
.wait-line button.link{font-size:14px;font-weight:500;color:#8ab8ff;padding:4px 2px}
.wait-line button.link:hover{color:#b3d0ff}
/* the stuck help (E8): three fixes, each with its own button */
.home-card[data-step=stuck]{text-align:left}
.fixes{margin:10px 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:10px}
.fixes li{display:flex;flex-direction:column;gap:8px;padding:14px 16px;background:#24272c;border-radius:14px}
.fixes b{font-size:16px;font-weight:600}
.fixes span{font-size:14px;line-height:1.4;color:var(--home-text2)}
.fixes .btn,.fixes button{height:48px;border:0;border-radius:12px;font-size:16px;margin-top:2px}
.fixes .btn.primary{background:var(--home-blue);color:#fff}
.fixes button.secondary{background:#2f333a;color:#f5f6f7;font-weight:500}
#paneStuck .wait-line{gap:10px}
.mini-spin{width:16px;height:16px;border-radius:50%;border:3px solid #2f333a;border-top-color:#8ab8ff;animation:seatSpin 1s linear infinite;flex:none}
/* joined (F4): a short progress bar while the table racks (the table opens by itself) */
.join-bar{height:6px;margin-top:12px;border-radius:3px;background:var(--home-line);overflow:hidden}
.join-bar i{display:block;height:100%;width:100%;border-radius:3px;background:var(--home-blue);transform-origin:0 50%;animation:joinFill 1.2s var(--ease) both}
@keyframes joinFill{from{transform:scaleX(.08)}to{transform:scaleX(1)}}
/* round 26: a rivalry link this device has never seen. arriving: the Muse greyed while the server is asked ("Opening your table…");
   setup: "<Muse> set up a table for you", in colour with the green ring and tick (as joined), a slightly longer bar (SETUP_BEAT_MS) */
.home-card[data-step=arriving] #homeMuseAva{filter:grayscale(1);opacity:.55;animation:none}
.home-card[data-step=arriving] .faceoff .side:last-child b{color:var(--home-text2)}
.home-card[data-step=setup] #homeMuseAva{box-shadow:0 0 0 4px var(--home-green)}
.home-card[data-step=setup] .seat-tick{display:grid;place-items:center;position:absolute;right:-4px;bottom:-4px;width:28px;height:28px;border-radius:50%;
  background:var(--home-green-dk);border:3px solid var(--home-card);animation:popin 420ms var(--spring) 160ms both}
#paneSetup .join-bar i{animation-duration:1.8s}
/* no JavaScript (an agent fetching the page): the instructions for people and for Muses, readable on the dark page */
.noscript{max-width:640px;margin:0 auto;padding:32px 16px;color:#fff;font:16px/1.5 system-ui,-apple-system,sans-serif}
.noscript code{background:#28292b;border-radius:6px;padding:1px 6px;overflow-wrap:anywhere}.noscript a{color:#82b4ff}
/* the dare (/?dare=<id>): "<Muse> dared you · Watch the game", small, over the headline */
.dare-line{margin:0 0 2px;font-size:13px;line-height:18px;color:var(--home-quiet)}
.dare-line a{color:#8ab8ff;text-decoration:none}.dare-line a:hover{color:#b3d0ff;text-decoration:underline}
/* the quiet links under the card */
.home-links{display:flex;justify-content:center;gap:22px;min-height:20px}
.home-links .quiet{font-size:13px;line-height:18px;font-weight:400;color:var(--home-quiet);text-decoration:none;background:none;border:0;padding:2px 2px;border-radius:6px}
.home-links .quiet:hover{color:var(--text)}
.home-links:not(:has(> :not([hidden]))){display:none}
/* the returning player's card, same shell */
.rivalry{font-size:20px;line-height:26px;font-weight:600;margin-bottom:2px}
.home-card .last{color:var(--muted);font-size:14px;line-height:19px;margin:0 auto 4px;max-width:320px}
.actions.two{margin-top:10px}
#paneHome .actions.two{margin-top:2px}
#paneHome .actions>button{background:#2f333a}
/* Home: the last 5 headlines (from /space.json), one line each */
.history{list-style:none;margin:6px auto;padding:0;max-width:340px;width:100%;text-align:left;display:flex;flex-direction:column;gap:4px}
.history li{display:flex;gap:8px;align-items:baseline;font-size:13px;line-height:18px;min-width:0}
.history .d{flex:none;min-width:46px;white-space:nowrap;color:var(--faint);font-variant-numeric:tabular-nums}
.history .h{flex:1;min-width:0;color:var(--muted);overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2}
.history li:first-child .h{color:var(--text)}
.history a{display:flex;gap:8px;align-items:baseline;flex:1;min-width:0;color:inherit;text-decoration:none;border-radius:var(--r-8)}
.history a:hover .h,.history a:focus-visible .h{color:var(--accent-hover)}
.history a:focus-visible{outline:2px solid var(--accent-soft);outline-offset:2px}
/* the paste-as-is note under Copy a nudge */
.bring-note{color:var(--faint);font-size:12px;line-height:16px;margin:4px auto 0;max-width:320px}
#bringUnnamed{margin-bottom:4px}
#bringUnnamed button{align-self:center;margin-top:6px}
.me-name{margin-bottom:16px}
.faceoff .side .ava{animation:popin 520ms var(--spring) both;animation-delay:120ms}
.faceoff .side:last-child .ava{animation-delay:200ms}
/* the Muse's banter on the landing's live table (js/demo.js places it at the table's top-right corner) */
.demo-bubble{position:absolute;z-index:1;display:flex;align-items:flex-end;gap:8px;pointer-events:none;
  opacity:0;transform:translateY(6px) scale(.96);transform-origin:100% 100%;transition:opacity 220ms var(--ease),transform 320ms var(--spring)}
.demo-bubble.show{opacity:1;transform:none}
.demo-bubble .txt{max-width:min(240px,calc(100vw - 90px));padding:10px 14px;background:#f5f6f7;color:#16181b;border-radius:16px 16px 4px 16px;
  font-size:15px;line-height:20px;font-weight:600;box-shadow:0 8px 24px rgba(0,0,0,.35)}
.demo-bubble .ava{width:34px;height:34px}
@media (min-width:701px){.home-wrap{bottom:28px}}

/* Game over */
.over-card{text-align:center;padding:24px 22px 20px;width:min(400px,100%)}
.faceoff.sm{gap:10px;margin-bottom:16px}
.faceoff.sm .ava{width:36px;height:36px;font-size:16px}
.series-big{font-size:28px;line-height:34px;font-weight:600;letter-spacing:-.01em;margin-bottom:8px;animation:popin 520ms var(--spring) 120ms both}
.over-card .headline,.over-card .agent-line{animation:rise 420ms var(--spring) 200ms both}
.over-card .actions{animation:rise 420ms var(--spring) 260ms both}
.over-card .headline{color:var(--text);opacity:.86;font-size:16px;line-height:22px;margin:0 auto 16px;max-width:320px}
.agent-line{display:flex;align-items:flex-end;gap:8px;text-align:left;margin:0 0 4px}
.agent-line .ava{width:28px;height:28px}
.agent-line .said{background:var(--agent-bubble);border-radius:var(--r-20) var(--r-20) var(--r-20) 6px;padding:9px 13px;font-size:15px;line-height:20px;
  box-shadow:inset 0 0 0 1px var(--border)}
.actions.three{margin-top:18px}
.actions.three .lead{flex:1 0 100%;padding:15px 20px;font-size:17px;line-height:22px}

@media (max-height:500px){
  header{padding:4px 8px 2px}.pcard{padding:4px 10px}.pcard .rack{margin-top:2px}
  #rail{height:min(70%,220px)}
  .fab{width:40px;height:40px;font-size:17px}.pop{bottom:48px}
  #spin{width:min(150px,52vh);height:min(150px,52vh)}
}
/* phones in portrait: two-line player cards, slim */
@media (max-width:520px){
  header{padding:6px 8px 4px;gap:6px}
  .pcard{padding:6px 10px;column-gap:5px}
  .pcard .who{font-size:14px;gap:6px}.pcard .who .ava{width:24px;height:24px;font-size:13px}
  .pcard .grp{font-size:11px;line-height:15px;margin-top:2px}
  .pcard .rack{gap:2px;margin-top:2px;min-height:11px}.pcard .mb{width:10px;height:10px}
  .fab{bottom:6px}#reactBtn,#reactBar{right:6px}
}

/* screen changes (anim.transition -> document.startViewTransition) */
::view-transition-old(root){animation:vt-out 200ms cubic-bezier(.4,0,1,1) both}
::view-transition-new(root){animation:vt-in 340ms var(--ease-out) both}
@keyframes vt-out{to{opacity:0;transform:scale(.97)}}
@keyframes vt-in{from{opacity:0;transform:scale(1.03) translateY(8px)}}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after,::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){
    animation-duration:1ms!important;animation-delay:0s!important;transition-duration:1ms!important}
}

/* the menu opened from the Home card must sit above the Home overlay (both are .modal at z-index 10) */
#menuModal{z-index:11}
/* round 29 (row H): the Home card's quiet notes: another table with the Muse, an expired table link */
.home-note{margin:12px 0 0;font-size:13px;line-height:18px;color:var(--muted);text-align:center}
.home-note .link{font-size:13px;padding:0;min-height:0}
