:root {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --bg-3: #334155;
  --fg: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --good: #22c55e;
  --bad: #ef4444;
  --border: #334155;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
body { display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }

button {
  background: linear-gradient(180deg, var(--accent-2), #6366f1);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.link { background: transparent; color: var(--accent); padding: 4px 8px; font-weight: 400; }

input[type="text"], input:not([type]) {
  background: var(--bg-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
}

.lang-toggle {
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--border);
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  border-radius: 6px;
  min-width: 60px;
  cursor: pointer;
}
.lang-toggle:hover { background: var(--bg-3); border-color: var(--accent); filter: none; }
.room-header .lang-toggle { padding: 4px 10px; font-size: 12px; min-width: 50px; }
.sound-toggle {
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--border);
  padding: 4px 8px; font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.sound-toggle:hover { background: var(--bg-3); border-color: var(--accent); filter: none; }
.room-header .sound-toggle { padding: 4px 8px; font-size: 14px; }

/* Section headings inside the room stage (a <section>). */
section h2 { font-size: 18px; margin: 28px 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============== Home page (index.html, .hm-*) ==============
   Phone: one column — hero, join card, open rooms, game library.
   ≥ 980px: two columns; the left one stays put while the games scroll.
   Game art comes from /js/game-art.js. Rules are scoped under .hm so the
   global button / input / section h2 styles don't leak in. */
.hm-body {
  display: block;
  background-image: radial-gradient(520px 360px at 12% -60px, rgba(251, 191, 36, 0.14), transparent 70%),
                    radial-gradient(600px 420px at 100% 0, rgba(56, 189, 248, 0.07), transparent 70%);
  background-repeat: no-repeat;
}
.hm {
  max-width: 1180px; margin: 0 auto; font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}
.hm button { font: inherit; }
.hm :focus-visible, .hm-sheet :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hm-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.hm-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: 0.02em; }
.hm-brand img { width: 34px; height: 34px; border-radius: 10px; display: block; box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.16); }
.hm-brand small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.hm button.hm-lang {
  min-height: 44px; min-width: 56px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3); background: #152036; color: var(--fg); font-weight: 700; font-size: 14px;
}

.hm-main { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.hm-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 980px) {
  .hm-main { grid-template-columns: 360px minmax(0, 1fr); gap: 32px; align-items: start; }
  .hm-side { position: sticky; top: 16px; }
}
.hm h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--fg); text-transform: none; letter-spacing: normal; }

