:root {
  --bg: #fbf6ee;
  --paper: #ffffff;
  --ink: #1d1a16;
  --muted: #6f675d;
  --line: #e9e0d2;
  --soft: #f4ecdf;
  --accent: #ff5a36;
  --good: #16a34a;
  --bad: #dc2626;
  --red: #ef4444;
  --blue: #2563eb;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(29, 26, 22, .08), 0 8px 24px -12px rgba(29, 26, 22, .18);
  --game: var(--accent);
  --tint: #fff;
  --on-ink: #fff;
  --pill: 999px;
  --bw: 2px;
  --font-body: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', Inter, system-ui, sans-serif;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -.02em; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.btn {
  appearance: none; border: var(--bw) solid var(--ink); background: var(--ink); color: var(--on-ink);
  border-radius: var(--pill); padding: .7em 1.3em; font-weight: 700; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.accent { background: var(--game); border-color: var(--game); }
.btn.sm { padding: .4em .9em; font-size: .85rem; }
.btn.xl { font-size: 1.4rem; padding: .9em 2em; }

input[type=text], input[type=number], input:not([type]), textarea {
  border: 2px solid var(--line); background: var(--paper); border-radius: 14px; padding: .75em 1em;
  outline: none; width: 100%; transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; min-height: 4.5em; }
label { font-weight: 600; font-size: .9rem; display: block; margin: .8em 0 .35em; }

.muted { color: var(--muted); }
.row { display: flex; gap: .6rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.pill { display: inline-flex; align-items: center; gap: .35em; background: var(--soft); border-radius: 999px; padding: .25em .75em; font-size: .8rem; font-weight: 600; }

/* ---------- Home ---------- */
.home { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.brand { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; letter-spacing: -.03em; display: flex; align-items: center; gap: .4em; text-decoration: none; }
.brand b { color: var(--accent); }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center; margin-top: 3rem; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 32em; line-height: 1.5; }
.avatars { display: flex; flex-wrap: wrap; gap: .35rem; }
.avatars button { font-size: 1.5rem; width: 2.6rem; height: 2.6rem; border-radius: 12px; border: 2px solid transparent; background: var(--soft); cursor: pointer; }
.avatars button.on { border-color: var(--ink); background: var(--paper); }
.join-row { display: flex; gap: .5rem; }
.join-row input { text-transform: uppercase; letter-spacing: .25em; font-weight: 700; text-align: center; max-width: 9em; }
.or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .85rem; margin: 1rem 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.err { color: var(--bad); font-weight: 600; min-height: 1.2em; margin-top: .6rem; }
.showcase { margin-top: 4rem; }
.showcase h2 { font-size: 2rem; margin-bottom: 1rem; }

/* ---------- Game grid ---------- */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; }
.gcard {
  --c: var(--accent);
  text-align: left; border: 2px solid transparent; background: var(--paper); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); cursor: default; position: relative; overflow: hidden;
}
.gcard.pickable { cursor: pointer; }
.gcard.pickable:hover { border-color: var(--c); }
.gcard.on { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent), var(--shadow); }
.gcard .emo { font-size: 2rem; width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--c) 16%, var(--tint)); }
.gcard h3 { font-size: 1.15rem; margin: .6rem 0 .2rem; }
.gcard p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.35; }
.gcard .meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .7rem; }
.gcard .meta span { font-size: .72rem; font-weight: 600; padding: .2em .6em; border-radius: 999px; background: var(--soft); }
.gcard .meta span.vibe { background: color-mix(in srgb, var(--c) 18%, var(--tint)); }

/* ---------- Room shell ---------- */
.shell { display: grid; grid-template-columns: 1fr 300px; grid-template-rows: auto auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; padding: .8rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top .spacer { flex: 1; }
.code-chip { display: flex; align-items: center; gap: .5rem; background: var(--soft); border-radius: 999px; padding: .3rem .4rem .3rem .9rem; font-weight: 700; }
.code-chip .code { letter-spacing: .2em; font-family: var(--font-display); font-size: 1.15rem; }
.timer { grid-column: 1 / -1; height: 6px; background: var(--line); position: relative; }
.timer .bar { position: absolute; inset: 0 auto 0 0; background: var(--game); width: 0; transition: background .3s; }
.timer .bar.low { background: var(--bad); }
.timer-text { font-variant-numeric: tabular-nums; font-weight: 800; font-family: var(--font-display); font-size: 1.3rem; min-width: 2.5em; text-align: right; }
.timer-text.low { color: var(--bad); }
.main { padding: 1.5rem 1.25rem 7rem; min-width: 0; }
.main-inner { max-width: 900px; margin: 0 auto; }
.side { border-left: 1px solid var(--line); padding: 1.25rem; background: color-mix(in srgb, var(--paper) 55%, var(--bg)); }
.side h3 { font-size: 1rem; margin-bottom: .75rem; display: flex; justify-content: space-between; }

.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 12px; position: relative; }
.plist li.me { background: var(--paper); }
.plist li.off { opacity: .45; }
.plist .pts { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.plist .tools { display: none; gap: .25rem; margin-left: auto; }
.plist li:hover .tools { display: flex; }
.plist li:hover .tools + .pts { display: none; }
.plist .tools button { border: none; background: var(--soft); border-radius: 8px; cursor: pointer; font-size: .75rem; padding: .25em .5em; }

.av { --pc: #999; width: 2rem; height: 2rem; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.1rem; background: color-mix(in srgb, var(--pc) 22%, var(--tint)); box-shadow: inset 0 0 0 2px var(--pc); flex: none; }
.av.lg { width: 3rem; height: 3rem; font-size: 1.6rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.chip .av { width: 1.6rem; height: 1.6rem; font-size: .95rem; }

.reactbar { position: fixed; bottom: 1rem; left: 50%; transform: translateX(calc(-50% - 150px)); display: flex; gap: .2rem; background: var(--paper); border-radius: 999px; padding: .3rem; box-shadow: var(--shadow); z-index: 20; }
.reactbar button { border: none; background: none; font-size: 1.35rem; width: 2.4rem; height: 2.4rem; border-radius: 50%; cursor: pointer; transition: transform .1s; }
.reactbar button:hover { background: var(--soft); transform: scale(1.15); }
.float { position: fixed; bottom: 4.5rem; font-size: 2.2rem; pointer-events: none; z-index: 30; animation: floatUp 2.6s ease-out forwards; display: flex; flex-direction: column; align-items: center; }
.float small { font-size: .7rem; font-weight: 700; background: var(--paper); padding: .1em .5em; border-radius: 999px; box-shadow: var(--shadow); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(20px) scale(.6); } 15% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-55vh) scale(1); } }

