/* Client styling. The pieces follow the physical game: birch plywood with burned lettering and the
   printed cards, on an oak table. The rest is a medieval overlay shared with Justice and Mercy
   (vellum panels, blackletter headings, red and gold): see "medieval overlay" at the end.
   Layout: the game is one table with everyone seated around it (see "The table" below). */
:root {
  --table: #46321f;
  --table-2: #574029;
  --maple: #efdcbc;
  --maple-2: #f8eedb;
  --burn: #6b3f22;
  --ink: #24180f;
  --muted: #c2aa8c;
  --oak: #9a7149;
  --felt: #2c6a5d;
  --brass: #d8b56a;
  --accent: #2f7d6d;
  --accent-ink: #ffffff;
  --danger: #b5432f;
  --red-suit: #d4261c;
  --black-suit: #1d1d1d;
  --card: #fffdf8;
  --card-face: #fbfaf6;
  --card-neg: #f3dcd6;
  --wild: #34536b;
  --select: #e8a33a;
  --suggest: rgb(232 163 58 / 0.6);
  --opp: #c27a3c;
  --radius: 10px;
  --shadow: 0 2px 6px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--table);
  color: var(--maple-2);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  min-height: 100vh;
  background-color: var(--table);
  background-image:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgb(255 214 160 / 0.2), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 180px, rgb(0 0 0 / 0.14) 180px 182px),
    repeating-linear-gradient(90deg, rgb(255 236 205 / 0.025) 0 1px, transparent 1px 7px, rgb(0 0 0 / 0.03) 7px 9px, transparent 9px 23px),
    linear-gradient(180deg, #5c432b, #4a3522 45%, #3f2d1d);
  background-attachment: fixed;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--table-2);
  border-bottom: 1px solid rgb(255 255 255 / 0.06);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
}
/* Paints the phone's status-bar area above the sticky bar. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--table-2);
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.amp { color: var(--muted); font-weight: 400; }
.conn { font-size: 13px; color: var(--muted); }
.conn.ok { color: #7fc8a9; }
.conn.bad { color: #f0a08f; }

main {
  max-width: 1100px; margin: 0 auto;
  padding-block: 16px calc(24px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.panel {
  background: var(--maple);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.panel .muted { color: #7a5f45; }

.grid { display: grid; gap: 14px; }

label { display: block; font-size: 14px; margin: 8px 0 4px; }
input[type="text"], select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #b89a74;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 160px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 14px; }

button {
  font: inherit;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  min-height: 44px;
}
button.secondary { background: #c9ad86; color: var(--ink); }
button.ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.45; cursor: default; }

.seats { list-style: none; margin: 8px 0; padding: 0; }
.seats li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid rgb(0 0 0 / 0.08);
}
.badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 999px; background: var(--burn); color: var(--maple-2);
}
.badge.light { background: #c9ad86; color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3fa37d; display: inline-block; }
.dot.off { background: #b9a48a; }
.code { font: 700 28px/1 ui-monospace, Menlo, monospace; letter-spacing: 0.15em; }

/* Game */
.status {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.step-label { font-weight: 700; font-size: 18px; }
.timer { font: 700 18px ui-monospace, Menlo, monospace; color: #f3c77a; }
.timer.low { color: #ff8a73; }

.prompt {
  background: var(--accent); color: #fff; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px;
}
.prompt.waiting { background: var(--table-2); color: var(--maple-2); }

.players { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 14px; }
.player {
  background: var(--maple); color: var(--ink); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
  border: 3px solid transparent;
}
.player.you { border-color: var(--accent); }
.player.thinking .pname::after { content: " · deciding…"; color: #7a5f45; font-weight: 400; font-size: 13px; }
.player .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pname { font-weight: 700; }
.laid-total { font: 700 26px/1 ui-monospace, Menlo, monospace; color: var(--burn); }
.meta { font-size: 12px; color: #7a5f45; }
.minirow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tokens { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.token {
  font: 700 12px ui-monospace, Menlo, monospace; border-radius: 999px; padding: 2px 7px;
  background: var(--burn); color: var(--maple-2);
}

.hand-area { background: var(--table-2); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.private-board { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; margin-bottom: 10px; }
.private-board .big { font: 700 22px ui-monospace, Menlo, monospace; color: #f3c77a; }

/* Cards: drawn like the printed decks. Sizes come from --w; inner parts use cqw (percent of card width). */
.cards { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.card {
  --w: 64px;
  position: relative; flex: none;
  width: var(--w); height: calc(var(--w) * 1.4); min-height: 0;
  container-type: inline-size;
  border: 0; padding: 0; margin: 0;
  border-radius: calc(var(--w) * 0.055);
  background: var(--card-face); color: var(--black-suit);
  box-shadow: var(--shadow);
  font-family: Arimo, Arial, "Helvetica Neue", sans-serif; font-weight: 400;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.26, 1), box-shadow 0.28s ease;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
/* The printed card art (cut at the trim line). Small cards show the top-left corner, like a fanned hand. */
.card.art { background-color: #fff; background-position: center; background-size: 100% 100%; background-repeat: no-repeat; }
.card.small.art { background-size: 250% auto; background-position: 0 0; }
.card svg { fill: currentColor; display: block; }
.card.red { color: var(--red-suit); }
.card.drawn::before {
  content: ""; position: absolute; inset: 4.5cqw; border: 1px solid #9a948c; border-radius: 5cqw; pointer-events: none;
}
.card .idx {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 1cqw;
  font-size: 21cqw; line-height: 1; letter-spacing: -0.04em;
}
.card .idx svg { width: 13cqw; height: 13cqw; }
.card .idx.tl { left: 7cqw; top: 8cqw; }
.card .idx.br { right: 7cqw; bottom: 8cqw; transform: rotate(180deg); }
.card .val { position: absolute; font-size: 14cqw; line-height: 1; color: #1d1d1d; }
.card .val.tr { right: 9cqw; top: 9cqw; }
.card .val.bl { left: 9cqw; bottom: 9cqw; transform: rotate(180deg); }
.card .center { position: absolute; left: 50%; top: 50%; width: 38cqw; height: 38cqw; transform: translate(-50%, -50%); }
.card .center.court { width: 50cqw; height: 50cqw; }
.card .pips { position: absolute; left: 25cqw; right: 25cqw; top: 15%; bottom: 15%; }
.card .pip { position: absolute; width: 19cqw; height: 19cqw; transform: translate(-50%, -50%); }
.card .pip.flip { transform: translate(-50%, -50%) rotate(180deg); }
.card .tag {
  position: absolute; left: 50%; transform: translateX(-50%);
  font: 700 11cqw/1 Arimo, Arial, sans-serif; letter-spacing: 0.06em; white-space: nowrap;
  padding: 2cqw 5cqw; border-radius: 99px; color: #fff;
}
.card .wild-tag { bottom: 22%; background: var(--wild); }
.card .neg-tag { top: 4cqw; background: var(--danger); font-size: 16cqw; }
.card.neg { background: var(--card-neg); }
.card.big { --w: 112px; }
.card.big .idx { font-size: 16cqw; }
.card.big .idx svg { width: 10cqw; height: 10cqw; }
.card.big .val { font-size: 12cqw; }

.card.small { --w: 40px; }
.card.small::before { display: none; }
.card.small .idx { font-size: 30cqw; gap: 0; left: 8cqw; top: 6cqw; }
.card.small .idx svg { display: none; }
.card.small .center { width: 46cqw; height: 46cqw; top: 64%; }
.card.small .tag { font-size: 22cqw; padding: 2cqw 6cqw; letter-spacing: 0; }
.card.small .wild-tag { bottom: auto; top: 6cqw; left: auto; right: 4cqw; transform: none; }
.card.small .neg-tag { top: auto; bottom: 4cqw; font-size: 26cqw; }

.card.selected { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--select), var(--shadow); }
.card.suggest { box-shadow: 0 0 0 3px var(--suggest), var(--shadow); }
.card.opp { outline: 2px dashed var(--opp); outline-offset: 2px; }

.card.back { background: #2a2420 center / cover no-repeat; }
.card.back.wv { background-image: url(/img/cards/wolverine/back.webp); }

button.card { cursor: pointer; min-height: 0; }
button.card:disabled { opacity: 1; }
button.card:focus-visible { outline: 3px solid var(--select); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* Home */
.game-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.game-head .mark { width: 72px; height: 72px; object-fit: contain; flex: none; }
.game-head > div { min-width: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.chip { padding: 6px 10px; min-height: 36px; background: #c9ad86; color: var(--ink); }
.chip.on { background: var(--accent); color: #fff; }

.log { max-height: 260px; overflow: auto; font-size: 14px; }
.log div { padding: 3px 0; border-bottom: 1px solid rgb(0 0 0 / 0.06); }
.log .private { color: var(--accent); }

.results table { width: 100%; border-collapse: collapse; }
.results th, .results td { text-align: left; padding: 6px 4px; border-bottom: 1px solid rgb(0 0 0 / 0.1); }
.results .win { font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: #1b120c; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px); z-index: 10;
}
.toast.error { background: var(--danger); }

/* Coach and tutorial */
.coach {
  background: var(--maple-2); color: var(--ink); border-radius: var(--radius); padding: 12px 14px;
  border: 2px solid #e8a33a; margin-bottom: 12px; box-shadow: var(--shadow);
}
.coach .coach-title { font-weight: 700; margin-bottom: 4px; }
.coach p { margin: 0 0 6px; }
.coach .checklist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.coach .checklist li { padding: 3px 8px; border-radius: 999px; background: #e3cba3; }
.coach .checklist li.now { background: var(--accent); color: #fff; }
.coach .checklist li.done { background: #d9bd92; color: #4a2a14; }
.tutorial h2 { font-size: 24px; }
.tutorial p { font-size: 16px; line-height: 1.5; }

/* Top bar: chat button */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.chat-btn {
  min-height: 34px; padding: 6px 12px; background: var(--maple); color: var(--ink); font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chat-btn .unread {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff;
  font: 700 12px/20px system-ui, sans-serif; text-align: center;
}

/* Chat drawer: a bottom sheet on phones, a side panel on wider screens */
.chat {
  position: fixed; z-index: 20; display: flex; flex-direction: column; gap: 8px;
  background: var(--maple-2); color: var(--ink); box-shadow: 0 -4px 24px rgb(0 0 0 / 0.45);
  left: 0; right: 0; bottom: 0; max-height: min(70vh, 560px);
  border-radius: 14px 14px 0 0;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.chat[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; }
.chat-head h2 { margin: 0; font-size: 18px; }
.chat-head .ghost { min-height: 36px; padding: 6px 12px; }
.chat-people { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-people[hidden] { display: none; }
.chat-list {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid #d9c3a0; border-radius: 10px; padding: 10px;
}
.msg { max-width: 85%; align-self: flex-start; background: #efe2cb; border-radius: 12px 12px 12px 4px; padding: 6px 10px; overflow-wrap: anywhere; }
.msg .who { display: block; font-size: 12px; font-weight: 700; color: var(--burn); }
.msg.mine { align-self: flex-end; background: #d6ebe5; border-radius: 12px 12px 4px 12px; }
.msg.reaction .text { font-size: 15px; }
.chat-reactions { display: flex; gap: 6px; flex-wrap: wrap; }
.react-btn { min-height: 40px; min-width: 44px; padding: 4px 8px; font-size: 20px; background: #e3cba3; color: var(--ink); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1 1 auto; min-width: 0; }

/* New-message preview while the chat is closed */
.chat-peek {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%);
  top: calc(56px + env(safe-area-inset-top, 0px)); max-width: min(92vw, 420px);
  background: var(--maple-2); color: var(--ink); border-radius: 999px; padding: 8px 14px; min-height: 0;
  box-shadow: var(--shadow); font-size: 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* A reaction shown over a player's name */
.bubble {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--maple-2); color: var(--ink); border: 1px solid #d9b98a; font-size: 13px; font-weight: 400;
  animation: pop 0.4s cubic-bezier(0.3, 1.4, 0.5, 1);
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Standings strip */
.scores { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.score {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  background: var(--table-2); border: 1px solid rgb(255 255 255 / 0.08); font-size: 14px; min-width: 0;
}
.score.you { border-color: var(--accent); }
.score .sname { max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .stotal { font: 700 16px ui-monospace, Menlo, monospace; color: #f3c77a; font-variant-numeric: tabular-nums; }
.score .swins { font-size: 12px; color: var(--muted); }
.score .bubble { margin-left: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7fc8a9; flex: none; }
.status-dot.thinking { background: #f3c77a; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* What just happened */
.recap {
  background: var(--table-2); border: 1px solid rgb(243 199 122 / 0.35); border-radius: var(--radius);
  padding: 8px 12px; margin-bottom: 12px; font-size: 14px;
}
.recap-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: #f3c77a; margin-bottom: 4px; }
.recap ul { margin: 0; padding-left: 18px; }
.recap li.private { color: #9fe0c9; }

/* Cards that just arrived in your hand */
.card.new { box-shadow: 0 0 0 3px #3fb59a, var(--shadow); }
.card.new .new-dot { position: absolute; left: 50%; bottom: 5cqw; width: 12cqw; height: 12cqw; transform: translateX(-50%); border-radius: 50%; background: #3fb59a; }
.card.suggest { box-shadow: 0 0 0 3px var(--suggest), var(--shadow); }
.card.selected { z-index: 2; box-shadow: 0 0 0 3px var(--select), var(--shadow); }

/* Your action buttons stay in reach */
.task-box {
  position: sticky; bottom: 0; z-index: 3;
  margin: 12px -12px -12px; padding: 4px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--table-2); border-top: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 0 0 var(--radius) var(--radius);
}

.on-target {
  margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}

.task-box .drawn .card { --w: 52px; }

/* Motion: cards arrive, a new summary fades in. Elements are kept between updates, so these play once. */
@keyframes card-in { from { transform: translateY(-14px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.hand-cards .card { animation: card-in 0.5s cubic-bezier(0.22, 0.8, 0.26, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.minirow .card { animation: card-in 0.5s cubic-bezier(0.22, 0.8, 0.26, 1) both; }
.recap { animation: fade-in 0.45s ease-out both; }
.card.selected { transform: translateY(-10px); }
@media (prefers-reduced-motion: reduce) {
  .hand-cards .card, .minirow .card, .recap, .bubble { animation: none; }
}
.tap-hint { margin: 6px 0 0; }

/* Home: a few cards from each deck */
.fan { display: flex; padding: 4px 0 16px 20px; margin-bottom: 4px; }
.fan .card { --w: 72px; margin-left: -20px; }
.fan .card:nth-child(1) { transform: rotate(-9deg) translateY(8px); }
.fan .card:nth-child(2) { transform: rotate(-3deg) translateY(1px); }
.fan .card:nth-child(3) { transform: rotate(3deg) translateY(1px); }
.fan .card:nth-child(4) { transform: rotate(9deg) translateY(8px); }
.fan button.card:hover { transform: translateY(-6px); z-index: 1; }

/* Card close-up */
.zoom {
  position: fixed; inset: 0; z-index: 40; background: rgb(15 10 6 / 0.78);
  display: flex; align-items: center; justify-content: center; animation: fade-in 0.3s ease-out;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.zoom[hidden] { display: none; }
.zoom-box {
  display: flex; flex-wrap: wrap; gap: 18px 22px; align-items: center; justify-content: center;
  max-width: 700px; max-height: 100%; overflow: auto;
  background: var(--maple-2); color: var(--ink); border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
}
.zoom-card { width: min(66vw, 300px); height: auto; max-width: 100%; border-radius: 14px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.4); display: block; animation: zoom-in 0.4s cubic-bezier(0.22, 0.8, 0.26, 1) both; }
@keyframes zoom-in { from { opacity: 0; transform: scale(0.85) rotate(-2deg); } to { opacity: 1; transform: none; } }
html[data-layout="desktop"] .zoom-box { max-width: 900px; }
html[data-layout="desktop"] .zoom-card { width: min(40vw, 440px, calc((100vh - 80px) / 1.4)); }
html[data-layout="desktop"] .zoom-fact { font-size: 21px; }
.zoom-box > .card { --w: min(66vw, 260px); }
.zoom-info { flex: 1 1 220px; min-width: 0; }
.zoom-info h2 { font-size: 22px; text-wrap: balance; }
.zoom-fact { font-size: 18px; line-height: 1.45; margin: 10px 0; }
.fact-label {
  display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--burn); margin-bottom: 2px;
}
.recap-fact {
  display: block; width: 100%; text-align: left; margin-top: 8px; min-height: 0; padding: 8px 10px;
  background: rgb(243 199 122 / 0.12); color: var(--maple-2); border: 1px solid rgb(243 199 122 / 0.3); border-radius: 8px; font-size: 14px;
}
.recap-fact .fact-label { color: #f3c77a; }


/* ================================================================== layouts
   html[data-layout] is "mobile" or "desktop": picked from the screen width, or chosen with the
   Phone/Desktop button in the top bar. Each layout is built for its own screen. */

.top-btn {
  min-height: 34px; padding: 6px 12px; font-size: 14px; background: transparent; color: var(--maple-2);
  border: 1px solid rgb(244 230 204 / 0.35);
}
.top-btn[hidden], .chat-btn[hidden] { display: none; }
/* Small screens: keep the top bar to the essentials whichever layout is showing. */
@media (max-width: 760px) {
  .conn.ok { display: none; }
  .brand { font-size: 14px; }
  .topbar-right { gap: 8px; }
}
.brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { gap: 12px; }
.log-panel summary { cursor: pointer; font-weight: 700; }
.log-panel summary + .log { margin-top: 8px; }

/* ---- Desktop: the table fills the screen ---- */
html[data-layout="desktop"] .grid.two { grid-template-columns: 1fr 1fr; }
html[data-layout="desktop"] #app[data-screen="game"] { max-width: 1680px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
html[data-layout="desktop"] .game-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 400px); gap: 18px; align-items: start;
}
html[data-layout="desktop"] .table-main { min-width: 0; }
html[data-layout="desktop"] .table-side {
  position: sticky; top: calc(62px + env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 78px); min-width: 0;
}
html[data-layout="desktop"] .table-side .players { grid-template-columns: 1fr; margin: 0; }
html[data-layout="desktop"] .table-side .log-panel { flex: 1 1 auto; min-height: 160px; display: flex; flex-direction: column; margin: 0; }
html[data-layout="desktop"] .table-side .log { max-height: none; flex: 1 1 auto; overflow-y: auto; }
html[data-layout="desktop"] .opponents { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
html[data-layout="desktop"] .opponents[data-count="1"] { grid-template-columns: minmax(240px, 520px); }
html[data-layout="desktop"] .minirow .card.small { --w: 46px; }
html[data-layout="desktop"] .task-box .drawn .card { --w: 70px; }
html[data-layout="desktop"] .hand-cards { gap: 0; padding-left: calc(var(--hand-w, 96px) * 0.3); padding-top: 14px; }
html[data-layout="desktop"] .hand-cards .card { margin-left: calc(var(--w) * -0.3); }
html[data-layout="desktop"] .hand-cards button.card:not(.selected):hover { transform: translateY(-6px); z-index: 1; }
html[data-layout="desktop"] .private-board .big { font-size: 26px; }
html[data-layout="desktop"] .chat {
  left: auto; top: 0; width: 340px; max-height: none; border-radius: 0;
  padding-top: calc(60px + env(safe-area-inset-top, 0px));
  box-shadow: -4px 0 24px rgb(0 0 0 / 0.45);
}
html[data-layout="desktop"] body.chat-open main { margin-right: 356px; }
html[data-layout="desktop"] body.chat-open .topbar { z-index: 25; }

/* ---- Phone: one column, the hand held like real cards, buttons within thumb reach ---- */
html[data-layout="mobile"] #app { max-width: 480px; }
html[data-layout="mobile"] .brand { font-size: 14px; }
html[data-layout="mobile"] .topbar-right { gap: 8px; }
html[data-layout="mobile"] .conn.ok { display: none; }
html[data-layout="mobile"] .players { grid-template-columns: 1fr; }
html[data-layout="mobile"] .hand-cards { gap: 0; row-gap: 12px; padding-left: 30px; padding-top: 8px; }
html[data-layout="mobile"] .hand-cards .card { --w: 68px; margin-left: -30px; }
html[data-layout="mobile"] .hand-cards .card .wild-tag { left: 4cqw; transform: none; bottom: 34%; }
html[data-layout="mobile"] .hand-cards .card .new-dot { left: 12cqw; }
html[data-layout="mobile"] .status { margin-bottom: 8px; }
html[data-layout="mobile"] .status .row button { min-height: 36px; padding: 6px 12px; font-size: 14px; }
html[data-layout="mobile"] .private-board { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 2px 16px; }
html[data-layout="mobile"] .private-board .big { font-size: 20px; }
html[data-layout="mobile"] .task-box .actions { margin-top: 8px; }
html[data-layout="mobile"] .task-box .actions button { padding: 8px 12px; min-height: 40px; }
html[data-layout="mobile"] .chat { max-width: 480px; margin: 0 auto; }

/* ================================================================== the table
   Everyone sits around one oak table in turn order (clockwise from your left), you on the near
   side. Each player's laid row lies on the table in front of their name plate; the deck and the
   current step lie on the felt runner down the middle. Like the Justice and Mercy table. */

#app[data-game="wolverine42"] { --row-w: 58px; --hand-w: clamp(132px, 10.5vw, 184px); }

.status { align-items: center; }
.status .game-title { font-weight: 800; font-size: 17px; }
.status-text { min-width: 0; }

.banquet {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "far far far" "left table right" "near near near";
  align-items: center;
  margin: 8px 0 22px;
  --row-h: calc(var(--row-w, 46px) * 1.4 + 8px);
}
/* Seats overlap the table so each laid row lies on the table in front of its plate. */
.bq-far { grid-area: far; display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin-bottom: calc(-1 * var(--row-h) - 14px); position: relative; z-index: 2; min-width: 0; }
.bq-near { grid-area: near; display: flex; justify-content: center; margin-top: calc(-1 * var(--row-h) - 14px); position: relative; z-index: 2; min-width: 0; }
.bq-left { grid-area: left; position: relative; z-index: 2; margin-right: -150px; }
.bq-right { grid-area: right; position: relative; z-index: 2; margin-left: -150px; }
/* Two players at each end (big tables). */
.bq-left, .bq-right { display: flex; flex-direction: column; gap: 18px; }
.bq-table, .table-phone {
  background:
    repeating-linear-gradient(180deg, rgb(0 0 0 / 0.14) 0 2px, transparent 2px 72px),
    repeating-linear-gradient(90deg, rgb(255 238 210 / 0.05) 0 2px, transparent 2px 13px),
    linear-gradient(180deg, #a87d50, #94693f 50%, #7f5a37);
}
.bq-table {
  grid-area: table;
  position: relative;
  min-width: 0;
  min-height: 300px;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--row-h) + 26px) 40px;
  border-radius: 28px;
  box-shadow: 0 0 0 7px #3b2716, 0 0 0 9px #b8925a, 0 30px 60px rgb(0 0 0 / 0.42), inset 0 2px 30px rgb(0 0 0 / 0.3);
}
/* The felt runner down the length of the table. */
.bq-table::before {
  content: ""; position: absolute; left: 0; right: 0; top: 30%; bottom: 30%;
  background: linear-gradient(180deg, #317567, #255c50);
  border-top: 3px double var(--brass); border-bottom: 3px double var(--brass);
  box-shadow: 0 6px 12px rgb(0 0 0 / 0.28);
}
.table-center { position: relative; display: flex; align-items: center; justify-content: center; gap: 22px; width: 100%; min-width: 0; }

/* Seats */
.seat { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
.banquet.has-ends .bq-table { padding-left: 176px; padding-right: 176px; }
.seat-end { width: 196px; }
.seat-far { width: auto; min-width: 200px; max-width: 440px; flex: 0 1 auto; }
.seat-near { width: auto; min-width: 300px; max-width: 520px; }
.seat-far .seat-row, .seat-near .seat-row { flex-wrap: nowrap; }
.seat-row {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 5px;
  min-height: calc(var(--row-w, 46px) * 1.4 + 8px); padding: 4px 6px; min-width: 0;
}
.seat-row .card.small { --w: var(--row-w, 46px); }
.seat-row { gap: 0; padding-left: calc(6px + var(--row-w) * 0.3); }
.seat-row .card.small { margin-left: calc(var(--row-w) * -0.3); }
.row-empty { align-self: center; font-size: 12px; font-style: italic; color: rgb(255 244 222 / 0.72); }
.plate {
  position: relative; color: var(--ink);
  padding: 7px 10px 8px; border-radius: 10px;
  background: linear-gradient(180deg, #fbf4e5, #efe0c3);
  box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.42), 0 6px 14px rgb(0 0 0 / 0.32);
  transition: box-shadow 0.25s ease;
}
.seat.you .plate { background: linear-gradient(180deg, #fffaf0, #f3e7cd); }
.plate-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.plate .pname { font-weight: 800; font-size: 15px; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate-total { margin-left: auto; font: 800 24px/1 ui-monospace, Menlo, monospace; color: var(--burn); font-variant-numeric: tabular-nums; }
.plate-meta { font-size: 12px; color: #6f5741; margin-top: 2px; }
.plate-pair { font-size: 12px; color: #6f5741; margin-top: 1px; }
.plate-pair.mine { color: #1f6a5b; font-weight: 700; }
.plate-wins { font-size: 12px; color: #8a6a2c; }
.plate .tokens { margin-top: 4px; }
.plate .bubble { position: absolute; top: -16px; right: 8px; margin: 0; }
.dealer-chip { flex: none; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font: 800 11px/1 system-ui, sans-serif; color: #fff4e2; background: var(--burn); }
.seat.deciding .plate { box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.42), 0 0 0 2px #e9b85c, 0 0 22px rgb(255 192 96 / 0.5), 0 6px 14px rgb(0 0 0 / 0.32); }
.seat.partner .plate { box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.42), 0 0 0 3px #3a9a85, 0 0 24px rgb(58 154 133 / 0.55), 0 6px 14px rgb(0 0 0 / 0.32); }

/* The deck and the step card on the runner */
.deck-pile { flex: none; display: grid; justify-items: center; gap: 3px; color: #fff4de; text-shadow: 0 1px 0 rgb(0 0 0 / 0.5); }
.deck-stack .card { --w: 62px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4), 2px 2px 0 #efe3c8, 3px 3px 0 rgb(0 0 0 / 0.3), 4px 4px 0 #e6d7b8, 5px 5px 0 rgb(0 0 0 / 0.3), 6px 8px 12px rgb(0 0 0 / 0.38); }
.deck-count { font: 800 20px/1 ui-monospace, Menlo, monospace; margin-top: 4px; }
.deck-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.9; }
.step-card {
  position: relative; flex: 1 1 320px; max-width: 540px; min-width: 0;
  color: var(--ink); border-radius: 12px; padding: 14px 16px 14px;
  background: linear-gradient(180deg, #fdf8ec, #f1e4c9);
  box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.45), 0 12px 28px rgb(0 0 0 / 0.38);
}
.step-card.your-move { box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.45), 0 0 0 3px #3a9a85, 0 0 30px rgb(58 154 133 / 0.45), 0 12px 28px rgb(0 0 0 / 0.38); }
.step-card .step-label { font-weight: 800; font-size: 19px; line-height: 1.2; margin-bottom: 6px; padding-right: 92px; text-wrap: balance; }
.move-seal {
  position: absolute; top: -13px; right: 12px; transform: rotate(-4deg);
  padding: 6px 11px; border-radius: 999px; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 12px; letter-spacing: 0.03em; box-shadow: 0 3px 8px rgb(0 0 0 / 0.35);
}
.step-card .prompt { background: none; color: var(--ink); padding: 0; margin: 0; border-radius: 0; font-size: 16px; line-height: 1.45; }
.step-card .prompt.waiting { background: none; color: #6a5440; font-style: italic; }
.step-card .recap { margin: 10px 0 0; max-height: 210px; overflow: hidden; background: rgb(255 255 255 / 0.55); border: 1px solid rgb(120 86 36 / 0.25); color: var(--ink); }
.step-card .recap-title { color: var(--burn); }
.step-card .recap li.private { color: #1d6a5a; font-weight: 600; }
.step-card .recap .muted { color: #7a6048; }
.step-card .recap-fact { background: #fffaf0; color: var(--ink); border: 1px solid rgb(120 86 36 / 0.3); }
.step-card .recap-fact .fact-label { color: var(--burn); }

/* Your hand, below the table */
.hand-area { background: rgb(50 34 21 / 0.62); box-shadow: inset 0 0 0 1px rgb(255 235 200 / 0.08); }
.log-note { margin: -4px 0 6px; }

/* Desktop sizes: bigger cards, Wolverine's six cards side by side */
html[data-layout="desktop"] .hand-area .card:not(.small) { --w: var(--hand-w); }
html[data-layout="desktop"] .hand-area .task-box .drawn .card { --w: calc(var(--hand-w) * 0.62); }
html[data-layout="desktop"] #app[data-game="wolverine42"] .hand-cards { gap: 14px; padding-left: 0; }
html[data-layout="desktop"] #app[data-game="wolverine42"] .hand-cards .card { margin-left: 0; }
html[data-layout="desktop"] .game-grid { grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 360px); }

/* Phone: the same table, top to bottom */
.table-phone {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 10px; margin: 6px 0 16px; border-radius: 18px;
  box-shadow: 0 0 0 5px #3b2716, 0 0 0 7px #b8925a, 0 16px 30px rgb(0 0 0 / 0.38);
}
.tp-seats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.tp-seats.one { grid-template-columns: minmax(0, 1fr); }
.table-phone .seat { width: auto; }
.table-phone .table-center {
  flex-direction: column; gap: 8px; margin: 0 -10px; padding: 12px 10px;
  background: linear-gradient(180deg, #317567, #255c50);
  border-top: 3px double var(--brass); border-bottom: 3px double var(--brass);
}
.table-phone .deck-pile { display: flex; align-items: center; gap: 8px; }
.table-phone .deck-stack .card { --w: 30px; }
.table-phone .deck-count { margin: 0; font-size: 16px; }
.table-phone .step-card { flex: none; width: 100%; max-width: none; padding: 10px 12px; }
.table-phone .step-card .step-label { font-size: 16px; padding-right: 86px; }
.table-phone .step-card .prompt { font-size: 15px; }
.table-phone .plate { padding: 6px 8px 7px; }
.table-phone .plate .pname { font-size: 14px; }
.table-phone .plate-total { font-size: 20px; }
.table-phone .seat-row { padding: 2px; }
#app[data-game="wolverine42"] .table-phone { --row-w: 40px; }
#app[data-game="wolverine42"] .table-phone .seat-near { --row-w: 48px; }
html[data-layout="mobile"] #app[data-game="wolverine42"] .hand-cards { --hw: min(100px, calc((100vw - 60px) / 3.5)); padding-left: calc(var(--hw) * 0.45); flex-wrap: nowrap; }
html[data-layout="mobile"] #app[data-game="wolverine42"] .hand-cards .card { --w: var(--hw); margin-left: calc(var(--hw) * -0.45); }

/* Phone plates: just what matters at a glance */
.table-phone .plate-meta { display: none; }
.table-phone .plate-pair:not(.mine) { display: none; }
.table-phone .plate .tokens { margin-top: 2px; }

/* ---------------------------------------------------------------- characters */
.ctoken {
  --t: 30px;
  flex: none; display: inline-grid; place-items: center; width: var(--t); height: var(--t); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e2bd, #d9b47c 62%, #b98c50);
  box-shadow: inset 0 0 0 2px #8a5f2e, inset 0 0 0 4px #e9cf9f, 0 2px 4px rgb(0 0 0 / 0.35);
  overflow: hidden; vertical-align: middle;
}
.ctoken .cemoji { font-size: calc(var(--t) * 0.58); line-height: 1; filter: saturate(0.85); }
.ctoken.mark img { width: 74%; height: 74%; object-fit: contain; filter: sepia(0.6) contrast(1.1); }
.ctoken.empty { background: rgb(255 255 255 / 0.15); box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.25); }
.ctoken.small { --t: 24px; margin-right: 2px; }
.ctoken.tiny { --t: 18px; margin-right: 5px; box-shadow: inset 0 0 0 1px #8a5f2e; }
.token-wrap { position: relative; flex: none; display: inline-flex; }
.token-wrap .status-dot { position: absolute; right: -2px; bottom: -1px; width: 10px; height: 10px; box-shadow: 0 0 0 2px #fbf4e5; }
.table-phone .ctoken { --t: 24px; }
.seat-near .ctoken { --t: 34px; }

.char-pick { margin-top: 12px; }
.char-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.label-like { font-size: 14px; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.char-btn {
  display: grid; justify-items: center; gap: 3px; min-height: 0; padding: 7px 4px 6px;
  background: rgb(255 255 255 / 0.06); color: inherit; border: 1px solid rgb(255 255 255 / 0.1); border-radius: 12px;
  transition: transform 0.25s cubic-bezier(0.22, 0.8, 0.26, 1), background 0.25s ease, border-color 0.25s ease;
}
.char-btn .ctoken { --t: 40px; }
.char-btn .char-name { font-size: 11px; line-height: 1.1; text-align: center; }
.char-btn:hover { transform: translateY(-2px); }
.char-btn.on { background: rgb(63 181 154 / 0.18); border-color: #3fb59a; }
.char-btn.on .ctoken { box-shadow: inset 0 0 0 2px #8a5f2e, inset 0 0 0 4px #e9cf9f, 0 0 0 3px #3fb59a, 0 2px 6px rgb(0 0 0 / 0.4); }
.seats li { display: flex; align-items: center; gap: 8px; }
.msg .who { display: flex; align-items: center; }

/* ---------------------------------------------------------------- trash talk */
.taunt-tray { border: 1px solid #d9c3a0; border-radius: 10px; padding: 4px 8px 8px; background: rgb(255 255 255 / 0.35); }
.taunt-tray summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--burn); padding: 4px 0; }
.taunts, .talk-lines { display: flex; flex-wrap: wrap; gap: 6px; max-height: 148px; overflow-y: auto; }
.taunt {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 10px; border-radius: 999px;
  background: #f3e3c4; color: var(--ink); border: 1px solid #d6b98a; font-size: 13px; font-weight: 600; text-align: left;
}
.taunt.themed { background: #dcefe8; border-color: #8cc8b5; }
.taunt .temoji { font-size: 16px; }
.msg.taunt { background: #fff1d6; border: 1px solid #ebcf98; }
.msg.mine.taunt { background: #d6ebe5; border-color: #9fd2c3; }
.bubble.taunt { max-width: 240px; white-space: normal; line-height: 1.25; font-weight: 600; border-radius: 12px; padding: 5px 10px; box-shadow: 0 6px 14px rgb(0 0 0 / 0.3); }
.plate .bubble.taunt { top: auto; bottom: calc(100% + 6px); right: -4px; z-index: 6; }
.plate .bubble.taunt::after { content: ""; position: absolute; right: 22px; bottom: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--maple-2); }
.talk-btn {
  position: absolute; right: -10px; bottom: -10px; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%;
  background: var(--maple-2); color: var(--ink); font-size: 16px; box-shadow: 0 0 0 1px #c9a46d, 0 3px 8px rgb(0 0 0 / 0.35); z-index: 3;
}
.talk-wrap { position: static; }
.talk-pop {
  position: absolute; z-index: 8; right: -8px; bottom: calc(100% + 10px); width: min(360px, 86vw);
  display: grid; gap: 8px; padding: 10px; border-radius: 14px; background: var(--maple-2); color: var(--ink);
  box-shadow: 0 0 0 1px #c9a46d, 0 16px 34px rgb(0 0 0 / 0.45);
  animation: fade-in 0.3s ease-out both; transform-origin: bottom right;
}
.talk-reacts { display: flex; flex-wrap: wrap; gap: 5px; }
.talk-reacts .react-btn { min-height: 36px; min-width: 40px; font-size: 18px; }
.table-phone .talk-pop { right: -4px; }

/* ---------------------------------------------------------------- your move: light up what to act on */
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.hand-area { position: relative; }
.hand-area::before {
  content: ""; position: absolute; inset: -3px; border-radius: calc(var(--radius) + 3px); pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 3px #f3c77a, 0 0 30px 6px rgb(243 199 122 / 0.5);
  transition: opacity 0.6s ease;
}
.hand-area.cue-pick::before { animation: breathe 2.6s ease-in-out infinite; }
.hand-area.cue-act::before { opacity: 0.35; box-shadow: 0 0 0 2px #3fb59a, 0 0 22px 2px rgb(63 181 154 / 0.35); }
.hand-cue {
  display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; padding: 7px 12px; border-radius: 10px;
  background: linear-gradient(90deg, rgb(243 199 122 / 0.22), rgb(243 199 122 / 0.06)); color: #ffe7b8;
  font-weight: 700; font-size: 15px; animation: fade-in 0.45s ease-out both;
}
.hand-area.cue-act .hand-cue { background: linear-gradient(90deg, rgb(63 181 154 / 0.26), rgb(63 181 154 / 0.06)); color: #c9f1e4; }
.cue-arrow { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #f3c77a; color: #3b2716; font-size: 15px; flex: none; }
.hand-area.cue-pick .cue-arrow { animation: nudge 1.3s ease-in-out infinite; }
.hand-area.cue-act .cue-arrow { background: #3fb59a; color: #fff; }
.hand-area.cue-pick .hand-cards button.card:hover { transform: translateY(-8px); }

/* The buttons that finish your move */
.task-box .actions button.cta { position: relative; }
.task-box .actions button.cta::after {
  content: ""; position: absolute; inset: -4px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px #f3c77a, 0 0 18px 3px rgb(243 199 122 / 0.6); animation: breathe 1.8s ease-in-out infinite;
}
.hand-area.cue-pick .task-box .actions button.cta::after { animation: none; opacity: 0; }

/* Where your card will go */
.slot-ghost {
  position: relative; flex: none; width: var(--row-w, 46px); height: calc(var(--row-w, 46px) * 1.4); margin-left: 6px;
  display: grid; place-items: center; border-radius: calc(var(--row-w, 46px) * 0.08);
  border: 2px dashed rgb(255 231 184 / 0.9); background: rgb(255 231 184 / 0.12);
}
.slot-ghost::after { content: ""; position: absolute; inset: -5px; border-radius: 8px; box-shadow: 0 0 16px 3px rgb(243 199 122 / 0.65); animation: breathe 2.2s ease-in-out infinite; pointer-events: none; }
.slot-ghost .slot-plus { color: #ffe7b8; font: 800 22px/1 system-ui, sans-serif; }
.slot-ghost.filled { border-style: solid; border-color: #3fb59a; }
.slot-ghost.filled .card { margin: 0 !important; opacity: 0.8; --w: calc(var(--row-w, 46px) - 4px) !important; }
.slot-ghost.filled::after { box-shadow: 0 0 16px 3px rgb(63 181 154 / 0.7); }
.seat-row .slot-ghost { margin-left: calc(var(--row-w) * -0.3 + 6px); }
.seat-row:not(:has(.card)) .slot-ghost { margin-left: 0; }

/* The partner you're trading with, the deck when you draw, the pile on your last card */
.seat.partner .plate::after {
  content: ""; position: absolute; inset: -4px; border-radius: 13px; pointer-events: none;
  box-shadow: 0 0 0 3px #3a9a85, 0 0 26px 4px rgb(58 154 133 / 0.6); animation: breathe 2.4s ease-in-out infinite;
}
.deck-pile.cue .deck-stack, .cards.pile.cue { position: relative; }
.deck-pile.cue .deck-stack::after, .cards.pile.cue::after {
  content: ""; position: absolute; inset: -6px; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 2px #f3c77a, 0 0 22px 4px rgb(243 199 122 / 0.6); animation: breathe 2.2s ease-in-out infinite;
}
.task-box .drawn .card { box-shadow: 0 0 0 3px #f3c77a, 0 0 18px 2px rgb(243 199 122 / 0.55), var(--shadow); }
.step-card.your-move .move-seal { animation: none; }
.timer.low { animation: blink 1s ease-in-out infinite; }

/* Cards in flight */
.card.flying { animation: none !important; z-index: 30; position: relative; will-change: transform; }
.ghost-fly { position: fixed !important; z-index: 60; margin: 0 !important; pointer-events: none; animation: none !important; will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) {
  .hand-area.cue-pick::before, .task-box .actions button.cta::after, .slot-ghost::after, .seat.partner .plate::after,
  .deck-pile.cue .deck-stack::after, .cards.pile.cue::after, .hand-area.cue-pick .cue-arrow, .timer.low { animation: none; opacity: 1; }
}

/* ---------------------------------------------------------------- learn to play: the animated walkthrough */
.walk { max-width: 1040px; margin-left: auto; margin-right: auto; }
.walk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.walk-head h2 { margin: 2px 0 0; }
.walk-dots { display: flex; gap: 6px; }
.walk-dot {
  width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; font-weight: 800; font-size: 13px;
  background: rgb(120 86 36 / 0.15); color: var(--ink); transition: background 0.35s ease, transform 0.35s ease;
}
.walk-dot.done { background: rgb(63 181 154 / 0.35); }
.walk-dot.on { background: var(--accent); color: #fff; transform: scale(1.12); }
.stage {
  --cw: 7cqw;
  position: relative; width: 100%; aspect-ratio: 16 / 10; container-type: size; overflow: hidden;
  border-radius: 22px; isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 45%, rgb(255 236 200 / 0.18), transparent 65%),
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.05) 0 2px, transparent 2px 70px),
    linear-gradient(180deg, #a87d50, #94693f 50%, #7f5a37);
  box-shadow: inset 0 0 0 6px #3b2716, inset 0 0 0 8px #b8925a, inset 0 2px 40px rgb(0 0 0 / 0.35);
}
.stage.phone { aspect-ratio: 4 / 5; }
.st-runner {
  position: absolute; left: 8px; right: 8px; top: 33%; bottom: 33%; z-index: 0;
  background: linear-gradient(180deg, #317567, #255c50);
  border-top: 3px double var(--brass); border-bottom: 3px double var(--brass);
}
.st-card {
  position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4);
  perspective: 900px;
  transform: translate(calc(var(--x) * 1cqw - 50%), calc(var(--y) * 1cqh - 50%)) rotate(var(--r, 0deg)) scale(var(--s, 1));
  transition: transform 0.95s cubic-bezier(0.22, 0.8, 0.26, 1);
  transition-delay: var(--d, 0ms);
  will-change: transform;
}
.st-flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.75s cubic-bezier(0.4, 0.1, 0.25, 1); transition-delay: var(--fd, 0ms); }
.st-card.down .st-flip { transform: rotateY(180deg); }
.st-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.st-back { transform: rotateY(180deg); }
.st-face .card { --w: var(--cw); box-shadow: 0 3px 8px rgb(0 0 0 / 0.35); }
.st-card.glow::after {
  content: ""; position: absolute; inset: -5px; border-radius: 9%; pointer-events: none;
  box-shadow: 0 0 0 3px #f3c77a, 0 0 22px 6px rgb(243 199 122 / 0.7);
  animation: breathe 2s ease-in-out infinite;
}
.st-card.tap { cursor: pointer; }
.st-card.tap::after { box-shadow: 0 0 0 3px #3fb59a, 0 0 26px 8px rgb(63 181 154 / 0.75); animation-duration: 1.4s; }
.st-card.tap:focus-visible { outline: 3px solid var(--select); outline-offset: 4px; }
.st-badge {
  position: absolute; left: 50%; top: -12px; transform: translateX(-50%); z-index: 2;
  min-width: 26px; padding: 2px 7px; border-radius: 999px; background: var(--burn); color: #fff4e2;
  font: 800 14px/1.2 ui-monospace, Menlo, monospace; text-align: center; box-shadow: 0 2px 6px rgb(0 0 0 / 0.4);
  animation: appear 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both 0.3s;
}
.st-seat {
  position: absolute; left: 0; top: 0; z-index: 70;
  transform: translate(calc(var(--x) * 1cqw - 50%), calc(var(--y) * 1cqh - 50%));
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px;
  background: linear-gradient(180deg, #fbf4e5, #efe0c3); color: var(--ink); font-weight: 800; font-size: 14px;
  box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.42), 0 4px 10px rgb(0 0 0 / 0.3);
  animation: appear 0.6s ease-out both;
}
@keyframes appear { from { opacity: 0; scale: 0.85; } to { opacity: 1; scale: 1; } }
.st-seat.glow { box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.42), 0 0 0 3px #3a9a85, 0 0 22px rgb(58 154 133 / 0.6); }
.st-chip {
  position: absolute; left: 0; top: 0; z-index: 80; min-height: 0;
  transform: translate(calc(var(--x) * 1cqw - 50%), calc(var(--y) * 1cqh - 50%));
  transition: transform 0.8s cubic-bezier(0.22, 0.8, 0.26, 1);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--maple-2); color: var(--ink); font-weight: 800; font-size: 14px;
  box-shadow: 0 0 0 1px #c9a46d, 0 6px 14px rgb(0 0 0 / 0.35);
  animation: appear 0.6s ease-out both 0.25s;
}
.st-chip.num { font: 800 22px/1.1 ui-monospace, Menlo, monospace; padding: 8px 14px; }
.st-chip.target { background: #3fb59a; color: #fff; box-shadow: 0 0 0 2px #fff4e2, 0 0 24px rgb(63 181 154 / 0.7); }
.st-chip.note { font-weight: 600; font-size: 13px; background: rgb(255 248 233 / 0.92); }
.st-chip.step { background: #fff4e2; }
.st-chip.total { font-family: ui-monospace, Menlo, monospace; }
.st-chip.token-chip { min-width: 46px; text-align: center; font: 800 18px/1.1 ui-monospace, Menlo, monospace; background: #f3c77a; color: #3b2716; }
.st-chip.token-chip.on, .st-chip.step.target, .st-chip.total.target { background: #3fb59a; color: #fff; }
button.st-chip { cursor: pointer; }
.st-chip.pick::after {
  content: ""; position: absolute; inset: -5px; border-radius: 999px; pointer-events: none;
  box-shadow: 0 0 0 3px #3fb59a, 0 0 24px 6px rgb(63 181 154 / 0.75); animation: breathe 1.4s ease-in-out infinite;
}
.walk-say {
  display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 8px; padding: 12px 14px; border-radius: 12px;
  background: rgb(255 255 255 / 0.55); border: 1px solid rgb(120 86 36 / 0.25);
  animation: fade-in 0.55s ease-out both; min-height: 3.2em;
}
.walk-say p { margin: 0; font-size: 17px; line-height: 1.45; }
.walk-say .cue-arrow { margin-top: 2px; background: #3fb59a; color: #fff; animation: nudge 1.3s ease-in-out infinite; }
.walk-progress { height: 4px; border-radius: 4px; background: rgb(120 86 36 / 0.18); overflow: hidden; }
.walk-progress span { display: block; height: 100%; background: var(--accent); transition: width 0.6s ease; }
.walk .actions .cta-next { position: relative; }
.stage.phone .st-chip { font-size: 12px; padding: 4px 9px; }
.stage.phone .st-chip.num { font-size: 18px; }
.stage.phone .st-seat { font-size: 12px; padding: 2px 8px 2px 3px; }
.stage.phone .st-badge { font-size: 11px; top: -9px; padding: 1px 5px; min-width: 20px; }
html[data-layout="mobile"] .walk-say p { font-size: 16px; }
@media (prefers-reduced-motion: reduce) {
  .st-card, .st-flip, .st-chip { transition-duration: 0.01ms; transition-delay: 0ms; }
  .st-card.glow::after, .st-chip.pick::after, .walk-say .cue-arrow { animation: none; }
}

/* The fact on the card you picked up, in type you can read */
.fact-line {
  margin: -4px 0 10px; padding: 8px 12px; border-radius: 10px; background: rgb(255 248 233 / 0.92); color: var(--ink);
  font-size: 15px; line-height: 1.4; animation: fade-in 0.4s ease-out both;
}
.fact-line .fact-label { display: block; color: var(--burn); }

/* ---------------------------------------------------------------- raw wood, like the game boxes
   Birch plywood pieces with laser-charred edges and burned (engraved) lettering, on oak and a dark
   plank table. The grain is SVG noise stretched along the board. */
:root {
  --grain-ply: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='320'%3E%3Cfilter id='g' x='0' y='0' width='100%' height='100%'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0025 0.11' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.27 0 0 0 0 0.12 0.8 0 0 0 -0.34'/%3E%3C/filter%3E%3Crect width='640' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-oak: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='320'%3E%3Cfilter id='g' x='0' y='0' width='100%' height='100%'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.12' numOctaves='4' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.25 0 0 0 0 0.14 0 0 0 0 0.06 1.7 0 0 0 -0.62'/%3E%3C/filter%3E%3Crect width='640' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='640'%3E%3Cfilter id='g' x='0' y='0' width='100%' height='100%'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.12 0.004' numOctaves='4' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.06 0 0 0 0 0.035 0 0 0 0 0.02 1.8 0 0 0 -0.55'/%3E%3C/filter%3E%3Crect width='320' height='640' filter='url(%23g)'/%3E%3C/svg%3E");
  --ply: linear-gradient(180deg, #f3e4c7, #e6d0ab);
  --char: #6a3a19;
  --engrave: #5a3216;
  --slab: "Zilla Slab", Rockwell, "Roboto Slab", "Bookman Old Style", Georgia, serif;
  --ply-edge: inset 0 0 0 1.5px var(--char), inset 0 0 0 3px rgb(255 245 222 / 0.35), inset 0 0 10px rgb(106 58 25 / 0.28);
}
body {
  background-image:
    var(--grain-dark),
    radial-gradient(ellipse 70% 45% at 50% -5%, rgb(255 214 160 / 0.2), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 180px, rgb(0 0 0 / 0.22) 180px 182px, rgb(255 230 190 / 0.05) 182px 183px),
    linear-gradient(180deg, #5c432b, #4a3522 45%, #3f2d1d);
  background-size: 320px 640px, auto, auto, auto;
}
.topbar { background: var(--grain-dark), linear-gradient(180deg, #5d4329, #4d3721); background-size: 320px 640px, auto; box-shadow: 0 2px 10px rgb(0 0 0 / 0.35); }
.brand { font-family: var(--slab); font-weight: 700; font-size: 19px; letter-spacing: 0.03em; color: #f6e6c8; text-shadow: 0 -1px 0 rgb(0 0 0 / 0.5), 0 1px 0 rgb(255 230 190 / 0.12); }

/* Plywood pieces: panels, name plates, the step card, chips */
.panel, .plate, .step-card, .zoom-box, .chat, .talk-pop, .st-seat, .st-chip, .walk-say, .char-btn.on {
  background-image: var(--grain-ply), var(--ply);
  background-size: 640px 320px, auto;
}
.panel, .step-card, .zoom-box { box-shadow: var(--ply-edge), 0 8px 20px rgb(0 0 0 / 0.4); }
.plate { box-shadow: var(--ply-edge), 0 6px 14px rgb(0 0 0 / 0.35); }
.seat.deciding .plate { box-shadow: var(--ply-edge), 0 0 0 2px #e9b85c, 0 0 22px rgb(255 192 96 / 0.5), 0 6px 14px rgb(0 0 0 / 0.32); }
.seat.partner .plate { box-shadow: var(--ply-edge), 0 0 0 3px #3a9a85, 0 0 24px rgb(58 154 133 / 0.55), 0 6px 14px rgb(0 0 0 / 0.32); }
.step-card.your-move { box-shadow: var(--ply-edge), 0 0 0 3px #3a9a85, 0 0 30px rgb(58 154 133 / 0.45), 0 12px 28px rgb(0 0 0 / 0.38); }
.st-seat { box-shadow: inset 0 0 0 1.5px var(--char), 0 4px 10px rgb(0 0 0 / 0.3); }
.st-chip { box-shadow: inset 0 0 0 1.5px var(--char), 0 6px 14px rgb(0 0 0 / 0.35); }
.st-chip.target, .st-chip.token-chip.on, .st-chip.step.target, .st-chip.total.target { background-image: none; }
.walk-say { border: 0; box-shadow: var(--ply-edge); }

/* Burned-in lettering, a hair below the surface */
.plate .pname, .plate-total, .step-card .step-label, .panel h2, .panel h3, .walk h2, .zoom-info h2, .chat-head h2, .st-seat, .st-chip.total, .st-chip.step, .char-head .label-like {
  font-family: var(--slab);
  color: var(--engrave);
  text-shadow: 0 1px 0 rgb(255 250 235 / 0.65), 0 0 2px rgb(120 62 22 / 0.3);
}
.plate .pname { font-weight: 700; font-size: 16px; }
.plate-total { font-weight: 700; font-size: 26px; font-variant-numeric: lining-nums tabular-nums; }
.step-card .step-label { font-weight: 700; font-size: 20px; }
.panel h2 { font-weight: 700; font-size: 22px; }
.game-head h2 { font-size: 24px; }
.walk h2 { font-size: 24px; }
.table-phone .plate-total { font-size: 21px; }

/* The wolverine mark and the character tokens look burned into the wood */
.game-head .mark { filter: sepia(0.7) saturate(1.3) contrast(1.15) brightness(0.92); mix-blend-mode: multiply; }
.ctoken {
  background-image: var(--grain-ply), radial-gradient(circle at 38% 32%, #f8ebd2, #e8d2ac 70%, #dcc196);
  background-size: 200px 100px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), inset 0 0 0 4px rgb(255 245 222 / 0.4), inset 0 0 0 5px rgb(106 58 25 / 0.45), 0 2px 5px rgb(0 0 0 / 0.4);
}
.ctoken .cemoji { filter: grayscale(1) sepia(1) saturate(2.2) hue-rotate(-8deg) brightness(0.62) contrast(1.7); mix-blend-mode: multiply; }
.ctoken.mark img { filter: sepia(1) saturate(1.5) brightness(0.72) contrast(1.35); mix-blend-mode: multiply; }
.ctoken.tiny { box-shadow: inset 0 0 0 1px var(--char); }
.char-btn .char-name { font-family: var(--slab); font-weight: 600; font-size: 12px; }

/* Bonus tokens: engraved ovals like the token sheet */
.token {
  font: 700 13px/1 var(--slab); padding: 4px 9px; border-radius: 50%;
  background-image: var(--grain-ply), var(--ply); background-size: 200px 100px, auto; color: var(--engrave);
  box-shadow: inset 0 0 0 1.5px var(--char), inset 0 0 0 3px rgb(255 245 222 / 0.5), inset 0 0 0 4px rgb(106 58 25 / 0.5);
}
.dealer-chip {
  background-image: var(--grain-ply), var(--ply); background-size: 200px 100px, auto; color: var(--engrave);
  font-family: var(--slab); box-shadow: inset 0 0 0 1.5px var(--char);
}

/* Wooden buttons */
button.secondary, .chip:not(.on), .taunt, .react-btn {
  background-image: var(--grain-ply), linear-gradient(180deg, #e9d3ae, #d7bb8f);
  background-size: 640px 320px, auto;
  color: var(--engrave); box-shadow: inset 0 0 0 1.5px var(--char), 0 2px 4px rgb(0 0 0 / 0.25);
}
.taunt.themed { background-image: var(--grain-ply), linear-gradient(180deg, #d8ecdf, #bfdccc); }

/* The table itself: oak with grain, a charred edge band like a cut board */
.bq-table, .table-phone, .stage {
  background:
    var(--grain-oak),
    repeating-linear-gradient(180deg, rgb(0 0 0 / 0.16) 0 2px, transparent 2px 72px),
    linear-gradient(180deg, #ad8253, #976b40 50%, #82603a);
  background-size: 640px 320px, auto, auto;
}
.stage { background:
    var(--grain-oak),
    radial-gradient(ellipse at 50% 45%, rgb(255 236 200 / 0.18), transparent 65%),
    repeating-linear-gradient(180deg, rgb(0 0 0 / 0.16) 0 2px, transparent 2px 72px),
    linear-gradient(180deg, #ad8253, #976b40 50%, #82603a);
  background-size: 640px 320px, auto, auto, auto; }
.hand-area { background-image: var(--grain-dark), linear-gradient(180deg, rgb(58 40 25 / 0.75), rgb(46 31 19 / 0.75)); background-size: 320px 640px, auto; }
.task-box { background-image: var(--grain-dark), linear-gradient(180deg, #4f3923, #45311f); background-size: 320px 640px, auto; }

/* The card you just played, waiting for everyone to reveal */
.hand-cards .card.committed { transform: translateY(-14px); box-shadow: 0 0 0 3px #3fb59a, 0 0 18px rgb(63 181 154 / 0.55), var(--shadow); z-index: 2; }

/* ---------------------------------------------------------------- Laydown switch (top bar) */
.laydown-switch { display: inline-flex; align-items: center; gap: 0; border-radius: 999px; padding: 2px; background: rgb(0 0 0 / 0.25); box-shadow: inset 0 0 0 1px rgb(255 235 200 / 0.18); }
.laydown-switch[hidden] { display: none; }
.ld-label { font-size: 12px; color: var(--muted); padding: 0 8px 0 10px; white-space: nowrap; }
.ld-btn { min-height: 32px; padding: 4px 11px; border-radius: 999px; background: transparent; color: var(--maple-2); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background 0.3s ease, color 0.3s ease; }
.ld-btn.on { background-image: var(--grain-ply), var(--ply); background-size: 200px 100px, auto; color: var(--engrave); box-shadow: inset 0 0 0 1.5px var(--char); }
.ld-btn:disabled { opacity: 0.6; cursor: default; }
.topbar { flex-wrap: wrap; row-gap: 6px; }
html[data-layout="mobile"] .laydown-switch { order: 5; width: 100%; justify-content: center; }
html[data-layout="mobile"] .ld-label { font-size: 11px; }
.topbar-right { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
.seat.giver .plate::after {
  content: ""; position: absolute; inset: -4px; border-radius: 13px; pointer-events: none;
  box-shadow: 0 0 0 2px rgb(58 154 133 / 0.55), 0 0 14px rgb(58 154 133 / 0.35);
}

/* ---------------------------------------------------------------- automated chat */
.msg.table-note {
  align-self: center; max-width: 92%; text-align: center; font-family: var(--slab); font-weight: 600; font-size: 14px;
  color: var(--engrave); background: transparent; border: 1px dashed rgb(106 58 25 / 0.35); border-radius: 10px; padding: 5px 10px;
}
.msg.at-you { box-shadow: 0 0 0 2px #3fb59a; }
.chat-replies:empty { display: none; }
.reply-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.reply-label { font-size: 13px; font-weight: 700; color: var(--burn); }
.talk-pop .reply-chips { padding-bottom: 6px; border-bottom: 1px dashed rgb(106 58 25 / 0.35); }
.announce-toggle { margin: 0 8px 0 auto; font-size: 13px; }
.talk-btn.has-reply::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 2px #3fb59a, 0 0 14px 3px rgb(63 181 154 / 0.7); animation: breathe 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .talk-btn.has-reply::after { animation: none; } }

/* ---------------------------------------------------------------- your hand: docked small, slides up when it's your move */

/* Room at the bottom of the page for the docked hand */
#app[data-hand="popup"] { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }

/* The hand as a sheet that slides up over the table */
.hand-area.sheet {
  position: fixed; z-index: 14; left: 0; right: 0; bottom: 0; margin: 0;
  max-height: min(86vh, 780px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 20px 20px 0 0; padding: 0 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background-color: #3d2a1a;
  box-shadow: 0 -14px 44px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 235 200 / 0.18);
  transform: translateY(104%); visibility: hidden;
  transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.26, 1), visibility 0s linear 0.6s;
}
.hand-area.sheet.open { transform: none; visibility: visible; transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.26, 1), visibility 0s; }
html[data-layout="desktop"] .hand-area.sheet { left: max(16px, calc(50% - 600px)); right: max(16px, calc(50% - 600px)); }
.hand-area.sheet::before { display: none; }
.sheet-head {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px;
  margin: 0 -14px 10px; padding: 16px 14px 10px; background: #3d2a1a; border-bottom: 1px solid rgb(255 235 200 / 0.08);
}
.sheet-head strong { font-family: var(--slab); font-size: 18px; color: #ffe7b8; }
.sheet-grab { position: absolute; left: 50%; top: 6px; width: 46px; height: 5px; border-radius: 3px; background: rgb(255 235 200 / 0.35); transform: translateX(-50%); }
.sheet-close { margin-left: auto; min-height: 36px; padding: 6px 12px; color: #ffe7b8; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 13; background: rgb(15 10 6 / 0.42); animation: fade-in 0.45s ease-out both; }
.hand-area.sheet .task-box { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }

/* The docked hand */
.hand-dock {
  position: fixed; z-index: 12; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 16px); min-height: 0;
  padding: 10px 14px 10px 12px; border-radius: 18px; color: var(--engrave); text-align: left;
  background-image: var(--grain-ply), var(--ply); background-size: 640px 320px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), 0 10px 26px rgb(0 0 0 / 0.5);
  animation: dock-in 0.55s cubic-bezier(0.22, 0.8, 0.26, 1) both;
}
@keyframes dock-in { from { opacity: 0; translate: 0 30px; } to { opacity: 1; translate: 0 0; } }
.dock-cards { display: flex; padding-left: 15px; }
.dock-cards .card.small { --w: 34px; margin-left: -15px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.35); }
html[data-layout="mobile"] .dock-cards .card.small { --w: 28px; margin-left: -14px; }
html[data-layout="mobile"] .dock-cards { padding-left: 14px; }
.dock-info { display: grid; line-height: 1.2; }
.dock-info strong { font-family: var(--slab); font-size: 16px; }
.dock-info span { font-size: 12px; color: #6f5741; white-space: nowrap; }
.dock-open { font-size: 18px; color: var(--char); }
.hand-dock.my-move { box-shadow: inset 0 0 0 1.5px var(--char), 0 0 0 3px #3fb59a, 0 10px 26px rgb(0 0 0 / 0.5); }
.hand-dock.my-move::after {
  content: ""; position: absolute; inset: -6px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 22px 5px rgb(63 181 154 / 0.6); animation: breathe 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hand-area.sheet, .hand-area.sheet.open { transition: none; }
  .hand-dock { animation: none; }
  .hand-dock.my-move::after { animation: none; }
}

/* ---------------------------------------------------------------- face-down cards, numbered in the order put down */
.pile-slot { position: relative; display: inline-grid; justify-items: center; align-content: start; gap: 5px; flex: none; }
.pile-num {
  position: absolute; top: -9px; left: -9px; z-index: 3; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font: 800 15px/1 var(--slab); color: #fff;
  box-shadow: 0 0 0 2px #fff4e2, 0 2px 6px rgb(0 0 0 / 0.45);
}
.pile-slot.n1 .pile-num { background: #2f7d6d; }
.pile-slot.n2 .pile-num { background: #b5742f; }
.pile-slot.n3 .pile-num { background: #6b4fa0; }
.pile-cap { font: 700 12px/1.1 var(--slab); color: #ffe7b8; white-space: nowrap; }
.pile-slot.n1 .pile-cap { color: #8fe0c9; }
.pile-slot.n2 .pile-cap { color: #f3c77a; }
.cards.pile { gap: 18px; padding: 10px 0 0 10px; }
.cards.pile .pile-slot .card.small { --w: 46px; }
/* In the row with your last cards */
.hand-cards.with-pile { align-items: flex-start; }
.hand-cards .pile-slot { margin-left: 12px; }
.hand-cards .pile-slot .card { margin-left: 0 !important; }
.hand-cards .pile-slot + .pile-slot { margin-left: 16px; }
.pile-or {
  align-self: center; display: grid; place-items: center; margin: 0 2px 0 14px; padding: 0 0 0 12px;
  border-left: 2px dashed rgb(255 231 184 / 0.45); min-height: 80px;
}
.pile-or span { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 12px/1 var(--slab); letter-spacing: 0.06em; color: #ffe7b8; text-transform: uppercase; }
.pile-slot.pickable::after {
  content: ""; position: absolute; left: -5px; right: -5px; top: -5px; bottom: 19px; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 2px #f3c77a, 0 0 18px 3px rgb(243 199 122 / 0.55); animation: breathe 2.2s ease-in-out infinite;
}
.pile-slot.pickable.selected::after { box-shadow: 0 0 0 3px #3fb59a, 0 0 20px 4px rgb(63 181 154 / 0.7); animation: none; }
.hand-cards .pile-slot .card.selected { transform: translateY(-10px); }
@media (prefers-reduced-motion: reduce) { .pile-slot.pickable::after { animation: none; } }

/* ---------------------------------------------------------------- the pass going round */
.pass-fly { position: fixed !important; z-index: 45; margin: 0 !important; pointer-events: none; animation: none !important; will-change: transform, opacity; box-shadow: 0 8px 18px rgb(0 0 0 / 0.45); }
.pass-banner {
  position: fixed; z-index: 44; transform: translate(-50%, -50%); pointer-events: none;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  font: 700 16px/1.2 var(--slab); color: var(--engrave);
  background-image: var(--grain-ply), var(--ply); background-size: 640px 320px, auto;
  box-shadow: inset 0 0 0 1.5px var(--char), 0 10px 24px rgb(0 0 0 / 0.45);
  animation: banner 2.6s ease-in-out both;
}
@keyframes banner { 0% { opacity: 0; scale: 0.85; } 15% { opacity: 1; scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ================================================================ medieval overlay (after Justice and Mercy)
   A candlelit oak room; panels are leaves of vellum with gold-leaf frames, blackletter headings in
   rubric red, red-and-gold buttons and a wax seal for your move. The wooden pieces (name plates,
   character and bonus tokens, chips, the docked hand) keep their plywood and burned lettering.
   Wood textures come from Justice and Mercy (art-source/textures/make_wood.py there). */
:root {
  --vellum: #eee0bf; --vellum-2: #e4d2a8; --vellum-3: #cdb683;
  --ink-m: #2a1a0f; --ink-soft: #5b4430; --ink-faint: #8c7253;
  --rubric: #8e1c12; --rubric-2: #b3311d;
  --gold: #b3862b; --gold-2: #d6ae55; --gold-3: #f1d690;
  --font-display: "Grenze Gotisch", "UnifrakturMaguntia", "Old English Text MT", "Palatino Linotype", Georgia, serif;
  --font-body: "EB Garamond", Garamond, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --vellum-bg:
    radial-gradient(ellipse 60% 50% at 18% 12%, rgb(255 255 255 / 0.38), transparent 70%),
    radial-gradient(ellipse 50% 40% at 88% 92%, rgb(139 100 40 / 0.2), transparent 70%),
    radial-gradient(circle at 72% 28%, rgb(150 110 50 / 0.07) 0 9%, transparent 10%),
    radial-gradient(circle at 30% 80%, rgb(150 110 50 / 0.06) 0 7%, transparent 8%);
  --vellum-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.4), inset 0 0 34px rgb(130 92 38 / 0.3), 0 1px 1px rgb(0 0 0 / 0.35), 0 10px 26px rgb(0 0 0 / 0.45);
}

/* The room */
html, body { font-family: var(--font-body); font-size: 17px; }
body {
  background-color: #2d1f15;
  background-image:
    radial-gradient(ellipse 65% 42% at 50% -4%, rgb(255 186 102 / 0.22), transparent 72%),
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 46%, rgb(0 0 0 / 0.46)),
    url(/img/textures/wood-wall.webp);
  background-size: auto, auto, 1440px 1024px;
  background-attachment: fixed;
}
body::before { background: #1d130c; }
.topbar {
  background: linear-gradient(180deg, rgb(29 19 12 / 0.96), rgb(45 31 21 / 0.92));
  border-bottom: 1px solid rgb(214 174 85 / 0.45);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.6), 0 8px 18px rgb(0 0 0 / 0.35);
}
.brand { font-family: var(--font-display); font-weight: 700; font-size: 27px; line-height: 1; letter-spacing: 0.01em; color: var(--gold-3); text-shadow: 0 1px 0 #000, 0 0 18px rgb(255 190 100 / 0.25); }
.amp { color: var(--rubric-2); font-weight: 700; }
html[data-layout="mobile"] .brand { font-size: 21px; }
.top-btn, .chat-btn {
  font-family: var(--font-body); font-size: 15px; color: var(--gold-3); background: rgb(0 0 0 / 0.3);
  border: 1px solid rgb(214 174 85 / 0.5); box-shadow: none;
}
.chat-btn[aria-expanded="true"] { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1d130c; }
.laydown-switch { background: rgb(0 0 0 / 0.3); box-shadow: inset 0 0 0 1px rgb(214 174 85 / 0.45); }
.ld-label { font-family: var(--font-body); font-variant-caps: small-caps; font-size: 13px; color: var(--vellum-3); }
.ld-btn { color: var(--vellum-3); font-family: var(--font-body); font-size: 14px; }

/* Vellum leaves */
.panel, .step-card, .zoom-box, .chat, .talk-pop, .walk-say {
  color: var(--ink-m);
  background-color: var(--vellum);
  background-image: var(--vellum-bg);
  background-size: auto;
  border: 0;
  border-radius: 5px 8px 6px 9px;
  box-shadow: var(--vellum-shadow);
}
.panel, .step-card, .zoom-box, .chat { position: relative; }
.panel::before, .step-card::before, .zoom-box::before, .chat::before {
  content: ""; position: absolute; inset: 7px; pointer-events: none; border-radius: 3px;
  border: 1px solid rgb(179 134 43 / 0.55); outline: 1px solid rgb(179 134 43 / 0.22); outline-offset: 2px;
}
.chat { border-radius: 10px 10px 0 0; }
.panel { padding: 18px 20px; }
.step-card { padding: 16px 18px; }
.step-card.your-move { box-shadow: var(--vellum-shadow), 0 0 0 3px var(--gold-2), 0 0 30px rgb(214 174 85 / 0.5); }
.panel .muted, .step-card .muted, .chat .muted { color: var(--ink-faint); }

/* Blackletter headings in rubric red, with a gold rule */
.panel h2, .walk h2, .zoom-info h2, .chat-head h2, .step-card .step-label, .results h2 {
  font-family: var(--font-display); font-weight: 700; color: var(--rubric); text-shadow: none; letter-spacing: 0.01em; line-height: 1.05;
}
.panel h2 { font-size: 30px; }
.game-head h2 { font-size: 34px; }
.walk h2 { font-size: 30px; }
.step-card .step-label { font-size: 25px; }
.table-phone .step-card .step-label { font-size: 21px; }
.zoom-info h2 { font-size: 30px; }
.chat-head h2 { font-size: 26px; }
.panel h2::after, .walk h2::after {
  content: ""; display: block; width: 72px; height: 5px; margin-top: 6px;
  background:
    radial-gradient(circle, var(--gold) 0 2px, transparent 2.5px) center / 9px 5px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left center / 100% 1px no-repeat;
}
.game-head h2::after { margin-top: 4px; }
.panel h3 { font-family: var(--font-body); font-size: 18px; font-weight: 700; color: var(--ink-m); font-variant-caps: small-caps; letter-spacing: 0.03em; text-shadow: none; }
.step-card .prompt { font-family: var(--font-body); font-size: 18px; color: var(--ink-m); }
.step-card .prompt.waiting { color: var(--ink-soft); }
.step-card .recap { background: rgb(255 250 235 / 0.5); border: 1px solid rgb(179 134 43 / 0.35); }
.step-card .recap-title, .recap-title { font-family: var(--font-body); font-variant-caps: small-caps; text-transform: none; letter-spacing: 0.06em; font-size: 15px; color: var(--rubric); }
.step-card .recap li.private { color: #21436e; }
.fact-label { font-variant-caps: small-caps; text-transform: none; letter-spacing: 0.05em; font-size: 14px; color: var(--rubric); }
.zoom-fact { font-family: var(--font-body); }
label, .label-like { font-variant-caps: small-caps; letter-spacing: 0.02em; }

/* The game's title line on the dark wood */
.status .game-title { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; color: var(--gold-3); text-shadow: 0 1px 0 #000, 0 0 16px rgb(255 190 100 / 0.2); }
.status .muted { color: var(--vellum-3); }
.timer { font-family: var(--font-body); font-weight: 700; color: var(--gold-3); padding: 2px 10px; border-radius: 999px; border: 1px solid rgb(214 174 85 / 0.5); background: rgb(0 0 0 / 0.3); }
.timer:empty { display: none; }

/* Table log */
.log-panel .log div { border-bottom: 1px solid rgb(179 134 43 / 0.22); color: var(--ink-m); }
.log .private { color: #21436e; font-style: italic; }
.log-panel summary { font-family: var(--font-display); font-size: 22px; color: var(--rubric); font-weight: 700; }

/* Buttons: red and gold, like an illuminated capital. Plywood buttons keep their burned look. */
button {
  font-family: var(--font-body); font-size: 17px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--gold-3);
  background: linear-gradient(180deg, #a52a1a, var(--rubric) 55%, #6c140c);
  border: 1px solid #5b0f08;
  box-shadow: inset 0 1px 0 rgb(255 200 150 / 0.3), inset 0 0 0 1px rgb(214 174 85 / 0.35), 0 2px 5px rgb(60 10 4 / 0.35);
}
button:hover:not(:disabled) { border-color: var(--gold-2); }
button.ghost { background: transparent; color: inherit; border: 1px solid currentColor; box-shadow: none; }
.panel button.ghost, .step-card button.ghost, .chat button.ghost, .zoom-box button.ghost { color: var(--ink-soft); border-color: rgb(91 68 48 / 0.6); }
.status button.ghost { color: var(--gold-3); border-color: rgb(214 174 85 / 0.55); background: rgb(0 0 0 / 0.25); }
button.danger { background: linear-gradient(180deg, #c24a2f, #8e2a16); color: #fff4e2; }
.chip.on { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1d130c; border: 0; }
.coach .checklist li.now { background: var(--rubric); color: var(--gold-3); }
.walk-dot { border: 0; box-shadow: none; }
.walk-dot.on { background: var(--rubric); color: var(--gold-3); }
.walk-dot.done { background: rgb(179 134 43 / 0.35); color: var(--ink-m); }

/* Your move: a wax seal */
.move-seal {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; color: #ffe9cf;
  padding: 7px 14px 6px; border-radius: 48% 52% 50% 46% / 58% 54% 62% 56%;
  background: radial-gradient(circle at 35% 30%, #c6402b, var(--rubric) 60%, #5d0f08);
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.45), inset 0 0 0 2px rgb(255 255 255 / 0.12), inset 0 -2px 4px rgb(0 0 0 / 0.3);
}

/* Inputs on vellum */
input[type="text"], select { font-family: var(--font-body); font-size: 17px; color: var(--ink-m); background: #fbf4e2; border: 1px solid var(--vellum-3); border-bottom-color: var(--ink-faint); border-radius: 5px; box-shadow: inset 0 1px 3px rgb(90 60 20 / 0.15); }
.check input { accent-color: var(--rubric); }

/* Character picker on vellum */
.char-btn { background: rgb(120 86 36 / 0.07); border-color: rgb(120 86 36 / 0.22); color: var(--ink-m); }
.char-btn.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgb(214 174 85 / 0.55); }
.char-btn .char-name { color: var(--ink-m); }

/* The table: Justice and Mercy's oak planks */
.bq-table, .table-phone {
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgb(255 210 150 / 0.12), transparent 70%),
    url(/img/textures/wood-table.webp) 50% 0 / 1024px 256px repeat,
    #5a412c;
}
.stage {
  background:
    radial-gradient(ellipse at 50% 45%, rgb(255 236 200 / 0.14), transparent 65%),
    url(/img/textures/wood-table.webp) 50% 0 / 1024px 256px repeat,
    #5a412c;
}

/* Your hand's sheet: dark oak with a gold edge and a blackletter heading */
.hand-area.sheet { border-top: 1px solid rgb(214 174 85 / 0.5); }
.sheet-head { border-bottom-color: rgb(214 174 85 / 0.25); }
.sheet-head strong { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--gold-3); text-shadow: 0 1px 0 #000; }
.sheet-close { color: var(--gold-3); border-color: rgb(214 174 85 / 0.55) !important; }
.private-board .big { font-family: var(--font-body); font-weight: 700; font-size: 26px; color: var(--gold-3); font-variant-numeric: lining-nums tabular-nums; }
.private-board .muted { font-variant-caps: small-caps; letter-spacing: 0.04em; }
.hand-cue { font-family: var(--font-body); font-size: 17px; }

/* Chat on vellum */
.chat-list { background: rgb(255 250 235 / 0.55); border-color: rgb(179 134 43 / 0.35); }
.msg { font-family: var(--font-body); }
.msg .who { color: var(--rubric); }
.msg.table-note { font-family: var(--font-body); font-style: italic; color: var(--rubric); border-color: rgb(179 134 43 / 0.5); }

/* Banners */
.pass-banner, .bubble.taunt, .chat-peek { font-family: var(--font-body); }
.toast { font-family: var(--font-body); }

/* ---------------------------------------------------------------- computer player level */
.level-note { margin: 10px 0 0; }
.level-note strong { color: var(--ink-m); }
.seats select.seat-level { width: auto; min-height: 34px; padding: 4px 8px; font-size: 15px; margin: 0; }
html[data-layout="mobile"] .level-switch .ld-btn { padding: 4px 9px; }

/* ---------------------------------------------------------------- sudden death and final standings */
.sd-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px 16px; overflow-y: auto;
  background:
    radial-gradient(ellipse 85% 60% at 50% 30%, rgb(140 20 10 / 0.6), transparent 72%),
    radial-gradient(ellipse 120% 80% at 50% 110%, rgb(90 30 6 / 0.55), transparent 70%),
    rgb(10 5 3 / 0.92);
  opacity: 0; transition: opacity 0.3s ease;
}
.sd-overlay.shown { opacity: 1; }
.sd-overlay.leaving { opacity: 0; pointer-events: none; }
/* Embers drifting up behind everything */
.sd-overlay.motion::before {
  content: ""; position: fixed; inset: -20% 0 0; pointer-events: none; opacity: 0.55;
  background-image:
    radial-gradient(2px 2px at 12% 70%, #ffc061, transparent 70%),
    radial-gradient(1.5px 1.5px at 38% 90%, #ff8a3a, transparent 70%),
    radial-gradient(2.5px 2.5px at 66% 78%, #ffd27a, transparent 70%),
    radial-gradient(1.5px 1.5px at 84% 95%, #ff6a2a, transparent 70%),
    radial-gradient(2px 2px at 52% 60%, #ffb347, transparent 70%);
  background-size: 340px 420px;
  animation: sd-embers 7s linear infinite;
}
@keyframes sd-embers { to { background-position: 0 -420px; } }
.sd-flash { position: fixed; inset: 0; pointer-events: none; background: #fff; opacity: 0; }
.sd-flash.strobe { animation: sd-strobe 1.15s ease-out both; }
.sd-flash.strobe-small { animation: sd-strobe-small 0.7s ease-out both; }
.sd-flash.strobe-win { animation: sd-strobe-win 1.1s ease-out both; }
@keyframes sd-strobe {
  0% { opacity: 0.95; background: #fff; } 7% { opacity: 0; }
  14% { opacity: 0.85; background: #ff3a12; } 24% { opacity: 0; }
  33% { opacity: 0.6; background: #fff4d0; } 46%, 100% { opacity: 0; }
}
@keyframes sd-strobe-small { 0% { opacity: 0.5; background: #ff3a12; } 40%, 100% { opacity: 0; } }
@keyframes sd-strobe-win { 0% { opacity: 0.7; background: #fff3c4; } 12% { opacity: 0; } 22% { opacity: 0.45; background: #f1d690; } 50%, 100% { opacity: 0; } }

.sd-stage { position: relative; width: min(780px, 100%); text-align: center; color: var(--vellum); }
.sd-overlay.motion.shown .sd-stage { animation: sd-shake 0.55s 0.34s both; }
@keyframes sd-shake {
  0%, 100% { translate: 0 0; } 12% { translate: -12px 5px; } 26% { translate: 10px -6px; }
  40% { translate: -8px 4px; } 55% { translate: 6px -3px; } 70% { translate: -3px 2px; } 85% { translate: 2px -1px; }
}
.sd-head {
  position: relative; display: inline-block;
  filter: drop-shadow(0 0 2px #3a0a04) drop-shadow(0 0 16px rgb(220 50 20 / 0.7)) drop-shadow(0 4px 0 #5a1208);
}
.sd-overlay.motion.shown .sd-head { animation: sd-glow 1.3s 1.1s ease-in-out infinite alternate; }
@keyframes sd-glow {
  to { filter: drop-shadow(0 0 2px #3a0a04) drop-shadow(0 0 34px rgb(255 96 30 / 0.95)) drop-shadow(0 4px 0 #5a1208); }
}
.sd-title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(58px, 15vw, 132px); line-height: 0.95; letter-spacing: 0.02em;
  padding: 0 0.1em 0.06em;
  background: linear-gradient(180deg, #fff6d2 0%, var(--gold-3) 28%, var(--gold-2) 55%, #9c5c16 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sd-overlay.motion.shown .sd-title { animation: sd-slam 0.72s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
@keyframes sd-slam {
  0% { transform: scale(3.4) rotate(-8deg); opacity: 0; }
  45% { opacity: 1; }
  62% { transform: scale(0.9) rotate(1.5deg); }
  80% { transform: scale(1.04) rotate(-0.5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.sd-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.sd-sparks span {
  position: absolute; left: 0; top: 0; width: 7px; height: 7px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fffbe6 0, #ffc04a 45%, rgb(255 90 20 / 0) 72%);
}
.sd-overlay.motion.shown .sd-sparks span { animation: sd-spark 0.95s calc(340ms + var(--t)) cubic-bezier(0.15, 0.7, 0.3, 1) both; }
@keyframes sd-spark {
  0% { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(0.2); opacity: 0; }
}
.sd-sub {
  max-width: 580px; margin: 8px auto 0; font-size: 19px; line-height: 1.35; color: var(--vellum-2);
  opacity: 0; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.6s ease;
}
.sd-sub.on, .sd-overlay.settled .sd-sub { opacity: 1; transform: none; }
.sd-round { margin-top: 14px; min-height: 1em; font-family: var(--font-display); font-size: 28px; color: var(--gold-3); }
.sd-lanes { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 10px; }
.sd-lane {
  width: 214px; padding: 10px 10px 12px; border-radius: 12px;
  background: linear-gradient(180deg, rgb(64 22 12 / 0.9), rgb(30 12 8 / 0.94));
  box-shadow: inset 0 0 0 1px rgb(214 174 85 / 0.5), 0 10px 26px rgb(0 0 0 / 0.55);
  transition: filter 0.6s ease, opacity 0.6s ease, box-shadow 0.6s ease, transform 0.6s ease;
}
.sd-overlay.motion .sd-lane { animation: sd-lane-in 0.5s ease-out both; }
@keyframes sd-lane-in { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
.sd-who { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; color: var(--gold-3); }
.sd-cards { display: flex; justify-content: center; gap: 6px; margin: 10px 0 8px; }
.sd-card { position: relative; width: 58px; height: calc(58px * 1.4); perspective: 700px; }
.sd-flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.65s cubic-bezier(0.3, 0.7, 0.3, 1.25); }
.sd-overlay.motion .sd-card { animation: sd-deal 0.45s calc(var(--i) * 130ms + 200ms) cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }
@keyframes sd-deal { from { opacity: 0; translate: 0 -70px; rotate: -10deg; } to { opacity: 1; translate: 0 0; rotate: 0deg; } }
.sd-card .card { --w: 58px; }
.sd-side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.sd-front { transform: rotateY(180deg); }
.sd-card.flipped .sd-flip { transform: rotateY(180deg); }
.sd-sum { color: var(--vellum); }
.sd-total { display: block; min-height: 1.1em; font-family: var(--font-display); font-size: 30px; line-height: 1.1; color: #fff3c4; }
.sd-off { display: block; min-height: 1.2em; font-size: 15px; color: var(--vellum-3); }
.sd-col.best .sd-card { border-radius: 8px; box-shadow: 0 0 0 4px #f1d690, 0 0 26px 6px rgb(255 200 110 / 0.75); transition: box-shadow 0.4s ease; }
.sd-col.best .sd-src { color: #f1d690; font-weight: 700; }
.sd-tag { margin-top: 6px; min-height: 24px; font-variant-caps: small-caps; letter-spacing: 0.08em; font-weight: 700; font-size: 18px; }
.sd-lane.out { filter: grayscale(0.9) brightness(0.62); opacity: 0.75; transform: scale(0.95); }
.sd-lane.out .sd-tag { color: #f08a78; }
.sd-lane.through { box-shadow: inset 0 0 0 2px var(--gold-2), 0 0 24px rgb(214 174 85 / 0.5); }
.sd-lane.through .sd-tag { color: var(--gold-3); }
.sd-lane.winner { transform: scale(1.06); box-shadow: inset 0 0 0 2px var(--gold-3), 0 0 36px rgb(241 214 144 / 0.75), 0 0 90px rgb(220 60 20 / 0.5); }
.sd-overlay.motion .sd-lane.winner { animation: sd-win 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes sd-win { 0% { scale: 1; } 45% { scale: 1.12; } 100% { scale: 1; } }
.sd-lane.winner .sd-tag { color: #fff3c4; font-size: 22px; }
.sd-lane.winner .sd-who strong::before { content: "♔ "; color: var(--gold-3); }
.sd-verdict { min-height: 1.15em; margin-top: 16px; font-family: var(--font-display); font-size: clamp(30px, 7vw, 48px); line-height: 1.1; color: var(--gold-3); opacity: 0; text-shadow: 0 0 18px rgb(255 120 40 / 0.6), 0 3px 0 #4a1006; }
.sd-verdict.on { opacity: 1; }
.sd-overlay.motion .sd-verdict.on { animation: sd-pop 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.35) both; }
@keyframes sd-pop { from { opacity: 0; scale: 0.6; } to { opacity: 1; scale: 1; } }
.sd-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.sd-actions button.ghost { color: var(--vellum-2); border-color: rgb(238 224 191 / 0.5); background: rgb(0 0 0 / 0.3); }
html[data-layout="mobile"] .sd-lane { width: calc(50% - 7px); min-width: 150px; padding: 8px 6px 10px; }
html[data-layout="mobile"] .sd-card, html[data-layout="mobile"] .sd-card .card { --w: 44px; width: 44px; height: calc(44px * 1.4); }
html[data-layout="mobile"] .sd-cards { gap: 4px; }
html[data-layout="mobile"] .sd-lane.four .sd-card, html[data-layout="mobile"] .sd-lane.four .sd-card .card { --w: 34px; width: 34px; height: calc(34px * 1.4); }
html[data-layout="mobile"] .sd-lane.four .sd-src { font-size: 9px; letter-spacing: 0; }
html[data-layout="mobile"] .sd-sub { font-size: 17px; }
@media (prefers-reduced-motion: reduce) {
  .sd-overlay, .sd-overlay * { animation: none !important; transition: none !important; }
}

/* Final standings */
.standings h3, .sd-explain h3 { margin-top: 12px; }
.results tr.you td { background: rgb(214 174 85 / 0.12); }
.place-mark {
  display: inline-block; min-width: 2.6em; padding: 1px 8px; border-radius: 999px; text-align: center;
  font-weight: 700; font-size: 15px; color: var(--ink-m); box-shadow: inset 0 0 0 1px rgb(90 60 20 / 0.45);
}
.place-mark.p1 { background: linear-gradient(180deg, #fbe7a0, #d6ae55 55%, #a77a22); color: #3a2405; box-shadow: inset 0 0 0 1px #7a5414, 0 0 8px rgb(214 174 85 / 0.6); }
.place-mark.p2 { background: linear-gradient(180deg, #f4f4f2, #c6c8c9 55%, #8f9396); color: #2a2c2e; box-shadow: inset 0 0 0 1px #6c7073; }
.place-mark.p3 { background: linear-gradient(180deg, #f1c79a, #c58b52 55%, #8c5627); color: #2e1606; box-shadow: inset 0 0 0 1px #6e3f19; }
.tie-note { margin-left: 6px; font-size: 12px; font-variant-caps: small-caps; letter-spacing: 0.06em; color: var(--ink-soft); }
.sd-note { display: block; font-size: 13px; color: var(--rubric); font-variant-caps: small-caps; letter-spacing: 0.04em; }
.sd-explain { margin-top: 6px; padding: 10px 12px; border-radius: 8px; background: rgb(142 28 18 / 0.08); box-shadow: inset 0 0 0 1px rgb(142 28 18 / 0.3); }
.sd-explain .sd-mark { color: var(--rubric); }
.sd-round-box { margin-top: 8px; }
.sd-round-name { font-family: var(--font-display); font-size: 19px; color: var(--rubric); }
.sd-hand { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 5px 0; border-bottom: 1px solid rgb(0 0 0 / 0.08); }
.sd-hand:last-child { border-bottom: 0; }
.sd-hand-who { min-width: 96px; font-weight: 700; }
.sd-hand-cards { display: inline-flex; gap: 4px; }
.sd-hand-sum { font-weight: 700; }
.sd-hand-tag { margin-left: auto; font-variant-caps: small-caps; letter-spacing: 0.06em; font-weight: 700; color: var(--ink-soft); }
.sd-hand.through .sd-hand-tag { color: #8a6212; }
.sd-hand.out { opacity: 0.75; }
.sd-hand.out .sd-hand-tag { color: var(--rubric); }

/* Where each player finished, on their plate */
.place-chip {
  flex: none; padding: 1px 7px; border-radius: 999px; font: 700 12px/1.5 var(--font-body);
  background: rgb(0 0 0 / 0.18); color: var(--engrave, #3a2410); box-shadow: inset 0 0 0 1px rgb(60 36 14 / 0.5);
}
.place-chip.p1 { background: linear-gradient(180deg, #fbe7a0, #d6ae55 55%, #a77a22); color: #3a2405; box-shadow: inset 0 0 0 1px #7a5414, 0 0 10px rgb(241 214 144 / 0.7); }
.place-chip.p2 { background: linear-gradient(180deg, #f4f4f2, #c6c8c9 55%, #8f9396); color: #2a2c2e; }
.place-chip.p3 { background: linear-gradient(180deg, #f1c79a, #c58b52 55%, #8c5627); color: #2e1606; }

/* How to play: a gold pill at the top right, opening rules.html in a new tab (same idea as Apis). */
.rules-link {
  display: inline-flex; align-items: center; min-height: 34px; padding: 6px 14px; border-radius: 999px;
  font-family: var(--font-body); font-size: 15px; font-weight: 700; letter-spacing: 0.01em; text-decoration: none; white-space: nowrap;
  color: #1d130c; background: linear-gradient(180deg, var(--gold-3), var(--gold-2));
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.22), 0 0 0 1px rgb(0 0 0 / 0.45), 0 0 14px rgb(241 214 144 / 0.35);
}
.rules-link:hover { background: linear-gradient(180deg, #fff0c2, var(--gold-3)); }
.rules-link:focus-visible { outline: 3px solid var(--gold-3); outline-offset: 2px; }
html[data-layout="mobile"] .rules-link { min-height: 32px; padding: 5px 12px; font-size: 14px; }
/* With How to play in the bar, "Online" only shows when something is wrong (Connecting…, Offline), as on phones,
   so the desktop bar stays on one line at a 1440-wide screen. */
.topbar-right .conn.ok { display: none; }

/* Sudden death: which cards were face down and which came from the deck */
.sd-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sd-col.dealt { margin-left: 10px; position: relative; }
.sd-col.down + .sd-col.dealt::before {
  content: "+"; position: absolute; left: -11px; top: calc(58px * 0.7 - 0.6em); font: 700 18px/1 var(--font-body); color: var(--gold-3);
}
.sd-src { font-size: 11px; font-variant-caps: small-caps; letter-spacing: 0.08em; color: var(--vellum-3); }
.sd-col.dealt .sd-src { color: var(--gold-3); }
html[data-layout="mobile"] .sd-col.down + .sd-col.dealt::before { top: calc(44px * 0.7 - 0.6em); }
.sd-group { display: inline-flex; align-items: flex-start; gap: 3px; position: relative; padding-bottom: 14px; }
.sd-group-cap { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 11px; font-variant-caps: small-caps; letter-spacing: 0.06em; color: var(--ink-soft); }
.sd-plus { align-self: center; margin: 0 2px 14px; font-weight: 700; color: var(--ink-soft); }

/* How to play in the single-file version: the rules page over the game */
.topbar-right button.rules-link { border: 0; cursor: pointer; margin: 0; text-transform: none; }
.rules-overlay { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; background: #1d130c; }
.rules-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: #1d130c; box-shadow: 0 2px 10px rgb(0 0 0 / 0.5);
}
.rules-title { font-family: var(--font-display); font-size: 24px; color: var(--gold-3); }
.rules-frame { flex: 1; width: 100%; border: 0; background: #2b1d14; }

/* A page for one game: its card centered */
html[data-layout="desktop"] .grid.one { grid-template-columns: minmax(0, 620px); justify-content: center; }

/* Copyright and trademark notice at the foot of every page */
.site-foot { max-width: 760px; margin: 28px auto 0; padding: 0 16px 96px; text-align: center; font-size: 12px; line-height: 1.5; color: rgb(238 224 191 / 0.85); text-shadow: 0 1px 2px rgb(0 0 0 / 0.8); }
.site-foot p { margin: 0; }

/* Pause */
.pause-btn.on { background: #f3c77a; color: #3b2716; border-color: #f3c77a; }
.paused-banner {
  position: sticky; top: calc(58px + env(safe-area-inset-top, 0px)); z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 8px 12px; border-radius: 12px;
  background: linear-gradient(180deg, #fdf8ec, #f1e4c9); color: var(--ink);
  box-shadow: inset 0 0 0 1px rgb(120 86 36 / 0.45), 0 0 0 3px #f3c77a, 0 10px 24px rgb(0 0 0 / 0.4);
  font-size: 15px;
}
.paused-banner button { min-height: 38px; padding: 6px 14px; }
.sheet-tools { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.sheet-head .pause-btn { min-height: 36px; padding: 6px 12px; }

/* How many players and the timer: the host's choices beside the game's name, in effect from the next deal */
.status-text .table-size { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; vertical-align: middle; }
.status-text .size-select {
  width: auto; min-height: 0; padding: 2px 8px 2px 11px; border-radius: 999px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--gold-3);
  background: rgb(0 0 0 / 0.3); border: 1px solid rgb(214 174 85 / 0.5); box-shadow: none; cursor: pointer;
}
.status-text .size-select option { color: #1d130c; background: #fbf4e2; }
.status-text .size-note { margin-left: 8px; font-size: 12px; font-style: italic; color: var(--gold-3); vertical-align: middle; }

/* ================================================================== one screen, no scrolling
   During a game (html[data-fit]) the page fits the screen. The top bar is one slim line with the
   game's timer and Pause beside the name, and the table's choices are in its Menu. The table is
   scaled to the space under the bar (fitTable in app.js). Your hand is a tray along the bottom that
   pops up on your move: on a desktop it has its own strip under the table, on a phone it slides up
   over the near side of the table. The results open over the table. */

/* ---- Top bar: the Menu, and the game's line beside the name ---- */
.top-tools { display: contents; }
.menu-btn, .menu-game, .menu-rules, .topbar-game { display: none; }
html[data-screen="game"] .menu-btn, html[data-layout="mobile"] .menu-btn { display: inline-flex; align-items: center; gap: 4px; }
html[data-screen="game"] .top-tools, html[data-layout="mobile"] .top-tools { display: none; }
html.menu-open[data-screen="game"] .top-tools, html.menu-open[data-layout="mobile"] .top-tools {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  position: absolute; z-index: 30; top: calc(100% + 6px); right: max(12px, env(safe-area-inset-right, 0px));
  width: min(370px, calc(100vw - 24px)); max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain;
  padding: 14px; border-radius: 10px;
  background: linear-gradient(180deg, rgb(40 27 18 / 0.98), rgb(29 19 12 / 0.98));
  box-shadow: inset 0 0 0 1px rgb(214 174 85 / 0.5), 0 18px 40px rgb(0 0 0 / 0.55);
  animation: fade-in 0.2s ease-out both;
}
html.menu-open .top-tools .menu-game { display: grid; gap: 10px; order: -1; padding-bottom: 12px; border-bottom: 1px solid rgb(214 174 85 / 0.3); }
html.menu-open .top-tools .menu-game:empty { display: none; }
html.menu-open[data-layout="mobile"] .top-tools .menu-rules { display: inline-flex; justify-content: center; }
html.menu-open .top-tools .laydown-switch { flex-wrap: wrap; justify-content: flex-start; align-self: flex-start; width: auto; order: 0; border-radius: 18px; row-gap: 2px; }
html.menu-open .top-tools .laydown-switch[hidden], html.menu-open .top-tools .top-btn[hidden] { display: none; }
html.menu-open .top-tools .top-btn { align-self: flex-start; min-height: 38px; }
.menu-btn[aria-expanded="true"] { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1d130c; }
.menu-info { font-size: 15px; line-height: 1.35; color: var(--vellum-3); }
.menu-info strong { color: var(--gold-3); }
.menu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.menu-row button { min-height: 38px; padding: 6px 14px; font-size: 16px; }
.menu-row button.ghost { color: var(--gold-3); border-color: rgb(214 174 85 / 0.55); background: rgb(0 0 0 / 0.25); }
.menu-row .table-size { display: inline-flex; }
.menu-row .size-select {
  width: auto; min-height: 36px; padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--gold-3);
  background: rgb(0 0 0 / 0.3); border: 1px solid rgb(214 174 85 / 0.5); box-shadow: none; cursor: pointer;
}
.menu-row .size-select option { color: #1d130c; background: #fbf4e2; }
.menu-row .size-note { font-size: 13px; font-style: italic; color: var(--gold-3); }

html[data-screen="game"] .topbar-game { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.gb-info { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; color: var(--vellum-3); }
.topbar-game .timer { flex: none; margin-left: auto; }
.topbar-game .timer:empty { display: none; }
.topbar-game button { flex: none; min-height: 34px; padding: 4px 12px; font-size: 15px; }
.topbar-game button.ghost { color: var(--gold-3); border-color: rgb(214 174 85 / 0.55); background: rgb(0 0 0 / 0.25); }
.topbar-game .pause-btn.on { background: #f3c77a; color: #3b2716; border-color: #f3c77a; }
html[data-layout="mobile"] .gb-info { display: none; }
html[data-layout="mobile"][data-screen="game"] .topbar-game { gap: 6px; }
html[data-layout="mobile"] .topbar-game button { padding: 4px 10px; }
html[data-layout="mobile"] .topbar-game .pb-word, html[data-layout="mobile"] .menu-word { display: none; }
html[data-layout="mobile"] .menu-btn { padding: 4px 11px; font-size: 18px; }
html[data-layout="mobile"] .topbar-right > .rules-link { display: none; }
html[data-layout="mobile"][data-screen="game"] .brand { font-size: 19px; }
html[data-layout="mobile"] .topbar { flex-wrap: nowrap; }
html[data-layout="mobile"] .topbar-right { flex-wrap: nowrap; flex: none; }
.rules-close-row { margin-bottom: 10px; }
.rules-close-row button.ghost { color: var(--gold-3); border-color: rgb(214 174 85 / 0.55); background: rgb(0 0 0 / 0.25); }

/* ---- The page: no footer, no scrolling ---- */
html[data-fit] { --strip: 0px; }
html[data-fit], html[data-fit] body { overflow: hidden; overscroll-behavior: none; }
html[data-fit] body { height: 100dvh; min-height: 0; display: flex; flex-direction: column; }
html[data-fit] .site-foot { display: none; }
html[data-fit] .topbar { flex: none; position: relative; top: 0; z-index: 11; padding-top: 6px; padding-bottom: 6px; }
html[data-fit] #app {
  flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column;
  padding-top: 8px; padding-bottom: calc(var(--strip) + 6px);
}
html[data-fit] .paused-banner { position: relative; top: 0; flex: none; }

/* ---- Desktop: the table above, your hand's tray in a strip along the bottom ---- */
html[data-fit][data-layout="desktop"] { --strip: clamp(170px, 29dvh, 300px); }
html[data-fit][data-layout="desktop"] body.chat-open #app { width: auto; margin-left: 0; }
html[data-fit][data-layout="desktop"] .game-grid { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
html[data-fit][data-layout="desktop"] .table-main { min-height: 0; display: flex; flex-direction: column; justify-content: center; }
html[data-fit][data-layout="desktop"] .banquet { margin: 0; flex: none; }
html[data-fit][data-layout="desktop"] .table-side { position: static; max-height: none; min-height: 0; }
html[data-fit][data-layout="desktop"] .table-side .coach { flex: none; max-height: calc(100% - 150px); overflow-y: auto; margin: 0; font-size: 15px; }
html[data-fit][data-layout="desktop"] .game-grid { grid-template-columns: minmax(0, 1fr) clamp(240px, 20vw, 360px); }
/* A narrow screen (a tablet held upright): the table takes the whole width, and the log is in the Menu */
@media (max-width: 1099px) {
  html[data-fit][data-layout="desktop"] .game-grid { grid-template-columns: minmax(0, 1fr); }
  html[data-fit][data-layout="desktop"] .table-side { display: none; }
}
html[data-fit][data-layout="desktop"] .log-drawer { left: auto; right: 0; top: 0; width: min(420px, 100vw); padding: 0; }
html[data-fit][data-layout="desktop"] .log-drawer .log-panel { max-height: none; border-radius: 0; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
/* A table that keeps its size from step to step: plates keep the same lines (the details are in their
   tooltip), the step card is wide enough for its words, and less wood above and below the runner. */
html[data-fit] .plate-meta, html[data-fit] .plate-pair { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-fit][data-layout="desktop"] .banquet .plate { min-height: 66px; }
html[data-fit][data-layout="desktop"] .banquet .plate-pair:empty { display: none; }
html[data-fit][data-layout="desktop"] .bq-table { padding-top: calc(var(--row-h) + 18px); padding-bottom: calc(var(--row-h) + 18px); }
html[data-fit][data-layout="desktop"] .bq-table .step-card { max-width: 680px; }

html[data-fit][data-layout="desktop"] .hand-area.sheet {
  left: max(12px, calc(50% - 840px)); right: max(12px, calc(50% - 840px));
  height: var(--strip); max-height: none; overflow: hidden;
  display: grid; grid-template-columns: minmax(170px, 240px) minmax(0, 1fr) minmax(0, max-content); grid-template-rows: auto minmax(0, 1fr);
  column-gap: 18px; align-items: start; padding: 0 16px 8px;
}
html[data-fit][data-layout="desktop"] .sheet-head { display: contents; }
html[data-fit][data-layout="desktop"] .sheet-head strong { grid-column: 1; grid-row: 1; align-self: center; padding: 12px 0 4px; font-size: 24px; }
html[data-fit][data-layout="desktop"] .hand-area .hand-cue { grid-column: 2; grid-row: 1; align-self: center; margin: 8px 0 2px; padding: 5px 12px; }
html[data-fit][data-layout="desktop"] .sheet-tools { grid-column: 3; grid-row: 1; justify-self: end; align-self: center; padding-top: 6px; }
html[data-fit][data-layout="desktop"] .sheet-close { min-height: 32px; padding: 4px 12px; font-size: 15px; }
html[data-fit][data-layout="desktop"] .hand-side { grid-column: 1; grid-row: 2; align-self: stretch; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
html[data-fit][data-layout="desktop"] .hand-side .private-board { display: grid; grid-template-columns: repeat(2, auto); justify-content: start; gap: 2px 18px; margin: 4px 0 0; }
html[data-fit][data-layout="desktop"] .hand-side .private-board .big { font-size: 24px; line-height: 1.1; }
html[data-fit][data-layout="desktop"] .hand-side .fact-line { font-size: 14px; line-height: 1.3; margin: 2px 0 4px; }
html[data-fit][data-layout="desktop"] .hand-main { grid-column: 2; grid-row: 2; align-self: stretch; min-width: 0; min-height: 0; display: flex; align-items: flex-start; gap: 16px; }
html[data-fit][data-layout="desktop"] .hand-main .hand-cards { flex: 1 1 0; min-width: 0; container-type: inline-size; flex-wrap: nowrap; padding-top: 12px; }
/* Your cards as big as the strip allows, and small enough that the whole hand fits across it */
html[data-fit][data-layout="desktop"] #app { --hand-w: calc((var(--strip) - 72px) / 1.4); --hand-step: 0.7; }
html[data-fit][data-layout="desktop"] #app[data-game="wolverine42"] { --hand-step: 1.08; }
html[data-fit][data-layout="desktop"] .hand-area .hand-cards .card:not(.small) { --w: min(var(--hand-w), calc((100cqw - 10px) / (1 + (var(--n, 6) - 1) * var(--hand-step)))); }
html[data-fit][data-layout="desktop"] #app[data-game="wolverine42"] .hand-cards { gap: 8px; }
html[data-fit][data-layout="desktop"] .hand-main .pile-wrap { flex: none; max-width: 190px; }
html[data-fit][data-layout="desktop"] .hand-main .pile-note { display: none; }
html[data-fit][data-layout="desktop"] .hand-main .pile-wrap .cards.pile { margin-top: 12px; }
html[data-fit][data-layout="desktop"] .hand-area .task-box {
  grid-column: 3; grid-row: 2; align-self: stretch; min-height: 0; overflow-y: auto; scrollbar-width: thin;
  position: static; margin: 0; padding: 2px 2px 0; background: none; border: 0; border-radius: 0;
}
html[data-fit][data-layout="desktop"] .task-box .actions { flex-direction: column; align-items: stretch; gap: 6px; margin-top: 6px; }
html[data-fit][data-layout="desktop"] .task-box .actions button { min-height: 38px; padding: 6px 14px; font-size: 16px; }
/* A drawn or turned-up card sits beside the buttons */
html[data-fit] .task-box:has(> .drawn) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-content: start; }
html[data-fit] .task-box:has(> .drawn) > * { grid-column: 1 / -1; }
html[data-fit] .task-box > .drawn { grid-column: 1; grid-row: 1 / span 3; margin-top: 6px !important; flex-direction: column; align-items: center; gap: 2px; }
html[data-fit] .task-box > .drawn ~ .actions { grid-column: 2; grid-row: 1; flex-direction: column; align-items: stretch; }
html[data-fit] .task-box > .drawn ~ .chips { grid-column: 2; }
html[data-fit][data-layout="desktop"] .task-box .drawn .card { --w: calc(var(--hand-w) * 0.62); }
html[data-fit][data-layout="mobile"] .task-box .drawn .card { --w: 46px; }
html[data-fit][data-layout="mobile"] .task-box > .drawn ~ .actions button { min-height: 36px; padding: 6px 10px; font-size: 15px; }
html[data-fit][data-layout="desktop"] .task-box .chips { margin-top: 4px; }
html[data-fit][data-layout="desktop"] .task-box .tap-hint { display: none; }
html[data-fit][data-layout="desktop"] .hand-area .coach { margin: 0 0 8px; padding: 8px 10px; font-size: 15px; }
/* A narrower screen: the totals go up beside "Your move", what to do across the tray, then your cards and the buttons */
@media (max-width: 1099px) {
  html[data-fit][data-layout="desktop"] #app { --hand-w: calc((var(--strip) - 118px) / 1.4); }
  html[data-fit][data-layout="desktop"] .hand-area.sheet { grid-template-columns: auto minmax(0, 1fr) minmax(0, max-content); grid-template-rows: auto auto minmax(0, 1fr); column-gap: 14px; }
  html[data-fit][data-layout="desktop"] .sheet-head strong { padding-top: 10px; font-size: 22px; }
  html[data-fit][data-layout="desktop"] .hand-side { grid-column: 2; grid-row: 1; align-self: center; overflow: visible; padding-top: 6px; }
  html[data-fit][data-layout="desktop"] .hand-side .private-board { grid-template-columns: repeat(4, auto); gap: 0 14px; margin: 0; }
  html[data-fit][data-layout="desktop"] .hand-side .private-board .big { font-size: 19px; }
  html[data-fit][data-layout="desktop"] .hand-side .private-board .muted { font-size: 12px; }
  html[data-fit][data-layout="desktop"] .hand-side .fact-line { display: none; }
  /* The coach's tip floats over the table's corner, just above your hand */
  html[data-fit][data-layout="desktop"] .hand-side .coach {
    position: fixed; z-index: 13; left: 12px; bottom: calc(var(--strip) + 8px); width: min(380px, 48vw); max-height: 42dvh; overflow-y: auto;
  }
  html[data-fit][data-layout="desktop"] .hand-area .hand-cue { grid-column: 1 / -1; grid-row: 2; margin: 4px 0 2px; font-size: 15px; line-height: 1.25; }
  html[data-fit][data-layout="desktop"] .hand-main { grid-column: 1 / 3; grid-row: 3; }
  html[data-fit][data-layout="desktop"] .hand-area .task-box { grid-row: 3; }
}
@media (max-width: 899px) {
  .gb-info { display: none; }
  /* Upright tablets: the hand overlaps a little so the cards stay big enough to read */
  html[data-fit][data-layout="desktop"] #app[data-game] { --hand-step: 0.7; }
  html[data-fit][data-layout="desktop"] #app[data-game] .hand-area .hand-cards { gap: 0; padding-left: 0; }
  html[data-fit][data-layout="desktop"] #app[data-game] .hand-area .hand-cards .card { margin-left: 0; }
  html[data-fit][data-layout="desktop"] #app[data-game] .hand-area .hand-cards .card + .card { margin-left: calc(var(--w) * -0.3); }
  html[data-fit][data-layout="desktop"] .task-box .drawn .card { --w: 60px; }
  html[data-fit][data-layout="desktop"] .task-box .actions button { max-width: 230px; white-space: normal; }
}
html[data-screen="game"] .topbar, html[data-screen="game"] .topbar-right { flex-wrap: nowrap; }

/* ---- The results, over the table ---- */
.results-overlay {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow-y: auto;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgb(15 10 6 / 0.6); animation: fade-in 0.45s ease-out both;
}
.results-wrap { position: relative; width: min(980px, 100%); }
.results-wrap > .panel, .results-wrap > .coach { margin: 0 0 10px; }
.results-wrap > .panel.results { margin: 0; }
.results-wrap > .results-close { position: absolute; top: 14px; right: 14px; z-index: 2; min-height: 36px; padding: 6px 12px; font-size: 15px; color: var(--ink-soft); border-color: rgb(91 68 48 / 0.6); background: rgb(255 250 235 / 0.6); }
.results-wrap .panel.results h2 { padding-right: 140px; }
/* Standings beside the face-down piles, so the results fit the screen */
.results-wrap .panel.results { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-auto-flow: row dense; column-gap: 28px; align-items: start; }
.results-wrap .panel.results > * { grid-column: 1 / -1; }
.results-wrap .panel.results > .standings { grid-column: 1; }
.results-wrap .panel.results > .piles { grid-column: 2; }
.results-wrap .results th, .results-wrap .results td { padding: 4px; }
.results-wrap .piles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
.results-wrap .piles h3 { grid-column: 1 / -1; }
.results-wrap .piles .row { flex-wrap: nowrap; gap: 4px; margin: 2px 0 !important; }
.results-wrap .piles .card.small { --w: 32px; }
.results-wrap .pile-who { min-width: 0; flex: 0 1 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-wrap .sd-explain { padding: 8px 12px; }
.results-wrap .sd-hand { padding: 3px 0; }
/* Play again and Leave stay in view if the results are taller than the screen */
.results-wrap .panel.results > .actions { position: sticky; bottom: 0; z-index: 2; margin: 8px -20px -18px; padding: 10px 20px 14px; background: linear-gradient(180deg, rgb(238 224 191 / 0.9), var(--vellum) 40%); border-radius: 0 0 8px 8px; }
html[data-layout="mobile"] .results-wrap .panel.results { grid-template-columns: minmax(0, 1fr); padding: 14px 14px 18px; }
html[data-layout="mobile"] .results-wrap > .results-close { position: relative; top: 0; right: 0; display: block; margin: 0 0 8px auto; }
html[data-layout="mobile"] .results-wrap .panel.results h2 { padding-right: 0; font-size: 26px; }
html[data-layout="mobile"] .results-overlay { padding-top: calc(56px + env(safe-area-inset-top, 0px)); padding-left: 8px; padding-right: 8px; }
html[data-layout="mobile"] .results-wrap .panel.results > .piles { grid-column: 1; grid-row: auto; }

/* ---- What just happened: one short line on the step card ---- */
.step-card .recap {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  max-height: none; margin: 8px 0 0; padding: 5px 10px; font-size: 15px; line-height: 1.3;
}
.step-card .recap .recap-title { margin: 0; flex: none; font-size: 14px; }
.recap-text { flex: 1 1 12em; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.step-card .recap-text.private { color: #21436e; font-weight: 600; }
.recap-more { flex: none; font-size: 13px; color: var(--ink-faint); white-space: nowrap; }
.step-card .recap-fact { display: inline-flex; width: auto; min-height: 0; margin: 0; padding: 1px 8px; border-radius: 999px; font-size: 13px; }
.step-card .recap-fact .fact-label { margin: 0; font-size: 13px; }

/* ---- The end seats keep one row: their cards overlap more as the row fills ---- */
.seat-end .seat-row { flex-wrap: nowrap; }
.seat-end .seat-row:has(> .card:nth-child(5 of .card)) { padding-left: calc(6px + var(--row-w) * 0.58); }
.seat-end .seat-row:has(> .card:nth-child(5 of .card)) > .card.small { margin-left: calc(var(--row-w) * -0.58); }
.seat-end .seat-row:has(> .card:nth-child(9 of .card)) { flex-wrap: wrap; }

/* Your face-down pile under your hand */
.pile-note { margin-top: 10px; }
.pile-wrap .cards.pile { margin-top: 6px; }

/* ---- Phone: the table above your docked hand; the hand slides up over the near side ---- */
html[data-fit][data-layout="mobile"] { --strip: calc(64px + env(safe-area-inset-bottom, 0px)); }
html[data-fit][data-layout="mobile"] #app { padding-top: 6px; justify-content: center; }
html[data-fit][data-layout="mobile"] .table-phone { flex: none; margin: 0; }
html[data-fit][data-layout="mobile"] .hand-area.sheet { max-height: min(64dvh, 560px); }
html[data-fit][data-layout="mobile"] .sheet-head { padding: 12px 14px 8px; margin-bottom: 6px; }
html[data-fit][data-layout="mobile"] .sheet-head strong { font-size: 22px; }
html[data-fit][data-layout="mobile"] .sheet-tools .pb-word { display: none; }
html[data-fit][data-layout="mobile"] .sheet-tools button { min-height: 34px; padding: 4px 11px; font-size: 15px; }
html[data-fit][data-layout="mobile"] .hand-area .hand-cue { font-size: 15px; line-height: 1.25; padding: 5px 10px; margin: 0 0 6px; }
html[data-fit][data-layout="mobile"] .hand-side .private-board { margin-bottom: 2px; }
html[data-fit][data-layout="mobile"] .hand-side .private-board .big { font-size: 19px; }
html[data-fit][data-layout="mobile"] .hand-side .private-board .muted { font-size: 12px; }
html[data-fit][data-layout="mobile"] .hand-side .fact-line { font-size: 14px; line-height: 1.3; }
/* Your face-down pile only shows on your final card, in the row with your hand (the dock counts them meanwhile) */
html[data-fit][data-layout="mobile"] .hand-main .pile-wrap { display: none; }
/* Five or more players: the others sit three across, so the table is two rows of seats, not three */
.tp-seats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tp-seats.three .plate { padding: 5px 6px 6px; }
.tp-seats.three .plate .pname { font-size: 13px; }
.tp-seats.three .plate-total { font-size: 18px; }
.tp-seats.three .ctoken { --t: 20px; }
.table-phone .seat-row { flex-wrap: nowrap; }
.table-phone .seat-row:has(> .card:nth-child(4 of .card)) { padding-left: calc(2px + var(--row-w) * 0.5); }
.table-phone .seat-row:has(> .card:nth-child(4 of .card)) > .card.small { margin-left: calc(var(--row-w) * -0.5); }
.table-phone .seat-row:has(> .card:nth-child(9 of .card)) { flex-wrap: wrap; }
html[data-fit][data-layout="mobile"] .hand-dock { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); padding-top: 7px; padding-bottom: 7px; }

/* The table log on a phone: from the Menu, over the table */
.log-drawer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 16; display: flex; padding: 0 8px; animation: fade-in 0.3s ease-out both; }
.log-drawer .log-panel { flex: 1 1 auto; display: flex; flex-direction: column; max-height: 72dvh; margin: 0; border-radius: 12px 12px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.log-drawer .log { max-height: none; flex: 1 1 auto; overflow-y: auto; }
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.log-head h3 { margin: 0; font-family: var(--font-display); font-size: 24px; color: var(--rubric); }
.log-head button { min-height: 36px; padding: 6px 12px; }