.hm-hero { padding: 6px 0 2px; }
.hm-eyebrow { font-size: 12px; font-weight: 700; color: #fbbf24; letter-spacing: 0.06em; }
.hm-hero h1 { margin: 6px 0 8px; font-size: 27px; line-height: 1.25; font-weight: 850; text-wrap: balance; letter-spacing: -0.01em; }
.hm-hero p { margin: 0; color: #cbd5e1; font-size: 14.5px; max-width: 40ch; }
.hm-verse { margin: 14px 0 0; padding: 2px 0 2px 12px; border-left: 3px solid #fbbf24; }
.hm-verse q { quotes: none; display: block; font-size: 15px; font-weight: 600; color: #fef3c7; }
.hm-verse cite { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }

.hm-card { background: #152036; border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 16px; padding: 16px; }
.hm-field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.hm-field > label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.hm-row { display: flex; gap: 8px; }
.hm .hm-inp, .hm-sheet .hm-inp {
  flex: 1; min-width: 0; width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3); background: var(--bg); color: var(--fg); font-size: 16px;
}
.hm-inp::placeholder { color: #64748b; }
.hm button.hm-dice {
  width: 48px; height: 48px; flex: none; padding: 0; border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3); background: var(--bg-2); color: var(--fg); font-size: 22px; line-height: 1;
}
.hm button.hm-dice:active { transform: rotate(-20deg) scale(0.94); }
.hm-code { position: relative; flex: 1; min-width: 0; }
.hm-code input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; padding: 0;
  opacity: 0.01; border: 0; font-size: 16px; text-transform: uppercase;
}
.hm-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.hm-slots i {
  height: 48px; border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.3); background: var(--bg);
  display: grid; place-items: center; font-style: normal; font-size: 22px; font-weight: 800; letter-spacing: 0.04em;
}
.hm-code.focus .hm-slots i.cur { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2); }
.hm button.hm-btn, .hm-sheet button.hm-btn { height: 48px; padding: 0 20px; border-radius: 12px; border: 0; font-weight: 800; font-size: 16px; white-space: nowrap; }
.hm button.hm-btn-sky, .hm-sheet button.hm-btn-sky { background: var(--accent); color: #082f49; }
.hm-sheet button.hm-btn-ghost { background: transparent; color: var(--muted); border: 1px solid rgba(148, 163, 184, 0.3); }
.hm-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); min-height: 1.2em; }
.hm-hint.err { color: #fb923c; }

.hm-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hm-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.hm-live { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: hm-pulse 2s infinite; }
@keyframes hm-pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } }
.hm button.hm-link { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 14px; min-height: 44px; padding: 0 4px; }
.hm-room-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.hm-room-list:empty { display: none; }
.hm button.hm-room {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 10px 8px 8px; text-align: left;
  border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.16); background: #152036; color: var(--fg); font-weight: 400;
}
.hm button.hm-room:hover { border-color: rgba(148, 163, 184, 0.3); background: var(--bg-2); filter: none; }
.hm-thumb { width: 60px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--bg-2); font-size: 22px; }
.hm-thumb svg { width: 100%; height: 100%; display: block; }
.hm-rm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hm-rn { font-weight: 750; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-lock { font-size: 12px; }
.hm-rs { font-size: 12.5px; color: var(--muted); }
.hm-phase { flex: none; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.hm-phase.wait { background: rgba(56, 189, 248, 0.14); color: var(--accent); }
.hm-phase.play { background: rgba(74, 222, 128, 0.14); color: #4ade80; }
.hm-empty { margin: 10px 0 0; padding: 14px; border-radius: 14px; border: 1px dashed rgba(148, 163, 184, 0.3); color: var(--muted); font-size: 14px; }

.hm-lib { min-width: 0; }
.hm-lede { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.hm-chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; margin-bottom: 8px; scrollbar-width: none; }
.hm-chips::-webkit-scrollbar { display: none; }
.hm button.hm-chip {
  flex: none; min-height: 44px; padding: 0 11px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, 0.3);
  background: transparent; color: #cbd5e1; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
}
.hm-chip b { font-size: 12px; color: var(--muted); font-weight: 700; }
.hm button.hm-chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.hm-chip[aria-pressed="true"] b { color: #475569; }

.hm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.hm button.hm-game {
  display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; text-align: left;
  border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.16); background: #152036; color: var(--fg); font-weight: 400;
  transition: transform 0.15s, border-color 0.15s;
}
.hm button.hm-game:hover { transform: translateY(-2px); border-color: rgba(148, 163, 184, 0.3); filter: none; }
.hm button.hm-game:active { transform: scale(0.98); }
.hm-art { display: block; aspect-ratio: 16 / 10; max-width: 100%; overflow: hidden; }
.hm-art svg { width: 100%; height: 100%; display: block; transition: transform 0.4s; }
.hm-game:hover .hm-art svg { transform: scale(1.04); }
.hm-gbody { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; padding: 10px 12px 12px; }
.hm-gname { font-weight: 800; font-size: 16px; line-height: 1.3; }
.hm-gtopic { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.hm-gblurb { display: none; margin-top: 4px; font-size: 13px; color: #cbd5e1; }
.hm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.hm-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; background: rgba(148, 163, 184, 0.12); color: #cbd5e1;
}
.hm-pill svg { width: 12px; height: 12px; }
.hm-pill.ref { background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.hm-badge { align-self: flex-start; margin-bottom: 2px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #fbbf24; color: #422006; }
/* The first card spans the row when the count would leave one card alone. */
@media (max-width: 639.98px) {
  .hm-grid.odd2 .hm-game:first-child { grid-column: span 2; flex-direction: row; }
  .hm-grid.odd2 .hm-game:first-child .hm-art { width: 52%; flex: none; aspect-ratio: auto; }
  .hm-grid.odd2 .hm-game:first-child .hm-gblurb { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (min-width: 640px) {
  .hm-grid.odd3 .hm-game:first-child { grid-column: span 2; flex-direction: row; }
  .hm-grid.odd3 .hm-game:first-child .hm-art { width: 54%; flex: none; aspect-ratio: auto; }
  .hm-grid.odd3 .hm-game:first-child .hm-gblurb { display: block; }
  .hm-grid.odd3 .hm-game:first-child .hm-gname { font-size: 19px; }
}
.hm-foot {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid rgba(148, 163, 184, 0.16);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; color: var(--muted); font-size: 13px;
}

/* Create sheet: a bottom sheet on phones, a centred dialog from 640px. */
.hm-back {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(2, 6, 23, 0.66); animation: hm-fade 0.18s ease-out;
}
.hm-sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; font-size: 15px; line-height: 1.5;
  background: #152036; border: 1px solid rgba(148, 163, 184, 0.3); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: hm-up 0.24s cubic-bezier(.2, .9, .3, 1.1);
}
@media (min-width: 640px) {
  .hm-back { align-items: center; }
  .hm-sheet { border-radius: 22px; border-bottom: 1px solid rgba(148, 163, 184, 0.3); padding: 14px 20px 20px; }
}
@keyframes hm-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes hm-fade { from { opacity: 0; } }
.hm-grab { width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: rgba(148, 163, 184, 0.3); }
.hm-sh-art { aspect-ratio: 16 / 8; max-width: 100%; overflow: hidden; border-radius: 14px; }
.hm-sh-art svg { width: 100%; height: 100%; display: block; }
.hm-sheet h2 { margin: 14px 0 4px; font-size: 22px; font-weight: 850; color: var(--fg); text-transform: none; letter-spacing: normal; text-wrap: balance; }
.hm-sheet .hm-tags { padding-top: 2px; }
.hm-sh-blurb { margin: 10px 0 0; color: #cbd5e1; font-size: 14.5px; }
.hm-opts { margin-top: 14px; border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 14px; }
.hm-opts summary {
  list-style: none; min-height: 48px; padding: 0 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14.5px;
}
.hm-opts summary::-webkit-details-marker { display: none; }
.hm-opts summary::after { content: "›"; font-size: 20px; color: var(--muted); transition: transform 0.2s; }
.hm-opts[open] summary::after { transform: rotate(90deg); }
.hm-opts-in { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px; }
.hm-opts-in .hm-field { margin-top: 0; }
.hm-switch { position: relative; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.hm-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hm-tg { position: relative; flex: none; width: 44px; height: 26px; margin-top: 1px; border-radius: 13px; background: var(--bg-2); border: 1px solid rgba(148, 163, 184, 0.3); transition: background 0.2s; }
.hm-tg::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #cbd5e1; transition: transform 0.2s; }
.hm-switch input:checked + .hm-tg { background: var(--accent); border-color: var(--accent); }
.hm-switch input:checked + .hm-tg::after { transform: translateX(18px); background: #fff; }
.hm-switch input:focus-visible + .hm-tg { outline: 2px solid var(--accent); outline-offset: 2px; }
.hm-switch b { display: block; font-size: 14.5px; }
.hm-switch small { display: block; font-size: 12.5px; color: var(--muted); }
.hm-sh-err { margin: 12px 0 0; color: #fb923c; font-size: 13.5px; }
.hm-sh-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.hm-sh-actions .hm-btn { width: 100%; }
.hm-sheet button.hm-btn { height: 52px; }
@media (prefers-reduced-motion: reduce) {
  .hm-live, .hm-back, .hm-sheet { animation: none; }
  .hm button.hm-game, .hm-art svg, .hm-tg, .hm-tg::after { transition: none; }
}

/* ── Password / settings modals ── */
.pw-modal-back {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.pw-modal {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 12px;
}
.pw-modal h3 { font-size: 16px; }
.pw-modal .pw-err { color: var(--bad); font-size: 13px; }
.pw-actions, .rs-actions { display: flex; justify-content: flex-end; gap: 10px; }
.room-settings-sheet { display: flex; flex-direction: column; gap: 14px; }
.rs-field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.rs-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rs-note { font-size: 12px; }
.rs-pw-input { width: 100%; }
/* ── Fishers of Men (boatfish) ──
   Lobby: the shared lobby card with two option rows. Play: one phone screen
   (.bf.fit-screen) — top bar with timer + boat scores, the sea canvas, the
   role chip + load bar, then the controls in the thumb zone. In-game classes
   are .bf-*; the lobby tile keeps .boatfish-tile. */
.boatfish-dur-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.boatfish-dur-btn {
  flex: 1 1 0; min-width: 0; min-height: 44px;
  background: var(--bg-3); color: var(--fg);
  border: 2px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
  font-size: 14px; cursor: pointer;
}
.boatfish-dur-btn.active {
  border-color: var(--accent);
  background: rgba(56,189,248,0.15);
  color: var(--accent);
}
.boatfish-dur-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.bf { position: relative; display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin: 0 auto; }
.bf.fit-screen { height: 600px; }
.bf [hidden] { display: none !important; }
.bf-hud { flex: none; min-height: 50px; display: flex; align-items: center; gap: 8px; padding: 3px 8px; }
.bf-chips { flex: 1; min-width: 0; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 8px 2px 2px; }
.bf-chips::-webkit-scrollbar { display: none; }
.bf-chip {
  flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px;
  border-radius: 999px; background: #0f172a; border: 1px solid var(--border); font-size: 12.5px;
}
.bf-chip.me { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bf-av { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.bf-pts { color: #facc15; font-variant-numeric: tabular-nums; }
.bf-you { position: absolute; top: -8px; left: -2px; font-size: 10px; font-weight: 900; line-height: 15px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #0b1220; }
.bf-delta { position: absolute; top: -9px; right: -2px; font-size: 12px; font-weight: 900; color: #4ade80; pointer-events: none; animation: qz-rise 1.7s ease forwards; }

.bf-sea { flex: 1; min-height: 0; position: relative; overflow: hidden; border-radius: 12px; border: 1px solid #075985; background: #06182b; }
.bf-sea canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.bf-warns { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.bf-wb { max-width: 100%; padding: 8px 14px; border-radius: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 22px rgba(0,0,0,0.5); }
.bf-wb.tilt { background: #c2410c; color: #fff7ed; border: 2px solid #fdba74; font-size: 19px; animation: bf-throb 0.4s ease-in-out infinite alternate; }
.bf-wb.time { background: #7f1d1d; color: #fee2e2; border: 2px solid #fca5a5; font-size: 15px; animation: bf-throb 0.8s ease-in-out infinite alternate; }
@keyframes bf-throb { to { transform: scale(1.06); } }
.bf-toast {
  max-width: 100%; padding: 8px 14px; border-radius: 18px; font-size: 13px; font-weight: 700;
  background: rgba(2,6,23,0.94); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: bf-tin 0.25s ease;
}
.bf-toast.good { border-color: rgba(74,222,128,0.7); }
.bf-toast.bad { border-color: #f87171; color: #fecaca; }
@keyframes bf-tin { from { transform: translateY(-6px); opacity: 0; } }
.bf-float { color: #facc15; font-size: 26px; }
.bf-splash { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: radial-gradient(circle at 50% 50%, rgba(191,219,254,0.55), rgba(30,64,175,0.35) 45%, transparent 75%); animation: bf-fadeout 0.9s ease-out forwards; }
@keyframes bf-fadeout { to { opacity: 0; } }

.bf-ctl-top { flex: none; height: 28px; display: flex; align-items: center; gap: 8px; }
.bf-role { flex: none; max-width: 62%; display: inline-flex; border-radius: 999px; border: 1px solid var(--border); background: #111a2e; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.bf-role span { padding: 5px 9px; overflow: hidden; text-overflow: ellipsis; transition: background 0.2s, color 0.2s; }
.bf-role .mine { flex: none; background: rgba(56,189,248,0.2); color: var(--accent); }
.bf-role .other { min-width: 0; color: var(--muted); }
.bf-role .other.row { background: rgba(244,114,182,0.28); color: #fbcfe8; }
.bf-load { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.bf-meter { flex: 1; min-width: 30px; max-width: 120px; height: 10px; border-radius: 6px; background: #1e293b; border: 1px solid var(--border); overflow: hidden; }
.bf-meter i { display: block; height: 100%; width: 0; background: #4ade80; transition: width 0.3s, background 0.3s; }
.bf-meter i.warn { background: #fb923c; }
.bf-meter i.over { background: #f87171; }
.bf-load b { color: var(--fg); font-variant-numeric: tabular-nums; }

.bf-btns { flex: none; height: 76px; display: flex; gap: 8px; }
.bf .bf-bb {
  position: relative; flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 18px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-weight: 900; font-size: 19px; line-height: 1.15;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.22); overflow: hidden; transition: transform 0.08s, filter 0.2s;
}
.bf-bb .bt { white-space: nowrap; }
.bf-bb small { max-width: 100%; padding: 0 6px; font-size: 11.5px; font-weight: 800; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-bb .fill { position: absolute; left: 0; bottom: 0; height: 6px; width: 0; background: rgba(0,0,0,0.35); }
.bf .bf-bb.oar { flex: 1.45; background: linear-gradient(180deg, #fde68a, #f59e0b); color: #422006; }
.bf .bf-bb.net { background: linear-gradient(180deg, #bae6fd, #38bdf8); color: #082f49; }
.bf .bf-bb.net.open { background: linear-gradient(180deg, #a5f3fc, #0891b2); color: #042f2e; }
.bf .bf-bb.net.ready { background: linear-gradient(180deg, #bbf7d0, #22c55e); color: #052e16; animation: bf-glow 0.6s ease-in-out infinite alternate; }
.bf .bf-bb.net.pull { background: linear-gradient(180deg, #d9f99d, #65a30d); color: #1a2e05; }
.bf .bf-bb.save { background: linear-gradient(180deg, #fecaca, #ef4444); color: #450a0a; font-size: 23px; animation: bf-glow 0.7s ease-in-out infinite alternate; }
@keyframes bf-glow { to { box-shadow: inset 0 -5px 0 rgba(0,0,0,0.22), inset 0 0 0 4px rgba(255,255,255,0.75); } }
.bf .bf-bb.off { filter: grayscale(0.9) brightness(0.55); cursor: not-allowed; }
.bf .bf-bb.press { transform: scale(0.95); }
.bf .bf-bb.nope { animation: qz-shake 0.35s ease; }
.bf-btns.solo .bf-bb { font-size: 16px; }
.bf .bf-btns.solo .bf-bb.oar { flex: 1; }

.bf-end { display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 0 auto; padding: 14px; background: var(--bg-2); border: 1px solid var(--border); border-top: 3px solid #facc15; border-radius: 18px; }
.bf-end h2 { margin: 0; font-size: 19px; color: var(--fg); text-transform: none; letter-spacing: normal; }
.bf-end-sub { margin: 0; color: var(--muted); font-size: 13px; }
.bf-rank { display: flex; flex-direction: column; gap: 5px; }
.bf-rank > div { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: #111a2e; font-size: 14px; }
.bf-rank > div.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.bf-rank .md { width: 26px; text-align: center; font-size: 17px; }
.bf-rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.bf-rank b { color: #facc15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bf-rank .ct { min-width: 44px; text-align: right; color: var(--muted); font-size: 12px; }
.bf-end-lost { margin: 0; color: #fca5a5; font-size: 13px; }
.bf-verse { padding: 12px 14px; border-radius: 12px; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.35); text-align: center; }
.bf-verse p { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.5; color: #fde68a; }
.bf-verse span { display: inline-block; margin-top: 6px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }

.game-name { font-weight: 700; font-size: 16px; }

/* ============== Room ============== */
.room-page {
  background: var(--bg); overflow: hidden;
  height: 100vh; height: 100dvh;
}
.room-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--bg-2);
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.room-header .room-meta { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; justify-content: center; }
.room-header .game-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.room-header .room-code {
  font-family: ui-monospace, Menlo, monospace; background: var(--bg-3);
  padding: 3px 10px; border-radius: 6px; letter-spacing: 0.15em; font-size: 13px;
  white-space: nowrap;
}
.room-header .header-right { display: flex; align-items: center; gap: 8px; }
.conn { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.conn .dot.online { background: var(--good); box-shadow: 0 0 8px var(--good); }
.conn .dot.offline { background: var(--bad); }
.conn .dot.connecting { background: #facc15; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.4 } }
.icon-btn {
  background: transparent; color: var(--fg); padding: 6px 10px;
  border-radius: 8px; font-size: 14px; cursor: pointer; font-weight: 600;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.icon-btn:hover:not(:disabled) { background: var(--bg-3); filter: none; }

/* Players button (left) */
.players-btn {
  position: relative; padding: 8px 12px;
  align-items: center; justify-content: center;
  font-size: 18px;
}
.players-emoji { font-size: 20px; line-height: 1; }
.player-count {
  position: absolute; top: -2px; right: -4px;
  background: var(--accent); color: #0b1220;
  padding: 1px 6px; border-radius: 10px;
  font-size: 10px; font-weight: 800;
  min-width: 16px; text-align: center; pointer-events: none;
  border: 2px solid var(--bg-2);
}

/* Exit button */
.exit-btn {
  font-size: 16px; font-weight: 700;
  color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
}
.exit-btn:hover { background: rgba(239,68,68,0.18); color: var(--bad); }

.room {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "drawer stage";
  flex: 1; min-height: 0;
  position: relative;
}

.drawer {
  grid-area: drawer;
  background: var(--bg-2); border-right: 1px solid var(--border);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; min-height: 0;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.drawer-close { display: none; font-size: 22px; line-height: 1; padding: 2px 10px; }
#players { list-style: none; padding: 0; margin: 0; }
#players li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
#players li:last-child { border-bottom: none; }
#players .swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
#players .pname { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#players .pscore { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
#players .badge { background: var(--bg-3); color: var(--muted); padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
#players li.disconnected { opacity: 0.5; }
#players .bot-remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 999px;
  width: 22px; height: 22px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
#players .bot-remove:hover { border-color: #ef4444; color: #ef4444; }
#players .name-edit {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  width: 22px; height: 22px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
#players .name-edit:hover { border-color: var(--accent); }
.copy-link-btn { background: var(--bg-3); color: var(--fg); font-size: 13px; padding: 8px 10px; font-weight: 500; }
.copy-link-btn:hover:not(:disabled) { background: #3f4f6b; filter: none; }
.lobby-controls { display: flex; flex-direction: column; gap: 6px; }
.lobby-controls .hint { color: var(--muted); font-size: 12px; margin: 0; }
#finishedControls h4 { margin: 0; font-size: 18px; text-align: center; }

/* Leaderboard */
.leaderboard { display: flex; flex-direction: column; gap: 6px; }
.leaderboard:empty { display: none; }
.lb-title {
  text-align: center; color: var(--muted);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.lb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-3); border-radius: 8px;
  font-size: 14px;
}
.lb-row.lb-first {
  background: linear-gradient(90deg, rgba(251,191,36,0.18), rgba(251,191,36,0.05));
  border: 1px solid rgba(251,191,36,0.4);
}
.lb-rank { min-width: 30px; font-weight: 800; color: var(--accent); }
.lb-first .lb-rank { color: #fbbf24; font-size: 18px; }
.lb-swatch { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.lb-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--fg); }

.drawer-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}

/* Mobile: drawer slides from LEFT */
@media (max-width: 768px) {
  .drawer.drawer-left {
    position: fixed; top: 52px; left: 0; bottom: 0;
    width: 280px; z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    border-right: 1px solid var(--border);
  }
  .drawer.drawer-left.open { transform: translateX(0); }
  .drawer-close { display: flex; }
  .drawer-backdrop { display: block; }
  .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
}

.stage {
  grid-area: stage;
  padding: 20px 20px 180px;        /* extra bottom padding clears the chat dock */
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  /* Keep the swipe inside the stage — chaining it to the (unscrollable)
     page is what leaves iOS stuck mid-rubber-band. */
  overscroll-behavior-y: contain;
  min-height: 0; height: 100%;
  display: flex; align-items: flex-start; justify-content: center;
}
.stage-inner { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 14px; }
#gameRoot { width: 100%; }

/* Game controls bar — appears below game card during lobby/finished */
.game-controls {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.game-controls[hidden] { display: none; }
.game-controls .lobby-controls { display: flex; flex-direction: column; gap: 6px; }
.game-controls .lobby-controls[hidden] { display: none; }
.game-controls .cta {
  font-size: 16px; padding: 14px 18px; font-weight: 700;
}
.game-controls .hint {
  text-align: center; color: var(--muted);
  font-size: 13px; margin: 0;
}
.game-controls .copy-link-btn {
  background: var(--bg-3); color: var(--fg);
  font-size: 13px; padding: 10px 14px; font-weight: 500;
}
.game-controls .copy-link-btn:hover:not(:disabled) { background: #3f4f6b; filter: none; }
.game-controls #winnerText { margin: 0; font-size: 18px; text-align: center; }

/* ── In-room "Change game" picker (host only) ── */
html.switch-game-open, html.switch-game-open body { overflow: hidden !important; }
.switch-game-overlay {
  position: fixed; inset: 0;
  background: rgba(2,6,23,0.78);
  backdrop-filter: blur(2px);
  z-index: 1500;
  display: flex; align-items: flex-end; justify-content: center;
  animation: switch-game-fade 0.18s ease-out;
}
@keyframes switch-game-fade { from { opacity: 0; } to { opacity: 1; } }
.switch-game-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--card, #0f172a);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: switch-game-slide 0.22s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes switch-game-slide {
  from { transform: translateY(20px); opacity: 0.4; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (min-width: 600px) {
  .switch-game-overlay { align-items: center; padding: 24px; }
  .switch-game-sheet { border-radius: 16px; }
}
.switch-game-head {
  display: flex; align-items: center; justify-content: space-between;
}
.switch-game-title { font-size: 17px; font-weight: 700; }
.switch-game-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 36px; height: 36px;
  border-radius: 999px;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.switch-game-close:hover { border-color: var(--accent); color: var(--accent); }
.switch-game-intro { margin: 0; font-size: 13px; }
.switch-game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.switch-game-tile {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  color: var(--fg);
}
.switch-game-tile:hover:not(:disabled) { border-color: var(--accent); }
.switch-game-tile:disabled, .switch-game-tile.current {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--accent);
  background: rgba(56,189,248,0.08);
}
.switch-game-emoji { font-size: 28px; line-height: 1; }
.switch-game-art { display: block; aspect-ratio: 16 / 10; max-width: 100%; overflow: hidden; border-radius: 8px; margin-bottom: 4px; }
.switch-game-art svg { width: 100%; height: 100%; display: block; }
.switch-game-name { font-size: 14px; font-weight: 700; }
.switch-game-meta { font-size: 11px; color: var(--muted); line-height: 1.3; }
@media (max-width: 360px) {
  .switch-game-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .switch-game-overlay, .switch-game-sheet { animation: none !important; }
}

/* Chat dock — bottom-pinned, toggle open / close */
.chat-dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 80;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  max-height: 70vh; max-height: 70dvh;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
}
.chat-dock-toggle {
  display: flex; align-items: center; gap: 10px;
  background: transparent; color: var(--fg);
  padding: 11px 14px; width: 100%; border: none;
  text-align: left; cursor: pointer; font-size: 13px;
  font-weight: 500;
}
.chat-dock-toggle:hover { background: var(--bg-3); }
.chat-dock-toggle .chat-icon { font-size: 18px; line-height: 1; }
.chat-dock-toggle .chat-preview {
  flex: 1; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 400; min-width: 0;
}
.chat-dock-toggle .chat-badge {
  background: var(--accent); color: #0b1220;
  padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 800;
  min-width: 18px; text-align: center;
}
.chat-dock-toggle .chat-chevron {
  transition: transform 0.2s;
  color: var(--muted); font-size: 14px;
}
.chat-dock.expanded .chat-dock-toggle .chat-chevron { transform: rotate(180deg); }
.chat-dock.expanded .chat-dock-toggle { border-bottom: 1px solid var(--border); }
.chat {
  max-height: 0; min-height: 0;
  overflow-y: auto;
  padding: 0 14px;
  font-size: 14px;
  transition: max-height 0.22s ease-out, padding 0.22s;
}
.chat-dock.expanded .chat { max-height: 42vh; max-height: 42dvh; padding: 10px 14px; }
.chat .msg { margin-bottom: 5px; word-wrap: break-word; line-height: 1.4; }
.chat .msg .who { font-weight: 700; }
.chat .system { color: var(--muted); font-style: italic; font-size: 13px; }
.chat-form {
  display: flex; gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.chat-form input { flex: 1; font-size: 16px; padding: 10px 12px; }
.chat-form .send-btn { padding: 10px 14px; font-size: 14px; min-width: 44px; }
.chat-badge.urgent { background: var(--bad) !important; color: white !important; }

/* Shared end-of-game status banner (used by trivia, verses, wheattares, snake) */
.ttt-status { text-align: center; margin: 12px; font-size: 18px; }

/* Trivia / Bible Quiz */
.trivia { max-width: 700px; margin: 0 auto; }
.trivia .question {
  position: relative;
  background: var(--bg-2); padding: 24px 24px 32px;
  border-radius: 10px; min-height: 80px;
}
.trivia .question-text {
  font-size: 22px; font-weight: 600; text-align: center;
}
.trivia-ref {
  position: absolute; right: 14px; bottom: 8px;
  color: var(--muted); font-style: italic;
  font-size: 11px; letter-spacing: 0.02em;
  white-space: nowrap;
}
.trivia .answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.trivia .answer { padding: 18px; font-size: 16px; background: var(--bg-2); color: var(--fg); border: 2px solid var(--border); border-radius: 8px; text-align: left; }
.trivia .answer:hover:not(:disabled) { border-color: var(--accent); }
.trivia .answer.picked { border-color: var(--accent-2); background: #2a2f59; }
.trivia .answer.correct { border-color: var(--good); background: rgba(34,197,94,0.2); }
.trivia .answer.wrong { border-color: var(--bad); background: rgba(239,68,68,0.15); }
.trivia .timer { text-align: center; font-size: 22px; font-weight: 700; margin: 12px 0; }

/* Trivia game-over review */
.trivia-summary { text-align: center; margin: 18px 0 6px; }
.trivia-win { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.trivia-stats { color: var(--accent); font-size: 15px; font-weight: 600; }
.trivia-review-head {
  margin: 18px 0 10px; font-size: 14px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; text-align: center;
}
.trivia-review { display: flex; flex-direction: column; gap: 10px; }
.review-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  border-left-width: 4px;
}
.review-card.good { border-left-color: var(--good); }
.review-card.bad  { border-left-color: var(--bad); }
.review-card.missed { border-left-color: var(--muted); }
.review-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.review-num { font-weight: 800; color: var(--accent); }
.review-ref {
  background: rgba(56,189,248,0.12); color: var(--accent);
  padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 700;
  border: 1px solid rgba(56,189,248,0.3);
}
.review-q { font-weight: 600; font-size: 15px; margin-bottom: 10px; line-height: 1.4; }
.review-opts { display: flex; flex-direction: column; gap: 6px; }
.review-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 6px;
  background: var(--bg-3); font-size: 14px;
  border: 1px solid transparent;
}
.review-opt.is-correct { background: rgba(34,197,94,0.18); border-color: rgba(34,197,94,0.4); }
.review-opt.is-yours-wrong { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); }
.review-opt.is-yours-right { background: rgba(34,197,94,0.28); border-color: var(--good); }
.review-letter { font-weight: 800; min-width: 22px; }
.review-tag {
  margin-left: auto; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
}
.review-tag.tag-correct { background: var(--good); color: #052e16; }
.review-tag.tag-yours { background: var(--bad); color: #fff; }
.review-skip { color: var(--muted); font-style: italic; font-size: 13px; margin-top: 8px; }
.trivia .progress { text-align: center; color: var(--muted); margin-bottom: 10px; }

/* ── Draw & Guess (你画我猜, public/js/games/draw.js) ──────────────────────
   Play fits one phone screen (.dg-play.fit-screen): top bar (word or blank
   boxes + countdown ring), player strip, a square canvas as big as fits, the
   wrong-guess strip, then the drawer's tools or the guess box in the thumb
   zone. While that screen is up the chat dock folds to its one-row toggle —
   the guess box is the only text box — and #stage's bottom padding shrinks to
   match (--dg-dock is measured by draw.js). Nothing here applies once the
   play screen is gone (lobby, end, other games). */
html:has(.dg-play) .chat-dock:not(.expanded) > .chat-form { display: none; }
#stage.stage:has(.dg-play.fit-screen) { padding-bottom: calc(var(--dg-dock, 48px) + 8px); }
.dg { position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 560px; margin: 0 auto; }
.dg.fit-screen { height: 600px; overflow: hidden; }
.dg h2, .dg h3 { color: var(--fg); text-transform: none; letter-spacing: normal; }
.dg-hud { flex: none; height: 52px; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 12px; }
.dg-hl { flex: none; width: 104px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dg-rd { font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.dg-who { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-wd { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; overflow: hidden; }
.dg-wd .w { font-size: 23px; font-weight: 900; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dg-wd .s { font-size: 12px; color: var(--muted); font-weight: 700; flex: none; }
.dg-wd .m { color: var(--muted); font-size: 13px; font-weight: 700; }
.dg-wd.got .w { color: #4ade80; }
.dg-blanks { display: flex; gap: 4px; min-width: 0; }
.dg-blanks i {
  flex: none; width: var(--bw, 24px); height: 30px; border-radius: 7px; border: 2px dashed #64748b; background: rgba(2, 6, 23, 0.6);
  display: grid; place-items: center; font-style: normal; font-size: 15px; font-weight: 900; color: #facc15;
}
.dg-blanks i.on { border-style: solid; border-color: #facc15; animation: qz-popin 0.35s ease; }
.dg-blanks i.gap { width: 6px; border: 0; background: none; }
.dg-cnt { flex: none; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.dg .qz-strip { padding: 8px 2px 3px; }
.dg .qz-chip.cur { box-shadow: 0 0 0 2px #facc15; }
.dg-pen { position: absolute; top: -7px; right: -5px; width: 19px; height: 19px; border-radius: 50%; background: #facc15; font-size: 10px; display: grid; place-items: center; }

/* canvas */
.dg-cbox { flex: 1 1 0; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.dg-cwrap {
  flex: none; position: relative; width: 300px; height: 300px; background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4); transition: box-shadow 0.2s;
}
.dg-cwrap canvas { display: block; width: 100%; height: 100%; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dg-cwrap.live { box-shadow: 0 0 0 3px var(--accent), 0 8px 24px rgba(0, 0, 0, 0.4); }
.dg-cwrap.live canvas { cursor: crosshair; }
.dg-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #334155; text-align: center; font-size: 16px; padding: 12px; pointer-events: none; }
.dg-cover .pen { font-size: 46px; animation: dg-wig 1s ease-in-out infinite; }
.dg-cover small { font-size: 12.5px; color: #64748b; font-weight: 700; }
@keyframes dg-wig { 50% { transform: rotate(-14deg) translateY(-4px); } }
.dg-banner {
  position: absolute; top: 10px; left: 50%; z-index: 5; max-width: calc(100% - 16px); padding: 7px 14px; border-radius: 999px;
  background: #16a34a; color: #fff; font-weight: 900; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); pointer-events: none; transform: translateX(-50%); animation: dg-banner 2.8s ease forwards;
}
@keyframes dg-banner { 0% { transform: translate(-50%, -20px); opacity: 0; } 12%, 85% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, 0); opacity: 0; } }
.dg-yay {
  position: absolute; left: 50%; top: 50%; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 24px; border-radius: 20px; background: rgba(2, 6, 23, 0.9); border: 2px solid #4ade80; color: #fff;
  pointer-events: none; transform: translate(-50%, -50%); animation: dg-yay 2s ease forwards;
}
.dg-yay .e { font-size: 40px; line-height: 1.1; }
.dg-yay b { font-size: 22px; }
.dg-yay em { font-style: normal; font-size: 26px; font-weight: 900; color: #4ade80; }
@keyframes dg-yay {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  25%, 85% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
.dg-cf { position: absolute; z-index: 45; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: dg-cf 1.6s cubic-bezier(0.2, 0.6, 0.4, 1) both; }
@keyframes dg-cf { 0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)); opacity: 0; } }

/* wrong guesses under the canvas */
.dg-feed { flex: none; height: 30px; display: flex; gap: 6px; align-items: center; overflow: hidden; }
.dg-fph { font-size: 12px; color: var(--muted); padding-left: 4px; white-space: nowrap; }
.dg-fb {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px 0 4px; border-radius: 999px;
  background: #1e293b; border: 1px solid var(--border); font-size: 13px; font-weight: 700; white-space: nowrap; max-width: 70%; overflow: hidden; text-overflow: ellipsis;
}
.dg-fb .qz-av { width: 20px; height: 20px; font-size: 10px; }
.dg-fb.mine { border-color: rgba(56, 189, 248, 0.6); }
.dg-fb.new { animation: dg-fbin 0.3s ease; }
@keyframes dg-fbin { from { transform: translateX(-16px); opacity: 0; } }

/* the drawer's tools (thumb zone) */
.dg-bottom { flex: none; }
.dg-tools { display: flex; flex-direction: column; gap: 6px; transition: opacity 0.2s; }
.dg-tools.off { opacity: 0.4; pointer-events: none; }
.dg-sws { display: flex; gap: 3px; }
.dg-sw { flex: 1 1 0; min-width: 0; height: 44px; padding: 0; border-radius: 12px; border: 3px solid rgba(255, 255, 255, 0.14); cursor: pointer; transition: transform 0.12s; }
.dg-sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); transform: translateY(-3px); }
.dg-tls { display: flex; gap: 4px; }
.dg-tl {
  flex: 1 1 0; min-width: 0; height: 54px; padding: 0; border-radius: 12px; background: #1e293b; border: 2px solid #334155; color: var(--fg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
  transition: transform 0.12s;
}
.dg-tl .ic { font-size: 18px; line-height: 1; height: 20px; display: grid; place-items: center; }
.dg-tl .dot { display: block; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75); }
.dg-tl .lb { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dg-tl.on { border-color: var(--accent); background: rgba(56, 189, 248, 0.16); }
.dg-tl.arm { border-color: #f87171; background: rgba(248, 113, 113, 0.22); color: #fecaca; animation: qz-shake 0.4s ease; }
.dg-tl:disabled { opacity: 0.35; cursor: default; }
.dg-tl:not(:disabled):active, .dg-sw:active { transform: scale(0.94); }

/* the guess box (thumb zone) */
.dg-guess { display: flex; gap: 6px; margin: 0; }
.dg-guess input {
  flex: 1; min-width: 0; height: 54px; border-radius: 14px; border: 2px solid var(--accent); background: #0b1220; color: var(--fg);
  font: inherit; font-size: 17px; padding: 0 14px; outline: none;
}
.dg-guess input::placeholder { color: #64748b; font-size: 15px; }
.dg-guess input:focus { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3); }
.dg-guess.nope input { animation: qz-shake 0.4s ease; }
.dg-go { flex: none; min-width: 78px; height: 54px; border: 0; border-radius: 14px; background: var(--accent); color: #0b1220; font-size: 18px; font-weight: 900; cursor: pointer; }
.dg-state {
  height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; padding: 0 10px; text-align: center;
  font-weight: 800; font-size: 15px; background: var(--bg-2); border: 2px dashed #334155; color: var(--muted);
}
.dg-state.ok { background: rgba(22, 163, 74, 0.18); border: 2px solid rgba(74, 222, 128, 0.55); color: #4ade80; }
.dg-toast {
  position: absolute; z-index: 25; left: 50%; transform: translateX(-50%); max-width: calc(100% - 16px); padding: 8px 14px; border-radius: 18px;
  font-size: 13px; font-weight: 800; background: rgba(2, 6, 23, 0.94); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; animation: qz-tin 0.25s ease;
}
.dg-toast.warn { background: #7c2d12; border-color: #fb923c; color: #ffedd5; font-size: 14px; font-weight: 900; }
.dg-toast.info { background: #422006; border-color: #facc15; color: #fef9c3; }

/* word picker sheet */
.dg-veil { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(2, 6, 23, 0.55); animation: dg-fade 0.2s ease; }
@keyframes dg-fade { from { opacity: 0; } }
.dg-sheet {
  background: #0f172a; border-top: 3px solid #facc15; border-radius: 18px 18px 14px 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); animation: qz-up 0.25s ease both;
}
.dg-sheet h3 { margin: 0; font-size: 17px; }
.dg-sheet p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.dg-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dg-pick {
  min-width: 0; min-height: 150px; padding: 8px 4px; border-radius: 16px; border: 2px solid #475569; background: linear-gradient(180deg, #1e293b, #162033);
  color: var(--fg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25); transition: transform 0.12s;
}
.dg-pick .e { font-size: 42px; line-height: 1.15; }
.dg-pick b { font-size: 22px; font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dg-pick small { font-size: 13px; color: var(--muted); font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dg-pick:not(:disabled):active { transform: scale(0.96); }
.dg-pick:disabled { cursor: default; opacity: 0.6; }
.dg-pick.chosen { opacity: 1; border-color: var(--accent); background: rgba(56, 189, 248, 0.2); animation: qz-pop 0.4s ease; }
.dg-drain { height: 5px; border-radius: 4px; background: #1e293b; overflow: hidden; }
.dg-drain > i { display: block; height: 100%; width: 100%; background: #facc15; animation: dg-drain linear forwards; }
@keyframes dg-drain { to { width: 0; } }

/* round result rows (inside the shared .qz-sheet) */
.dg-rv-o { font-size: 13px; color: var(--muted); font-weight: 700; }
.dg-rvl { display: flex; flex-direction: column; gap: 5px; }
.dg-rv { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 10px; background: var(--bg-2); font-size: 14px; font-weight: 700; }
.dg-rv .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-rv b { color: #4ade80; font-variant-numeric: tabular-nums; }
.dg-rv small { color: var(--muted); font-size: 12px; }
.dg-rv.miss { color: var(--muted); } .dg-rv.miss b { color: var(--muted); font-weight: 700; }
.dg-rv.drw b { color: #facc15; }

/* end: podium + gallery of every drawing */
.dg-end { gap: 12px; }
.dg-ghead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 0 2px; }
.dg-ghead h3 { margin: 0; font-size: 16px; }
.dg-ghead span { font-size: 12px; color: var(--muted); }
.dg-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.dg-gcard { position: relative; margin: 0; padding: 6px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); border-bottom: 3px solid #475569; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dg-gcard.good { border-bottom-color: var(--good); }
.dg-gcard.mine { border-bottom-color: #facc15; }
.dg-gcard canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; background: #fff; }
.dg-gcard figcaption { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; color: var(--muted); line-height: 1.3; min-width: 0; }
.dg-gcard .w { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-gcard .w b { font-size: 15px; color: var(--fg); }
.dg-gcard .by { overflow-wrap: anywhere; }
.dg-gcard .mk { position: absolute; top: 10px; right: 10px; font-size: 16px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
@media (prefers-reduced-motion: reduce) {
  .dg-cover .pen, .dg-banner, .dg-yay, .dg-cf, .dg-fb.new, .dg-tl.arm, .dg-guess.nope input, .dg-pick.chosen, .dg-blanks i.on { animation: none !important; }
  .dg-cf { display: none; }
}
.guessed { color: var(--good); font-weight: 700; }

/* ── Manna Trail (game key `snake`) ──
   Lobby: the shared lobby card plus a speed row (.snake-speed-*). Play: one
   phone screen (.mn.fit-screen): top bar (me, score, manna, who is left),
   player strip, the wilderness canvas, then four big arrow blocks in the
   thumb zone (swiping on the board also turns). Feedback floats over the
   layout so nothing moves. End: a compact ranking card (.mn-end). */
.snake-speed-row { display: flex; gap: 8px; margin: 0 0 6px; }
.snake-speed-btn {
  flex: 1 1 0; min-width: 0; min-height: 48px; background: var(--bg-3); color: var(--fg);
  border: 2px solid var(--border); border-radius: 12px; padding: 8px 12px; font-size: 15px;
}
.snake-speed-btn.active { border-color: var(--accent); background: rgba(56, 189, 248, 0.15); color: var(--accent); }
.snake-speed-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.snake-speed-btn.active:disabled { opacity: 0.9; }
.snake-speed-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

.mn { position: relative; display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.mn.fit-screen { height: 600px; }
.mn-hud {
  flex: none; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 5px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
}
.mn-me-av { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 13px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9); }
.mn-score { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 900; color: #facc15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mn-score b { font-size: 22px; display: inline-block; }
.mn-score small { font-size: 12px; color: var(--muted); font-weight: 700; }
.mn-score.bump b { animation: mn-bump 0.45s ease; }
@keyframes mn-bump { 40% { transform: scale(1.35); color: #fff; } }
.mn-count { font-size: 13px; font-weight: 800; color: #fde68a; white-space: nowrap; }
.mn-sp { flex: 1; }
.mn-alive {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: rgba(74, 222, 128, 0.12); color: #4ade80;
}
.mn-alive::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; animation: mn-blink 1.4s ease-in-out infinite; }
.mn-alive.out { background: rgba(248, 113, 113, 0.12); color: #fca5a5; }
.mn-alive.out::before { animation: none; }
@keyframes mn-blink { 50% { opacity: 0.3; } }
.mn-strip { flex: none; height: 38px; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 9px 1px 0; }
.mn-strip::-webkit-scrollbar { display: none; }
.mn-chip {
  flex: none; position: relative; height: 28px; display: inline-flex; align-items: center; gap: 4px; padding: 0 9px 0 3px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border); font-size: 12px; font-weight: 700; max-width: 150px; transition: opacity 0.3s;
}
.mn-chip.me { border-color: rgba(56, 189, 248, 0.6); }
.mn-chip.out { opacity: 0.45; }
.mn-chip.lead::before { content: "👑"; position: absolute; top: -9px; left: -3px; font-size: 12px; }
.mn-chip .av { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 900; }
.mn-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mn-chip .pt { color: #facc15; font-variant-numeric: tabular-nums; }
.mn-chip .dl { position: absolute; top: -10px; right: 2px; font-size: 12px; color: #4ade80; font-weight: 900; pointer-events: none; animation: mn-rise 1.5s ease forwards; }
@keyframes mn-rise { 0% { transform: translateY(5px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }
.mn-board { flex: 1 1 auto; min-height: 0; position: relative; touch-action: none; }
.mn-board canvas {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(253, 230, 138, 0.22), 0 8px 24px rgba(0, 0, 0, 0.4);
}
.mn-board.shake { animation: mn-shake 0.45s ease; }
@keyframes mn-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.mn-cd { position: absolute; inset: 0; z-index: 22; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: none; background: rgba(2, 6, 23, 0.32); border-radius: 10px; text-align: center; padding: 0 10px; }
.mn-cd[hidden] { display: none; }
.mn-cd b { font-size: 64px; font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.6); animation: mn-cdpop 0.6s ease; }
.mn-cd b.go { font-size: 40px; color: #facc15; }
.mn-cd span { font-size: 13px; font-weight: 800; background: rgba(2, 6, 23, 0.85); border: 1px solid var(--border); padding: 5px 12px; border-radius: 999px; }
@keyframes mn-cdpop { 0% { transform: scale(1.8); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1); } }
.mn-toast {
  position: absolute; z-index: 25; left: 50%; top: 8px; transform: translateX(-50%); max-width: calc(100% - 16px); pointer-events: none;
  padding: 7px 13px; border-radius: 18px; font-size: 12.5px; font-weight: 700; background: rgba(2, 6, 23, 0.92); border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: mn-tin 0.25s ease;
}
.mn-toast.bad { color: #fca5a5; border-color: rgba(248, 113, 113, 0.5); }
.mn-toast.gold { color: #fde68a; border-color: rgba(250, 204, 21, 0.5); }
@keyframes mn-tin { from { transform: translate(-50%, -6px); opacity: 0; } }
.mn-float {
  position: absolute; z-index: 40; pointer-events: none; font-weight: 900; font-size: 24px; color: #facc15; white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75); animation: mn-fly 1.1s ease-out forwards;
}
.mn-float.sm { font-size: 14px; opacity: 0.85; }
@keyframes mn-fly { 0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -80%) scale(1.15); } 100% { transform: translate(-50%, -260%) scale(1); opacity: 0; } }
.mn-hurt { position: absolute; inset: 0; z-index: 20; pointer-events: none; border-radius: 14px; box-shadow: inset 0 0 0 4px rgba(248, 113, 113, 0.95), inset 0 0 70px rgba(248, 113, 113, 0.55); animation: mn-hurt 0.8s ease forwards; }
@keyframes mn-hurt { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.mn-pad { flex: none; height: var(--mn-pad-h, 190px); position: relative; touch-action: none; }
.mn-grid {
  height: 100%; display: grid; gap: 8px; grid-template-columns: 1fr 1.3fr 1fr; grid-template-rows: 1fr 1fr;
  grid-template-areas: "l u r" "l d r";
}
button.mn-btn {
  min-width: 56px; min-height: 56px; padding: 0; border-radius: 18px; color: #cbd5e1; display: grid; place-items: center;
  background: linear-gradient(180deg, #334155, #1e293b); border: 2px solid #475569; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25);
  touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, opacity 0.2s, background 0.2s, border-color 0.2s;
}
button.mn-btn:hover:not(:disabled) { filter: none; }
.mn-btn svg { width: 40px; height: 40px; fill: currentColor; pointer-events: none; }
.mn-btn[data-d="up"] { grid-area: u; } .mn-btn[data-d="down"] { grid-area: d; }
.mn-btn[data-d="left"] { grid-area: l; } .mn-btn[data-d="right"] { grid-area: r; }
.mn-btn[data-d="down"] svg { transform: rotate(180deg); } .mn-btn[data-d="left"] svg { transform: rotate(-90deg); } .mn-btn[data-d="right"] svg { transform: rotate(90deg); }
.mn-btn[data-d="left"] svg, .mn-btn[data-d="right"] svg { width: 46px; height: 46px; }
button.mn-btn.lit { border-color: var(--accent); color: #e0f2fe; background: linear-gradient(180deg, rgba(56, 189, 248, 0.42), rgba(56, 189, 248, 0.14)); }
button.mn-btn.rev { opacity: 0.28; }
button.mn-btn.press { transform: scale(0.95); background: linear-gradient(180deg, rgba(56, 189, 248, 0.6), rgba(56, 189, 248, 0.25)); }
button.mn-btn.nope { animation: mn-nudge 0.3s ease; }
@keyframes mn-nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.mn-out {
  position: absolute; inset: 0; z-index: 5; border-radius: 16px; background: rgba(15, 23, 42, 0.97); border: 1px solid rgba(248, 113, 113, 0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; text-align: center; padding: 10px 14px; animation: mn-up 0.3s ease;
}
.mn-out.watch { border-color: var(--border); }
.mn-out .e { font-size: 38px; line-height: 1; }
.mn-out b { font-size: 16px; }
.mn-out span { font-size: 13px; color: #fde68a; font-weight: 800; }
.mn-out small { font-size: 12.5px; color: var(--muted); }
@keyframes mn-up { from { transform: translateY(30px); opacity: 0.4; } }
.mn-end { display: flex; flex-direction: column; gap: 10px; padding: 14px; max-width: 520px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--border); border-top: 3px solid #facc15; border-radius: 16px; }
.mn-end h2 { margin: 0; text-align: center; font-size: 19px; color: var(--fg); text-transform: none; letter-spacing: normal; text-wrap: balance; }
.mn-end .qz-podium > div { background: var(--bg); }
.mn-end .qz-podium > .p1 { background: linear-gradient(180deg, rgba(250, 204, 21, 0.35), var(--bg)); }
.mn-end .qz-podium small { color: var(--muted); font-size: 11px; font-weight: 700; }
.mn-end .qz-podium .me { box-shadow: inset 0 0 0 2px var(--accent); }
.mn-solo { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 900; }
.mn-solo .e { font-size: 44px; }
.mn-solo b { font-size: 34px; color: #facc15; }
.mn-rks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; max-height: 34vh; overflow-y: auto; }
.mn-rks.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mn-rk { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 10px; background: var(--bg); font-size: 13px; font-weight: 700; min-width: 0; }
.mn-rk.me { box-shadow: inset 0 0 0 1px var(--accent); }
.mn-rk .no { width: 18px; flex: none; color: var(--muted); text-align: center; font-size: 12px; }
.mn-rk .av { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; font-weight: 900; }
.mn-rk .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-rk small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.mn-rk b { color: #facc15; font-variant-numeric: tabular-nums; }
.mn-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mn-tag { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.mn-tag.gold { background: rgba(250, 204, 21, 0.14); color: #facc15; }
.mn-end p { margin: 0; text-align: center; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.mn-end p b { color: var(--fg); }
.mn-end .ref { font-size: 12px; color: #fde68a; }
@media (prefers-reduced-motion: reduce) {
  .mn-score.bump b, .mn-alive::before, .mn-chip .dl, .mn-board.shake, .mn-cd b, .mn-toast, .mn-float, .mn-hurt, button.mn-btn.nope, .mn-out { animation: none; }
}

/* Ten Plagues */
.tenplagues-lobby { max-width: 520px; }
.tenplagues-howto { padding-left: 20px; margin: 8px 0; line-height: 1.55; }
.tenplagues-howto li { margin-bottom: 4px; }
/* Ten Plagues play screen (.tp.fit-screen) — one phone screen: a two-row top
   bar (ring to the next plague, plague + tip, players still in; a big HP bar
   with a mark at 50 + status chips), the arena canvas (3:2, sized by JS),
   then the thumb zone where a joystick appears under the finger. Banners,
   floats, toasts and the red edge flash are absolutely positioned so the
   layout never moves. In-game classes are .tp-*; the lobby keeps .tenplagues-*. */
.tp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 640px; margin: 0 auto; }
.tp.fit-screen { height: 600px; }
.tp [hidden] { display: none !important; }
.tp-hud { align-self: stretch; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 7px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; }
.tp-hud-top { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.tp-ring { width: 40px; height: 40px; flex: none; position: relative; display: grid; place-items: center; font-weight: 900; font-size: 15px; font-variant-numeric: tabular-nums; }
.tp-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.tp-ring circle { fill: none; stroke-width: 4; }
.tp-ring .bg { stroke: #334155; }
.tp-ring .fg { stroke: #facc15; transition: stroke 0.3s; }
.tp-ring.low { animation: tp-beat 0.5s ease-in-out infinite alternate; }
.tp-ring.low .fg { stroke: #f87171; }
.tp-ring.low b { color: #f87171; }
@keyframes tp-beat { to { transform: scale(1.1); } }
.tp-pg { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.tp-pg .e { flex: none; font-size: 26px; line-height: 1; }
.tp-pg .tx { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tp-pg b { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-pg small { font-size: 12px; font-weight: 700; color: #fde68a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-pg.pop { animation: tp-pop 0.45s ease; }
@keyframes tp-pop { 50% { transform: scale(1.08); } }
.tp-alive { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 999px; background: #0f172a; border: 1px solid var(--border); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.tp-alive b { font-size: 16px; }
.tp-alive i { font-style: normal; }
.tp-alive.pop { animation: tp-alive-pop 0.6s ease; }
@keyframes tp-alive-pop { 30% { transform: scale(1.12); border-color: #f87171; } }
.tp-hp-row { display: flex; align-items: center; gap: 8px; height: 26px; }
.tp-hp-num { flex: none; min-width: 58px; font-weight: 900; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tp-hp-num b { font-size: 19px; }
.tp-hp-bar { flex: 1; min-width: 56px; height: 18px; border-radius: 10px; background: #0f172a; border: 1px solid var(--border); position: relative; overflow: hidden; }
.tp-hp-bar i { position: absolute; left: 0; top: 0; bottom: 0; display: block; }
.tp-hp-bar .lag { background: #fecaca; }
.tp-hp-bar .fill { background: #22c55e; transition: background 0.3s; }
.tp-hp-bar .mark { left: 50%; width: 2px; background: rgba(255, 255, 255, 0.5); }
.tp-hp-row.hit .tp-hp-bar { animation: tp-shake 0.3s ease; border-color: #f87171; }
.tp-hp-row.heal .tp-hp-bar { box-shadow: 0 0 0 2px #4ade80, 0 0 14px rgba(74, 222, 128, 0.8); }
@keyframes tp-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.tp-buffs { flex: 0 1 auto; min-width: 0; display: flex; gap: 3px; overflow: hidden; }
.tp-chip {
  flex: none; position: relative; height: 24px; min-width: 28px; padding: 0 4px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  font-size: 11.5px; font-weight: 900; background: #0f172a; border: 1.5px solid currentColor; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; animation: tp-popin 0.3s ease;
}
.tp-chip .v { color: var(--fg); }
.tp-chip i { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; }
.tp-chip.red { color: #f87171; } .tp-chip.blue { color: #60a5fa; } .tp-chip.purple { color: #c084fc; }
.tp-chip.flies { color: #a8a29e; } .tp-chip.burn { color: #fb923c; } .tp-chip.slow { color: #7dd3fc; } .tp-chip.boils { color: #fca5a5; }
@keyframes tp-popin { from { transform: scale(0); } }

.tp-arena { flex: none; position: relative; width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; background: #1a1208; border: 1px solid #5c3a1a; touch-action: none; }
.tp-arena canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tp-arena.shake { animation: tp-ashake 0.32s ease; }
@keyframes tp-ashake { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
/* The count sits low in the arena so it never covers the spawn point (and "You're here"). */
.tp-ready { position: absolute; inset: 0; z-index: 4; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2%; font-size: 64px; line-height: 1; font-weight: 900; color: #fbbf24; text-shadow: 0 0 24px rgba(251, 191, 36, 0.7), 0 4px 8px rgba(0, 0, 0, 0.6); pointer-events: none; }
.tp-ready span { animation: tp-rdy 1s ease-out both; }
.tp-ready.go { font-size: 46px; padding-bottom: 4%; }
@keyframes tp-rdy { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.9); opacity: 0.85; } }
.tp-banner {
  position: absolute; left: 50%; top: 50%; z-index: 5; width: min(280px, 84%); padding: 7px 12px 9px; border-radius: 16px; text-align: center; pointer-events: none;
  background: rgba(2, 6, 23, 0.74); border: 2px solid #facc15; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); transform: translate(-50%, -50%); animation: tp-bnr 2.2s ease forwards;
}
.tp-banner.boils { border-color: #f87171; }
.tp-banner .bh { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tp-banner .e { font-size: 28px; line-height: 1.1; }
.tp-banner b { font-size: 21px; font-weight: 900; color: #fde68a; }
.tp-banner.boils b { color: #fecaca; }
.tp-banner .ref { display: inline-block; margin-top: 3px; font-size: 11px; color: var(--muted); border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 999px; padding: 0 8px; }
.tp-banner p { margin: 5px 0 0; font-size: 14px; font-weight: 800; color: var(--fg); line-height: 1.35; }
@keyframes tp-bnr { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } 20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -64%); } }
.tp-outbig { position: absolute; left: 50%; top: 50%; z-index: 6; padding: 12px 18px; border-radius: 16px; background: rgba(69, 10, 10, 0.9); border: 2px solid #f87171; text-align: center; white-space: nowrap; pointer-events: none; transform: translate(-50%, -50%); animation: tp-bnr 2.6s ease forwards; }
.tp-outbig b { display: block; font-size: 25px; font-weight: 900; color: #fecaca; }
.tp-outbig span { font-size: 14px; font-weight: 700; color: var(--fg); }
.tp-toast {
  position: absolute; z-index: 7; top: 8px; left: 50%; max-width: calc(100% - 16px); padding: 7px 14px; border-radius: 18px; pointer-events: none;
  font-size: 13px; font-weight: 700; line-height: 1.35; text-align: center; color: var(--fg); background: rgba(2, 6, 23, 0.92); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  width: max-content; transform: translateX(-50%); animation: tp-tin 0.25s ease;
}
.tp-toast.bad { border-color: #f87171; color: #fecaca; }
.tp-toast.good { border-color: rgba(74, 222, 128, 0.7); color: #bbf7d0; }
@keyframes tp-tin { from { transform: translate(-50%, -6px); opacity: 0; } }
.tp-vig { position: absolute; inset: 0; z-index: 20; pointer-events: none; opacity: 0; border-radius: 14px; box-shadow: inset 0 0 0 3px rgba(239, 68, 68, 0.9), inset 0 0 80px rgba(239, 68, 68, 0.8); }
.tp-vig.on { animation: tp-vig 0.55s ease-out; }
@keyframes tp-vig { 0% { opacity: 1; } 100% { opacity: 0; } }
.tp-float { position: absolute; z-index: 22; pointer-events: none; transform: translate(-50%, 0); font-weight: 900; white-space: nowrap; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 2px #000; animation: tp-fly 1.2s ease-out forwards; }
.tp-float.dmg { font-size: 26px; color: #f87171; }
.tp-float.dmg.sh { font-size: 22px; color: #fca5a5; }
.tp-float.dot { font-size: 15px; color: #e7e5e4; animation-duration: 0.9s; }
.tp-float.dot.burn { color: #fdba74; }
.tp-float.zero { font-size: 15px; color: #d8b4fe; }
.tp-float.buff { font-size: 15px; padding: 3px 10px; border-radius: 999px; background: rgba(2, 6, 23, 0.85); border: 2px solid currentColor; text-shadow: none; animation-duration: 1.6s; }
.tp-float.buff.green { font-size: 20px; color: #4ade80; } .tp-float.buff.red { color: #fca5a5; } .tp-float.buff.blue { color: #93c5fd; }
.tp-float.buff.purple { color: #d8b4fe; } .tp-float.buff.water { color: #7dd3fc; }
@keyframes tp-fly { 0% { transform: translate(-50%, 4px) scale(0.6); opacity: 0; } 18% { opacity: 1; transform: translate(-50%, -8px) scale(1.15); } 30% { transform: translate(-50%, -12px) scale(1); } 100% { transform: translate(-50%, -54px) scale(1); opacity: 0; } }

/* Thumb zone: press anywhere and the stick appears under the finger. */
.tp-pad {
  align-self: stretch; flex: 1 1 0; min-height: 120px; position: relative; overflow: hidden; border-radius: 16px; cursor: grab;
  border: 1.5px dashed rgba(148, 163, 184, 0.22); background: radial-gradient(ellipse at 50% 56%, rgba(251, 191, 36, 0.07), transparent 70%);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.tp-hint { position: absolute; top: 9px; left: 8px; right: 8px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); pointer-events: none; transition: opacity 0.4s; }
.tp-hint.gone { opacity: 0; }
.tp-joy {
  position: absolute; left: 50%; top: 56%; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; pointer-events: none; opacity: 0.5;
  background: radial-gradient(circle, rgba(94, 57, 26, 0.6) 0%, rgba(42, 29, 18, 0.88) 70%); border: 2px solid #5c3a1a; box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.5);
  transition: left 0.2s ease, top 0.2s ease, opacity 0.2s;
}
.tp-joy::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 1px dashed rgba(253, 230, 138, 0.25); }
.tp-joy.on { opacity: 1; transition: opacity 0.1s; }
.tp-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fde68a, #b45309); border: 2px solid #78350f; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.tp-spec { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 16px; background: #0f172a; cursor: default; }
.tp-spec-h { font-size: 15px; font-weight: 800; }
.tp-spec-s { font-size: 13px; color: var(--muted); }
.tp-spec-list { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.tp-spec-list .row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.tp-spec-list .nm { width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-spec-list .hb { flex: 1; height: 8px; border-radius: 5px; background: #1e293b; overflow: hidden; }
.tp-spec-list .hb i { display: block; height: 100%; }
.tp-spec-list .n { width: 30px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.tp-av { width: 22px; height: 22px; flex: none; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #0b1220; }

/* End: a sheet over the play screen — ranking by survival time, the verse, buttons. */
.tp-end { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(2, 6, 23, 0.55); border-radius: 14px; animation: tp-fade 0.25s ease; }
@keyframes tp-fade { from { opacity: 0; } }
.tp-sheet {
  display: flex; flex-direction: column; gap: 8px; max-height: 100%; overflow-y: auto; padding: 12px; border-radius: 18px 18px 14px 14px;
  background: #0f172a; border-top: 3px solid #facc15; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); animation: tp-up 0.3s ease;
}
@keyframes tp-up { from { transform: translateY(40px); opacity: 0.4; } }
.tp-sheet h3 { margin: 0; font-size: 17px; line-height: 1.35; color: var(--fg); }
.tp-end-sub { margin: 0; font-size: 13px; color: var(--muted); }
.tp-rank { display: flex; flex-direction: column; gap: 4px; }
.tp-rank > div { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 10px; border-radius: 10px; background: #111a2e; font-size: 13px; }
.tp-rank > div.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.tp-rank .md { width: 22px; text-align: center; font-size: 15px; font-weight: 900; color: var(--muted); }
.tp-rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.tp-rank .nm em { font-style: normal; font-size: 11px; font-weight: 800; color: #facc15; margin-left: 5px; }
.tp-rank .nm em.you { color: var(--accent); }
.tp-rank .ct { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-rank .pts { min-width: 52px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-more { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.tp-verse { border-radius: 12px; padding: 9px 14px; background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.35); text-align: center; }
.tp-verse p { margin: 0; font-size: 14.5px; font-weight: 800; line-height: 1.5; color: #fde68a; }
.tp-verse span { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--muted); border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 999px; padding: 1px 8px; }
.tp-end-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-end-btns .prim, .tp-end-btns .tp-btn:only-child { grid-column: 1 / -1; }
.tp-btn { min-height: 44px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 800; color: var(--fg); background: #1e293b; border: 1px solid rgba(148, 163, 184, 0.35); white-space: nowrap; touch-action: manipulation; }
.tp-btn.prim { background: var(--accent); color: #0b1220; border: 0; }
@media (prefers-reduced-motion: reduce) {
  .tp-ring.low, .tp-pg.pop, .tp-alive.pop, .tp-hp-row.hit .tp-hp-bar, .tp-chip, .tp-arena.shake, .tp-ready span, .tp-toast, .tp-sheet, .tp-end { animation: none; }
}

/* Responsive */
@media (max-width: 768px) {
  .room-header {
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top));
    gap: 8px; min-height: 48px;
  }
  .room-header .game-name { max-width: 120px; font-size: 14px; }
  .room-header .room-code { font-size: 12px; padding: 2px 8px; letter-spacing: 0.1em; }
  .room-header .header-right { gap: 4px; }
  .conn-text { display: none; }
  .icon-btn { padding: 6px 8px; font-size: 13px; }

  .room {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "stage";
  }

  .stage {
    padding: 10px;
    padding-bottom: 200px;     /* clearance for chat dock (toggle bar + form) */
    padding-bottom: calc(200px + env(safe-area-inset-bottom));
    overflow-y: auto; overflow-x: hidden;
    align-items: flex-start;
  }
  .stage-inner { gap: 10px; }
  #gameRoot { padding: 0; }

  .game-controls { padding: 12px; }
  .game-controls .cta { font-size: 16px; padding: 16px; }

  /* Mobile chat dock — tighter spacing */
  .chat-dock-toggle { padding: 10px 12px; }
  .chat-form { padding: 8px; }
  .chat-form input { font-size: 16px; padding: 10px 12px; }   /* 16px prevents iOS zoom */
  .chat-form .send-btn { padding: 10px 14px; min-width: 44px; }

  /* Keep answers as a 2x2 grid on phones — a single column pushes option D
     below the fold, so players scroll to see their choices. */
  .trivia .answers { gap: 8px; }
  .trivia .answer {
    padding: 14px 10px; font-size: 15px; text-align: center;
    line-height: 1.35; overflow-wrap: anywhere; min-height: 60px;
  }
  .trivia .question { font-size: 18px; padding: 16px; }
}

.center-msg { text-align: center; padding: 40px; color: var(--muted); font-size: 16px; }

/* Lobby card (per-game pre-start UI) */
.lobby-card {
  max-width: 520px; margin: 0 auto;
  background: var(--bg-2); padding: 24px;
  border-radius: 12px; border: 1px solid var(--border);
}
.lobby-card h2 { margin: 0 0 8px; font-size: 22px; }
.lobby-card .muted { color: var(--muted); font-size: 14px; margin: 4px 0; }
.cat-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cat-list.radio { flex-direction: row; flex-wrap: wrap; }
.cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--bg-3); border-radius: 8px;
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
}
.cat-row:hover { border-color: var(--accent); }
.cat-row input { accent-color: var(--accent); transform: scale(1.15); cursor: pointer; }
.cat-row input:disabled { cursor: not-allowed; }
.cat-row span { flex: 1; font-weight: 500; }

/* Verse Scramble */
.verses { max-width: 720px; margin: 0 auto; padding: 4px; }
.verses .progress { text-align: center; color: var(--muted); margin-bottom: 6px; font-size: 14px; }
.verses .timer { text-align: center; font-size: 20px; font-weight: 700; margin: 8px 0 12px; }
.verses .scramble {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 12px 0; padding: 16px; background: var(--bg-2); border-radius: 10px;
}
.verses .word-chip {
  background: var(--bg-3); color: var(--fg);
  padding: 8px 14px; border-radius: 6px;
  font-weight: 600; font-size: 15px;
  white-space: nowrap;
}
.verses .verse-form { display: flex; gap: 8px; margin: 14px 0; }
.verses .verse-form input { flex: 1; font-size: 15px; }
.verses .verse-form button { white-space: nowrap; }
.verses .verse-reveal {
  text-align: center; padding: 22px;
  background: rgba(34,197,94,0.12); border-radius: 10px;
  border: 1px solid rgba(34,197,94,0.3);
}
.verses .verse-text { font-size: 18px; font-style: italic; margin-bottom: 8px; line-height: 1.5; }
.verses .verse-ref { color: var(--muted); font-size: 13px; font-weight: 600; }
.verses .verse-solved { text-align: center; color: var(--good); font-weight: 700; margin: 12px 0; padding: 10px; background: rgba(34,197,94,0.1); border-radius: 8px; }
/* ── Verse Scramble ── */
.verse-ref-banner {
  text-align: center; font-size: 17px; font-weight: 700;
  color: var(--accent); margin: 8px 0 4px;
  letter-spacing: 0.04em;
}
.verse-instr { text-align: center; font-size: 13px; margin: 0 0 10px; }
.verse-avail {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; min-height: 52px;
}
.verse-chunk {
  background: var(--bg-3); color: var(--fg);
  padding: 8px 12px; font-size: 14px; line-height: 1.4;
  border-radius: 6px; border: 1px solid var(--border);
  cursor: pointer; text-align: left;
}
.verse-chunk:hover { border-color: var(--accent); background: #1e2f4a; filter: none; }
.verse-answer {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; margin-top: 8px; min-height: 52px;
}
.verse-zone-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.verse-slots {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.verse-slot {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-3); border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  font-size: 13px; line-height: 1.3;
  max-width: 100%;
}
.verse-slot.correct { border-color: var(--good); }
.verse-seq {
  min-width: 18px; height: 18px;
  background: var(--accent); color: #0b1220;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.verse-slot.correct .verse-seq { background: var(--good); }
.verse-remove {
  padding: 0 2px;
  background: none; color: var(--muted); font-size: 14px; line-height: 1;
  border: none; cursor: pointer; flex-shrink: 0;
}
.verse-remove:hover { color: var(--bad); filter: none; }
.verse-btn-row { display: flex; gap: 8px; margin-top: 8px; }
.verse-submit { flex: 1; }
.verse-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.verse-reset { background: var(--bg-3); color: var(--fg); border: 1px solid var(--border); padding: 10px 14px; font-size: 14px; }
.verse-solvers { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.verse-solved { color: var(--good); font-weight: 700; text-align: center; padding: 14px; font-size: 16px; }
.verse-reveal { margin-top: 8px; }

/* ── Wheat and Tares ── */
.wt-lobby .ref { color: var(--muted); font-size: 13px; font-style: italic; }
.wt-stage { display: flex; flex-direction: column; gap: 12px; }
.wt-progress {
  text-align: center; color: var(--muted);
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
}
.wt-timer {
  text-align: center; font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--bg-3); padding: 6px 14px;
  border-radius: 8px; width: fit-content; margin: 0 auto;
}
.wt-statement {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: 12px; padding: 24px;
  font-size: 18px; line-height: 1.55; text-align: center;
  font-weight: 500;
  min-height: 100px;
  display: flex; align-items: center; justify-content: center;
}
.wt-statement .wt-quote {
  color: var(--accent); font-size: 32px; font-weight: 800;
  vertical-align: -6px; padding: 0 6px;
}
.wt-choices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 6px;
}
.wt-btn {
  background: var(--bg-2); color: var(--fg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; transition: all 0.15s;
  font-size: 16px; font-weight: 700;
}
.wt-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.wt-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.wt-btn .wt-icon { font-size: 32px; line-height: 1; }
.wt-btn .wt-label { font-size: 17px; font-weight: 700; }
.wt-btn .wt-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.wt-btn-wheat { border-color: #f59e0b; }
.wt-btn-wheat.picked { background: rgba(245,158,11,0.22); border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.25); }
.wt-btn-tares { border-color: #6b7280; }
.wt-btn-tares.picked { background: rgba(107,114,128,0.25); border-color: #9ca3af; box-shadow: 0 0 0 3px rgba(156,163,175,0.25); }
.wt-waiting { text-align: center; font-size: 13px; }
.wt-reveal {
  border-radius: 12px; padding: 16px;
  border: 2px solid;
  display: flex; flex-direction: column; gap: 6px;
  animation: fadeIn 0.3s;
}
.wt-reveal.is-wheat { border-color: #f59e0b; background: rgba(245,158,11,0.12); }
.wt-reveal.is-tares { border-color: #94a3b8; background: rgba(148,163,184,0.10); }
.wt-verdict { font-size: 18px; font-weight: 800; text-align: center; }
.wt-reveal.is-wheat .wt-verdict { color: #f59e0b; }
.wt-reveal.is-tares .wt-verdict { color: #cbd5e1; }
.wt-ref { font-size: 14px; font-style: italic; color: var(--accent); text-align: center; font-weight: 600; }
.wt-why { font-size: 14px; line-height: 1.5; padding: 8px 4px 0; color: var(--fg); }
.wt-yours { font-size: 14px; text-align: center; font-weight: 700; margin-top: 4px; }
.wt-yours.ok { color: var(--good); }
.wt-yours.bad { color: var(--bad); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .wt-choices { grid-template-columns: 1fr; }
  .wt-statement { font-size: 16px; padding: 20px 16px; }
}

/* ── Foods of the Spirit ── */
.foods-weather-list {
  list-style: none; padding: 0; margin: 0 0 10px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}
.foods-weather-list li {
  display: grid;
  grid-template-columns: 26px 38px 1fr;
  align-items: baseline;
  gap: 6px;
}
.ww-emoji { font-size: 16px; text-align: center; }
.ww-pct { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.ww-desc { line-height: 1.35; }
.btn-good { background: var(--good); color: #052e16; padding: 6px 14px; }
.btn-bad { background: var(--bad); color: white; padding: 6px 14px; }
.btn-link { background: transparent; color: var(--muted); padding: 6px 12px; font-weight: 400; }
.btn-link:hover:not(:disabled) { color: var(--fg); filter: none; }
.btn-prim { background: var(--accent); color: #0b1220; padding: 8px 14px; font-weight: 700; }
.btn-second { background: var(--bg-3); color: var(--fg); padding: 8px 14px; }

.foods-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.foods-modal {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
  max-width: 500px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.foods-modal h3 { margin: 0; font-size: 18px; }
.foods-modal h4 { margin: 4px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.foods-modal .small { font-size: 12px; }
.foods-modal > button {
  background: var(--bg-3); color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 14px; text-align: left;
  width: 100%;
}
.foods-modal > button:hover { border-color: var(--accent); filter: none; }
.foods-trade-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.foods-tc {
  background: var(--bg-3); color: var(--fg);
  border: 2px solid var(--border);
  border-radius: 6px; padding: 6px 10px;
  font-size: 13px;
}
.foods-tc.picked { background: rgba(56,189,248,0.18); border-color: var(--accent); }
.foods-tc.blind { font-family: serif; font-size: 16px; }
.foods-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ── Card Guide modal (mobile-first bottom-sheet) ── */
/* The lobby button (full-width below the mode picker). */
.foods-guide-open { width: 100%; margin-top: 10px; }

/* Stop body scroll while the guide is open (prevents iOS rubber-band) */
html.foods-guide-open, html.foods-guide-open body {
  overflow: hidden !important;
  overscroll-behavior: contain;
}

.foods-guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.78);
  backdrop-filter: blur(2px);
  z-index: 1500;          /* above app header (smaller z-index) */
  display: flex;
  align-items: flex-end;  /* mobile: docks to bottom */
  justify-content: center;
  animation: foods-guide-fade 0.18s ease-out;
}
@keyframes foods-guide-fade { from { opacity: 0; } to { opacity: 1; } }

.foods-guide-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--card, #0f172a);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  animation: foods-guide-slide 0.22s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes foods-guide-slide {
  from { transform: translateY(20px); opacity: 0.4; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Sticky header — always visible. Drag-handle bar at the top. */
.foods-guide-head {
  position: relative;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.foods-guide-head::before {
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.18);
}
.foods-guide-head-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  padding-top: 4px;
}
.foods-guide-close-x {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 36px; height: 36px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.foods-guide-close-x:hover { border-color: var(--accent); color: var(--accent); }

/* Scrollable body */
.foods-guide-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.foods-guide-intro {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}
.foods-guide-section { display: flex; flex-direction: column; gap: 8px; }
.foods-guide-kind {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 4px;
  border-bottom: 2px solid currentColor;
  width: fit-content;
  align-self: flex-start;
}
.foods-guide-kind.kind-resource { color: #4ade80; }
.foods-guide-kind.kind-friendly { color: #bef264; }
.foods-guide-kind.kind-defense  { color: #60a5fa; }
.foods-guide-kind.kind-twist    { color: #c4b5fd; }
.foods-guide-kind.kind-sabotage { color: #f87171; }

.foods-guide-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.foods-guide-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
}
.foods-guide-item.kind-resource { border-left-color: #4ade80; }
.foods-guide-item.kind-friendly { border-left-color: #bef264; }
.foods-guide-item.kind-defense  { border-left-color: #60a5fa; }
.foods-guide-item.kind-twist    { border-left-color: #c4b5fd; }
.foods-guide-item.kind-sabotage { border-left-color: #f87171; }
.foods-guide-item-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.foods-guide-item-icon .emoji { font-size: 26px; line-height: 1; }
.foods-guide-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.foods-guide-item-name { font-size: 14px; font-weight: 700; color: var(--fg); }
.foods-guide-item-desc { font-size: 12.5px; line-height: 1.4; color: var(--muted); }

/* Sticky footer with primary action */
.foods-guide-foot {
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--card, #0f172a);
}
.foods-guide-done { width: 100%; }

/* Tablets / desktop: center the sheet, give it rounded corners on all sides. */
@media (min-width: 600px) {
  .foods-guide-overlay { align-items: center; padding: 24px; }
  .foods-guide-sheet { border-radius: 16px; max-height: 86vh; max-height: 86dvh; }
  .foods-guide-head::before { display: none; }
}

/* Narrow phones (≤ 360 px): tighten paddings */
@media (max-width: 360px) {
  .foods-guide-body { padding: 10px 12px 6px; }
  .foods-guide-item { padding: 8px 10px; grid-template-columns: 42px 1fr; gap: 10px; }
  .foods-guide-item-icon { width: 42px; height: 42px; }
  .foods-guide-item-icon .emoji { font-size: 22px; }
  .foods-guide-item-name { font-size: 13px; }
  .foods-guide-item-desc { font-size: 12px; }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .foods-guide-overlay, .foods-guide-sheet { animation: none !important; }
}

/* ── Time Bomb ── */
.tb-lobby .tb-mode-pick {
  display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin: 14px 0;
}
.tb-mode-btn {
  background: var(--bg-3); color: var(--fg);
  border: 2px solid var(--border);
  border-radius: 10px; padding: 14px 12px;
  text-align: center;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  cursor: pointer; transition: all 0.15s;
}
.tb-mode-btn:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.08); }
.tb-mode-btn.active { border-color: var(--accent); background: rgba(56,189,248,0.12); box-shadow: 0 0 0 3px rgba(56,189,248,0.18); }
.tb-mode-icon { font-size: 28px; line-height: 1; }
.tb-mode-title { font-weight: 700; font-size: 14px; }
.tb-mode-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }
.tb-mode-btn:disabled { opacity: 0.6; cursor: not-allowed; }
@media (max-width: 480px) {
  .tb-lobby .tb-mode-pick { grid-template-columns: 1fr; }
}

.tb-stage { display: flex; flex-direction: column; gap: 12px; }
.tb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--bg-2); border-radius: 8px;
}
.tb-round { font-weight: 700; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.tb-bomb-emoji {
  font-size: 26px;
  animation: tbShake 0.6s infinite ease-in-out;
  filter: drop-shadow(0 0 6px rgba(239,68,68,0.6));
}
@keyframes tbShake {
  0%,100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.tb-ring {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
}
.tb-pcell {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  transition: all 0.2s;
}
.tb-pcell.dead { opacity: 0.4; text-decoration: line-through; }
.tb-pcell.active {
  border-color: #ef4444;
  background: rgba(239,68,68,0.15);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.3);
}
.tb-dot { width: 10px; height: 10px; border-radius: 50%; }
.tb-pname { font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-holding { font-size: 16px; }

.tb-prompt {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
  text-align: center;
}
.tb-cat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.tb-cat-name { font-size: 22px; font-weight: 700; color: var(--accent); margin-top: 4px; }

.tb-choices {
  display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr;
}
.tb-choice {
  background: var(--bg-2); color: var(--fg);
  border: 2px solid var(--border);
  border-radius: 10px; padding: 16px 12px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.12s;
  min-height: 56px;
}
.tb-choice:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--accent); }
.tb-choice:disabled { opacity: 0.55; cursor: not-allowed; }
.tb-choice.picked { border-color: var(--accent); background: rgba(56,189,248,0.18); }

.tb-turn-note { text-align: center; font-size: 14px; margin: 2px 0; }
.tb-active-banner {
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 14px;
  margin: 4px 0 6px;
}
.tb-active-banner.your-turn {
  background: rgba(56,189,248,0.14);
  border-color: var(--accent);
  color: var(--accent);
  font-size: 16px;
}
.tb-active-banner .tb-help-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tb-choice.spectating { opacity: 0.55; cursor: default; }
@media (max-width: 480px) {
  /* Stays 2x2 on phones so all four options are visible at a glance. */
  .tb-choices { gap: 8px; }
  .tb-choice { padding: 14px 8px; font-size: 14px; min-height: 60px; }
}

/* ── Strike banner (competitive mode) ── */
.tb-strike-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: rgba(248,113,113,0.10);
  border: 1px solid rgba(248,113,113,0.35);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fca5a5;
  margin-bottom: 6px;
}
.tb-strike-banner.active {
  background: rgba(239,68,68,0.22);
  border-color: #ef4444;
  color: #fecaca;
  animation: tb-strike-flash 0.6s ease-out;
}
.tb-strike-hint { flex: 1; }
.tb-strike-count { font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes tb-strike-flash {
  0%   { background: rgba(239,68,68,0.55); }
  100% { background: rgba(239,68,68,0.22); }
}

/* ── Full-screen bomb explosion overlay ── */
.tb-boom-overlay {
  position: fixed; inset: 0;
  z-index: 2000;
  background: radial-gradient(circle at center, rgba(255,180,90,0.95) 0%, rgba(220,38,38,0.85) 35%, rgba(20,5,0,0.95) 80%);
  display: flex; align-items: center; justify-content: center;
  animation: tb-boom-shake 0.5s ease-out;
  cursor: default;
  overflow: hidden;
}
.tb-boom-overlay.dismissible { cursor: pointer; }
.tb-boom-flash {
  position: absolute; inset: 0;
  background: white;
  animation: tb-boom-flash 0.35s ease-out forwards;
  pointer-events: none;
}
.tb-boom-content {
  position: relative;
  text-align: center;
  animation: tb-boom-pop 0.45s cubic-bezier(0.22, 1.61, 0.36, 1) both;
}
.tb-boom-emoji {
  font-size: 120px;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(255,200,80,0.95));
  animation: tb-boom-emoji 2s ease-out forwards;
}
.tb-boom-text {
  margin-top: 12px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
  padding: 0 18px;
}
@keyframes tb-boom-flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes tb-boom-shake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-10px, 6px); }
  30% { transform: translate(8px, -8px); }
  45% { transform: translate(-6px, 4px); }
  60% { transform: translate(6px, -4px); }
  75% { transform: translate(-3px, 2px); }
  90% { transform: translate(2px, -1px); }
}
@keyframes tb-boom-pop {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes tb-boom-emoji {
  0%   { transform: scale(1) rotate(0deg); }
  20%  { transform: scale(1.3) rotate(-8deg); }
  40%  { transform: scale(1.15) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .tb-boom-overlay, .tb-boom-content, .tb-boom-emoji, .tb-boom-flash {
    animation: none !important;
  }
}
.tb-events { display: flex; flex-direction: column; gap: 4px; }
.tb-event {
  font-size: 13px; padding: 6px 10px;
  background: var(--bg-2); border-radius: 6px; color: var(--muted);
}
.tb-final { margin-top: 12px; font-size: 18px; font-weight: 700; }

/* Cooperative meter */
.tb-meter {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.tb-meter-head {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 700; margin-bottom: 6px;
}
.tb-meter-num { color: var(--accent); font-variant-numeric: tabular-nums; }
.tb-meter-bar {
  height: 14px; background: var(--bg-3);
  border-radius: 7px; overflow: hidden;
}
.tb-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  transition: width 0.3s ease-out;
}

.tb-coop-end {
  text-align: center; padding: 24px;
  border-radius: 12px;
  border: 2px solid;
}
.tb-coop-end.good { background: rgba(34,197,94,0.12); border-color: var(--good); }
.tb-coop-end.bad { background: rgba(239,68,68,0.10); border-color: var(--bad); }
.tb-coop-end .tb-emoji { font-size: 52px; margin-bottom: 6px; }
.tb-coop-end h2 { margin: 0 0 6px; font-size: 22px; }
.tb-coop-end p { color: var(--muted); margin: 0; line-height: 1.5; }

/* ── Trivia rounds selector ── */
.rounds-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px;
}
.rounds-label { font-size: 14px; font-weight: 600; margin-right: 4px; }
.round-opt {
  background: var(--bg-3); color: var(--fg);
  padding: 6px 14px; font-size: 14px; font-weight: 600;
  border-radius: 6px; border: 1px solid var(--border);
}
.round-opt:hover:not(:disabled) { border-color: var(--accent); background: #1e2f4a; filter: none; }
.round-opt.active { background: var(--accent); color: #0b1220; border-color: var(--accent); }

/* ── Shared lobby card (public/js/lobby-ui.js) ─────────────────────────────
   Same layout for every game: badge + name, one intro line, three "how to
   play" tiles, the game's settings, folded rules, who is here. */
.lobby-card.lc { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.lc-head { display: flex; gap: 12px; align-items: center; }
.lc-badge {
  width: 54px; height: 54px; flex: none; border-radius: 15px; display: grid; place-items: center; font-size: 28px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
:where(.lc-badge) { background: linear-gradient(135deg, #1e3a8a, #0f172a); }
/* With the game's picture from /js/game-art.js (same art as the home page). */
.lc-badge.has-art { width: 76px; height: 54px; border-radius: 14px; overflow: hidden; }
.lc-badge.has-art svg { width: 100%; height: 100%; display: block; }
.lc-titles { min-width: 0; }
.lobby-card.lc h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.lc-meta { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.lc-intro { margin: 0; font-size: 15px; line-height: 1.6; }
.lc-how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lc-how-item {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 9px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-width: 0;
}
.lc-how-e { font-size: 24px; line-height: 1.1; }
.lc-how-item b { font-size: 13px; line-height: 1.3; }
.lc-how-item span:last-child { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.lc-slot:empty { display: none; }
.lc-slot > :first-child { margin-top: 0; }
.lc-slot h4 { margin: 4px 0 6px; font-size: 13px; color: var(--muted); }
.lc-rules { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-3); }
.lc-rules summary {
  cursor: pointer; list-style: none; min-height: 46px; padding: 0 14px; display: flex; align-items: center;
  font-weight: 700; font-size: 14px;
}
.lc-rules summary::-webkit-details-marker { display: none; }
.lc-rules summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.lc-rules[open] summary::after { content: "▴"; }
.lc-rules ul { margin: 0; padding: 0 14px 10px 30px; font-size: 13.5px; line-height: 1.65; color: var(--fg); }
.lc-rules li + li { margin-top: 3px; }
.lc-rules-note { margin: 0; padding: 0 14px 12px; font-size: 12.5px; color: var(--muted); font-style: italic; line-height: 1.5; }
.lc-who { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-player {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border); font-size: 13px; font-weight: 600; max-width: 100%;
}
.lc-player.me { border-color: var(--accent); }
.lc-player.away { opacity: 0.5; }
.lc-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: #0b1220; flex: none; }
.lc-pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Settings controls inside the card: thumb-sized. */
.lobby-card.lc .round-opt { min-width: 52px; min-height: 44px; font-size: 15px; border-radius: 10px; }
.lobby-card.lc .cat-row { min-height: 46px; border-radius: 10px; }
.lobby-card.lc .cat-row input { transform: scale(1.35); }
.lobby-card.lc .cat-list { margin-top: 0; }
.lobby-card.lc .rounds-row { margin-top: 0; }
.lobby-card.lc .lc-host-note { margin: 0; color: var(--muted); font-size: 13px; }

/* Lobby phase: the room controls become a bar pinned just above the chat
   dock, so Start is always one tap away however long the lobby is. Sticky
   offsets count from inside the stage's bottom padding, so in the lobby that
   padding is just the dock height and the bar sticks at bottom: 0. */
#stage:has(#gameControls.is-lobby) {
  padding-bottom: calc(var(--dock-h, 104px) + 8px);
  scroll-padding-bottom: calc(var(--dock-h, 104px) + 100px);
}
.game-controls.is-lobby {
  position: sticky; bottom: 0; z-index: 6;
  flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px;
  background: rgba(17, 26, 46, 0.96); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 18px; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}
.game-controls.is-lobby .lobby-controls { flex: 1 1 160px; min-width: 0; gap: 4px; }
.game-controls.is-lobby .cta { min-height: 52px; padding: 0 18px; font-size: 17px; border-radius: 14px; }
.game-controls.is-lobby .hint { font-size: 12px; }
.game-controls.is-lobby .lobby-controls.waiting .hint { font-size: 14px; padding: 14px 4px; color: var(--fg); }
.game-controls.is-lobby .copy-link-btn[hidden], .game-controls.is-lobby .cta[hidden] { display: none; }
.game-controls.is-lobby .copy-link-btn {
  width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 19px;
}
.game-controls.is-lobby .copy-link-btn .tx {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.game-controls.is-lobby .copy-link-btn.copied { background: var(--good); }
.round-opt:disabled { opacity: 0.5; cursor: not-allowed; }

.player-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.pcell {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.pcell.dead { opacity: 0.42; }
.pcell.you { border-color: var(--accent); }
.pcell .dot { width: 10px; height: 10px; border-radius: 50%; margin-bottom: 4px; }
.pcell .pname { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcell .pstatus { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.pcell .discern-tag { font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-top: 3px; display: inline-block; font-weight: 700; }
.pcell .discern-tag.wolf { background: rgba(239,68,68,0.2); color: #fca5a5; }
.pcell .discern-tag.sheep { background: rgba(34,197,94,0.2); color: #86efac; }

.action-panel {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.action-panel h4 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.action-panel .act-sec { display: flex; flex-direction: column; gap: 6px; }
.action-panel .muted { color: var(--muted); font-size: 13px; margin: 0; }
.action-panel .ok { color: var(--good); font-size: 13px; margin: 4px 0 0; }
.target-list { display: flex; flex-wrap: wrap; gap: 6px; }
.target-btn {
  background: var(--bg-3); color: var(--fg);
  padding: 6px 12px; font-size: 13px; font-weight: 600;
  border-radius: 6px;
}
.target-btn:hover:not(:disabled) { background: #4b5876; filter: none; }
.target-btn.active { background: var(--accent); color: #0b1220; }
.evan-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.evan-choices button { background: var(--bg-3); color: var(--fg); padding: 8px 12px; font-size: 13px; }
.evan-choices button.active { background: var(--accent); color: #0b1220; }
.discern-history h4 { margin-top: 8px; }
.discern-row { padding: 4px 8px; background: var(--bg-3); border-radius: 4px; font-size: 12px; margin-top: 4px; }
.discern-row.wolf { color: #fca5a5; }
.discern-row.sheep { color: #86efac; }
.tally { background: var(--bg-3); padding: 10px; border-radius: 6px; }
.tally-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }

.event-log {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
}
.event-log h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.event-log .event { padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--fg); }
.event-log .event:last-child { border-bottom: none; }
.reveal-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin: 14px 0;
  text-align: center;
}

/* Channel-tagged chat messages */
.msg .channel { font-size: 11px; font-weight: 700; margin-right: 4px; padding: 1px 5px; border-radius: 4px; }
.msg.msg-spectator { background: rgba(148,163,184,0.07); border-radius: 4px; padding: 2px 4px; font-style: italic; }
.msg.msg-spectator .channel { background: rgba(148,163,184,0.18); color: #cbd5e1; }
.chat-badge.urgent { background: #ef4444 !important; }

/* ── Days of Creation (public/js/games/creation.js) ──
   One screen in play (.cr.fit-screen): top bar (built n/10 + flourishing bar),
   players, the layered world scene with the hint card on top, and the 10
   element buttons as a 5 × 2 grid in the thumb zone. Feedback (flying emoji,
   bursts, wither, growth, toasts) floats over the scene; the layout never moves. */
.cr { position: relative; display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin: 0 auto; overflow: hidden; }
.cr.fit-screen { height: 600px; }
.cr [hidden] { display: none !important; }
.cr-hud { flex: none; min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 4px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; }
.cr-count { font-weight: 800; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cr-flo { flex: 1; min-width: 0; position: relative; height: 24px; border-radius: 999px; background: #0f172a; border: 1px solid var(--border); overflow: hidden; }
.cr-flo i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #15803d, #4ade80); transition: width 0.9s ease; }
.cr-flo span { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 11.5px; font-weight: 800; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); white-space: nowrap; }
.cr-flo.full i { background: linear-gradient(90deg, #f59e0b, #fde047, #f59e0b); background-size: 200% 100%; animation: cr-shimmer 2s linear infinite; }
.cr-flo.full span { color: #422006; text-shadow: none; }
@keyframes cr-shimmer { to { background-position: -200% 0; } }
.cr-strip { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px; }
.cr-strip::-webkit-scrollbar { display: none; }
.cr-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; max-width: 170px; }
.cr-chip.me { border-color: rgba(56, 189, 248, 0.55); }
.cr-chip.away { opacity: 0.45; }
.cr-chip.ping { animation: cr-ping 0.7s ease; }
@keyframes cr-ping { 40% { box-shadow: 0 0 0 3px var(--c, var(--accent)); } }
.cr-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #0b1220; flex: none; }
.cr-cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* the world scene: stacked layers, darkness → light → sky → island & sea → life */
.cr-scene { flex: 1 1 0; min-height: 120px; position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #020617; isolation: isolate; }
.cr-lay { position: absolute; inset: 0; pointer-events: none; }
.cr-bg { opacity: 0; transition: opacity 1.4s ease; z-index: 0; }
.cr-bg-void { opacity: 1; background: linear-gradient(#020617, #0b1220 62%, #050b16); }
.cr-bg-light { background: radial-gradient(ellipse 95% 75% at 50% -12%, rgba(254, 240, 138, 0.7), rgba(254, 240, 138, 0) 72%), linear-gradient(#1e3a8a, #1e2f63 58%, #0c1a33); }
.cr-bg-sky { background: linear-gradient(#1d4ed8 0%, #38bdf8 38%, #bae6fd 58%, #bae6fd); }
.cr-scene.s-light .cr-bg-light, .cr-scene.s-sky .cr-bg-sky { opacity: 1; }
.cr-mist { z-index: 1; transition: opacity 1.6s ease; overflow: hidden; }
.cr-mist::before, .cr-mist::after { content: ""; position: absolute; width: 95%; height: 60%; border-radius: 50%; background: radial-gradient(closest-side, rgba(100, 116, 139, 0.26), rgba(100, 116, 139, 0)); animation: cr-drift 14s ease-in-out infinite alternate; }
.cr-mist::before { left: -25%; top: 8%; }
.cr-mist::after { right: -30%; top: 34%; animation-duration: 19s; animation-direction: alternate-reverse; }
@keyframes cr-drift { to { transform: translate(22%, -8%) scale(1.15); } }
.cr-scene.s-light .cr-mist { opacity: 0; }
.cr-sea { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; z-index: 1; pointer-events: none; background: linear-gradient(#0b1a2e, #050b16); transition: background 1.2s ease, filter 1s ease; overflow: hidden; }
.cr-sea::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(172deg, rgba(255, 255, 255, 0) 0 15px, rgba(255, 255, 255, 0.05) 15px 17px); background-size: 120px 100%; animation: cr-waves 7s linear infinite; }
@keyframes cr-waves { to { background-position: 120px 0; } }
.cr-scene:not(.s-light) .cr-sea::after { opacity: 0.45; }
.cr-scene.s-light .cr-sea { background: linear-gradient(#1e3a5f, #0f2440); }
.cr-scene.s-sky .cr-sea { background: linear-gradient(#0e7490, #164e63); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3); }
.cr-scene.s-land .cr-sea { background: linear-gradient(#0891b2, #0e7490 55%, #155e75); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35); }
.cr-scene.s-landdead .cr-sea { filter: grayscale(1) brightness(0.75); }
.cr-island { position: absolute; left: 14%; width: 72%; top: 58%; height: 28%; z-index: 2; pointer-events: none; border-radius: 50%; background: radial-gradient(ellipse at 50% 32%, #ca8a04, #92400e 72%); box-shadow: 0 9px 0 #5c2e0c, 0 16px 18px rgba(0, 0, 0, 0.35); opacity: 0; transform: translateY(34px) scale(0.6); transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.3, 1.5, 0.5, 1), background 1.4s ease, filter 1.2s ease; }
.cr-island.on { opacity: 1; transform: none; }
.cr-island.lv2 { background: radial-gradient(ellipse at 50% 32%, #a3e635, #4d7c0f 72%); box-shadow: 0 9px 0 #78350f, 0 16px 18px rgba(0, 0, 0, 0.35); }
.cr-island.dead { filter: grayscale(1) brightness(0.72); }
.cr-island.pulse { animation: cr-ipulse 0.8s ease; }
@keyframes cr-ipulse { 40% { filter: brightness(1.35); } }
.cr-night { z-index: 3; background: #020617; opacity: 0; }
.cr-stars { z-index: 3; opacity: 0; background:
  radial-gradient(1.5px 1.5px at 12% 8%, #fef9c3, transparent), radial-gradient(1.5px 1.5px at 30% 18%, #fef9c3, transparent),
  radial-gradient(2px 2px at 44% 6%, #fef9c3, transparent), radial-gradient(1.5px 1.5px at 66% 14%, #fef9c3, transparent),
  radial-gradient(1.5px 1.5px at 78% 32%, #fef9c3, transparent), radial-gradient(2px 2px at 92% 10%, #fef9c3, transparent),
  radial-gradient(1.5px 1.5px at 22% 36%, #fef9c3, transparent), radial-gradient(1.5px 1.5px at 56% 30%, #fef9c3, transparent),
  radial-gradient(1.5px 1.5px at 6% 44%, #fef9c3, transparent), radial-gradient(2px 2px at 38% 46%, #fef9c3, transparent); }
.cr-scene.cycle .cr-night { animation: cr-nightc 20s ease-in-out infinite; }
.cr-scene.cycle .cr-stars { animation: cr-moonc 20s ease-in-out infinite; }
@keyframes cr-nightc { 0%, 30% { opacity: 0; } 50%, 80% { opacity: 0.38; } 100% { opacity: 0; } }
@keyframes cr-moonc { 0%, 30% { opacity: 0; } 50%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cr-sunc { 0%, 30% { opacity: 1; transform: translateY(0); } 50%, 80% { opacity: 0; transform: translateY(16px); } 100% { opacity: 1; transform: translateY(0); } }
.cr-restglow { z-index: 3; opacity: 0; transition: opacity 1.6s ease; background: radial-gradient(ellipse 80% 60% at 50% 25%, rgba(253, 224, 71, 0.28), rgba(253, 224, 71, 0)); }
.cr-scene.s-rest .cr-restglow { opacity: 1; }

/* things in the world: .cr-ent (position) > .m (looping motion) > .g (born / grow / wither) */
.cr-ent { position: absolute; z-index: 4; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity 0.6s ease; line-height: 1; }
.cr-ent.on { opacity: 1; }
.cr-ent .m, .cr-ent .g { display: block; }
.cr-ent .g { font-size: 26px; transition: filter 1.2s ease, opacity 1.2s ease, transform 1.2s ease, font-size 0.6s ease; }
.cr-ent.alive .g { filter: drop-shadow(0 0 3px rgba(253, 224, 71, 0.35)); }
.cr-ent.dead .g { filter: grayscale(1) brightness(0.85); opacity: 0.5; transform: rotate(-16deg) translateY(5px) scale(0.86); }
.cr-ent.dead .m { animation: none !important; }
.cr-ent .g.born { animation: cr-born 1.3s ease; }
.cr-ent .g.born-sm { animation: cr-bornsm 0.6s ease; }
.cr-ent .g.grow { animation: cr-grow 0.8s ease; }
@keyframes cr-born { 0% { transform: scale(0.2); filter: brightness(1.8); } 45% { transform: scale(1.4); filter: drop-shadow(0 0 16px rgba(253, 224, 71, 0.95)) brightness(1.3); } 100% { transform: scale(1); } }
@keyframes cr-bornsm { 0% { transform: scale(0.3); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes cr-grow { 40% { transform: scale(1.45) translateY(-5px); filter: drop-shadow(0 0 12px rgba(134, 239, 172, 0.95)) brightness(1.25); } }
.cr-ent.alive .m.sway { animation: cr-sway 3.2s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.cr-ent.alive .m.bob { animation: cr-bob 2.4s ease-in-out infinite alternate; }
.cr-ent.alive .m.swim { animation: cr-swim 3.6s ease-in-out infinite alternate; }
.cr-ent.alive .m.wander { animation: cr-wander 5.5s ease-in-out infinite alternate; }
@keyframes cr-sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes cr-bob { to { transform: translateY(-4px); } }
@keyframes cr-swim { from { transform: translate(-9px, 1px); } to { transform: translate(9px, -2px); } }
@keyframes cr-wander { from { transform: translateX(-12px); } to { transform: translateX(12px); } }
.cr-ent.bird { transform: translate(-50%, -50%) scaleX(-1); }
.cr-ent.bird.alive { animation: cr-flyx 11s linear infinite; }
.cr-ent.bird.alive .m { animation: cr-bob 0.5s ease-in-out infinite alternate; }
@keyframes cr-flyx { from { left: -8%; } to { left: 108%; } }
.cr-ent.cloud.alive { animation: cr-cloudx 34s linear infinite; }
@keyframes cr-cloudx { from { left: -12%; } to { left: 112%; } }
.cr-scene.cycle .cr-ent.sun.alive .m { animation: cr-sunc 20s ease-in-out infinite; }
.cr-scene.cycle .cr-ent.moon.alive .m { animation: cr-moonc 20s ease-in-out infinite; }
.cr-ent.moon.alive .m { opacity: 0; }

/* the empty world */
.cr-void { position: absolute; z-index: 6; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 86%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: opacity 0.8s ease; pointer-events: none; }
.cr-void-dot { width: 14px; height: 14px; border-radius: 50%; background: #fef9c3; box-shadow: 0 0 18px 6px rgba(254, 249, 195, 0.35); animation: cr-breathe 3s ease-in-out infinite; margin-bottom: 12px; }
@keyframes cr-breathe { 50% { transform: scale(1.5); box-shadow: 0 0 28px 12px rgba(254, 249, 195, 0.25); } }
.cr-void b { font-size: 17px; color: #e2e8f0; }
.cr-void span { font-size: 13px; color: var(--muted); }
.cr-void .cr-void-go { margin-top: 10px; color: #fde68a; font-weight: 800; font-size: 14px; animation: cr-nudge 1.6s ease-in-out infinite; }
@keyframes cr-nudge { 50% { transform: translateY(4px); } }
.cr-scene.s-light .cr-void, .cr-scene.s-some .cr-void { opacity: 0; }

/* the world flourishes */
.cr-holy { z-index: 5; opacity: 0; transition: opacity 1.6s ease; overflow: hidden; }
.cr-holy.on { opacity: 1; }
.cr-beam { position: absolute; left: 50%; top: 0; width: 120%; height: 92%; transform: translateX(-50%); background: linear-gradient(rgba(255, 248, 205, 0.75), rgba(255, 238, 165, 0.18) 60%, rgba(255, 238, 165, 0)); clip-path: polygon(43% 0, 57% 0, 90% 100%, 10% 100%); mix-blend-mode: screen; }
.cr-holy.on .cr-beam { animation: cr-beam 3s ease-in-out infinite alternate; }
@keyframes cr-beam { to { opacity: 0.6; } }
.cr-rays { position: absolute; width: 680px; height: 680px; left: calc(50% - 340px); top: -330px; background: repeating-conic-gradient(rgba(255, 245, 190, 0.26) 0deg 7deg, rgba(255, 245, 190, 0) 7deg 22deg); -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 60%); mask-image: radial-gradient(circle, #000 12%, transparent 60%); mix-blend-mode: screen; }
.cr-holy.on .cr-rays { animation: cr-spin 60s linear infinite; }
@keyframes cr-spin { to { transform: rotate(360deg); } }
.cr-word { position: absolute; left: 50%; top: 43%; transform: translate(-50%, -50%); width: 90%; text-align: center; color: #fffbe6; font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif; font-weight: 700; font-size: 21px; line-height: 1.5; text-wrap: balance; text-shadow: 0 0 12px rgba(255, 240, 150, 0.95), 0 0 26px rgba(255, 240, 150, 0.6), 0 2px 4px rgba(0, 0, 0, 0.5); }
.cr-word small { display: block; margin-top: 2px; font-family: inherit; font-size: 12px; font-weight: 700; color: rgba(255, 244, 200, 0.95); }
.cr-holy.on .cr-word { animation: cr-wordin 1.8s ease 0.5s both; }
@keyframes cr-wordin { from { opacity: 0; transform: translate(-50%, -38%); } }
.cr-rain { position: absolute; top: -24px; font-size: 16px; pointer-events: none; animation: cr-rain linear forwards; }
@keyframes cr-rain { to { transform: translateY(380px) rotate(260deg); opacity: 0.2; } }

/* feedback */
.cr-fx { z-index: 6; }
.cr-burst { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 3px solid #fde047; box-shadow: 0 0 16px #fde047, inset 0 0 10px #fde047; animation: cr-burst 0.9s ease-out forwards; }
@keyframes cr-burst { to { transform: scale(7); opacity: 0; border-width: 1px; } }
.cr-spk { position: absolute; font-size: 14px; transform: translate(-50%, -50%); animation: cr-spk 1s ease-out forwards; }
@keyframes cr-spk { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4); opacity: 0; } }
.cr-leaf { position: absolute; font-size: 18px; transform: translate(-50%, -50%); animation: cr-leaf 1.9s ease-in forwards; }
@keyframes cr-leaf { 0% { opacity: 0; } 15% { opacity: 1; } 50% { transform: translate(calc(-50% + 14px), calc(-50% + 24px)) rotate(70deg); } 100% { transform: translate(calc(-50% - 8px), calc(-50% + 56px)) rotate(150deg); opacity: 0; } }
.cr-gtxt { position: absolute; transform: translate(-50%, -50%); font-size: 12px; font-weight: 900; color: #bbf7d0; white-space: nowrap; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); animation: cr-gt 1.5s ease-out forwards; }
@keyframes cr-gt { 0% { opacity: 0; transform: translate(-50%, -30%); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }
.cr-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 18%, rgba(255, 251, 230, 0.95), rgba(254, 240, 138, 0.35) 40%, rgba(254, 240, 138, 0) 75%); animation: cr-flash 1.5s ease-out forwards; }
@keyframes cr-flash { from { opacity: 1; } to { opacity: 0; } }
.cr-flyer { position: absolute; z-index: 45; font-size: 30px; line-height: 1; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 0 8px var(--c, rgba(253, 224, 71, 0.9))); }

/* hint card (top of the scene) and toast (bottom of the scene) */
.cr-hint { position: absolute; z-index: 8; top: 8px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 16px); min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 14px; border-radius: 18px; background: rgba(2, 6, 23, 0.8); border: 1px solid rgba(250, 204, 21, 0.45); color: #fde68a; font-size: 12.5px; font-weight: 800; line-height: 1.35; text-align: center; text-wrap: balance; cursor: pointer; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.cr-hint:hover:not(:disabled) { filter: none; }
.cr-hint:active { transform: translateX(-50%) scale(0.97); }
.cr-hint.done { border-color: rgba(253, 224, 71, 0.7); color: #fef9c3; cursor: default; }
.cr-toast { position: absolute; z-index: 8; left: 50%; bottom: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 16px; font-size: 13px; font-weight: 700; line-height: 1.4; background: rgba(2, 6, 23, 0.92); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); text-wrap: balance; pointer-events: none; animation: cr-tin 0.25s ease; transition: opacity 0.5s ease; }
.cr-toast.good { border-color: rgba(74, 222, 128, 0.55); color: #bbf7d0; }
.cr-toast.soft { border-color: rgba(251, 146, 60, 0.6); color: #fed7aa; }
.cr-toast.out { opacity: 0; }
.cr-toast .cr-av { width: 20px; height: 20px; font-size: 10px; }
@keyframes cr-tin { from { transform: translate(-50%, 6px); opacity: 0; } }

/* the 10 element buttons: 5 × 2 in the thumb zone */
.cr-tray { flex: none; height: 130px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cr-el { position: relative; min-width: 0; min-height: 56px; padding: 5px 2px 0; border-radius: 14px; border: 2px solid #334155; background: #1e293b; color: var(--fg); font-weight: 400; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; cursor: pointer; transition: transform 0.12s, background 0.3s, border-color 0.3s, opacity 0.3s; -webkit-tap-highlight-color: transparent; }
.cr-el:not(:disabled):active { transform: scale(0.93); }
.cr-el:disabled { opacity: 1; cursor: default; }
.cr-el .e { font-size: 25px; line-height: 1; height: 27px; display: grid; place-items: center; transition: filter 0.6s, opacity 0.6s; }
.cr-el .n { font-size: 11.5px; font-weight: 800; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cr-el .n.sm { font-size: 10px; letter-spacing: -0.2px; }
.cr-el .lv { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px; }
.cr-el .lv i { width: 5px; height: 5px; border-radius: 50%; background: rgba(148, 163, 184, 0.4); }
.cr-el .lv i.on { background: #4ade80; }
.cr-el:not(.ok) .lv { visibility: hidden; }
.cr-el .bd { position: absolute; top: -6px; right: -4px; width: 19px; height: 19px; border-radius: 50%; display: none; place-items: center; font-size: 10px; font-weight: 900; color: #fff; }
.cr-el.wait { opacity: 0.5; }
.cr-el.ok { background: rgba(22, 163, 74, 0.14); border-color: rgba(74, 222, 128, 0.45); }
.cr-el.ok .n { color: #bbf7d0; }
.cr-el.ok .bd { display: grid; background: #16a34a; }
.cr-el.dead { background: rgba(124, 45, 18, 0.22); border-color: rgba(251, 146, 60, 0.55); }
.cr-el.dead .e { filter: grayscale(1); opacity: 0.55; }
.cr-el.dead .n { color: #fdba74; }
.cr-el.dead .bd { display: grid; background: #9a3412; }
.cr-el.cue { border-color: #fde047; box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.35), 0 0 18px rgba(253, 224, 71, 0.45); animation: cr-cue 0.55s ease 3; }
@keyframes cr-cue { 50% { transform: translateY(-6px) scale(1.06); } }
.cr-el.okflash { animation: cr-okflash 0.8s ease; }
@keyframes cr-okflash { 40% { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.6), 0 0 22px rgba(74, 222, 128, 0.6); } }
.cr-el.wob { animation: cr-wob 0.5s ease; }
@keyframes cr-wob { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.cr-endbar { flex: none; height: 130px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.cr-sum { display: flex; justify-content: center; gap: 3px; font-size: 20px; }
.cr-sum span.x { filter: grayscale(1); opacity: 0.45; }
.cr-btn { min-height: 46px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 800; font-size: 15px; color: var(--fg); border: 1px solid rgba(148, 163, 184, 0.35); background: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-btn.prim { background: var(--accent); color: #0b1220; border: 0; }
.cr-btn.gold { min-height: 54px; font-size: 17px; border: 0; color: #422006; background: linear-gradient(#fde047, #facc15); box-shadow: 0 4px 16px rgba(253, 224, 71, 0.35); animation: cr-popin 0.35s ease; }
@keyframes cr-popin { from { transform: scale(0); } }

/* the result sheet (one screen) */
.cr-veil { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(2, 6, 23, 0.55); animation: cr-fade 0.2s ease; }
@keyframes cr-fade { from { opacity: 0; } }
.cr-sheet { background: #0f172a; border-top: 3px solid var(--accent); border-radius: 18px 18px 14px 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; animation: cr-up 0.28s ease; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); max-height: 100%; overflow-y: auto; }
.cr-sheet.gold { border-top-color: #facc15; } .cr-sheet.soft { border-top-color: #fb923c; }
@keyframes cr-up { from { transform: translateY(40px); opacity: 0.4; } }
.cr-sheet h3 { margin: 0; font-size: 18px; text-align: center; color: #fde047; text-transform: none; letter-spacing: normal; }
.cr-sub { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; text-align: center; }
.cr-verse { margin: 0; text-align: center; font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif; font-size: 16px; font-weight: 700; color: #fef3c7; line-height: 1.45; }
.cr-verse small { display: block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cr-badge { align-self: center; font-size: 12.5px; font-weight: 800; color: #fbbf24; background: rgba(250, 204, 21, 0.12); border: 1px solid rgba(250, 204, 21, 0.4); padding: 4px 12px; border-radius: 999px; text-align: center; }
.cr-team { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 13.5px; }
.cr-who { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-height: 58px; overflow: hidden; }
.cr-who-p { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 3px; border-radius: 999px; background: #111a2e; border: 1px solid var(--border); font-size: 12px; font-weight: 700; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-who-p .cr-av { width: 18px; height: 18px; font-size: 9.5px; }
.cr-sec { font-size: 11.5px; font-weight: 800; color: var(--muted); letter-spacing: 0.04em; }
.cr-yours { display: flex; flex-wrap: wrap; gap: 4px; }
.cr-yours span { position: relative; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 17px; background: #111a2e; border: 1px solid rgba(74, 222, 128, 0.35); }
.cr-yours span.x { border-color: rgba(251, 146, 60, 0.5); }
.cr-yours span.x > em { filter: grayscale(1); opacity: 0.5; }
.cr-yours em { font-style: normal; }
.cr-yours span.x::after { content: "🍂"; position: absolute; right: -4px; bottom: -4px; font-size: 10px; }
.cr-order { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(5, auto); grid-auto-flow: column; gap: 4px 6px; }
.cr-order li { display: grid; grid-template-columns: 14px 22px minmax(0, 1fr) 16px; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 8px; background: #111a2e; border-left: 3px solid #16a34a; min-width: 0; }
.cr-order li.x { border-left-color: #fb923c; }
.cr-order .i { font-size: 10.5px; color: var(--muted); font-weight: 800; text-align: right; }
.cr-order .e { font-size: 17px; text-align: center; }
.cr-order .tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cr-order .tx b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-order .tx small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-order .mk { font-weight: 900; font-size: 12px; color: #4ade80; text-align: center; }
.cr-row { display: flex; gap: 8px; align-items: center; }
.cr-row .cr-btn { flex: 1; min-width: 0; }
.cr-wait { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .cr *, .cr *::before, .cr *::after { animation: none !important; transition: none !important; }
}

/* ── Two by Two (Noah's ark memory match) ── */
/* Two by Two: one screen in play — top bar, player strip, then the board
   fills the rest (4 × 8 on phones). Cards flip in 3D; a match pops and
   floats "+1"; a miss shakes. Feedback floats so the layout never moves. */
#stage:has(.fit-screen) { padding-bottom: calc(var(--dock-h, 104px) + 8px); }
.tbt { position: relative; display: flex; flex-direction: column; gap: 6px; max-width: 760px; margin: 0 auto; }
.tbt.fit-screen { height: 600px; }
.tbt-hud {
  flex: none; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 4px 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
}
.tbt-turn { flex: 1; min-width: 0; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbt-turn.you { color: var(--accent); }
.tbt-progress { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tbt-strip { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px; }
.tbt-strip::-webkit-scrollbar { display: none; }
.tbt-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; max-width: 180px;
}
.tbt-chip.me { border-color: rgba(56, 189, 248, 0.5); }
.tbt-chip.cur { box-shadow: 0 0 0 2px var(--accent); }
.tbt-chip b { color: #fde68a; white-space: nowrap; }
.tbt-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #0b1220; flex: none; }
.tbt-cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbt-grid { flex: 1; min-height: 0; display: grid; gap: 5px; perspective: 800px; }
.tbt.done .tbt-grid { flex: none; grid-auto-rows: 52px; }
.tbt-card { position: relative; border: 0; padding: 0; background: transparent; cursor: pointer; min-height: 0; min-width: 0; font: inherit; color: inherit; }
.tbt-card:disabled { cursor: default; }
.tbt-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.38s ease; }
.tbt-card.up .tbt-in { transform: rotateY(180deg); }
.tbt-card.from-down .tbt-in { transform: rotateY(0deg); transition: none; }
.tbt-card.from-up .tbt-in { transform: rotateY(180deg); transition: none; }
.tbt-b, .tbt-f {
  position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.tbt-b { background: linear-gradient(135deg, #1e3a5f, #172554); border: 1px solid #334155; color: #60a5fa; font-size: 15px; }
.tbt-card:not(:disabled):active .tbt-b { filter: brightness(1.3); }
.tbt-f { transform: rotateY(180deg); background: #fef3c7; border: 2px solid #f59e0b; color: #1c1917; }
.tbt-emoji { font-size: clamp(20px, 5.6vh, 34px); line-height: 1; }
.tbt-f small { font-size: 10.5px; font-weight: 800; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.tbt-card.matched .tbt-f { background: #dcfce7; border-color: #22c55e; opacity: 0.6; }
.tbt-card.hit { animation: tbt-pop 0.55s ease 0.3s both; }
.tbt-card.hit .tbt-f { opacity: 1; box-shadow: 0 0 18px rgba(34, 197, 94, 0.85); }
.tbt-card.miss { animation: tbt-shake 0.45s ease 0.35s; }
.tbt-card.miss .tbt-f { border-color: #f87171; }
@keyframes tbt-pop { 50% { transform: scale(1.12); } }
@keyframes tbt-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.tbt-toast {
  position: absolute; z-index: 5; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 20px);
  padding: 8px 14px; border-radius: 18px; font-size: 13px; font-weight: 700; pointer-events: none;
  background: rgba(2, 6, 23, 0.94); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: tbt-toast 2.4s ease forwards;
}
.tbt-toast.ok { color: #86efac; border-color: rgba(34, 197, 94, 0.5); }
.tbt-toast.miss { color: var(--muted); }
@keyframes tbt-toast { 0% { opacity: 0; transform: translate(-50%, -6px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.tbt-float {
  position: absolute; z-index: 6; pointer-events: none; transform: translate(-50%, 0); font-size: 22px; font-weight: 900; color: #4ade80;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); animation: tbt-float 1.3s ease-out 0.35s both;
}
@keyframes tbt-float { 0% { opacity: 0; transform: translate(-50%, 0) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, -12px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.tbt-result { text-align: center; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; }
.tbt-result-win { font-size: 18px; font-weight: 800; color: var(--accent); }
.tbt-result-teach { font-size: 14px; color: var(--fg); max-width: 340px; margin: 0 auto; line-height: 1.6; }
.tbt-result-ref { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
@media (prefers-reduced-motion: reduce) {
  .tbt-in { transition: none; }
  .tbt-card.hit, .tbt-card.miss, .tbt-toast, .tbt-float { animation: none; }
  .tbt-float { display: none; }
}

/* ── Fruit of the Spirit ─────────────────────────────────────────────────
   One portrait screen in play (see renderActive in games/foods2.js). In-game
   classes use the .f2-* namespace; the lobby is the shared lobby card (.f2l-*). */
.foods-guide-item.kind-weather { border-left-color: #7dd3fc; }
.foods2-tier { font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 4px; }
/* Lobby: the shared lobby card. Garden and goal are option buttons in its
   slot (icon + title + one line); the reshuffle table and weather die sit
   inside the folded rules. */
.f2l-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.f2l-goals { display: flex; flex-direction: column; gap: 8px; }
.lobby-card.lc .f2l-opt {
  display: flex; align-items: flex-start; gap: 10px; min-height: 52px; padding: 10px 12px; text-align: left;
  background: var(--bg-3); color: var(--fg); border: 2px solid var(--border); border-radius: 12px; font-weight: 400;
}
.lobby-card.lc .f2l-opt.active { border-color: var(--accent); background: rgba(56,189,248,0.12); }
.lobby-card.lc .f2l-opt:disabled { cursor: default; }
.lobby-card.lc .f2l-opt:disabled:not(.active) { opacity: 0.55; }
.f2l-ic { font-size: 24px; line-height: 1.1; flex: none; }
.f2l-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.f2l-tx b { font-size: 14.5px; }
.f2l-tx small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.f2l-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.lobby-card.lc .foods-guide-open { min-height: 44px; border-radius: 12px; }
.f2l-rules-extra { padding: 0 14px 12px; font-size: 13px; }
.f2l-rules-extra h5 { margin: 12px 0 2px; font-size: 13.5px; }
.f2l-rules-extra p { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 360px) { .f2l-modes { grid-template-columns: 1fr; } }
.foods2-table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.foods2-table th, .foods2-table td { padding: 4px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.foods2-table tr.here td { color: var(--accent); font-weight: 700; }

.f2-stage {
  position: relative; isolation: isolate; max-width: 560px; margin: 0 auto;
  border-radius: 18px; overflow: hidden; background: #0f172a; color: #e2e8f0;
}
.f2-sky, .f2-sky-l { position: absolute; inset: 0; }
.f2-sky { z-index: 0; }
.f2-sky-l { opacity: 0; transition: opacity 0.9s ease; }
.f2-sky-l.on { opacity: 1; }
.f2-sky-l[data-w="sunny"] { background: linear-gradient(180deg, #38bdf8 0%, #7dd3fc 42%, #fde68a 100%); }
.f2-sky-l[data-w="rain"] { background: linear-gradient(180deg, #334155 0%, #475569 50%, #64748b 100%); }
.f2-sky-l[data-w="storm"] { background: linear-gradient(180deg, #1e1b4b 0%, #312e81 45%, #334155 100%); }
.f2-sky-l[data-w="drought"] { background: linear-gradient(180deg, #f59e0b 0%, #d97706 50%, #92400e 100%); }
.f2-sky-l[data-w="locust"] { background: linear-gradient(180deg, #365314 0%, #4d7c0f 45%, #57534e 100%); }
.f2-sky-l[data-w="glory"] { background: radial-gradient(circle at 50% 12%, #fffbeb 0%, #fde68a 28%, #f59e0b 72%, #b45309 100%); }
.f2-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.f2-panel { background: rgba(15, 23, 42, 0.84); border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 14px; }
.f2-muted { color: #94a3b8; font-size: 12px; }
.f2-stage .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.f2-stage .frost { color: #bae6fd; }

/* In-game screen: sized by JS to the space between the header and the chat
   dock, so nothing scrolls. The garden takes whatever height is left. */
#stage:has(.f2-stage.fit) { padding-bottom: calc(var(--f2-dock, 110px) + 8px); }
.f2-stage.fit { display: flex; flex-direction: column; height: 600px; }
.f2-stage.fit > .f2-col { flex: 1; min-height: 0; gap: 6px; padding: 8px; }
.f2-stage.fit > .f2-col > * { flex: none; }
.f2-stage.fit > .f2-col > .f2-garden-wrap { flex: 1 1 auto; min-height: 150px; }

.f2-hud { display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 3px 4px 3px 8px; font-size: 12px; }
.f2-round { font-weight: 800; white-space: nowrap; }
.f2-banner {
  padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: #422006; color: #fde68a; border: 1px solid rgba(251, 191, 36, 0.6);
  display: inline-flex; gap: 4px; align-items: center;
}
.f2-banner .hg { display: inline-block; animation: f2-hg 1.2s ease-in-out infinite; }
@keyframes f2-hg { 50% { transform: rotate(180deg); } }
.f2-wx {
  display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 2px 10px 2px 4px; flex: none;
  border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.09); color: inherit; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.f2-wx-badge { width: 28px; height: 28px; display: grid; place-items: center; font-size: 19px; line-height: 1; }
.f2-turn { flex: 1; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f2-turn.you { color: #38bdf8; font-weight: 800; }
.f2-icon-btn {
  width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid rgba(148, 163, 184, 0.3);
  background: transparent; color: inherit; cursor: pointer; font-size: 15px; display: grid; place-items: center; padding: 0;
}

.f2-ticker {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 10px;
  color: inherit; font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.f2-ticker-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f8fafc; }
.f2-ticker-text.wx { color: #fde68a; }
.f2-ticker-more { color: #94a3b8; font-size: 11px; white-space: nowrap; }
.f2-ticker.flash .f2-ticker-text { animation: f2-tick 0.45s ease; }
@keyframes f2-tick { from { transform: translateY(-8px); opacity: 0.2; } to { transform: none; opacity: 1; } }

.f2-opps { display: flex; gap: 6px; }
.f2-opps.rows { flex-direction: column; }
.f2-opps.chips { overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.f2-opps.chips::-webkit-scrollbar { display: none; }
.f2-opp {
  position: relative; display: flex; gap: 8px; align-items: center; padding: 6px 8px; overflow: hidden;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.f2-opps.rows .f2-opp { width: 100%; }
.f2-opps.chips .f2-opp { flex: none; width: 132px; gap: 6px; padding: 5px 6px; }
.f2-opp.current { border-color: #38bdf8; box-shadow: inset 0 0 0 1px #38bdf8; }
.f2-opp-head { display: flex; flex-direction: column; gap: 1px; font-size: 12px; font-weight: 700; min-width: 0; }
.f2-opps.rows .f2-opp-head { width: 74px; flex: none; }
.f2-opps.chips .f2-opp-head { flex: 1; font-size: 11px; }
.f2-opp-head .row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.f2-opp-head .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f2-opp-head small { color: #94a3b8; font-weight: 500; font-size: 11px; white-space: nowrap; }
.f2-minis { display: grid; gap: 3px; min-width: 0; }
.f2-opps.rows .f2-minis { flex: 1; grid-template-columns: repeat(9, minmax(0, 1fr)); }
.f2-opps.chips .f2-minis { flex: none; grid-template-columns: repeat(3, 16px); gap: 2px; }
.f2-mini {
  aspect-ratio: 1; min-width: 0; border-radius: 5px; font-size: 13px; line-height: 1;
  display: grid; place-items: center; color: #fde7c7;
  background: linear-gradient(180deg, #7a4f2a, #4a2e17); border: 1px solid #3f2712;
}
.f2-opps.chips .f2-mini { font-size: 9px; border-radius: 3px; }
.f2-mini.rooted { box-shadow: inset 0 0 0 2px #facc15; }
.f2-frost-layer {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: inherit;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.5) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 85%, rgba(255, 255, 255, 0.45) 0 1.5px, transparent 2.5px),
    linear-gradient(135deg, rgba(186, 230, 253, 0.55), rgba(125, 211, 252, 0.25));
  box-shadow: inset 0 0 18px rgba(224, 242, 254, 0.9);
}
.frosted > .f2-frost-layer { opacity: 0.35; }

.f2-garden-wrap { position: relative; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.f2-garden-head { font-size: 12px; font-weight: 700; margin: 0 2px; display: flex; gap: 6px; align-items: center; min-height: 20px; white-space: nowrap; }
.f2-garden-head .r { margin-left: auto; color: #94a3b8; font-weight: 600; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.f2-garden { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.f2-stage.fit .f2-garden { flex: 1; min-height: 0; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.f2-slot {
  --fc: #facc15;
  position: relative; height: 76px; border-radius: 10px; cursor: pointer; color: inherit; font: inherit; padding: 0 0 3px; min-height: 0;
  background: linear-gradient(180deg, #7a4f2a, #4a2e17); border: 1px solid #3f2712;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -3px 0 rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.f2-stage.fit .f2-slot { height: auto; }
.f2-soil { position: absolute; left: 20%; right: 20%; bottom: 19px; height: 11px; border-radius: 50%; background: #3b2a1a; transition: background 0.5s, box-shadow 0.5s; }
.f2-slot.wet .f2-soil { background: #1c130a; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 0 8px rgba(56, 189, 248, 0.35); }
.f2-plant { position: absolute; bottom: 23px; font-size: 23px; line-height: 1; transform-origin: 50% 100%; }
.f2-slot[data-stage="3"] .f2-plant { font-size: 27px; }
.f2-slot[data-stage="4"] .f2-plant { font-size: 28px; filter: drop-shadow(0 0 6px var(--fc)); }
.f2-nm { font-size: 10px; color: #fde7c7; position: relative; }
.f2-slot.rooted { box-shadow: inset 0 0 0 2px #facc15, 0 0 12px rgba(250, 204, 21, 0.45); }
.f2-slot.rooted::after { content: "🌳"; position: absolute; top: 3px; right: 5px; font-size: 11px; }
.f2-slot.ok { outline: 2px dashed #38bdf8; outline-offset: -3px; animation: f2-ok 1.2s ease-in-out infinite; }
@keyframes f2-ok { 50% { outline-color: rgba(56, 189, 248, 0.3); } }
.f2-slot.will-grow .f2-soil { animation: f2-willgrow 0.9s ease-in-out 3; }
@keyframes f2-willgrow { 50% { box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.8), 0 0 16px rgba(250, 204, 21, 0.8); } }
.f2-dome, .f2-dome-temp > div {
  position: absolute; inset: -2px; border-radius: 22px; pointer-events: none; opacity: 0;
  display: flex; justify-content: center; align-items: flex-start;
  background: radial-gradient(ellipse at 50% 65%, rgba(125, 211, 252, 0.06), rgba(125, 211, 252, 0.26) 70%, rgba(186, 230, 253, 0.5));
  border: 2px solid rgba(186, 230, 253, 0.9);
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.65), inset 0 0 30px rgba(56, 189, 248, 0.35);
}
.f2-dome span, .f2-dome-temp span { font-size: 26px; margin-top: -15px; }

/* Floating hint over the garden header — never moves the layout. */
.f2-hint {
  position: absolute; z-index: 3; top: 3px; left: 6px; right: 6px; min-height: 30px;
  display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 10px; font-size: 12px;
  border-radius: 999px; background: rgba(2, 6, 23, 0.94); border: 1px solid rgba(56, 189, 248, 0.75);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); animation: f2-float-in 0.2s ease;
}
.f2-hint .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f2-hint button { border: 0; background: transparent; color: #cbd5e1; text-decoration: underline; cursor: pointer; min-height: 30px; font: inherit; padding: 0 8px; }
@keyframes f2-float-in { from { transform: translateY(-6px); opacity: 0; } }

.f2-bar { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 3px 4px 3px 10px; }
.f2-piles { flex: 1; display: flex; gap: 9px; font-size: 11px; color: #94a3b8; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }
.f2-pile { display: inline-block; }
.f2-pile b { color: #e2e8f0; }
.f2-btn {
  min-height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px; white-space: nowrap;
  border: 1px solid rgba(148, 163, 184, 0.35); background: #1e293b; color: #e2e8f0;
}
.f2-btn.lg { min-height: 46px; font-size: 15px; padding: 0 16px; }
.f2-btn.prim { background: #38bdf8; color: #0f172a; border: 0; }
.f2-btn.good { background: #16a34a; color: #f0fdf4; border: 0; }
.f2-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Hand: a fan of overlapping cards, like holding them. */
.f2-hand-wrap { padding: 4px 6px 6px; }
.f2-fan { height: 100px; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 2px; }
.f2-fan > .f2-muted { align-self: center; }
.f2-fan .f2-card {
  width: 60px; height: 84px; box-shadow: -3px 0 8px rgba(0, 0, 0, 0.35); transform-origin: 50% 120%;
  transform: translateY(var(--dy, 0)) rotate(var(--rot, 0deg)); transition: transform 0.15s ease;
}
.f2-fan .f2-card.selected { transform: translateY(-14px); z-index: 50 !important; }
.f2-fan .f2-card { justify-content: flex-start; align-items: flex-start; gap: 4px; padding: 8px 3px 3px 5px; }
.f2-fan .f2-card .cn { width: calc(var(--vis, 60px) - 8px); text-align: left; -webkit-line-clamp: 3; }
.f2-card {
  width: 58px; height: 78px; flex: none; border-radius: 9px; padding: 2px; position: relative; cursor: pointer;
  background: #1e293b; border: 2px solid #334155; color: #e2e8f0; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.f2-card .ce { font-size: 22px; line-height: 1; }
.f2-card .cn { font-size: 10px; font-weight: 700; line-height: 1.15; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.f2-card .gen { position: absolute; left: 3px; bottom: 2px; font-size: 9px; font-weight: 800; color: #fca5a5; border: 1px solid rgba(252, 165, 165, 0.6); border-radius: 3px; padding: 0 2px; line-height: 1.3; }
.f2-card.k-res { border-color: rgba(74, 222, 128, 0.6); }
.f2-card.k-fri { border-color: rgba(190, 242, 100, 0.6); }
.f2-card.k-wx { border-color: rgba(56, 189, 248, 0.65); }
.f2-card.k-def { border-color: rgba(96, 165, 250, 0.65); }
.f2-card.k-sab { border-color: rgba(248, 113, 113, 0.65); }
.f2-card.back { background: repeating-linear-gradient(45deg, #14532d 0 6px, #166534 6px 12px); border-color: #4ade80; }
.f2-card.back::after { content: "🌳"; font-size: 20px; }
.f2-card.glow { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5), 0 0 18px rgba(56, 189, 248, 0.6); }
.f2-card.selected { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.45); }
.f2-card.discard-pick { border-color: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.45); opacity: 0.75; }
.f2-card:disabled { opacity: 0.55; cursor: not-allowed; }
.f2-fan .f2-card:disabled { opacity: 0.7; }
.f2-minicard { width: 20px; height: 28px; border-radius: 4px; background: repeating-linear-gradient(45deg, #14532d 0 4px, #166534 4px 8px); border: 1px solid #4ade80; }

/* Floating status pill (waiting on someone, or a tucked-away question). */
.f2-pill {
  position: absolute; z-index: 25; left: 50%; top: 6px; transform: translateX(-50%); max-width: calc(100% - 16px);
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 18px; font-size: 12px; line-height: 1.35;
  background: rgba(2, 6, 23, 0.94); color: #e2e8f0; border: 1px solid rgba(148, 163, 184, 0.35); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  animation: f2-pill-in 0.25s ease;
}
@keyframes f2-pill-in { from { transform: translate(-50%, -8px); opacity: 0; } }
.f2-pill.alert { border: 0; background: #ef4444; color: #fff; font-weight: 800; font-size: 13px; cursor: pointer; min-height: 44px; animation: f2-pill-in 0.25s ease, f2-pulse 1.4s ease-in-out infinite; }
.f2-pill.alert.orange { background: #fb923c; color: #1c1917; }
.f2-pill.alert.violet { background: #a78bfa; color: #1e1b4b; }
@keyframes f2-pulse { 50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0.25), 0 6px 18px rgba(0, 0, 0, 0.45); } }
.f2-sec { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.f2-pill-link { border: 0; background: transparent; color: #cbd5e1; text-decoration: underline; cursor: pointer; font: inherit; white-space: nowrap; min-height: 32px; }

/* Bottom sheets over the game. */
.f2-veil { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(2, 6, 23, 0.6); animation: f2-fade 0.2s ease; }
@keyframes f2-fade { from { opacity: 0; } }
.f2-sheet {
  display: flex; flex-direction: column; gap: 10px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); background: #0f172a; border-top: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); animation: f2-up 0.25s ease;
}
@keyframes f2-up { from { transform: translateY(40px); opacity: 0.4; } }
.f2-sheet.alert { border-top: 3px solid #38bdf8; }
.f2-sheet.alert.red { border-top-color: #f87171; }
.f2-sheet.alert.orange { border-top-color: #fb923c; }
.f2-sheet.alert.violet { border-top-color: #a78bfa; }
.f2-sheet h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.f2-sub { margin: 0; font-size: 13px; line-height: 1.5; color: #94a3b8; }
.f2-sub b { color: #e2e8f0; }
.f2-grab { width: 40px; height: 4px; border-radius: 4px; background: #334155; align-self: center; margin-top: -6px; flex: none; }
.f2-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.f2-acts .f2-btn { flex: 1; }
.f2-sheet > .f2-acts:last-child { position: sticky; bottom: calc(-14px - env(safe-area-inset-bottom, 0px)); margin: 0 -14px calc(-14px - env(safe-area-inset-bottom, 0px)); padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px)); background: #0f172a; border-top: 1px solid rgba(148, 163, 184, 0.18); }
.f2-sheet .f2-pick .f2-card { width: 50px; height: 68px; }
.f2-sheet .f2-pick .f2-card .ce { font-size: 19px; }
.f2-peek { align-self: center; border: 0; background: transparent; color: #94a3b8; text-decoration: underline; cursor: pointer; min-height: 40px; font: inherit; font-size: 13px; }
.f2-attack { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.4); }
.f2-attack.violet { background: rgba(167, 139, 250, 0.1); border-color: rgba(167, 139, 250, 0.45); }
.f2-attack .big { font-size: 34px; line-height: 1; }
.f2-attack .what { flex: 1; font-size: 14px; line-height: 1.5; }
.f2-ring { width: 52px; height: 52px; flex: none; position: relative; display: grid; place-items: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.f2-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.f2-ring circle { fill: none; stroke-width: 5; }
.f2-ring circle.bg { stroke: #334155; }
.f2-ring circle.fg { stroke: #f87171; transition: stroke-dashoffset 0.25s linear; }
.f2-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.f2-sec-label { font-size: 12px; color: #94a3b8; font-weight: 700; }
.f2-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.f2-opt {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.3); background: #111a2e; color: inherit; font: inherit; font-size: 13px;
}
.f2-opt.on { border-color: #38bdf8; background: rgba(56, 189, 248, 0.16); font-weight: 700; }
.f2-target-opp { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: #111a2e; border: 1px solid rgba(148, 163, 184, 0.22); }
.f2-target-opp .h { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.f2-target-opp .h .r { margin-left: auto; font-weight: 500; }
.f2-tgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.f2-tgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.f2-tcell {
  min-height: 48px; border-radius: 9px; border: 1px solid #3f2712; background: linear-gradient(180deg, #7a4f2a, #4a2e17); color: #fde7c7;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font: inherit; padding: 2px;
}
.f2-tcell .e { font-size: 18px; line-height: 1; }
.f2-tcell .n { font-size: 10px; }
.f2-tcell.ok { outline: 2px solid #f87171; outline-offset: -2px; }
.f2-tcell.rooted { box-shadow: inset 0 0 0 2px #facc15; }
.f2-tcell:disabled { opacity: 0.35; cursor: not-allowed; }
.f2-tcell.view { cursor: default; min-height: 60px; }
.f2-tcell.view .e { font-size: 24px; }
.f2-log { display: flex; flex-direction: column; gap: 1px; }
.f2-log-line { font-size: 13px; line-height: 1.5; padding: 4px 6px; border-radius: 6px; color: #cbd5e1; }
.f2-log-line:first-child { color: #f8fafc; background: rgba(56, 189, 248, 0.1); }
.f2-log-line.wx { color: #fde68a; }
.f2-wx-big { display: flex; gap: 14px; align-items: center; }
.f2-wx-big .e { font-size: 44px; line-height: 1; }
.f2-wx-big h3 { margin: 0 0 2px; }

@media (prefers-reduced-motion: reduce) {
  .f2-ticker.flash .f2-ticker-text, .f2-pill, .f2-pill.alert, .f2-veil, .f2-sheet, .f2-hint, .f2-slot.ok, .f2-banner .hg { animation: none; }
}

.f2-end .f2-col { padding: 16px 12px; }
.f2-res { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; text-align: center; }
.f2-res-art { position: relative; width: 240px; height: 240px; max-width: 100%; }
.f2-res-art svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.f2-res-art .canopy { transform-box: fill-box; transform-origin: 50% 100%; }
.f2-res-art .pin { position: absolute; transform: translate(-50%, -50%); font-size: 24px; line-height: 1; }
.f2-res-art .ava { position: absolute; transform: translate(-50%, -50%); width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #0f172a; border: 3px solid rgba(255, 255, 255, 0.45); }
.f2-res-title { margin: 0; font-size: 26px; font-weight: 900; color: #fde68a; text-shadow: 0 2px 14px rgba(250, 204, 21, 0.5); }
.f2-res-sub { margin: 0; font-size: 14px; }
.f2-res-teach { margin: 4px 0 0; font-size: 13px; font-style: italic; color: #cbd5e1; }
.f2-final-list { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.f2-final-row { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: rgba(30, 41, 59, 0.8); }
.f2-final-row.win { background: rgba(250, 204, 21, 0.16); border: 1px solid rgba(250, 204, 21, 0.5); }
.f2-final-row .rank { width: 30px; text-align: center; }
.f2-final-row .name { flex: 1; text-align: left; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f2-final-row .stats { font-variant-numeric: tabular-nums; color: #cbd5e1; }

/* Effects overlay (lives on <body>, see foods2-fx.js). Below the chat dock
   and drawers (z 80+), clipped to the visible stage by the engine. */
.f2-fx { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.f2-fx canvas { position: absolute; inset: 0; }
.f2-fly { position: absolute; inset: 0; overflow: hidden; }
.f2-flyer { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); perspective: 600px; will-change: transform; }
.f2-flyer .f2-card { cursor: default; }
.f2-emo { font-size: 30px; display: block; line-height: 1; }
.f2-emo.sm { font-size: 20px; }
.f2-critter { font-size: 34px; display: block; line-height: 1; }
.f2-critter.right { transform: scaleX(-1); }
.f2-ftxt { font-size: 13px; font-weight: 900; white-space: nowrap; padding: 3px 10px; border-radius: 999px; background: rgba(2, 6, 23, 0.82); border: 1px solid rgba(148, 163, 184, 0.35); }
.f2-beam { border-radius: 10px; background: linear-gradient(180deg, rgba(254, 249, 195, 0) 0%, rgba(254, 249, 195, 0.75) 60%, rgba(253, 224, 71, 0.35) 100%); mix-blend-mode: screen; }
.f2-sweep { overflow: hidden; border-radius: 12px; }
.f2-sweep::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -40%; background: linear-gradient(90deg, rgba(254, 240, 138, 0), rgba(254, 240, 138, 0.55), rgba(254, 240, 138, 0)); animation: f2-sweep 1.1s ease-in-out forwards; }
@keyframes f2-sweep { to { left: 100%; } }
.f2-dome-temp { position: absolute; }
svg.f2-draw path { fill: none; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) {
  .f2-sky-l { transition: none; }
  .f2-banner .hg, .f2-slot.will-grow .f2-soil, .f2-sweep::before { animation: none; }
}

/* ── Question-and-answer games (public/js/quiz-ui.js) ──────────────────────
   Bible Quiz, Wheat and Tares, Verse Scramble, Time Bomb share this layout:
   top bar with a countdown ring, player strip, a content card, the answer
   area in the thumb zone, a result sheet from the bottom, a podium at the end. */
.qz { position: relative; display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin: 0 auto; }
.qz.fit-screen { height: 600px; }
.qz-panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; }
.qz-hud { flex: none; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 3px 12px; }
.qz-lbl { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.qz-sp { flex: 1; }
.qz-score { font-weight: 900; font-size: 14px; color: #facc15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qz-ring { width: 42px; height: 42px; flex: none; position: relative; display: grid; place-items: center; font-weight: 900; font-size: 14px; font-variant-numeric: tabular-nums; }
.qz-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.qz-ring circle { fill: none; stroke-width: 4; }
.qz-ring .bg { stroke: #334155; }
.qz-ring .fg { stroke: var(--accent); transition: stroke-dashoffset 0.2s linear, stroke 0.3s; }
.qz-ring.low .fg { stroke: #f87171; }
.qz-ring.low b { color: #f87171; }
.qz-strip { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 7px 1px 2px; }
.qz-strip::-webkit-scrollbar { display: none; }
.qz-chip {
  flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; max-width: 190px;
}
.qz-chip.me { border-color: rgba(56, 189, 248, 0.55); }
.qz-chip.cur { box-shadow: 0 0 0 2px var(--accent); }
.qz-chip.out, .qz-chip.away { opacity: 0.45; }
.qz-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #0b1220; flex: none; }
.qz-cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qz-pts { color: #facc15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qz-ok { position: absolute; top: -6px; right: -3px; width: 17px; height: 17px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 10px; display: grid; place-items: center; animation: qz-popin 0.3s ease; }
.qz-delta { position: absolute; top: -12px; right: 2px; font-size: 12px; color: #4ade80; font-weight: 900; pointer-events: none; animation: qz-rise 1.8s ease forwards; }
@keyframes qz-popin { from { transform: scale(0); } }
@keyframes qz-rise { 0% { transform: translateY(6px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-16px); opacity: 0; } }
.qz-space { flex: 1 1 0; min-height: 4px; }
.qz-card { flex: none; padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.qz-q { font-size: 19px; font-weight: 800; line-height: 1.45; text-wrap: balance; }
.qz-ref { font-size: 11.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }
.qz-answers { flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qz-ans {
  position: relative; min-height: 78px; padding: 10px 12px 10px 42px; border-radius: 14px; cursor: pointer; text-align: left;
  background: #1e293b; border: 2px solid #334155; color: var(--fg); font-size: 15px; font-weight: 700; line-height: 1.35;
  display: flex; align-items: center; transition: transform 0.12s, opacity 0.2s, border-color 0.2s, background 0.2s;
}
.qz-ans:not(:disabled):active { transform: scale(0.97); }
.qz-ans:disabled { cursor: default; }
.qz-ans .k { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: #0b1220; }
.qz-ans:nth-child(1) .k { background: #38bdf8; } .qz-ans:nth-child(2) .k { background: #facc15; }
.qz-ans:nth-child(3) .k { background: #4ade80; } .qz-ans:nth-child(4) .k { background: #f9a8d4; }
.qz-ans.picked { border-color: var(--accent); background: rgba(56, 189, 248, 0.14); }
.qz-ans.dim { opacity: 0.4; }
.qz-ans.right { border-color: #4ade80; background: rgba(22, 163, 74, 0.25); opacity: 1; animation: qz-pop 0.45s ease; }
.qz-ans.right::after { content: "✓"; position: absolute; right: 10px; top: 7px; font-size: 18px; color: #4ade80; }
.qz-ans.wrong { border-color: #f87171; background: rgba(248, 113, 113, 0.16); opacity: 1; animation: qz-shake 0.4s ease; }
@keyframes qz-pop { 50% { transform: scale(1.05); } }
@keyframes qz-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.qz-float {
  position: absolute; z-index: 40; pointer-events: none; transform: translate(-50%, 0); font-weight: 900; font-size: 22px; color: #4ade80;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); animation: qz-fly 1.3s ease-out forwards;
}
@keyframes qz-fly { 0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -10px) scale(1.15); } 100% { transform: translate(-50%, -60px) scale(1); opacity: 0; } }
.qz-toast {
  position: absolute; z-index: 25; left: 50%; bottom: 190px; transform: translateX(-50%); max-width: calc(100% - 16px); pointer-events: none;
  padding: 8px 14px; border-radius: 18px; font-size: 13px; font-weight: 700; background: rgba(2, 6, 23, 0.94); border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: qz-tin 0.25s ease;
}
.qz-toast.bad { color: #fca5a5; border-color: rgba(248, 113, 113, 0.5); }
@keyframes qz-tin { from { transform: translate(-50%, 6px); opacity: 0; } }
.qz-veil { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none; padding-bottom: var(--qz-lift, 0px); }
/* #stage is a <section>, whose h2 rule is muted uppercase; game titles keep their own look. */
.lobby-card.lc h2, .qz h2 { color: var(--fg); text-transform: none; letter-spacing: normal; }
.qz-sheet {
  pointer-events: auto; background: #0f172a; border-top: 3px solid var(--accent); border-radius: 18px 18px 14px 14px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); animation: qz-up 0.28s ease 0.6s both;
  max-height: 70%; overflow-y: auto;
}
.qz-sheet.good { border-top-color: #16a34a; } .qz-sheet.bad { border-top-color: #f87171; } .qz-sheet.gold { border-top-color: #facc15; }
@keyframes qz-up { from { transform: translateY(40px); opacity: 0; } }
.qz-sheet h3 { margin: 0; font-size: 17px; }
.qz-sheet p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.qz-sheet p b { color: var(--fg); }
.qz-bar { height: 4px; border-radius: 4px; background: #1e293b; overflow: hidden; }
.qz-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s linear; }
.qz-end { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.qz-end h2 { margin: 0; text-align: center; font-size: 20px; }
.qz-end .qz-mine { text-align: center; color: var(--muted); font-size: 14px; }
.qz-podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; padding-top: 4px; }
.qz-podium div { width: 92px; border-radius: 12px 12px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 0; font-size: 12.5px; font-weight: 800; background: #1e293b; min-width: 0; }
.qz-podium .p1 { height: 116px; background: linear-gradient(180deg, rgba(250, 204, 21, 0.35), #1e293b); }
.qz-podium .p2 { height: 90px; } .qz-podium .p3 { height: 70px; }
.qz-podium .e { font-size: 24px; }
.qz-podium .n { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-podium .s { color: #facc15; font-variant-numeric: tabular-nums; }
.qz-review { display: flex; flex-direction: column; gap: 6px; }
.qz-rev { padding: 9px 11px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); border-left: 4px solid #16a34a; font-size: 13.5px; line-height: 1.5; }
.qz-rev.bad { border-left-color: #f87171; } .qz-rev.missed { border-left-color: #64748b; }
.qz-rev .h { display: flex; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.qz-rev .a { margin-top: 3px; }
.qz-rev .a b { color: #4ade80; }
.qz-rev .y { color: #fca5a5; }
@media (prefers-reduced-motion: reduce) {
  .qz-ans.right, .qz-ans.wrong, .qz-float, .qz-delta, .qz-ok, .qz-sheet, .qz-toast { animation: none; }
}
/* Wheat and Tares in the shared layout: the saying in the middle, two big
   buttons (golden wheat, green tares) in the thumb zone. */
.wt-say { flex: none; padding: 22px 18px 24px; text-align: center; }
.wt-qm { display: block; height: 22px; font-size: 48px; line-height: 0.75; color: rgba(245, 158, 11, 0.55); font-family: Georgia, serif; }
.wt-say-t { font-size: 21px; font-weight: 800; line-height: 1.5; text-wrap: balance; }
.wt-pick { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wt-big {
  min-height: 128px; border-radius: 18px; cursor: pointer; border: 2px solid transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 18px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.12s, opacity 0.2s;
}
.wt-big .e { font-size: 40px; line-height: 1; }
.wt-big small { font-size: 12px; font-weight: 700; opacity: 0.85; }
.wt-big.wheat { background: linear-gradient(180deg, #fde68a, #f59e0b); color: #422006; }
.wt-big.tares { background: linear-gradient(180deg, #bef264, #4d7c0f); color: #1a2e05; }
.wt-big:not(:disabled):active { transform: scale(0.97); }
.wt-big:disabled { cursor: default; }
.wt-big.picked { border-color: #fff; box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.6); }
.wt-big.dim { opacity: 0.35; }
.wt-big.right { opacity: 1; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.9); animation: qz-pop 0.45s ease; }
.wt-big.wrong { opacity: 1; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.9); animation: qz-shake 0.4s ease; }
.wt-play .qz-toast { bottom: 150px; }
/* Verse Scramble in the shared layout: the verse builds up in a card, the
   pieces are 48px tiles in the thumb zone. */
.vs-ref { flex: none; display: flex; justify-content: center; }
.vs-ref span { font-weight: 800; font-size: 14px; background: rgba(245, 158, 11, 0.16); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.4); padding: 3px 12px; border-radius: 999px; }
.vs-built { flex: none; min-height: 128px; padding: 12px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; transition: border-color 0.3s, box-shadow 0.3s; }
.vs-built.no { animation: qz-shake 0.45s ease; border-color: #f87171; }
.vs-built.ok { border-color: #4ade80; box-shadow: 0 0 22px rgba(74, 222, 128, 0.35); }
.vs-built.done { align-content: center; justify-content: center; }
.vs-ph { width: 100%; text-align: center; color: var(--muted); font-size: 13.5px; padding-top: 34px; }
.vs-full { font-size: 19px; font-weight: 800; line-height: 1.6; text-align: center; text-wrap: balance; }
.vs-chunk {
  min-height: 48px; padding: 0 14px; border-radius: 12px; cursor: pointer; font-size: 17px; font-weight: 800; color: var(--fg);
  border: 2px solid #475569; background: #1e293b; display: inline-flex; align-items: center; gap: 6px; transition: transform 0.12s;
}
.vs-chunk:active { transform: scale(0.95); }
.vs-chunk.in { background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.6); animation: qz-popin 0.2s ease; }
.vs-chunk .n { font-size: 11px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #0b1220; display: grid; place-items: center; flex: none; }
.vs-pool { flex: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.vs-row { flex: none; display: flex; gap: 8px; }
.vs-btn { min-height: 48px; padding: 0 18px; border-radius: 999px; cursor: pointer; font-weight: 800; font-size: 15px; border: 1px solid rgba(148, 163, 184, 0.35); background: #1e293b; color: var(--fg); white-space: nowrap; }
.vs-btn.prim { flex: 1; background: var(--accent); color: #0b1220; border: 0; }
.vs-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.vs-play .qz-toast { bottom: 140px; }
/* Time Bomb in the shared layout: players round a table, the bomb ticks by
   whoever must answer and flies to the next on a right answer. */
.tb-status { flex: none; text-align: center; font-size: 13.5px; font-weight: 700; color: var(--muted); min-height: 20px; }
.tb-status.you { color: var(--accent); }
.tb-strikes { display: inline-flex; gap: 4px; align-items: center; }
.tb-strikes i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #f87171; display: inline-block; }
.tb-strikes i.on { background: #f87171; }
.tb-table { flex: 1 1 auto; min-height: 150px; position: relative; }
.tb-seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 800; width: 76px; text-align: center; transition: opacity 0.3s; }
.tb-seat .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #0b1220; border: 3px solid transparent; }
.tb-seat .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-seat .sc { color: #facc15; font-size: 11px; }
.tb-seat.me .av { border-color: rgba(56, 189, 248, 0.7); }
.tb-seat.cur .av { border-color: #fff; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.45); }
.tb-seat.out { opacity: 0.32; }
.tb-bomb {
  position: absolute; z-index: 3; transform: translate(-50%, -50%); font-size: 36px; pointer-events: none;
  transition: left 0.55s cubic-bezier(0.4, 1.5, 0.5, 1), top 0.55s cubic-bezier(0.4, 1.5, 0.5, 1);
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.6)); animation: tb-tick 0.6s ease-in-out infinite;
}
@keyframes tb-tick { 50% { transform: translate(-50%, -50%) scale(1.14) rotate(-6deg); } }
.tb-ask { flex: none; padding: 10px 12px; text-align: center; }
.tb-ask .l { font-size: 12px; color: var(--muted); }
.tb-ask .c { font-size: 21px; font-weight: 900; color: var(--accent); margin-top: 2px; }
.tb-answers .qz-ans { min-height: 62px; }
.tb-lamp { flex: none; padding: 10px 12px; display: flex; align-items: center; gap: 12px; }
.tb-lamp .fl { font-size: 38px; transition: transform 0.4s; }
.tb-lamp .m { flex: 1; min-width: 0; }
.tb-lamp .h { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.tb-lamp .bar { height: 14px; border-radius: 10px; background: #1e293b; overflow: hidden; border: 1px solid var(--border); }
.tb-lamp .bar i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #fde047); transition: width 0.5s; }
.tb-play .qz-toast { bottom: 170px; }
@media (prefers-reduced-motion: reduce) { .tb-bomb { animation: none; transition: none; } }
