:root {
  --blue: #5a9cf8;
  --blue-d: #3f82e0;
  --orange: #f0882f;
  --orange-d: #dc6f16;
  --ink: #2e2e2e;
  --mute: #8a8f98;
  --tag: #9fb6d6;
  --paper: #fff;
  --wash: #f3f4f6;
  --line: #e3e5e9;
  --tint: #eef3fb;
  --red: #e0483a;

  /* board */
  --bd-size: 560px;           /* set by size() to fit the window */
  --bd-l: #eaf1fb;
  --bd-d: #8fb4ea;
  --bd-last-l: #fde0bd;
  --bd-last-d: #f3b77c;
  --bd-sel-l: #fbc88c;
  --bd-sel-d: #ee9f55;
  --bd-hint: rgba(28, 52, 96, .24);
  --bd-check: radial-gradient(circle, rgba(224, 72, 58, 1) 0, rgba(224, 72, 58, .75) 28%, rgba(224, 72, 58, 0) 72%);

  --card-w: 420px;
  --bar-h: 44px;
  --col-h: calc(var(--bd-size) + 2 * var(--bar-h) + 20px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--wash); color: var(--ink); font: 15px/1.45 Nunito, system-ui, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; cursor: pointer; }


/* ---------- header ---------- */
.st-head { background: var(--paper); border-bottom: 1px solid var(--line); flex: none; }
.st-head-in { display: flex; align-items: center; gap: 14px; padding: 12px 32px; }
.st-mark { width: 46px; height: 46px; flex: none; }
.st-word { height: 40px; display: block; }
.st-tag { font-weight: 800; font-size: 23px; color: var(--tag); transform: rotate(-6deg); margin-left: 8px; white-space: nowrap; }
.st-online { margin-left: auto; color: var(--mute); font-weight: 700; font-size: 16px; }
.st-online b { color: var(--blue); font-size: 20px; font-weight: 800; }

/* ---------- screens ---------- */
.screen { flex: 1; min-height: 0; display: none; }
body[data-view="start"] .st-main, body[data-view="game"] .game { display: grid; }