.toast { position: fixed; top: 1rem; left: 50%; transform: translate(-50%, calc(-100% - 2rem)); background: var(--ink); color: var(--on-ink); padding: .7em 1.2em; border-radius: 999px; font-weight: 600; transition: transform .25s; z-index: 50; }
.toast.on { transform: translate(-50%, 0); }

/* ---------- Lobby ---------- */
.lobby-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.lobby-head h2 { font-size: 2rem; }
.detail { margin-top: 1.25rem; border-top: 6px solid var(--game); }
.detail h2 { font-size: 1.8rem; display: flex; gap: .5rem; align-items: center; }
.detail ol { padding-left: 1.2rem; line-height: 1.6; }
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 999px; }
.stepper button { border: none; background: none; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1.1rem; font-weight: 700; }
.stepper span { min-width: 2ch; text-align: center; font-weight: 700; }
.invite { display: flex; gap: 1rem; align-items: center; background: var(--ink); color: var(--on-ink); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.invite .big { font-family: var(--font-display); font-size: 2.2rem; letter-spacing: .25em; font-weight: 800; }
.invite .btn { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); }

/* ---------- In-game shared ---------- */
.ghead { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ghead h2 { font-size: 1.4rem; }
.ghead .emo { font-size: 1.6rem; }
.prompt { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; margin: .5rem 0 1.25rem; }
.prompt.sm { font-size: clamp(1.3rem, 2.6vw, 1.8rem); }
.label { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--muted); }
.waiting { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.5rem; align-items: center; }
.waiting .av { opacity: .3; transition: opacity .2s, transform .2s; position: relative; }
.waiting .av.done { opacity: 1; transform: scale(1.05); }
.waiting .av.done::after { content: '✓'; position: absolute; right: -4px; bottom: -4px; font-size: .6rem; background: var(--good); color: #fff; border-radius: 50%; width: 1rem; height: 1rem; display: grid; place-items: center; }
.locked { background: var(--soft); border-radius: var(--radius); padding: 1rem 1.25rem; font-weight: 600; }
.hostbar { margin-top: 2rem; display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 1rem; flex-wrap: wrap; align-items: center; }
.hostbar .label { margin-right: auto; }
.gain { font-weight: 800; color: var(--good); }
.gain.zero { color: var(--muted); }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.opt { border: 2px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 1.1rem; font-weight: 700; font-size: 1.05rem; cursor: pointer; text-align: left; transition: border-color .12s, transform .08s; }
.opt:hover:not(:disabled) { border-color: var(--ink); }
.opt.on { border-color: var(--game); background: color-mix(in srgb, var(--game) 12%, var(--tint)); }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--paper)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--paper)); }
.opt:disabled { cursor: default; }
.opt .who { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .6rem; }
.opt .who .av { width: 1.6rem; height: 1.6rem; font-size: .9rem; }

.results { display: grid; gap: .6rem; }
.result { display: flex; align-items: center; gap: .75rem; background: var(--paper); border-radius: 14px; padding: .75rem 1rem; box-shadow: var(--shadow); flex-wrap: wrap; }
.result .grow { flex: 1; min-width: 8em; }
.result .big { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; }
.result.top { outline: 3px solid var(--game); }
.stack-av { display: flex; }
.stack-av .av { margin-left: -.4rem; border: 2px solid var(--paper); }
.stack-av .av:first-child { margin-left: 0; }

