/* TapToVote: loud, poppy, simple. Hot pink + electric yellow + ink black, chunky type, thick outlines.
   Tokens first; every colour below comes from them. Dark theme swaps the paper for ink. */
:root {
  --ink: #111014;
  --paper: #fffdf6;
  --card: #ffffff;
  --pink: #ff2e88;
  --yellow: #ffe14d;
  --blue: #2f5bff;
  --mint: #18d9a0;
  --orange: #ff7a1a;
  --violet: #8a4dff;
  --muted: #5d5a66;
  --line: #111014;
  --soft: #f3efe3;
  --ok: #0f9d6b;
  --bad: #e5243b;
  --accent: var(--pink);
  --shadow: 4px 4px 0 var(--line);
  --shadow-lg: 7px 7px 0 var(--line);
  --r: 16px;
  --display: "Archivo Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --c1: #ff2e88; --c2: #2f5bff; --c3: #ffbf00; --c4: #18c48f; --c5: #8a4dff; --c6: #ff7a1a; --c7: #00b3d6; --c8: #e5243b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ink: #fffdf6; --paper: #141218; --card: #1e1b24; --muted: #b6b0c2; --line: #000000; --soft: #26222e;
  --shadow: 4px 4px 0 #000; --shadow-lg: 7px 7px 0 #000; color-scheme: dark; } }
:root[data-theme="dark"] { --ink: #fffdf6; --paper: #141218; --card: #1e1b24; --muted: #b6b0c2; --line: #000000; --soft: #26222e;
  --shadow: 4px 4px 0 #000; --shadow-lg: 7px 7px 0 #000; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.5; }
a { color: inherit; }
img, svg { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.02; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border: 3px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-weight: 800;
  font-size: 1rem; text-decoration: none; cursor: pointer; box-shadow: var(--shadow); transition: transform .08s, box-shadow .08s; white-space: nowrap; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
@media (hover: hover) { .btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--line); } }
.btn.pink { background: var(--pink); color: #fff; }
.btn.yellow { background: var(--yellow); color: #111014; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.black { background: #111014; color: #fff; }
.btn.big { min-height: 64px; padding: 14px 30px; font-size: 1.25rem; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; box-shadow: 3px 3px 0 var(--line); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.02em; }
.logo .mark { width: 40px; height: 40px; border: 3px solid var(--line); border-radius: 12px; background: var(--yellow); display: grid; place-items: center; box-shadow: 3px 3px 0 var(--line); }
.logo .mark svg { width: 30px; height: 30px; }
.logo em { font-style: normal; color: var(--pink); }
.by { font-size: .78rem; color: var(--muted); font-weight: 600; }
.by a { text-decoration: none; }
@media (hover: hover) { .by a:hover { text-decoration: underline; } }

/* ---------- cards & inputs ---------- */
.card { background: var(--card); border: 3px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.field { display: grid; gap: 6px; }
.field label, .lbl { font-weight: 800; font-size: .9rem; }
.input, textarea.input, select.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
textarea.input { min-height: 80px; resize: vertical; }
.code-in { font-family: var(--display); font-size: 2rem; letter-spacing: .12em; text-align: center; }
.hint { color: var(--muted); font-size: .9rem; }
.err { color: var(--bad); font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border: 2px solid var(--line); border-radius: 999px; font-weight: 800; font-size: .8rem; background: var(--yellow); color: #111014; }
.pill.pink { background: var(--pink); color: #fff; }
.pill.mint { background: var(--mint); color: #111014; }
.pill.dim { background: var(--soft); color: var(--ink); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; min-height: 44px; }
.switch input { appearance: none; width: 52px; height: 30px; border: 3px solid var(--line); border-radius: 999px; background: var(--soft); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.switch input:checked { background: var(--mint); }
.switch input:checked::after { transform: translateX(22px); background: #111014; }

/* ---------- voter (phone) ---------- */
.vote { min-height: 100dvh; display: flex; flex-direction: column; }
.vote header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 3px solid var(--line); background: var(--accent); color: #fff; }
.vote header .t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote header .live { font-size: .8rem; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 2px #fff; }
.dot.off { background: var(--bad); }
.vote main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left, 0px)) 24px; display: flex; flex-direction: column; gap: 16px; }
.vote main:has(.sendbar) { padding-bottom: 110px; }
.qtext { font-family: var(--display); font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.08; }
.opts { display: grid; gap: 12px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 12px 16px; text-align: left; border: 3px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; font-size: 1.08rem; cursor: pointer; transition: transform .08s, box-shadow .08s, background .12s; }
.opt:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.opt .k { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 3px solid var(--line); display: grid; place-items: center; font-family: var(--display); font-size: 1rem; color: #fff; }
.opt.sel { background: var(--yellow); color: #111014; }
.opt.right { background: var(--mint); color: #111014; }
.opt.wrong { background: #ffd0d6; color: #111014; text-decoration: line-through; text-decoration-thickness: 3px; }
.opt.tiles { min-height: 96px; color: #fff; justify-content: center; font-size: 1.15rem; text-align: center; }
.quizgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quizgrid .opt { flex-direction: column; justify-content: center; min-height: 120px; color: #fff; text-align: center; }
.quizgrid .opt .k { background: rgba(0,0,0,.18); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.scale.ten { grid-template-columns: repeat(5, 1fr); }
.scale button { min-height: 64px; font-family: var(--display); font-size: 1.5rem; border: 3px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); cursor: pointer; }
.scale button.sel { background: var(--yellow); color: #111014; }
.scale-ends { display: flex; justify-content: space-between; font-weight: 700; color: var(--muted); font-size: .9rem; gap: 10px; }
.sendbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px max(16px, env(safe-area-inset-left, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--paper); border-top: 3px solid var(--line); display: flex; justify-content: center; z-index: 5; }
.sendbar .btn { width: 100%; max-width: 560px; }
.done { text-align: center; display: grid; gap: 14px; justify-items: center; padding-top: 10px; }
.done .big { font-family: var(--display); font-size: 2.2rem; }
.wait { text-align: center; display: grid; gap: 16px; justify-items: center; padding-top: 6vh; }
.wait .owl { width: 140px; animation: bob 2.4s ease-in-out 3; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
/* the dark look: a thin cream edge so the brown owl and his black outline still stand out */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .owl { filter: drop-shadow(0 0 1px #fbf5ea) drop-shadow(0 0 1px #fbf5ea); } }
:root[data-theme="dark"] .owl { filter: drop-shadow(0 0 1px #fbf5ea) drop-shadow(0 0 1px #fbf5ea); }
.rxbar { position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; gap: 8px; pointer-events: none; z-index: 4; }
.rxbar.low { position: static; margin-top: auto; padding-top: 16px; }
.rxbar button { pointer-events: auto; width: 48px; height: 48px; border: 3px solid var(--line); border-radius: 50%; background: var(--card); font-size: 1.4rem; cursor: pointer; box-shadow: 3px 3px 0 var(--line); }
.rxbar button:active { transform: scale(.9); }
.timer { height: 14px; border: 3px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--soft); }
.timer i { display: block; height: 100%; background: var(--pink); transform-origin: left; }
.qa-list { display: grid; gap: 10px; }
.qa-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); }
.qa-item .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qa-item .nm { font-size: .8rem; color: var(--muted); font-weight: 700; }
.up { flex: none; display: grid; justify-items: center; min-width: 52px; min-height: 52px; padding: 4px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; font-weight: 800; }
.up.on { background: var(--yellow); color: #111014; }
.up[disabled] { cursor: default; opacity: .6; }
.tabs { display: flex; gap: 8px; }
.tabs button { flex: 1; min-height: 46px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.mywords { display: flex; flex-wrap: wrap; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: #111014; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 800; z-index: 50; max-width: calc(100% - 32px); text-align: center; border: 3px solid #111014; box-shadow: 4px 4px 0 var(--pink); }
.myres { display: grid; gap: 8px; }

/* ---------- result bars (phone + screen) ---------- */
.bars { display: grid; gap: 12px; }
.bar { display: grid; gap: 4px; }
.bar .lab { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; }
.bar .lab span:first-child { overflow-wrap: anywhere; min-width: 0; }
.bar .tr { height: 30px; border: 3px solid var(--line); border-radius: 10px; background: var(--soft); overflow: hidden; }
.bar .fl { height: 100%; width: 0; transition: width .6s cubic-bezier(.2,.8,.2,1); border-right: 3px solid var(--line); }
.bar .fl.zero { border-right: 0; }
.bar.right .lab span:first-child::after { content: " ✓"; color: var(--ok); }
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 18px; padding: 10px; min-height: 160px; }
.cloud span { font-family: var(--display); line-height: 1.05; transition: font-size .5s; overflow-wrap: anywhere; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cards .c { padding: 14px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 700; box-shadow: 3px 3px 0 var(--line); overflow-wrap: anywhere; animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.avg { font-family: var(--display); font-size: 3rem; }
.lead { display: grid; gap: 10px; }
.lead .p { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 800; }
.lead .p .n { font-family: var(--display); width: 40px; height: 40px; display: grid; place-items: center; border: 3px solid var(--line); border-radius: 50%; background: var(--yellow); color: #111014; flex: none; }
.lead .p .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- big screen ---------- */
.screen { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--paper); overflow: hidden; }
.screen .joinbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 3vw; background: var(--accent); color: #fff; border-bottom: 4px solid var(--line); }
.screen .joinbar .how { font-family: var(--display); font-size: clamp(1.1rem, 2.2vw, 2rem); }
.screen .joinbar .how b { background: var(--yellow); color: #111014; padding: 0 .3em; border: 3px solid var(--line); border-radius: 10px; display: inline-block; }
.screen .joinbar .qr { background: #fff; padding: 6px; border: 3px solid var(--line); border-radius: 10px; width: clamp(70px, 8vw, 120px); height: clamp(70px, 8vw, 120px); }
.screen .joinbar .qr svg { width: 100%; height: 100%; display: block; }
.screen .stage { padding: 3vh 4vw; display: flex; flex-direction: column; gap: 3vh; min-height: 0; }
.screen .stage .qtext { font-size: clamp(2rem, 4.4vw, 4.6rem); }
.screen .bars { gap: 2vh; }
.screen .bar .lab { font-size: clamp(1rem, 2vw, 1.8rem); }
.screen .bar .tr { height: clamp(30px, 5vh, 64px); border-width: 4px; }
.screen .cloud { min-height: 40vh; }
.screen .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 3vw; border-top: 4px solid var(--line); font-weight: 800; font-size: clamp(.9rem, 1.3vw, 1.2rem); }
.screen .count { font-family: var(--display); font-size: clamp(1.2rem, 2vw, 2rem); }
.screen .waiting { display: grid; grid-template-columns: 1fr auto; gap: 5vw; align-items: center; height: 100%; padding: 2vh 4vw; }
.screen .waiting h1 { font-size: clamp(2.6rem, 7vw, 7.5rem); }
.screen .waiting .bigqr { background: #fff; padding: 14px; border: 5px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); width: min(36vw, 52vh); }
.screen .waiting .bigqr svg { width: 100%; height: auto; display: block; }
.screen .waiting .code { font-family: var(--display); font-size: clamp(2rem, 6vw, 6rem); letter-spacing: .06em; }
.screen .podium { display: flex; justify-content: center; align-items: flex-end; gap: 2vw; height: 46vh; margin-top: 2vh; }
.screen .podium .col { display: grid; justify-items: center; gap: 1vh; width: min(24vw, 300px); }
.screen .podium .blk { width: 100%; border: 4px solid var(--line); border-radius: 18px 18px 0 0; display: grid; place-items: center; font-family: var(--display); font-size: 4vw; color: #111014; box-shadow: var(--shadow); animation: rise .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { transform: scaleY(0); transform-origin: bottom; } }
.screen .podium .who { font-family: var(--display); font-size: clamp(1rem, 2vw, 2rem); text-align: center; overflow-wrap: anywhere; }
.floaters { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.floaters span { position: absolute; bottom: -60px; font-size: clamp(28px, 4vw, 56px); animation: floatup 3.2s ease-out forwards; }
@keyframes floatup { to { transform: translateY(-85vh) translateX(var(--dx, 0)); opacity: 0; } }
.screen-qa .qa-item { font-size: clamp(1.1rem, 2vw, 1.8rem); border-width: 4px; }
.screen-qa .qa-item .up { min-width: 80px; font-size: 1.4rem; }
.screen .ctrl { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; display: flex; gap: 8px; opacity: .15; transition: opacity .2s; z-index: 30; }
.screen .ctrl:hover, .screen .ctrl:focus-within { opacity: 1; }

/* ---------- host ---------- */
.host { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.host .bar1 { display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 3px solid var(--line); background: var(--card); flex-wrap: wrap; }
.host .bar1 .title { font-family: var(--display); font-size: 1.15rem; border: 0; background: transparent; min-width: 0; flex: 1 1 200px; padding: 6px 8px; border-radius: 10px; }
.host .bar1 .title:focus { background: var(--soft); outline: 3px solid var(--blue); }
.host .joininfo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.host .joininfo b { font-family: var(--display); font-size: 1.2rem; letter-spacing: .05em; background: var(--yellow); color: #111014; border: 3px solid var(--line); border-radius: 10px; padding: 0 8px; }
.host .body { display: grid; grid-template-columns: 300px 1fr 340px; min-height: 0; }
.host .list { border-right: 3px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: auto; background: var(--soft); }
.host .qitem { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; text-align: left; width: 100%; }
.host .qitem.sel { outline: 4px solid var(--blue); outline-offset: 0; }
.host .qitem.live { background: var(--yellow); color: #111014; }
.host .qitem .num { font-family: var(--display); flex: none; width: 28px; }
.host .qitem .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.host .qitem .ty { font-size: .72rem; font-weight: 800; color: var(--muted); }
.host .qitem.live .ty { color: #111014; }
.host .edit { padding: 18px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.host .side { border-left: 3px solid var(--line); padding: 14px; overflow: auto; display: flex; flex-direction: column; gap: 14px; background: var(--card); }
.typegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.typegrid button { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; font-size: .8rem; cursor: pointer; min-height: 64px; }
.typegrid button .i { font-size: 1.3rem; }
.typegrid button[aria-pressed="true"] { background: var(--yellow); color: #111014; }
.optrow { display: flex; gap: 8px; align-items: center; }
.optrow .chk { width: 44px; height: 44px; flex: none; border: 3px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; font-weight: 900; }
.optrow .chk.on { background: var(--mint); color: #111014; }
.live-ctl { display: grid; gap: 10px; }
.live-ctl .nav { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.live-ctl .btn, .host .side .btn { white-space: normal; min-width: 0; padding-inline: 10px; text-align: center; line-height: 1.15; }
.host .body > section { min-width: 0; }
.pend { display: grid; gap: 8px; }
.pend .it { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 3px solid var(--line); border-radius: 12px; }
.pend .it .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat div { border: 3px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; background: var(--paper); }
.stat b { display: block; font-family: var(--display); font-size: 1.4rem; }
.stat span { font-size: .75rem; font-weight: 700; color: var(--muted); }
.mobtabs { display: none; }
@media (max-width: 1000px) {
  .host .body { grid-template-columns: 1fr; }
  .host .list, .host .side { border: 0; }
  .host .body > section { display: none; }
  .host .body > section.on { display: flex; }
  .mobtabs { display: flex; position: sticky; bottom: 0; gap: 8px; padding: 10px max(16px, env(safe-area-inset-left, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--paper); border-top: 3px solid var(--line); z-index: 6; }
  .mobtabs button { flex: 1; min-height: 48px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; cursor: pointer; }
  .mobtabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
  .host { grid-template-rows: auto 1fr auto; }
}
.modal { position: fixed; inset: 0; background: rgba(17,16,20,.6); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal .card { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; display: grid; gap: 14px; }

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

/* picture choice */
.picgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.picgrid.big { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22vw), 1fr)); gap: 2vw; }
.pic { position: relative; padding: 0; border: 3px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); cursor: pointer; display: grid; text-align: left; box-shadow: var(--shadow); }
.pic img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.picgrid.big .pic img { aspect-ratio: 4 / 3; }
.pic .noimg { aspect-ratio: 1; display: grid; place-items: center; font-family: var(--display); font-size: 2.4rem; background: var(--soft); }
.pic .pl { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 800; overflow-wrap: anywhere; }
.pic .pl .k { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: .8rem; }
.picgrid.big .pl { font-size: clamp(1rem, 1.8vw, 1.6rem); }
.pic.sel { outline: 5px solid var(--yellow); outline-offset: -5px; }
.pic.sel .pl { background: var(--yellow); color: #111014; }
.pic[disabled] { cursor: default; }
.bimg { width: 1.8em; height: 1.8em; border-radius: 6px; object-fit: cover; vertical-align: middle; margin-right: 8px; }
/* before and after */
.bar .tr.before { height: 10px; border-width: 2px; opacity: .8; }
.bar .tr.before .fl { background: #a9a3b6; border-right: 0; }
.bar .was { color: var(--muted); font-weight: 700; }
.bfkey { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bfkey .k1, .bfkey .k2 { width: 14px; height: 10px; border-radius: 3px; display: inline-block; background: #a9a3b6; }
.bfkey .k2 { background: var(--c1); margin-left: 10px; }
.screen .bar .tr.before { height: clamp(12px, 2vh, 22px); }
/* guess the number */
.numbox { display: grid; gap: 10px; }
.numbox .unit { text-align: center; font-weight: 800; color: var(--muted); margin-top: -6px; }
.numbox input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); }
.numres { display: grid; gap: 10px; }
.hist { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 3px solid var(--line); padding-top: 22px; }
.hist i { flex: 1; background: var(--c2); border-radius: 4px 4px 0 0; transition: height .5s; }
.numres.big .hist { height: 34vh; gap: .5vw; }
.hist .mk { position: absolute; top: 0; bottom: 0; width: 0; border-left: 3px dashed var(--ink); }
.hist .mk span { position: absolute; top: 0; left: 6px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.hist .ansmk { border-left: 4px solid var(--ok); }
.hist .ansmk span { color: var(--ok); top: 1.1em; }
.numres.big .hist .mk span { font-size: clamp(.9rem, 1.4vw, 1.4rem); }
.axis { display: flex; justify-content: space-between; font-weight: 700; color: var(--muted); font-size: .85rem; }
.nstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.nstats div { border: 2px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; background: var(--card); }
.nstats b { display: block; font-family: var(--display); font-size: 1.5rem; overflow-wrap: anywhere; }
.numres.big .nstats b { font-size: clamp(1.6rem, 3vw, 3.2rem); }
.nstats span { font-size: .78rem; font-weight: 700; color: var(--muted); }
.nstats .ans { background: var(--mint); color: #111014; }
.nstats .ans span { color: #111014; }
.closest { display: grid; gap: 6px; }
.closest div { display: flex; gap: 10px; align-items: center; font-weight: 800; }
.closest .n { width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); color: #111014; display: grid; place-items: center; flex: none; }
/* guess the room */
.guessbox { display: grid; gap: 8px; margin-top: 12px; }
.guessbox .mini { display: grid; gap: 6px; }
.guessbox .mini div { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.guessbox .mb { width: 40%; height: 10px; border-radius: 9px; background: var(--soft); overflow: hidden; flex: none; }
.guessbox .mb i { display: block; height: 100%; }
.gline { margin: 0; font-weight: 700; }
.screen .gline { font-size: clamp(1rem, 2vw, 2rem); }

/* unanimous */
.unan { align-self: center; justify-self: center; margin-top: 2vh; padding: 1vh 2.4vw; border: 4px solid var(--line); border-radius: 999px; background: var(--yellow); color: #111014; font-family: var(--display); font-size: clamp(1.4rem, 3vw, 3rem); box-shadow: var(--shadow); display: flex; align-items: baseline; gap: 1vw; flex-wrap: wrap; justify-content: center; }
.unan small { font-family: var(--body); font-weight: 800; font-size: .45em; }
.unan.fresh { animation: pop .5s cubic-bezier(.3,1.6,.5,1) 1; }
/* coin flip: a thick gold coin tossed up, spinning end over end, with a shadow on the floor and a burst when it lands */
.coinbox { position: fixed; inset: 0; z-index: 80; background: radial-gradient(ellipse at 50% 60%, rgba(40,30,60,.82), rgba(10,9,14,.92)); display: grid; place-content: center; justify-items: center; gap: 2.5vh; color: #fff; text-align: center; padding: 20px; animation: cfade .25s ease-out; }
.coinbox.bye { opacity: 0; transition: opacity .3s; }
@keyframes cfade { from { opacity: 0; } }
.coinbox .tie { font-family: var(--display); font-size: clamp(1.2rem, 2.8vw, 2.6rem); margin: 0; line-height: 1.15; max-width: 90vw; }
.coinbox .tie b { color: var(--yellow); font-weight: 400; }
.coinbox .tie i { font-style: normal; opacity: .7; font-size: .7em; padding: 0 .3em; }
.cstage { --size: clamp(150px, 24vmin, 320px); position: relative; width: var(--size); height: calc(var(--size) * 2); display: grid; place-items: end center; perspective: 1200px; }
.ctoss { width: var(--size); height: var(--size); transform-style: preserve-3d; }
.coin3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(var(--end)); }
.cface { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden; overflow: hidden;
  background: radial-gradient(circle at 32% 28%, #fff7c2 0 8%, #ffe066 22%, #f5b800 52%, #c98a00 78%, #a86f00);
  box-shadow: inset 0 0 0 calc(var(--size) * .035) #d99a00, inset 0 0 0 calc(var(--size) * .05) #fff0a0, inset 0 0 0 calc(var(--size) * .065) #b07800, inset 0 calc(var(--size) * -.04) calc(var(--size) * .08) rgba(120,70,0,.45); }
.cface::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.75) 48%, transparent 60%); transform: translateX(-120%); }
.landed .cface::after { animation: shine .9s ease-out .15s 1; }
@keyframes shine { to { transform: translateX(120%); } }
.cface.front { transform: translateZ(calc(var(--size) * .045)); }
.cface.back { transform: rotateX(180deg) translateZ(calc(var(--size) * .045)); }
.cedge { position: absolute; inset: 0; border-radius: 50%; background: repeating-linear-gradient(90deg, #8a5a00 0 3px, #d39a00 3px 6px); transform: translateZ(calc(var(--size) * var(--z))); }
.ctext { font-family: var(--display); color: #5a3a00; font-size: clamp(1.1rem, 3.2vmin, 2.4rem); line-height: 1.05; padding: 0 16%; overflow-wrap: anywhere; text-shadow: 0 1px 0 rgba(255,250,210,.8), 0 -1px 0 rgba(110,60,0,.35); position: relative; z-index: 1; }
.cface-owl { width: 62%; height: auto; filter: sepia(1) saturate(2.2) hue-rotate(-12deg) brightness(.75) drop-shadow(0 1px 0 rgba(255,250,210,.7)); position: relative; z-index: 1; }
.cshadow { position: absolute; bottom: calc(var(--size) * -.08); width: 80%; height: calc(var(--size) * .14); border-radius: 50%; background: radial-gradient(rgba(0,0,0,.55), transparent 70%); }
.coinbox:not(.still) .ctoss { animation: toss 2.3s cubic-bezier(.33,0,.4,1) 1 both; }
.coinbox:not(.still) .coin3d { animation: spin 2.3s cubic-bezier(.2,.6,.35,1) 1 both; }
.coinbox:not(.still) .cshadow { animation: shad 2.3s cubic-bezier(.33,0,.4,1) 1 both; }
@keyframes spin { from { transform: rotateX(0); } to { transform: rotateX(var(--end)); } }
@keyframes toss { 0% { transform: translateY(0) scale(.9); } 12% { transform: translateY(calc(var(--size) * -.15)) scale(1); }
  45% { transform: translateY(calc(var(--size) * -.95)) scale(1.15); animation-timing-function: cubic-bezier(.5,0,.8,.6); }
  82% { transform: translateY(0) scale(1); } 89% { transform: translateY(calc(var(--size) * -.12)) rotateZ(-4deg); } 95% { transform: translateY(0) rotateZ(2deg); } 100% { transform: translateY(0) rotateZ(0); } }
@keyframes shad { 0%, 12% { transform: scale(1); opacity: 1; } 45% { transform: scale(.45); opacity: .35; } 82% { transform: scale(1); opacity: 1; } 89% { transform: scale(.85); } 100% { transform: scale(1); } }
.cburst { position: absolute; left: 50%; top: 60%; width: 0; height: 0; pointer-events: none; }
.cburst i { position: absolute; width: 12px; height: 18px; border-radius: 3px; animation: pop 1.1s cubic-bezier(.15,.7,.3,1) 1 both; }
@keyframes pop { from { transform: translate(0,0) rotate(0) scale(.4); opacity: 1; } 70% { opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); opacity: 0; } }
.coinbox .won { margin: 0; display: grid; gap: .3em; animation: wonin .45s cubic-bezier(.2,1.4,.4,1) 1 both; }
.coinbox.still .won { animation: none; }
@keyframes wonin { from { transform: scale(.6); opacity: 0; } }
.coinbox .won span { font-weight: 800; font-size: clamp(1rem, 2vw, 1.6rem); opacity: .85; }
.coinbox .won b { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 6vw, 5rem); color: var(--yellow); line-height: 1; text-shadow: 0 4px 24px rgba(255,212,59,.45); max-width: 90vw; overflow-wrap: anywhere; }

/* ---------- stream overlay (/overlay/123456, an OBS browser source): see-through page, one card in a corner ---------- */
html.ovl, body.ovl { background: transparent !important; min-height: 0; overflow: hidden; }
body.ovl #app { position: fixed; inset: 0; pointer-events: none; }
.ovcard { position: absolute; width: min(36vw, 760px); max-height: 86vh; overflow: hidden; padding: 1.6vw 1.8vw; border-radius: 1.4vw;
  background: rgba(17, 16, 20, .88); color: #fff; font-family: Figtree, system-ui, sans-serif; font-size: 1.25vw; line-height: 1.25;
  box-shadow: 0 .6vw 2.4vw rgba(0, 0, 0, .45); border: .15vw solid rgba(255, 255, 255, .14); animation: ovin .25s ease-out; }
.ovcard.s { width: min(28vw, 600px); font-size: 1vw; } .ovcard.l { width: min(46vw, 960px); font-size: 1.55vw; }
.ovcard.bl { left: 2.2vw; bottom: 2.2vw; } .ovcard.br { right: 2.2vw; bottom: 2.2vw; } .ovcard.tl { left: 2.2vw; top: 2.2vw; } .ovcard.tr { right: 2.2vw; top: 2.2vw; }
@keyframes ovin { from { opacity: 0; transform: translateY(.6vw); } }
@media (prefers-reduced-motion: reduce) { .ovcard { animation: none; } .ovf { transition: none !important; } }
.ovhead { display: flex; align-items: center; gap: .5em; font-weight: 800; font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: #ffd43b; }
.ovhead img { width: 1.6em; height: 1.6em; }
.ovtag { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; color: rgba(255, 255, 255, .62); font-size: .9em; }
.ovq { font-family: "Archivo Black", Figtree, sans-serif; font-weight: 400; font-size: 1.55em; line-height: 1.15; margin: .45em 0 .55em; overflow-wrap: break-word; }
.ovsub { margin: .2em 0 0; color: rgba(255, 255, 255, .8); }
.ovbars { display: grid; gap: .42em; }
.ovbar { position: relative; display: flex; align-items: center; gap: .55em; padding: .42em .6em; border-radius: .55em; background: rgba(255, 255, 255, .08); overflow: hidden; font-weight: 600; }
.ovbar > * { position: relative; z-index: 1; }
.ovbar .ovf { position: absolute; z-index: 0; left: 0; top: 0; bottom: 0; opacity: .38; transition: width .25s ease-out; }
.ovbar.right { outline: .14em solid #18c29c; } .ovbar.dim { opacity: .45; }
.ovk { flex: none; min-width: 2.2em; text-align: center; padding: .08em .3em; border-radius: .4em; background: #ffd43b; color: #111014; font-weight: 800; }
.ovl2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovp { font-weight: 800; }
.ovhow { margin: .7em 0 0; color: rgba(255, 255, 255, .85); }
.ovhow b { color: #ffd43b; }
.ovn2 { color: rgba(255, 255, 255, .62); }
.ovtimer { height: .4em; border-radius: 1em; background: rgba(255, 255, 255, .15); margin-bottom: .6em; overflow: hidden; }
.ovtimer i { display: block; height: 100%; background: #ffd43b; transform-origin: left; }
.ovwords { line-height: 1.5; font-weight: 800; }
.ovwords span { margin-right: .35em; }
.ovtop { list-style: none; margin: 0; padding: 0; display: grid; gap: .35em; }
.ovtop li { display: flex; gap: .6em; align-items: center; padding: .35em .6em; border-radius: .55em; background: rgba(255, 255, 255, .08); font-weight: 600; }
.ovtop li:first-child { background: rgba(255, 212, 59, .22); }
.ovr { min-width: 1.6em; font-weight: 800; color: #ffd43b; } .ovn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* host: stream mode card */
.twcard summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.twcard summary::-webkit-details-marker { display: none; }
.twcard { display: grid; gap: 10px; }
.twcard .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c9c6d3; margin-right: 8px; vertical-align: middle; }
.twcard .dot.on { background: #18c29c; }
.twcard .mono { font-family: ui-monospace, Menlo, monospace; }
.twcard p.hint { margin: 0; }