/* ---------- start ---------- */
.st-main { place-items: center; padding: 24px 32px 56px; position: relative; overflow: hidden; }
.st-main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: conic-gradient(rgba(90,156,248,.05) 25%, transparent 0 50%, rgba(90,156,248,.05) 0 75%, transparent 0) 0 0 / 96px 96px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 35%, #000 110%);
          mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 35%, #000 110%);
}
.st-card { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; width: 560px; padding: 44px 52px 36px; text-align: center; display: grid; gap: 28px; justify-items: center; box-shadow: 0 10px 40px rgba(30, 50, 90, .07); }
.st-sticker { position: absolute; top: -74px; right: -74px; width: 140px; height: auto; transform: rotate(9deg); pointer-events: none; }
.st-pick { display: grid; gap: 28px; justify-items: center; }
.st-lead { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.35; }
.st-go { display: flex; align-items: center; gap: 16px; }
.st-or { color: var(--mute); font-weight: 700; }
.st-big { border: 0; border-radius: 14px; color: #fff; font-weight: 800; font-size: 24px; padding: 18px 0; width: 188px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14); }
.st-big svg { width: 24px; height: 24px; }
.st-big.st-blue { background: linear-gradient(#7cb3fb, var(--blue)); }
.st-big.st-orange { background: linear-gradient(#f6a65f, var(--orange)); }
.st-time { display: inline-flex; background: var(--wash); border-radius: 10px; padding: 3px; }
.st-time span { padding: 6px 16px; border-radius: 8px; font-weight: 700; color: var(--mute); display: flex; align-items: center; gap: 6px; }
.st-time .st-on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(30, 50, 90, .14); }
.st-time .st-soon { opacity: .55; }
.st-time small { font-size: 11px; font-weight: 800; color: var(--orange); }
.st-fine { font-size: 13px; color: var(--mute); margin: 0; }
.st-down { margin: 0; padding: 8px 14px; border-radius: 8px; background: var(--tint); color: var(--ink); font-size: 14px; font-weight: 700; }
.st-down[hidden] { display: none; }

/* allow camera (phase 4) */
.st-wait { display: none; gap: 20px; justify-items: center; width: 100%; }
body[data-screen="allow"] .st-pick { display: none; }
body[data-screen="allow"] .st-wait { display: grid; }
.st-preview { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: linear-gradient(160deg, #46536a, #22272f); display: grid; place-items: center; color: rgba(255,255,255,.55); }
.st-preview svg { width: 44px; height: 44px; }
.st-ask { margin: 0; font-size: 19px; font-weight: 700; }
.st-cancel { border: 0; background: none; color: var(--mute); font-weight: 700; padding: 4px 10px; }
.st-friend { margin-top: -14px; border: 0; background: none; color: var(--blue); font-weight: 700; font-size: 16px; padding: 4px 10px; text-decoration: underline; text-underline-offset: 3px; }



/* ---------- game layout ---------- */
.game { grid-template-columns: var(--bd-size) var(--card-w); gap: 28px; justify-content: center; align-content: center; padding: 24px 32px; }

/* ---------- board column ---------- */
.bd { width: var(--bd-size); height: var(--col-h); display: flex; flex-direction: column; gap: 10px; }
.bd-bar { display: flex; align-items: center; gap: 10px; height: var(--bar-h); flex: none; }
.bd-name { font-weight: 800; font-size: 17px; }
.bd-name.idle { color: var(--mute); }
.bd-clock { margin-left: auto; min-width: 92px; text-align: right; font: 800 24px/1 Nunito, sans-serif; font-variant-numeric: tabular-nums; padding: 9px 14px; border-radius: 8px; background: var(--paper); color: var(--mute); border: 1px solid var(--line); }
.bd-clock.run { background: var(--blue); border-color: var(--blue); color: #fff; }
.bd-clock.low { background: var(--paper); border-color: var(--red); color: var(--red); }
.bd-clock.run.low { background: var(--red); border-color: var(--red); color: #fff; }

.bd-acts { margin-left: auto; display: flex; gap: 2px; }
.bd-acts + .bd-clock { margin-left: 8px; }
.bd-act { position: relative; width: 38px; height: 38px; border: 0; border-radius: 8px; background: none; color: var(--mute); display: grid; place-items: center; }
.bd-act:hover { background: var(--paper); color: var(--ink); }
.bd-act svg { width: 20px; height: 20px; }
.bd-act .half { font-weight: 800; font-size: 18px; line-height: 1; }
.bd-act::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; padding: 4px 9px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 4; }
.bd-act:hover::after { opacity: 1; }

.bd-ask { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.bd-ask + .bd-clock { margin-left: 12px; }
.bd-ask span { margin-right: 4px; }
.bd-btn { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 6px 14px; font-weight: 800; }
.bd-btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.bd-btn.red { background: var(--red); border-color: var(--red); color: #fff; }

.bd-wrap { position: relative; flex: none; }
.bd-board { width: var(--bd-size); height: var(--bd-size); display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 8px; overflow: hidden; box-shadow: 0 6px 24px rgba(30, 50, 90, .14); user-select: none; }
.bd-sq { position: relative; display: grid; place-items: center; }
.bd-sq.l { background: var(--bd-l); }
.bd-sq.d { background: var(--bd-d); }
.bd-sq.l.last { background: var(--bd-last-l); }
.bd-sq.d.last { background: var(--bd-last-d); }
.bd-sq.l.sel { background: var(--bd-sel-l); }
.bd-sq.d.sel { background: var(--bd-sel-d); }
.bd-sq.chk::before { content: ""; position: absolute; inset: 0; background: var(--bd-check); }
.bd-sq.dot::after { content: ""; position: absolute; z-index: 2; width: 30%; height: 30%; border-radius: 50%; background: var(--bd-hint); }
.bd-sq.ring::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle closest-side, transparent 0 77%, var(--bd-hint) 79% 97%, transparent 99%); z-index: 2; }
.bd-co { position: absolute; font-size: 13px; font-weight: 800; line-height: 1; pointer-events: none; }
.bd-co.f { right: 4px; bottom: 3px; }
.bd-co.r { left: 4px; top: 4px; }
.bd-sq.l .bd-co { color: var(--bd-d); }
.bd-sq.d .bd-co { color: var(--bd-l); }
.bd-sq.last .bd-co, .bd-sq.sel .bd-co { color: rgba(46, 46, 46, .45); }
.bd-pc { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }

.bd-over { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(255, 255, 255, .4); border-radius: 8px; }
.bd-card { background: var(--paper); border-radius: 14px; padding: 24px 28px 22px; text-align: center; box-shadow: 0 12px 40px rgba(30, 50, 90, .22); display: grid; gap: 4px; min-width: 280px; }
.bd-card h3 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.15; }
.bd-card p { margin: 0 0 14px; font-weight: 800; font-size: 17px; }
.bd-card p.win { color: var(--orange); }
.bd-card p.lose, .bd-card p.draw { color: var(--mute); }
.bd-card .row { display: flex; gap: 10px; justify-content: center; }
.bd-big { border: 0; border-radius: 10px; color: #fff; font-weight: 800; font-size: 18px; padding: 11px 0; flex: 1; min-width: 116px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14); }
.bd-big.blue { background: linear-gradient(#7cb3fb, var(--blue)); }
.bd-big.orange { background: linear-gradient(#f6a65f, var(--orange)); }
.bd-big.light { margin-top: 8px; background: var(--tint); color: var(--blue-d); box-shadow: inset 0 -3px 0 rgba(30, 50, 90, .08); }
.bd-big.light.done { cursor: default; }

/* ---------- the right column (mock: video-first.html, A · Stacked) ---------- */
:root {
  --gap: 10px;
  --slim: 56px;
  --them-bg: radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255,255,255,.09), transparent 70%), linear-gradient(160deg, #4a586f, #22272f);
  --me-bg: radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255,255,255,.08), transparent 70%), linear-gradient(160deg, #6f5d4e, #2b2622);
  --tile-shadow: 0 6px 24px rgba(30, 50, 90, .14);
}
.rc { position: relative; width: var(--card-w); height: var(--col-h); display: flex; flex-direction: column; gap: var(--gap); }
.rc .slot { position: relative; flex: 1; min-height: 0; display: flex; }

/* video tiles */
.tile { position: relative; flex: 1; min-height: 0; border-radius: 16px; overflow: hidden; box-shadow: var(--tile-shadow); }
.tile.them { background: var(--them-bg); }
.tile.me { background: var(--me-bg); }
.vf-person { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 66%; height: 82%; }
.vf-tools { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; gap: 8px; justify-content: center; z-index: 2; }
.vf-wait { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: rgba(255,255,255,.75); font-weight: 700; }
.vf-gone { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.75); font-weight: 700; font-size: 17px; }
.cm-spin { width: 40px; height: 40px; border-radius: 50%; border: 4px solid rgba(255,255,255,.2); border-top-color: #fff; animation: cm-sp 1s linear infinite; }
@keyframes cm-sp { to { transform: rotate(360deg); } }

/* round icon buttons */
.cm-ic { width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; background: rgba(0,0,0,.42); color: #fff; display: grid; place-items: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.cm-ic svg { width: 17px; height: 17px; }
.cm-ic.cm-sm { width: 28px; height: 28px; }
.cm-ic.cm-sm svg { width: 14px; height: 14px; }
.cm-ic.cm-off { background: var(--red); }

/* transient chat bubbles over the stranger's video */
.bubs { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.bub { max-width: 100%; padding: 5px 11px 6px; border-radius: 13px; background: rgba(20, 24, 31, .58); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; font-weight: 700; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; animation: bub-in .25s ease-out both; }
.bub b { font-weight: 800; margin-right: 4px; }
.bub.s b { color: #ffbb80; }
.bub.y b { color: #a8cbff; }
.bub.sys { background: rgba(255,255,255,.92); color: var(--ink); }
.bub.old { opacity: .5; }
@keyframes bub-in { from { transform: translateY(6px); opacity: 0; } }

/* chat log */
.cm-log { flex: 1; min-height: 0; overflow: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 5px; }
.cm-sys { color: var(--mute); font-weight: 700; font-size: 14px; }
.cm-msg b { font-weight: 800; margin-right: 4px; }
.cm-msg.cm-s b { color: var(--orange-d); }
.cm-msg.cm-y b { color: var(--blue-d); }

/* the one-line bar */
.bar { flex: none; height: var(--slim); display: flex; align-items: stretch; gap: 6px; padding: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.bar textarea { flex: 1; min-width: 0; resize: none; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; color: var(--ink); background: var(--paper); outline: none; }
.bar textarea:focus { border-color: var(--blue); }
.bar textarea::placeholder { color: var(--mute); }
.bar textarea:disabled { background: var(--wash); }
.cm-btn { flex: none; width: 72px; border: 0; border-radius: 10px; font-weight: 800; line-height: 1.05; display: grid; place-content: center; gap: 1px; }
.cm-btn small { font-size: 11px; font-weight: 700; }
.cm-next { background: var(--wash); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.cm-next small { color: var(--mute); }
.cm-next.cm-go { background: linear-gradient(#7cb3fb, var(--blue)); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.cm-next.cm-go small { color: rgba(255,255,255,.85); }
.cm-send { width: 64px; background: linear-gradient(#7cb3fb, var(--blue)); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.cm-btn:disabled, .vf-chat:disabled { background: var(--wash); color: #b9bdc4; box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.cm-btn:disabled small { color: #c6c9cf; }

/* chat toggle (icon + unread count) */
.vf-chat { position: relative; flex: none; width: 42px; border: 0; border-radius: 10px; background: var(--wash); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; padding: 0; }
.vf-chat svg { width: 20px; height: 20px; }
.vf-chat.on { background: var(--tint); color: var(--blue-d); box-shadow: inset 0 0 0 1px #cfe0f8; }
.vf-n { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 12px; font-weight: 800; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px var(--paper); }

/* the full log: a panel over your video (video games), the main strip (voice games) */
.logp { position: absolute; inset: 0; z-index: 4; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(30, 50, 90, .18); display: none; flex-direction: column; overflow: hidden; }
.rc.open .logp { display: flex; animation: logp-in .2s ease-out both; }
.logp .cm-log { padding: 16px 44px 14px 18px; }
.logp-x { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--mute); display: grid; place-items: center; padding: 0; z-index: 1; }
.logp-x:hover { background: var(--wash); color: var(--ink); }
.logp-x svg { width: 16px; height: 16px; }
@keyframes logp-in { from { transform: translateY(10px); opacity: 0; } }

/* chat open: you shrink to a PiP on the stranger's video */
.pip { position: absolute; right: 12px; bottom: 12px; width: 34%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--me-bg); box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 6px 18px rgba(0,0,0,.3); z-index: 2; display: none; }
.pip .vf-person { width: 62%; height: 80%; }
.rc.open .pip { display: block; }
.rc.open .bubs { display: none; }

/* voice: avatars panel + the full log with the bar */
.vc { position: relative; flex: none; height: 240px; border-radius: 16px; background: var(--tint); display: grid; grid-template-columns: 1fr 1fr; align-items: center; justify-items: center; padding: 8px 24px 0; }
.cm-peer { display: grid; justify-items: center; gap: 10px; }
.cm-av { position: relative; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; }
.cm-av svg.cm-pawn { width: 52px; height: 52px; }
.cm-av.cm-them { background: var(--orange); }
.cm-av.cm-me { background: var(--blue); }
.cm-av.cm-talk { box-shadow: 0 0 0 4px var(--tint), 0 0 0 7px var(--orange); }
.cm-av .cm-ic { position: absolute; right: -4px; bottom: -4px; box-shadow: 0 0 0 3px var(--tint); -webkit-backdrop-filter: none; backdrop-filter: none; }
.cm-av .cm-ic:not(.cm-off) { background: var(--paper); color: var(--ink); }
.cm-peer > span { font-weight: 800; font-size: 16px; }
.cm-peer.cm-s > span { color: var(--orange-d); }
.cm-peer.cm-y > span { color: var(--blue-d); }
.cm-lvl { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-left: 6px; vertical-align: -1px; }
.cm-lvl i { width: 3px; border-radius: 1px; background: var(--orange); }
.cm-lvl i:nth-child(1) { height: 6px; } .cm-lvl i:nth-child(2) { height: 12px; } .cm-lvl i:nth-child(3) { height: 8px; }
.rc.voice .tile.me, .rc.voice .logp-x, .rc.voice .vf-chat { display: none; }
.rc.voice .logp { display: flex; position: static; flex: 1; box-shadow: none; border-bottom: 0; border-radius: 16px 16px 0 0; animation: none; }
.rc.voice .logp .cm-log { padding: 14px 18px; }
.rc.voice .bar { margin-top: calc(-1 * var(--gap)); border-radius: 0 0 16px 16px; }

/* ---------- app additions (not in the mock) ---------- */
[hidden] { display: none !important; }
.st-small { display: none; }
@media (max-width: 899px) {
  body[data-view="start"] .st-head, body[data-view="start"] .st-card { display: none; }
  body[data-view="start"] .st-small { display: block; position: relative; margin: 0; padding: 32px 44px 34px; font-size: 21px; font-weight: 700; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 40px rgba(30, 50, 90, .07); }
  body[data-view="start"] .st-small::before { content: ""; display: block; width: 46px; height: 46px; margin: 0 auto 16px; background: url(/brand/checkmates-mark.svg) center / contain no-repeat; }
}

/* states the mock doesn't draw: hover, press, disabled, keyboard focus */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.st-big:not(:disabled):hover, .bd-big:not(:disabled):hover, .cm-send:not(:disabled):hover, .cm-next.cm-go:not(:disabled):hover, .bd-btn:hover { filter: brightness(1.05); }
.cm-next:not(.cm-go):not(.cm-sure):not(:disabled):hover { background: #eceef1; }
.st-big:not(:disabled):active, .bd-big:not(:disabled):active, .cm-btn:not(:disabled):active { transform: translateY(1px); }
.st-big:disabled, .bd-big:disabled { background: var(--wash); color: #b9bdc4; box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.bd-act:focus-visible { background: var(--paper); color: var(--ink); }
.bd-act:focus-visible::after { opacity: 1; }

/* the board is driven by pointer events */
.bd-board { touch-action: none; }
.bd-board.live .bd-sq.own { cursor: grab; }
.bd-board.live .bd-sq.dot, .bd-board.live .bd-sq.ring { cursor: pointer; }
/* the dragged piece, moved out of its square into .bd-wrap (so the board doesn't clip it) */
.bd-pc.dragging { position: absolute; left: 0; top: 0; z-index: 10; pointer-events: none; }
body.dragging, body.dragging * { cursor: grabbing !important; }

/* promotion picker: four pieces down (or up) the target file, like the over card */
.bd-promo { position: absolute; inset: 0; z-index: 4; background: rgba(255, 255, 255, .4); border-radius: 8px; }
.bd-promo-col { position: absolute; top: 0; width: 12.5%; height: 50%; display: flex; flex-direction: column; background: var(--paper); border-radius: 8px; overflow: hidden; box-shadow: 0 12px 40px rgba(30, 50, 90, .22); }
.bd-promo-col.up { top: auto; bottom: 0; flex-direction: column-reverse; }
.bd-promo button { flex: 1; min-height: 0; border: 0; padding: 0; background: none; }
.bd-promo button:hover { background: var(--bd-last-l); }
.bd-promo button:focus-visible { outline-offset: -3px; }
.bd-promo img { width: 100%; height: 100%; display: block; }


/* on refresh, wait a moment for the server to send the game back before showing Start */
body.boot .st-head, body.boot .screen { visibility: hidden; }
.bd-acts[hidden] + .bd-clock { margin-left: auto; }

/* ---------- phase 3 ---------- */
/* asks on the bars (draw offer on the stranger's, resign on yours) */
.bd-ask[hidden] + .bd-clock { margin-left: auto; }
.bd-ask:not([hidden]) ~ .bd-clock { margin-left: 12px; }
.bd-act:disabled { cursor: default; opacity: .4; }
.bd-act:disabled:hover { background: none; color: var(--mute); }
.bd-act.sent { opacity: 1; color: var(--blue-d); background: var(--tint); }
.bd-act.sent:hover { color: var(--blue-d); background: var(--tint); }
.bd-act:disabled:not(.sent)::after { display: none; }

/* Next pressed once (from the card mock) */
.cm-next.cm-sure { background: linear-gradient(#f6a65f, var(--orange)); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.cm-next.cm-sure small { color: rgba(255,255,255,.85); }
.cm-next.cm-sure:hover { filter: brightness(1.05); }
/* how long "Really?" stays: a bar that runs out with it (SURE_MS) */
.cm-next { position: relative; overflow: hidden; }
.cm-next.cm-sure { padding-bottom: 5px; } /* room for the bar under "Esc" */
.cm-next.cm-sure::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.8); transform-origin: left; animation: cm-sure 3s linear forwards; }
@keyframes cm-sure { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* chat: long words wrap; the rematch Accept link (from the card mock) */
.cm-msg, .cm-sys { overflow-wrap: anywhere; }
.cm-link { border: 0; background: none; padding: 0; color: var(--blue-d); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.cm-link:disabled { color: var(--mute); text-decoration: none; cursor: default; }

/* report: the flag, then Report? with optional reasons under it */
.cm-rep { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; justify-items: end; gap: 6px; }
.cm-rep .cm-report span { display: none; }
.cm-rep.armed .cm-report { width: auto; padding: 0 12px 0 9px; border-radius: 15px; background: var(--red); color: #fff; display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px; }
.cm-rep.armed .cm-report span { display: inline; }
.cm-why { display: none; gap: 4px; }
.cm-rep.armed .cm-why { display: flex; }
.cm-why button { border: 0; border-radius: 12px; padding: 3px 10px; font-size: 13px; font-weight: 800; background: rgba(0,0,0,.45); color: #fff; }
.cm-why button:hover, .cm-rep:not(.armed) .cm-report:hover { background: rgba(0,0,0,.6); }
.cm-rep.armed .cm-report:hover { filter: brightness(1.05); }
.cm-why button.on, .cm-why button.on:hover { background: #fff; color: var(--ink); }
.rc.voice .cm-rep:not(.armed) .cm-report { background: rgba(46,46,46,.08); color: var(--ink); }
.rc.voice .cm-rep:not(.armed) .cm-report:hover { background: rgba(46,46,46,.16); }
.rc.voice .cm-why button { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.rc.voice .cm-why button:hover { background: var(--wash); }
.rc.voice .cm-why button.on, .rc.voice .cm-why button.on:hover { background: var(--ink); color: #fff; box-shadow: none; }
/* while asking, the stranger's video (or the voice card) dims under it */
.rc:has(.cm-rep.armed) > :is(#video, #voice)::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(20, 24, 32, .45); }
.rc.voice:has(.cm-rep.armed) > #voice::after { background: rgba(238, 243, 251, .7); }
/* voice: once the stranger has gone, their side fades */
.rc.gone #voice .cm-s { opacity: .35; filter: grayscale(1); }

/* white buttons on the bars (Decline, Cancel, Copy link) */
.bd-btn:not(.blue):not(.red):hover { background: var(--wash); filter: none; }
/* sent / done: a quiet tint of the button's colour, like the ½ button once offered */
.bd-big.orange:disabled { background: #fdeedf; color: var(--orange-d); box-shadow: none; }
#copy { min-width: 96px; }
#copy.done, #copy.done:hover { background: var(--tint); border-color: var(--tint); color: var(--blue-d); }

/* waiting puzzle: the board column shows it; the bars swap for the puzzle's */
.pz { display: none; flex: 1; align-items: center; gap: 10px; min-width: 0; }
body.puzzling .bd-bar > :not(.pz) { display: none; }
body.puzzling .bd-bar > .pz { display: flex; }
.pz-status { margin-left: auto; font-weight: 800; color: var(--mute); }
.pz-status.nope { color: var(--red); }
.pz-status.solved { color: var(--orange); }
.pz-share { font-weight: 800; color: var(--ink); }
.pz-share + .bd-btn { margin-left: auto; }
.bd-wrap.nope .bd-board { animation: bd-nope .3s ease-in-out; }
@keyframes bd-nope { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- phase 4: calls ---------- */
/* Allow screen: your camera in the preview once granted; Voice offered when the camera (or mic) is blocked */
.st-preview { position: relative; overflow: hidden; }
.st-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: none; }
.st-preview.on video { display: block; }
.st-preview.on svg { display: none; }
.st-cancel:hover { color: var(--ink); }

/* the stranger's video once the call is up and their camera is on; else their avatar; spinner while searching or connecting */
.vf-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.vf-self { transform: scaleX(-1); }
#remote { z-index: 1; }
.rc.live:not(.gone) #remote { display: block; }
.rc.live #video-them, .rc.connecting #video-them { display: none; }
.rc .vf-wait { display: none; }
.rc.wait .vf-wait, .rc.connecting:not(.gone) .vf-wait { display: grid; }
.rc.connecting .vf-wait span, .rc.connecting #invite-copy { display: none; }
.bubs, .pip { z-index: 3; }

/* you: your camera, mirrored (in your tile, and in the PiP while the chat is open) */
.rc.cam-on .vf-self { display: block; }
.rc.cam-on .tile.me > .vf-person, .rc.cam-on .pip > .vf-person { display: none; }
.cm-ic:not(:disabled):hover { background: rgba(0,0,0,.6); }
.cm-ic.cm-off:not(:disabled):hover { background: var(--red); filter: brightness(1.08); }
.cm-ic:disabled { cursor: default; }
.vf-chat:not(:disabled):not(.on):hover { background: #eceef1; }

/* voice: talking ring & level bars for both; yours in blue */
.cm-av.cm-talk::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid var(--orange); animation: cm-ring 1.4s ease-out infinite; pointer-events: none; }
.cm-av.cm-me.cm-talk { box-shadow: 0 0 0 4px var(--tint), 0 0 0 7px var(--blue); }
.cm-av.cm-me.cm-talk::after { border-color: var(--blue); }
@keyframes cm-ring { from { transform: scale(1); opacity: .6; } to { transform: scale(1.28); opacity: 0; } }
.cm-lvl i { transition: height 60ms linear; }
.cm-y .cm-lvl i { background: var(--blue); }
.cm-av span.cm-ic { cursor: default; }
.cm-av .cm-ic:not(.cm-off):not(:disabled):hover { background: var(--wash); }

/* ---------- phase 5 ---------- */
/* the stranger's country: by their name, on their video, on the voice card */
.flag { width: 24px; height: 18px; border-radius: 2px; object-fit: cover; vertical-align: -2px; margin-left: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }

/* start: the credit line at the bottom, and the wide ad under the card */
.st-main { align-content: center; gap: 24px; }
.st-credit { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; }
.st-credit a { color: inherit; text-decoration: none; }
.st-credit a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* ad slots: only when configured (ads.js) */
.ad { position: relative; }
.ad .adsbygoogle { display: block; width: 100%; height: 100%; }
.ad-h { width: min(728px, 100%); height: 90px; }
.ad-v { display: none; width: 160px; height: 600px; align-self: center; }
.game.with-ad { grid-template-columns: 160px var(--bd-size) var(--card-w); }
.game.with-ad .ad-v { display: block; }
@media (max-width: 899px) { .ad-h, .st-credit { display: none !important; } }
/* the Allow card is taller: no wide ad under it */
body[data-screen="allow"] .ad-h { display: none; }
/* waiting for a first move: a quiet label by the mover's name (the clock box counts down) */
.bd-first { margin-left: 10px; font-size: 13px; font-weight: 700; color: var(--mute); }

/* start: Terms & Privacy links in the notice */
.st-card .st-fine a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.st-card .st-fine a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* /terms and /privacy: a readable column, the page scrolls */
body.doc-page { display: block; height: auto; overflow: auto; }
.doc-home { display: flex; align-items: center; gap: 14px; }
.doc { max-width: 680px; margin: 0 auto; padding: 40px 24px 24px; font-size: 16px; line-height: 1.6; }
.doc h1 { margin: 0 0 6px; font-size: 34px; font-weight: 800; line-height: 1.2; }
.doc h1 + p { color: var(--mute); margin-top: 0; }
.doc h2 { margin: 40px 0 10px; font-size: 22px; font-weight: 800; line-height: 1.3; }
.doc h3 { margin: 28px 0 8px; font-size: 18px; font-weight: 800; }
.doc p, .doc ul { margin: 0 0 14px; }
.doc ul { padding-left: 22px; }
.doc li { margin-bottom: 4px; }
.doc a { color: var(--blue-d); text-underline-offset: 2px; overflow-wrap: anywhere; }
.doc strong { font-weight: 800; }
.doc code { font: 600 14px/1.4 ui-monospace, Menlo, monospace; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.doc-table { overflow-x: auto; margin: 0 0 14px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.doc th { font-weight: 800; color: var(--mute); }
.doc td:first-child { min-width: 9em; }
.doc-box { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 14px; padding: 14px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.doc-switch { display: flex; align-items: center; gap: 10px; font-weight: 800; cursor: pointer; }
.doc-switch input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.doc-label { font-weight: 800; }
.doc-id code { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; font-size: 13px; padding: 4px 8px; background: var(--wash); border: 0; }
.doc-btn { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 10px; padding: 5px 14px; font-weight: 800; }
.doc-btn:hover { border-color: var(--blue); color: var(--blue-d); }
.doc-foot { text-align: center; padding: 8px 24px 40px; }
.doc-foot a { color: inherit; text-decoration: none; }
.doc-foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.doc-404 { text-align: center; padding-top: 72px; padding-bottom: 56px; }
.doc-404-piece { width: 96px; height: 96px; transform: rotate(-12deg); margin-bottom: 12px; }
.doc .doc-404-go { margin: 24px auto 0; color: #fff; text-decoration: none; }