/* Pitch / gallery */
.entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.entry { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; border: 3px solid transparent; }
.entry.on { border-color: var(--game); }
.entry .product { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.entry .bname { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; line-height: 1.1; }
.entry .tag { font-style: italic; flex: 1; }
.entry .foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .3rem; }
.product-card { background: var(--ink); color: var(--on-ink); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.product-card .display { font-size: 1.8rem; line-height: 1.1; }

/* Bets */
.bidgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.2rem, 1fr)); gap: .4rem; max-width: 560px; }
.bidgrid button { aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.bidgrid button:hover { border-color: var(--ink); }
.bidgrid button.on { background: var(--game); border-color: var(--game); color: #fff; }
.items { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.item { display: inline-flex; align-items: center; gap: .3rem; background: var(--soft); border-radius: 999px; padding: .35em .5em .35em .85em; font-weight: 600; border: 2px solid transparent; }
.item button { border: none; background: none; cursor: pointer; padding: 0 .3em; font-size: 1rem; color: var(--muted); }
.item.click { cursor: pointer; padding-right: .85em; }
.item.click:hover { border-color: var(--bad); }
.item.flag { border-color: var(--bad); }
.item.out { text-decoration: line-through; opacity: .5; }
.item sup { color: var(--bad); font-weight: 800; }
.progress { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--game); transition: width .2s; }

/* Count Up */
.counter { text-align: center; padding: 1rem 0; }
.counter .num { font-family: var(--font-display); font-weight: 800; font-size: clamp(5rem, 16vw, 9rem); line-height: 1; font-variant-numeric: tabular-nums; }
.counter .num small { font-size: .3em; color: var(--muted); }
.flash { border-radius: var(--radius); padding: .8rem 1rem; font-weight: 700; text-align: center; margin: 1rem auto; max-width: 520px; animation: shake .4s; }
.flash.bad { background: color-mix(in srgb, var(--bad) 12%, var(--paper)); color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.trail { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 1.25rem; min-height: 3rem; }
.trail span { display: inline-flex; flex-direction: column; align-items: center; font-weight: 800; font-size: .8rem; }

/* Sketch */
.canvas-wrap { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; aspect-ratio: 4/3; max-width: 640px; margin: 0 auto; touch-action: none; }
.canvas-wrap canvas { width: 100%; height: 100%; display: block; cursor: none; }
.canvas-wrap .pen { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--game); transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
.canvas-wrap .blind { position: absolute; inset: auto 0 .6rem 0; text-align: center; font-weight: 600; color: var(--muted); pointer-events: none; font-size: .9rem; }
.gallery canvas { width: 100%; aspect-ratio: 4/3; background: #fff; border-radius: 12px; border: 1px solid var(--line); display: block; }

/* Hot takes */
.slider { margin: 1.25rem 0; }
.slider input[type=range] { width: 100%; accent-color: var(--game); height: 2rem; }
.slider .ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); font-weight: 600; }
.slider .val { font-weight: 800; font-size: 1.1rem; }
.track { position: relative; height: 110px; margin: 2rem .5rem 1rem; }
.track .line { position: absolute; left: 0; right: 0; top: 50%; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #60a5fa, #e5e7eb, #f87171); transform: translateY(-50%); }
.track .dot { position: absolute; transform: translate(-50%, -50%); transition: left .5s; }
.track .avg { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--ink); transform: translateX(-50%); }
.track .avg span { position: absolute; top: -1.6rem; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: 800; font-size: .8rem; background: var(--ink); color: var(--paper); padding: .15em .6em; border-radius: 999px; }
.track .ends { position: absolute; top: 100%; left: 0; right: 0; display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); font-weight: 600; }

/* Tug */
.rope-area { position: relative; height: 90px; margin: 1.5rem 0; }
.rope-area .zone { position: absolute; top: 0; bottom: 0; width: 8%; border-radius: 12px; opacity: .15; }
.rope-area .zone.red { left: 0; background: var(--red); }
.rope-area .zone.blue { right: 0; background: var(--blue); }
.rope-area .rope { position: absolute; left: 0; right: 0; top: 50%; height: 10px; background: repeating-linear-gradient(45deg, #b08a5a 0 8px, #8a6a40 8px 16px); border-radius: 999px; transform: translateY(-50%); }
.rope-area .mid { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px dashed var(--muted); }
.rope-area .knot { position: absolute; top: 50%; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); transition: left .25s cubic-bezier(.3, 1.4, .6, 1); box-shadow: 0 0 0 4px #fff; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.team { border-radius: var(--radius); padding: 1rem; background: var(--paper); box-shadow: var(--shadow); border-top: 6px solid; }
.team.red { border-color: var(--red); }
.team.blue { border-color: var(--blue); }
.team ul { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .3rem; }
.team li { display: flex; justify-content: space-between; align-items: center; }
.typebox { text-align: center; margin: 1rem auto; max-width: 460px; }
.typebox .word { font-family: var(--font-display); font-size: 3.2rem; font-weight: 800; letter-spacing: .02em; }
.typebox input { text-align: center; font-size: 1.4rem; font-weight: 700; }
.banner { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 6vw, 3.4rem); margin: 1rem 0; }
.banner.red { color: var(--red); }
.banner.blue { color: var(--blue); }

/* Game over */
.podium { display: flex; align-items: end; justify-content: center; gap: 1rem; margin: 2rem 0; }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.podium .block { width: 110px; border-radius: 16px 16px 0 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: #fff; }
.podium .p1 .block { height: 150px; background: #f5b700; }
.podium .p2 .block { height: 110px; background: #94a3b8; }
.podium .p3 .block { height: 80px; background: #c2410c; }
.podium .name { font-weight: 700; max-width: 110px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; margin-top: 1.5rem; }
  .shell { grid-template-columns: 1fr; }
  .side { border-left: none; border-top: 1px solid var(--line); order: 5; }
  .reactbar { transform: translateX(-50%); }
  .teams { grid-template-columns: 1fr; }
}

/* =========================================================
   Motion & AI host
   ========================================================= */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes bump { 0% { transform: scale(.55); opacity: .2; } 55% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .15; } 40% { opacity: 1; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--game) 45%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { 0% { transform: translate3d(0, -10vh, 0) rotate(0); opacity: 1; } 100% { transform: translate3d(var(--x), 105vh, 0) rotate(var(--r)); opacity: .9; } }
@keyframes plusUp { 0% { opacity: 0; transform: translateY(6px) scale(.7); } 25% { opacity: 1; transform: translateY(-4px) scale(1.15); } 100% { opacity: 0; transform: translateY(-26px); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(0, 20px) scale(.6); } 15% { opacity: 1; transform: translate(0, 0) scale(1.15); } 100% { opacity: 0; transform: translate(var(--sway, 0), -55vh) scale(1); } }

/* Scenes and phases animate in when they are created */
.scene > * { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.scene > *:nth-child(2) { animation-delay: .05s; }
.scene > *:nth-child(3) { animation-delay: .1s; }
.scene > *:nth-child(4) { animation-delay: .15s; }
.scene > *:nth-child(5) { animation-delay: .2s; }
.phase > * { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.phase > *:nth-child(2) { animation-delay: .06s; }
.phase > *:nth-child(3) { animation-delay: .12s; }
.phase > *:nth-child(4) { animation-delay: .18s; }
.phase > *:nth-child(5) { animation-delay: .24s; }
.prompt { animation: pop .5s cubic-bezier(.2, .9, .3, 1.2) both; }

/* Staggered lists: anything with --i pops in one after another */
.result, .entry, .opt, .gcard, .item, .qrow, .bidgrid button, .waiting .av, .trail span {
  animation: rise .4s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.item, .trail span { animation-name: pop; animation-duration: .35s; }
.qrow { animation-name: slideIn; }
.bidgrid button:nth-child(n) { animation-delay: calc(var(--n, 0) * 20ms); }
.gcard { transition: transform .18s ease, box-shadow .18s ease, border-color .15s; }
.gcard.pickable:hover { transform: translateY(-4px) rotate(-.4deg); }
.gcard.pickable:hover .emo { animation: bob 1.2s ease-in-out infinite; }
.opt { transition: border-color .15s, background .2s, transform .12s; }
.opt:hover:not(:disabled):not(div) { transform: translateY(-2px); }
.opt.on { animation: pop .3s ease both; }
.btn.glow { animation: glow 2s ease-in-out infinite; }
.pulse { animation: pulse 1s ease-in-out infinite; }

/* Count Up number bumps on every change */
.counter .num { animation: bump .35s cubic-bezier(.2, .9, .3, 1.3) both; }
.big-progress { max-width: 420px; margin: .5rem auto 0; height: 10px; }
.big-progress > div { transition: width .3s cubic-bezier(.2, .9, .3, 1.2); }

/* Tug rope */
.rope-area .knot.red { background: var(--red); box-shadow: 0 0 0 4px #fff, 0 0 24px var(--red); }
.rope-area .knot.blue { background: var(--blue); box-shadow: 0 0 0 4px #fff, 0 0 24px var(--blue); }
.typebox .word { animation: bump .3s ease both; }

/* Hot takes dots glide and drop in */
.track .dot { transition: left .6s cubic-bezier(.2, .9, .3, 1.1), top .4s; animation: pop .5s both; animation-delay: calc(var(--i, 0) * 80ms + .1s); }
.track .avg { animation: rise .5s .4s both; }

/* Scoreboard */
.plist li { will-change: transform; }
.plist .plus { position: absolute; right: .4rem; top: -.2rem; font-weight: 800; color: var(--good); pointer-events: none; animation: plusUp 1.1s ease-out forwards; }
.timer-text { display: inline-block; }
.timer .bar.low { animation: pulse .6s ease-in-out infinite; transform-origin: left; }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: 0; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }

/* Home */
.bob-row { display: flex; gap: .4rem; font-size: 1.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.bob-row span { display: inline-block; animation: bob 3s ease-in-out infinite; animation-delay: calc(var(--i) * -0.35s); }
.hero-copy h1 { animation: rise .6s both; }
.hero-copy .lede { animation: rise .6s .1s both; }
.join-card { animation: rise .6s .15s both; }

/* AI host */
.ai-pill { background: linear-gradient(90deg, #ede9fe, #fce7f3, #ede9fe); background-size: 200% 100%; animation: shimmer 4s linear infinite; color: #5b21b6; }
.ai-chip { position: absolute; top: .8rem; right: .8rem; font-size: .7rem; font-weight: 700; color: #6d28d9; background: #ede9fe; border-radius: 999px; padding: .15em .55em; }
.aibox { background: var(--paper); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); border-left: 5px solid #8b5cf6; }
.aibox.off { border-left-color: var(--line); display: flex; gap: .6rem; align-items: center; }
.aibox code { background: var(--soft); padding: .1em .4em; border-radius: 6px; }
.aibox .spark { font-size: 1.4rem; }
.ai-note { background: color-mix(in srgb, #8b5cf6 10%, var(--paper)); border-radius: 12px; padding: .7rem .9rem; }
.hostline { display: flex; gap: .75rem; align-items: flex-start; margin: 0 0 1rem; animation: pop .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.hostline .bot { font-size: 1.6rem; width: 2.6rem; height: 2.6rem; flex: none; display: grid; place-items: center; border-radius: 50%; background: #ede9fe; box-shadow: inset 0 0 0 2px #8b5cf6; animation: bob 2.4s ease-in-out infinite; }
.hostline p { margin: 0; background: var(--paper); border-radius: 4px 18px 18px 18px; padding: .75rem 1rem; box-shadow: var(--shadow); font-weight: 600; line-height: 1.4; position: relative; }
.thinking { font-size: 1.2rem; font-weight: 700; padding: 2rem 0; text-align: center; }
.dots i { font-style: normal; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
.preparing { text-align: center; padding: 4rem 1rem; }
.preparing .orb { font-size: 3.5rem; width: 7rem; height: 7rem; margin: 0 auto 1.5rem; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, color-mix(in srgb, var(--game) 30%, var(--tint))); box-shadow: 0 0 0 0 var(--game); animation: glow 1.6s ease-in-out infinite, bob 2.4s ease-in-out infinite; }
.preparing h2 { font-size: 1.6rem; margin-bottom: .5rem; }
.variants { font-size: .85rem; font-style: italic; }
.reaction { background: color-mix(in srgb, #f59e0b 16%, var(--paper)); border-radius: 10px; padding: .5rem .7rem; font-size: .88rem; animation: pop .4s both; }
.item .robo { margin-right: .25em; }

/* Mystery Job */
.qmeter { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: .6rem 0 1rem; }
.qmeter i { height: 8px; border-radius: 999px; background: var(--soft); transition: background .3s; }
.qmeter i.used { background: var(--game); }
.jobcard { display: flex; gap: 1rem; align-items: center; background: var(--ink); color: var(--on-ink); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.jobcard .label { color: #bbb; }
.jobcard .muted { color: color-mix(in srgb, var(--on-ink) 75%, transparent); }
.jobcard .jobemo { font-size: 2.6rem; width: 4rem; height: 4rem; display: grid; place-items: center; background: rgba(255, 255, 255, .1); border-radius: 16px; flex: none; }
.jobcard.mystery .jobemo { animation: pulse 1.6s ease-in-out infinite; }
.jobcard.revealed { animation: pop .6s cubic-bezier(.2, .9, .3, 1.2) both; background: var(--game); }
.jobcard.revealed .label, .jobcard.revealed .muted { color: rgba(255, 255, 255, .85); }
.askrow { display: grid; grid-template-columns: 1.5fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.qlog { display: grid; gap: .45rem; }
.qrow { display: flex; align-items: center; gap: .7rem; background: var(--paper); border-radius: 14px; padding: .6rem .8rem; box-shadow: var(--shadow); }
.qrow.guess { border: 2px dashed var(--line); }
.ans { font-weight: 800; font-size: .85rem; padding: .3em .75em; border-radius: 999px; white-space: nowrap; animation: pop .35s both; }
.ans.yes { background: #dcfce7; color: #166534; }
.ans.no { background: #fee2e2; color: #991b1b; }
.ans.some { background: #fef3c7; color: #92400e; }
.ans.unclear, .ans.pending { background: var(--soft); color: var(--muted); }
.banner.sm { font-size: 1.6rem; margin: .5rem 0 1rem; animation: pop .5s both; }

/* Spot the Bot */
.story { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; font-family: Georgia, 'Times New Roman', serif; font-size: 1.25rem; line-height: 1.5; box-shadow: var(--shadow); margin-bottom: 1rem; }
.story p { margin: .4rem 0 0; }
.story .ellipsis { color: var(--game); font-weight: 800; animation: blink 1.4s infinite; }
.opt.endings { font-weight: 500; font-family: Georgia, serif; font-size: 1.05rem; cursor: default; }
.opt.botpick { animation: pop .6s cubic-bezier(.2, .9, .3, 1.2) both; box-shadow: 0 0 0 4px #bbf7d0; }

@media (max-width: 860px) {
  .askrow { grid-template-columns: 1fr; }
}

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

/* ---------- Custom art (characters & game icons) ---------- */
.art { display: inline-block; vertical-align: -.16em; overflow: visible; flex: none; }
.av .art { width: 92%; height: 92%; vertical-align: middle; }
.avatars button { display: grid; place-items: center; padding: 0; }
.avatars button .art { width: 86%; height: 86%; transition: transform .15s; }
.avatars button:hover .art { transform: scale(1.12) rotate(-6deg); }
.avatars button.on .art { animation: bob 1.6s ease-in-out infinite; }
.brand .art { font-size: 1.5em; vertical-align: middle; }
.hostline .bot .art { width: 82%; height: 82%; }
.item .robo .art, .chip .art { vertical-align: -.2em; }

/* ---------- Recess logo ---------- */
.logo { display: inline-flex; align-items: center; gap: .25em; }
.logo .mark { font-size: 1.5em; }
.wm { font-family: 'Lilita One', var(--font-display); font-weight: 400; letter-spacing: .015em; line-height: 1; color: #fff; -webkit-text-stroke: .15em #1d1a16; paint-order: stroke fill; text-shadow: 0 .09em 0 #1d1a16; }
.brand .wm { font-size: 1.15em; }
.home-logo { text-align: center; margin: .5rem 0 2rem; }
.lockup { display: inline-flex; align-items: center; gap: .08em; font-size: clamp(3.6rem, 9vw, 6.4rem); }
.lk-mark .mark { font-size: 1.15em; transform-origin: 20% 90%; animation: bellRing 3.2s ease-in-out infinite; }
@keyframes bellRing { 0%, 64%, 100% { transform: rotate(0); } 68% { transform: rotate(14deg); } 72% { transform: rotate(-12deg); } 76% { transform: rotate(9deg); } 80% { transform: rotate(-6deg); } 84% { transform: rotate(3deg); } }
.wm-xl i { font-style: normal; display: inline-block; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.wm-xl i:nth-child(odd) { transform: rotate(-3deg); }
.wm-xl i:nth-child(even) { transform: translateY(-.05em) rotate(3deg); }
.wm-xl i:hover { transform: translateY(-.12em) rotate(-6deg) scale(1.08); }
.ribbon { display: inline-block; margin-top: .6rem; background: #1d1a16; color: #fff; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .16em; font-size: .85rem; padding: .5em 1.3em; border-radius: 8px; transform: rotate(-1.5deg); }

/* ---------- Home console ---------- */
.console { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.25rem; align-items: stretch; }
.panel .panel-title { text-align: center; font-size: 1.35rem; margin: 0 0 1.1rem; }
.char-pick { display: flex; gap: 1.4rem; align-items: center; margin-bottom: 1.1rem; }
.char-big { position: relative; flex: none; width: 8.5rem; height: 8.5rem; border-radius: 50%; display: grid; place-items: center; font-size: 6.6rem; background: radial-gradient(circle at 50% 38%, #fff, #ece6fb); box-shadow: inset 0 0 0 4px var(--line); animation: pop .35s cubic-bezier(.2, .9, .3, 1.3) both; }
.char-big .shuffle { position: absolute; right: -.15rem; bottom: -.15rem; width: 2.7rem; height: 2.7rem; border-radius: 50%; border: 3px solid #1d1a16; background: #fff; font-size: 1.2rem; cursor: pointer; transition: transform .15s; }
.char-big .shuffle:hover { transform: rotate(-20deg) scale(1.1); }
.char-side { flex: 1; min-width: 0; }
.char-name { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; line-height: 1.1; }
.char-side label { margin-top: .4rem; }
.join-actions { margin-top: 1.25rem; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.steps li { display: flex; gap: .9rem; align-items: center; animation: rise .5s both; animation-delay: calc(var(--i) * 90ms); }
.step-art { font-size: 2.9rem; flex: none; width: 4rem; height: 4rem; display: grid; place-items: center; border-radius: 50%; background: var(--soft); }
.steps b { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.steps li div > span { color: var(--muted); font-size: .92rem; }
.home .showcase { margin-top: 1.25rem; }
.plist li.empty { opacity: .5; border: 2px dashed var(--line); margin-top: .35rem; }
.plist li.empty .av { background: var(--soft); box-shadow: none; }
@media (max-width: 820px) { .console { grid-template-columns: 1fr; } }
.panel { padding: 1.5rem; }
.home-logo .ribbon { display: table; margin: .5rem auto 0; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: .4rem; }
.avatars button { width: auto; height: auto; aspect-ratio: 1; }
.avatars button .art { width: 92%; height: 92%; }
.how-panel { display: flex; flex-direction: column; }
.perks { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: 1.25rem; justify-content: center; }
.perks span { background: var(--soft); border-radius: 999px; padding: .3em .8em; font-size: .82rem; font-weight: 700; }
.ghead .emo { font-size: 2.3rem; line-height: 1; }

/* First screen (logo + join console) fits in one viewport; the games list follows below. */
.home { padding-top: max(1rem, 2.5vh); }
.home-logo { margin: 0 0 max(.9rem, 2vh); }
.lockup { font-size: clamp(2.4rem, 7.5vh, 4.6rem); }
.home-logo .ribbon { margin-top: .2rem; font-size: .78rem; }
.home .panel { padding: 1.25rem 1.4rem; }
.panel .panel-title { margin-bottom: .75rem; }
.char-pick { margin-bottom: .85rem; gap: 1.2rem; }
.char-big { width: 6.6rem; height: 6.6rem; font-size: 5.1rem; }
.avatars { grid-template-columns: repeat(12, 1fr); gap: .3rem; }
.join-actions { margin-top: 1rem; }
.join-actions .or { margin: .55rem 0; }
.join-actions .btn.xl { font-size: 1.2rem; padding: .7em 1.5em; }
.home .err:empty { display: none; }
@media (max-width: 640px) { .avatars { grid-template-columns: repeat(8, 1fr); } }

/* ---------- Bottom dock: game, reactions, main actions ---------- */
.dock { position: fixed; left: 0; right: 300px; bottom: 0; z-index: 25; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: .65rem 1.25rem; background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -18px rgba(0, 0, 0, .3); }
.dock-game { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.dock-game .art { font-size: 2.3rem; flex: none; }
.dock-game b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-game span { display: block; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.dock-react { display: flex; gap: .1rem; background: var(--soft); border-radius: 999px; padding: .2rem; }
.dock-react button { border: none; background: none; font-size: 1.3rem; width: 2.3rem; height: 2.3rem; border-radius: 50%; cursor: pointer; transition: transform .1s; }
.dock-react button:hover { background: var(--paper); transform: scale(1.18); }
.dock-actions { display: flex; gap: .55rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.dock-actions .label { margin-right: -.1rem; }
.dock-go { font-size: 1.05rem; padding: .75em 1.5em; }
.dock-wait { font-weight: 700; color: var(--muted); }
.float { bottom: 6.5rem; }
.main { padding-bottom: 9rem; }
body:has(.dock) .tp { bottom: .9rem; left: .9rem; }
body:has(.dock) .tp-fab { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; }
@media (max-width: 860px) {
  .dock { right: 0; grid-template-columns: 1fr auto; row-gap: .5rem; }
  .dock-react { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
}
.dock { grid-template-columns: minmax(10rem, 1fr) auto auto; }
.dock-actions { flex-wrap: nowrap; white-space: nowrap; }
@media (max-width: 1180px) { .dock-actions .label { display: none; } }
.dock-react button { width: 2.05rem; height: 2.05rem; font-size: 1.15rem; }

/* ---------- Game card "learn" affordance ---------- */
.gcard .learn { margin-top: .75rem; border: none; background: none; font: inherit; font-size: .8rem; font-weight: 800; color: var(--c); cursor: pointer; padding: .2rem .5rem; border-radius: 999px; }
.gcard button.learn:hover { background: color-mix(in srgb, var(--c) 14%, transparent); }
.gcard span.learn { opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.gcard:hover span.learn, .gcard:focus-visible span.learn { opacity: 1; transform: none; }
.gcard[role=button] { cursor: pointer; }
.detail > .btn { margin: .25rem 0 .5rem; }

/* ---------- Tutorial modal ---------- */
html.tut-open { overflow: hidden; }
.tut-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: rgba(29, 26, 22, .45); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.tut-overlay.on { opacity: 1; pointer-events: auto; }
.tut { position: relative; width: min(620px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--paper); color: var(--ink); border-radius: 26px; padding: 1.4rem 1.5rem 1.2rem; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .55); transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2); }
.tut-overlay.on .tut { transform: none; }
.tut-x { position: absolute; top: .9rem; right: .9rem; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 800; color: var(--muted); }
.tut-head { display: flex; align-items: center; gap: .8rem; }
.tut-icon { font-size: 2.8rem; width: 3.8rem; height: 3.8rem; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 15%, #fff); flex: none; }
.tut-kicker { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.tut-head h2 { font-size: 1.6rem; }
.tut-dots { display: flex; align-items: center; gap: .35rem; margin: 1rem 0 .4rem; }
.tut-dots i { width: 2.2rem; height: .45rem; border-radius: 999px; background: var(--line); transition: background .2s; }
.tut-dots i.done { background: color-mix(in srgb, var(--c) 45%, #fff); }
.tut-dots i.on { background: var(--c); }
.tut-dots span { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--muted); }
.tut-body { min-height: 17rem; padding: .4rem 0 .2rem; }
.tut-body.enter { animation: tutIn .3s cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes tutIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.tut-body h3 { font-size: 1.3rem; margin-bottom: .7rem; }
.tut-body p { line-height: 1.5; }
.tut-q { font-weight: 800; font-size: 1.08rem; margin: 0 0 .7rem; }
.tut-hint { color: var(--muted); font-size: .9rem; font-weight: 700; animation: bob 2s ease-in-out infinite; }
.tut-prompt { background: color-mix(in srgb, var(--c) 10%, #fff); border: 2px dashed color-mix(in srgb, var(--c) 50%, #fff); border-radius: 16px; padding: .8rem 1rem; font-family: var(--font-display); font-weight: 900; font-size: 1.25rem; margin-bottom: .8rem; }
.tut-prompt span { display: block; font-family: var(--font-body); font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 800; }
.tut-table { display: flex; justify-content: center; gap: 1rem; margin: .8rem 0; }
.tut-seat { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: 2.6rem; animation: bob 2.4s ease-in-out infinite; animation-delay: var(--d); }
.tut-seat b { font-size: .78rem; }
.tut-who { display: inline-flex; align-items: center; gap: .25rem; vertical-align: middle; }
.tut-who .art { font-size: 1.5rem; }
.tut-crowd { display: inline-flex; vertical-align: middle; margin-right: .2rem; }
.tut-crowd .art { font-size: 1.6rem; margin-right: -.3rem; }
.tut-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .55rem; margin-bottom: .8rem; }
.tut-opts.col { grid-template-columns: 1fr; }
.tut-opt { text-align: left; border: 2px solid var(--line); background: var(--paper); border-radius: 14px; padding: .8rem .95rem; font: inherit; font-weight: 800; cursor: pointer; color: inherit; transition: transform .1s, border-color .1s; }
.tut-opt:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-2px); }
.tut-opt.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.tut-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, #fff); animation: pop .4s both; }
.tut-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, #fff); animation: shake .4s; }
.tut-opt:disabled { cursor: default; }
.tut-opt.ask { display: flex; justify-content: space-between; align-items: center; }
.tut-opt .ans { background: var(--good); color: #fff; border-radius: 999px; padding: .1em .7em; font-size: .85rem; animation: pop .35s both; }
.tut-opt .ans:is(:empty) { display: none; }
.tut-result { border-radius: 14px; padding: .75rem .95rem; background: var(--soft); font-weight: 700; line-height: 1.45; animation: rise .35s both; }
.tut-result.good { background: color-mix(in srgb, var(--good) 14%, #fff); }
.tut-slider { display: flex; align-items: center; gap: 1rem; margin: .4rem 0 1rem; }
.tut-slider input { flex: 1; accent-color: var(--c); height: 2rem; }
.tut-slider output { font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; min-width: 4.5ch; text-align: right; }
.tut-type { display: flex; gap: .5rem; margin-bottom: .8rem; }
.tut-type input { flex: 1; }
.tut-canvas { position: relative; border: 2px dashed var(--line); border-radius: 16px; background: #fff; margin-bottom: .8rem; touch-action: none; }
.tut-canvas canvas { width: 100%; height: auto; display: block; cursor: crosshair; }
.tut-canvas span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 700; pointer-events: none; }
.tut-canvas.shown { border-style: solid; border-color: var(--good); }
.tut-count { text-align: center; margin: .5rem 0 1rem; }
.tut-count .num { font-family: var(--font-display); font-weight: 900; font-size: 4.5rem; line-height: 1; }
.tut-count .log { color: var(--muted); font-weight: 700; min-height: 1.5em; margin-top: .3rem; }
.tut-body:has(.tut-count) > .btn { display: block; margin: 0 auto; }
.tut-rope { position: relative; height: 14px; margin: 1.8rem .5rem 1.4rem; border-radius: 999px; background: repeating-linear-gradient(45deg, #b08a5a 0 8px, #8a6a40 8px 16px); }
.tut-rope::before, .tut-rope::after { content: ''; position: absolute; top: -12px; bottom: -12px; width: 10%; border-radius: 8px; opacity: .25; }
.tut-rope::before { left: 0; background: var(--red); }
.tut-rope::after { right: 0; background: var(--blue); }
.tut-rope .knot { position: absolute; top: 50%; width: 30px; height: 30px; border-radius: 50%; background: var(--red); transform: translate(-50%, -50%); box-shadow: 0 0 0 4px #fff; transition: left .35s cubic-bezier(.3, 1.4, .6, 1); }
.tut-word { text-align: center; font-family: var(--font-display); font-weight: 900; font-size: 2.4rem; margin-bottom: .5rem; animation: pop .3s both; }
.tut-final { text-align: center; }
.tut-big-icon { font-size: 4.5rem; display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.tut-final ol { text-align: left; line-height: 1.55; margin: .6rem 0 1rem; }
.tut-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.tut-meta span, .tut-chips span { background: var(--soft); border-radius: 999px; padding: .3em .8em; font-weight: 800; font-size: .88rem; }
.tut-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .6rem 0 1rem; }
.tut-chips .hl { background: color-mix(in srgb, var(--c) 25%, #fff); }
.tut-chips .arrow { background: none; }
.tut-spot { font-size: 4.2rem; text-align: center; margin-bottom: .5rem; filter: drop-shadow(0 0 18px #ffe066); animation: bob 2.4s ease-in-out infinite; }
.tut-product { text-align: center; font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; background: var(--ink); color: var(--on-ink); border-radius: 18px; padding: 1.1rem; margin-bottom: .8rem; }
.tut-product small { font-size: .65em; opacity: .8; }
.tut-notes { display: flex; gap: .5rem; justify-content: center; margin: .5rem 0 1rem; }
.tut-notes span { background: #fff8c5; border: 2px solid var(--line); border-radius: 6px; padding: .9rem 1rem; font-weight: 800; transform: rotate(-2deg); box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.tut-notes span:nth-child(2) { transform: rotate(2deg); }
.tut-big { text-align: center; font-family: var(--font-display); font-weight: 900; font-size: 3rem; margin: .5rem 0 1rem; }
.tut-gallery { display: flex; gap: .6rem; justify-content: center; font-size: 3rem; margin: .5rem 0 1rem; }
.tut-story { font-family: Georgia, serif; font-size: 1.3rem; font-style: italic; background: var(--soft); border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: .8rem; }
.tut-teams { display: flex; align-items: center; justify-content: center; gap: .6rem; font-weight: 900; font-size: 1.2rem; margin: .8rem 0 1rem; }
.tut-teams .r { color: var(--red); } .tut-teams .b { color: var(--blue); } .tut-teams .rope { color: #8a6a40; letter-spacing: -.1em; }
.tut-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1rem; padding-top: .9rem; border-top: 2px dashed var(--line); }
.gcard .learn { margin-top: auto; align-self: center; }
.gcard .meta { margin-bottom: .75rem; }
.gcard span.learn { opacity: 1; transform: none; background: color-mix(in srgb, var(--c) 14%, transparent); }
.gcard:hover span.learn { background: var(--c); color: #fff; }
.gcard { display: flex; flex-direction: column; }
.entry .tag, .entry .bname, .opt.endings, .opt { overflow-wrap: anywhere; }
/* Keep the dock from spilling into the sidebar on mid-width screens. */
.dock { grid-template-columns: minmax(0, 1fr) auto auto; }
@media (max-width: 1280px) {
  .dock-react button { width: 1.8rem; height: 1.8rem; font-size: 1rem; }
  .dock-actions .btn { padding: .6em 1em; font-size: .9rem; }
  .dock-game span { display: none; }
}
/* Keep the players/scores list in view while the main column scrolls. */
@media (min-width: 861px) {
  .side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding-bottom: 6rem; }
}

/* Mystery Job: give the ask/guess inputs room on mid-width screens. */
@media (max-width: 1150px) { .askrow { grid-template-columns: 1fr; } }
/* Bottom dock on mid-width screens: show just the game icon rather than a clipped name. */
@media (max-width: 1150px) { .dock-game > div { display: none; } }

/* Connection-lost banner */
.offline-bar { position: fixed; left: 50%; top: .75rem; z-index: 90; transform: translate(-50%, -200%); background: #1d1a16; color: #fff; font-weight: 700; padding: .6em 1.2em; border-radius: 999px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); transition: transform .25s; pointer-events: none; }
html.offline .offline-bar { transform: translate(-50%, 0); }
.offline-bar { white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }

/* Feedback + newsletter links (top-right of home; a small button in the room bar) and their pop-ups. */
.home-links { position: absolute; top: max(1rem, 2.5vh); right: 1.5rem; display: flex; gap: .5rem; z-index: 2; }
.btn.follow-btn, [data-theme] .btn.follow-btn { background: var(--butter, #ffd43b); color: var(--ink); }
@media (max-width: 1300px) { .home-links { position: static; justify-content: flex-end; margin-bottom: .5rem; } }
@media (max-width: 520px) { .home-links { justify-content: center; flex-wrap: wrap; } }
@media (max-width: 760px) { .top-feedback span { display: none; } }
.sheet { width: min(520px, 100%); padding: 1.3rem 1.4rem 1.2rem; }
.sheet-bar { margin-right: 2.6rem !important; background: var(--butter, #ffd43b); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); text-align: center; font-family: 'Lilita One', var(--font-display); font-size: 1.45rem; letter-spacing: .04em; padding: .4rem 1rem; transform: rotate(-1deg); margin: 0 .2rem 1rem; }
.sheet-why { background: var(--soft); border-left: 6px solid var(--butter, #ffd43b); border-radius: 0 14px 14px 0; padding: .75rem 1rem; line-height: 1.5; margin: 0 0 1rem; }
.sheet-form { display: grid; gap: .65rem; }
.sheet-form.row { grid-template-columns: 1fr auto; }
.sheet-form input, .sheet-form textarea { font: inherit; width: 100%; padding: .7em .9em; border: 3px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); resize: vertical; }
.sheet-form input:focus, .sheet-form textarea:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.sheet-trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sheet-msg { margin: .8rem 0 0; font-weight: 800; }
.sheet-msg:empty { display: none; }
.sheet-msg.good { color: var(--good); font-size: 1.1rem; text-align: center; }
.sheet-msg.bad { color: var(--bad); }
.sheet-msg a { color: inherit; text-decoration: underline; }
@media (max-width: 460px) { .sheet-form.row { grid-template-columns: 1fr; } }
