/* Justice and Mercy
   Concept: a candlelit oak table in a scriptorium. Every panel is a leaf of vellum
   with illuminated-manuscript conventions: blackletter headings in rubric red,
   gold-leaf rules, lapis for virtue, vermilion for vice. The printed cards sit
   on the table as real cards. One visual world on purpose, in either app theme.
   Layout: desktop = seats across the top, decks and the current step in the
   middle, your place below, the chronicle on the right. Mobile = seat strip,
   one section at a time, tabs along the bottom. */

:root {
  --oak-0: #1d130c;
  --oak-1: #2d1f15;
  --oak-2: #402d20;
  --oak-3: #5a412c;
  /* Generated by art-source/textures/make_wood.py */
  --wood-wall: url(textures/wood-wall.webp);
  --wood-table: url(textures/wood-table.webp);
  --vellum: #eee0bf;
  --vellum-2: #e4d2a8;
  --vellum-3: #cdb683;
  --ink: #2a1a0f;
  --ink-soft: #5b4430;
  --ink-faint: #8c7253;
  --rubric: #8e1c12;
  --rubric-2: #b3311d;
  --gold: #b3862b;
  --gold-2: #d6ae55;
  --gold-3: #f1d690;
  --lapis: #21436e;
  --lapis-2: #3b67a3;
  --coin: #a87a17;
  --sus: #2f6b43;
  --ex: #2f4f80;
  --ok: #2f6b43;
  --font-display: "Grenze Gotisch", "UnifrakturMaguntia", "Old English Text MT", "Palatino Linotype", Georgia, serif;
  --font-body: "EB Garamond", Garamond, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --shadow-sheet: 0 1px 1px rgb(0 0 0 / 35%), 0 10px 26px rgb(0 0 0 / 45%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--vellum);
  font: 18px/1.45 var(--font-body);
  font-variant-numeric: lining-nums;
  -webkit-text-size-adjust: 100%;
  background-color: var(--oak-1);
}
/* The room: hand-hewn oak boards (adze-carved, weathered grain, pegged to a batten),
   lit by candles hanging above. The texture is generated by art-source/textures/make_wood.py.
   It sits on a fixed layer behind the page so it stays put while the page scrolls. */
body::after {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 42% at 50% -4%, rgb(255 186 102 / 22%), transparent 72%),
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 46%, rgb(0 0 0 / 46%)),
    linear-gradient(180deg, rgb(255 214 160 / 6%), transparent 32%, rgb(0 0 0 / 18%) 78%, rgb(0 0 0 / 34%)),
    var(--wood-wall) 50% 0 / 1440px 1024px repeat,
    var(--oak-1);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--oak-0); }

h1, h2 { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: 0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 2.6rem; }
h2 { font-size: 1.7rem; color: var(--rubric); margin-bottom: 0.55rem; }
h3 { font-family: var(--font-body); font-size: 1.02rem; font-weight: 700; margin: 1.1rem 0 0.45rem; color: var(--ink); font-variant-caps: small-caps; letter-spacing: 0.03em; }
p { margin: 0.4rem 0; }
.muted { color: var(--ink-faint); }
.small { font-size: 0.86rem; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.code { font-family: var(--font-body); font-weight: 700; letter-spacing: 0.12em; }
.loading { padding: 3rem; text-align: center; color: var(--gold-2); font-family: var(--font-display); font-size: 1.6rem; }
.error { color: var(--rubric-2); font-weight: 600; }
.count { font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; color: var(--ink-faint); }

svg { display: block; }
table { color: inherit; font: inherit; }

/* ---------- Vellum sheets ---------- */

.vellum {
  position: relative;
  color: var(--ink);
  color-scheme: light;
  padding: 1.15rem 1.25rem 1.25rem;
  border-radius: 5px 8px 6px 9px;
  background-color: var(--vellum);
  background-image:
    radial-gradient(ellipse 60% 50% at 18% 12%, rgb(255 255 255 / 38%), transparent 70%),
    radial-gradient(ellipse 50% 40% at 88% 92%, rgb(139 100 40 / 20%), transparent 70%),
    radial-gradient(circle at 72% 28%, rgb(150 110 50 / 7%) 0 9%, transparent 10%),
    radial-gradient(circle at 30% 80%, rgb(150 110 50 / 6%) 0 7%, transparent 8%);
  box-shadow: inset 0 0 0 1px rgb(120 86 36 / 40%), inset 0 0 34px rgb(130 92 38 / 30%), var(--shadow-sheet);
}
.vellum::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgb(179 134 43 / 55%);
  outline: 1px solid rgb(179 134 43 / 22%);
  outline-offset: 2px;
  border-radius: 3px;
  pointer-events: none;
}
.vellum > * { position: relative; }
.vellum h2::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 5px;
  margin-top: 0.35rem;
  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;
}

/* ---------- Controls ---------- */

button {
  font: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  background: linear-gradient(180deg, #f5ead0, var(--vellum-2));
  border: 1px solid var(--ink-faint);
  border-radius: 6px;
  padding: 0.45rem 0.95rem;
  min-height: 42px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 60%), 0 1px 2px rgb(0 0 0 / 18%);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
button:hover:not(:disabled) { border-color: var(--gold); box-shadow: inset 0 1px 0 rgb(255 255 255 / 60%), 0 0 0 2px rgb(179 134 43 / 25%); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary {
  color: var(--gold-3);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #a52a1a, var(--rubric) 55%, #6c140c);
  border: 1px solid #5b0f08;
  box-shadow: inset 0 1px 0 rgb(255 200 150 / 30%), inset 0 0 0 1px rgb(214 174 85 / 35%), 0 2px 5px rgb(60 10 4 / 35%);
}
button.primary:hover:not(:disabled) { border-color: var(--gold-2); box-shadow: inset 0 1px 0 rgb(255 200 150 / 30%), inset 0 0 0 1px rgb(241 214 144 / 60%), 0 0 0 2px rgb(214 174 85 / 30%); }
button.primary svg { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; margin-right: 0.2rem; }
button.small { min-height: 32px; padding: 0.2rem 0.65rem; font-size: 0.88rem; }
button.link { background: none; border: none; box-shadow: none; color: var(--rubric); text-decoration: underline; text-underline-offset: 3px; padding: 0.35rem 0; min-height: 0; }
button.wide { width: 100%; margin-top: 0.75rem; }
:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; }

input, select {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fbf4e2;
  border: 1px solid var(--vellum-3);
  border-bottom-color: var(--ink-faint);
  border-radius: 5px;
  padding: 0.45rem 0.65rem;
  min-height: 42px;
  max-width: 100%;
  box-shadow: inset 0 1px 3px rgb(90 60 20 / 15%);
}
.field { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.55rem 0; font-size: 0.92rem; color: var(--ink-soft); font-variant-caps: small-caps; letter-spacing: 0.02em; }
.field select, .field input { font-variant-caps: normal; letter-spacing: 0; }
.check { display: flex; align-items: center; gap: 0.5rem; margin: 0.45rem 0; font-size: 0.95rem; }
.check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--rubric); }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.55rem 0; }
.row .field { margin: 0; }

.tag { display: inline-block; font-size: 0.74rem; padding: 0.02rem 0.45rem; border-radius: 3px; background: rgb(179 134 43 / 14%); border: 1px solid rgb(179 134 43 / 45%); color: var(--ink-soft); vertical-align: middle; font-variant-caps: small-caps; letter-spacing: 0.04em; }
.tag.new { background: var(--rubric); color: var(--gold-3); border-color: var(--rubric); }
.badge { display: inline-block; min-width: 1.35em; padding: 0 0.35em; border-radius: 999px; background: var(--rubric-2); color: #fff4dc; font-size: 0.72rem; font-weight: 700; line-height: 1.45; text-align: center; font-family: var(--font-body); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5ea36b; flex: none; box-shadow: 0 0 0 1px rgb(0 0 0 / 25%); }
.dot.off { background: #9c8f7d; }
.divider { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-faint); font-size: 0.9rem; margin: 1rem 0 0.2rem; font-style: italic; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.table-wrap { overflow-x: auto; max-width: 100%; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-block: 0.55rem;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  background: linear-gradient(180deg, rgb(29 19 12 / 96%), rgb(45 31 21 / 92%));
  border-bottom: 1px solid rgb(214 174 85 / 45%);
  box-shadow: 0 1px 0 rgb(0 0 0 / 60%), 0 8px 18px rgb(0 0 0 / 35%);
  backdrop-filter: blur(4px);
}
.topbar-right { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.brand-mark { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--gold-3); }
.brand-scales { width: 28px; height: 28px; color: var(--gold-2); }
.brand-scales svg { width: 100%; height: 100%; }
.brand-name { font-family: var(--font-display); font-size: 1.75rem; line-height: 1; letter-spacing: 0.01em; text-shadow: 0 1px 0 #000, 0 0 18px rgb(255 190 100 / 25%); }
.brand-name i { font-style: normal; color: var(--rubric-2); }
.brand-mark.small .brand-name { font-size: 1.35rem; }
.brand-mark.small .brand-scales { width: 22px; height: 22px; }
.pill { font-size: 0.9rem; padding: 0.15rem 0.7rem; border-radius: 999px; border: 1px solid rgb(214 174 85 / 50%); color: var(--gold-3); background: rgb(0 0 0 / 30%); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.code-pill { letter-spacing: 0.1em; }
.timer.urgent { color: #ffd2c4; border-color: var(--rubric-2); background: rgb(142 28 18 / 45%); }
.offline { color: #ffb4a3; font-size: 0.88rem; }

.layout-toggle { display: inline-flex; border: 1px solid rgb(214 174 85 / 50%); border-radius: 7px; overflow: hidden; background: rgb(0 0 0 / 30%); }
.layout-toggle button { min-height: 32px; padding: 0.15rem 0.55rem; border: none; border-radius: 0; background: none; box-shadow: none; color: var(--vellum-3); display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; }
.layout-toggle button svg { width: 17px; height: 17px; }
.layout-toggle button[aria-pressed="true"] { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--oak-0); font-weight: 600; }
.layout-toggle button + button { border-left: 1px solid rgb(214 174 85 / 40%); }

/* ---------- Home ---------- */

.home { max-width: 560px; margin: 0 auto; padding-block: 1.25rem 3rem; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.home-top { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.folio { padding: 2rem 2rem 1.75rem; }
.folio-head { display: flex; align-items: center; gap: 1rem; }
.initial {
  flex: none;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 4.3rem;
  line-height: 1;
  color: var(--gold-3);
  background:
    radial-gradient(circle at 30% 25%, rgb(255 255 255 / 18%), transparent 45%),
    repeating-linear-gradient(45deg, rgb(255 255 255 / 5%) 0 3px, transparent 3px 8px),
    var(--lapis);
  border: 3px solid var(--gold);
  outline: 1px solid var(--rubric);
  outline-offset: 2px;
  border-radius: 3px;
  text-shadow: 0 2px 0 #0b1a2e;
}
.folio h1 { color: var(--rubric); font-size: 3rem; }
.folio h1 i { font-style: normal; color: var(--gold); }
.tagline { font-style: italic; color: var(--ink-soft); font-size: 1.08rem; margin-top: 0.3rem; }
.folio-cards { display: flex; justify-content: center; gap: 0.2rem; margin: 1.4rem 0 1rem; }
.folio-cards .card { box-shadow: 0 6px 14px rgb(40 20 5 / 35%); }
.tilt-l { transform: rotate(-8deg) translateY(6px); }
.tilt-r { transform: rotate(8deg) translateY(6px); }
.tilt-0 { transform: translateY(-4px); z-index: 1; }
.folio-form { max-width: 380px; margin: 0 auto; }

/* ---------- Lobby ---------- */

.lobby-grid { display: grid; gap: 1.25rem; padding-block: 1.4rem 2.5rem; padding-left: var(--gutter-l); padding-right: var(--gutter-r); max-width: 1180px; margin: 0 auto; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.lobby-grid > * { min-width: 0; }
.seats { list-style: none; padding: 0; margin: 0; }
.seat { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.1rem; border-bottom: 1px solid rgb(140 114 83 / 35%); }
.seat-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.invite { margin-top: 1rem; }
.invite input { flex: 1; min-width: 0; }
.preview-cards { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0 0.6rem; }
.lobby-chat .feed { max-height: 300px; }

/* ---------- Cards ---------- */

.card {
  container-type: inline-size;
  position: relative;
  display: inline-block;
  flex: none;
  aspect-ratio: 330 / 476;
  border-radius: 7% / 4.8%;
  overflow: hidden;
  background: #1c130c;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 3px 8px rgb(0 0 0 / 35%);
  vertical-align: middle;
}
.card-xs { width: 22px; }
.card-s { width: 54px; }
.card-m { width: 84px; }
.card-l { width: 128px; }
.card-xl { width: 210px; }
.card-art { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 9cqw 7cqw;
  text-align: center;
  box-shadow: inset 0 0 0 3.2cqw rgb(214 174 85 / 85%), inset 0 0 0 4.6cqw rgb(0 0 0 / 35%), inset 0 0 22cqw rgb(0 0 0 / 35%);
}
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 16cqw; line-height: 1; overflow-wrap: break-word; hyphens: manual; text-shadow: 0 1px 0 rgb(0 0 0 / 55%); }
.card-title-flip { transform: rotate(180deg); opacity: 0.85; }
.card-sub { font-size: 10.5cqw; font-variant-caps: small-caps; letter-spacing: 0.04em; opacity: 0.9; line-height: 1.05; margin-top: 1cqw; }
.card-emblem { width: 44cqw; height: 44cqw; display: grid; place-items: center; }
.card-emblem svg { width: 100%; height: 100%; }
.card-xs .card-face { padding: 0; justify-content: center; }
.card-xs .card-title, .card-xs .card-sub { display: none; }
.card-s .card-sub { display: none; }

.card-vice .card-face { color: #f6e2c4; background: radial-gradient(circle at 50% 42%, #7a2014, #3a0d07 62%, #1c0604); }
.card-vice .card-emblem { color: #f0a046; filter: drop-shadow(0 0 4cqw rgb(255 140 40 / 45%)); }
.card-virtue .card-face { color: #f2e6c8; background: radial-gradient(circle at 50% 42%, #335f96, #152c4f 65%, #0b1830); }
.card-virtue .card-emblem { color: var(--gold-2); }
.card-saint .card-face { color: var(--ink); background: radial-gradient(circle at 50% 45%, #fff5d6, var(--vellum) 50%, var(--vellum-3)); }
.card-saint .card-title { text-shadow: none; color: var(--rubric); font-size: 13.5cqw; }
.card-saint .card-emblem { color: var(--gold); }
.card-scapular .card-face { color: var(--ink); background: repeating-linear-gradient(0deg, rgb(120 90 50 / 9%) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgb(120 90 50 / 9%) 0 1px, transparent 1px 3px), radial-gradient(circle at 50% 45%, #f7eed8, #ddcaa0); }
.card-scapular .card-title { text-shadow: none; color: var(--rubric); }
.card-power .card-face { color: #f1e7cc; background: radial-gradient(circle at 50% 42%, #2f5a3c, #14301f 70%); }
.card-power .card-emblem { color: var(--gold-2); }
.card-token .card-face { color: #f2e9d4; background: radial-gradient(ellipse 70% 45% at 50% 52%, #c23b2b 0 60%, transparent 61%), radial-gradient(ellipse 66% 42% at 50% 52%, #f3c34a 0 98%, transparent 99%), #1d2b47; }
.card-token .card-title { font-size: 12cqw; }
.card-token .card-emblem { width: 80cqw; height: auto; }
.card-costs { display: flex; gap: 2.5cqw; justify-content: center; background: rgb(255 248 230 / 92%); border-radius: 4cqw; padding: 2cqw 3cqw; color: var(--ink); }
.card-costs > span { display: flex; flex-direction: column; align-items: center; font-size: 9cqw; font-weight: 700; line-height: 1; }
.card-costs svg { width: 13cqw; height: 13cqw; }
.card-costs .tok-C { color: var(--coin); }
.card-costs .tok-S { color: var(--sus); }
.card-costs .tok-E { color: var(--ex); }
.card-costs b { color: var(--ink); }
.card-role .card-face { color: var(--gold-3); background: radial-gradient(circle at 50% 40%, #5b3b22, #2a1a0e 70%); }
.card-role .card-emblem { color: var(--gold-2); }
.card-role.villain .card-face { background: radial-gradient(circle at 50% 40%, #4f1a12, #1a0705 70%); }
.card-role.villain .card-emblem { color: #f0a046; }
.card-back-drawn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgb(214 174 85 / 55%) 0 9%, transparent 10%) 0 0 / 22cqw 22cqw,
    radial-gradient(circle at 0 0, rgb(214 174 85 / 30%) 0 6%, transparent 7%) 0 0 / 22cqw 22cqw,
    linear-gradient(160deg, #2e5a33, #1c3a20);
  box-shadow: inset 0 0 0 3cqw rgb(214 174 85 / 75%), inset 0 0 0 4.4cqw rgb(0 0 0 / 35%);
}
.card-back-drawn span { font-family: var(--font-display); color: var(--gold-3); font-size: 15cqw; text-shadow: 0 1px 2px #000; padding: 0 6cqw; text-align: center; line-height: 1; }
.card-xs .card-back-drawn span { display: none; }
.card-btn { padding: 0; border: none; background: none; box-shadow: none; min-height: 0; border-radius: 7% / 4.8%; cursor: zoom-in; line-height: 0; }
.card-btn:hover:not(:disabled) { box-shadow: none; transform: translateY(-2px); }

/* ---------- Tokens ---------- */

.tokrow { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.tok { display: inline-flex; align-items: center; gap: 0.18rem; padding: 0.06rem 0.38rem 0.06rem 0.22rem; border-radius: 999px; background: rgb(255 250 235 / 75%); border: 1px solid currentColor; font-variant-numeric: lining-nums tabular-nums; line-height: 1.25; }
.tok svg { width: 17px; height: 17px; }
.tok b { color: var(--ink); font-weight: 700; font-size: 0.92rem; min-width: 1.4ch; text-align: right; }
.tok-C { color: var(--coin); }
.tok-S { color: var(--sus); }
.tok-E { color: var(--ex); }
.tok.zero { background: currentColor; }
.tok.zero svg { color: #fff6df; }
.tok.zero b { color: #fff6df; }
.tokrow-s .tok svg { width: 14px; height: 14px; }
.tokrow-s .tok b { font-size: 0.8rem; }
.tok.bump-up { animation: bump-up 0.8s ease-out; }
.tok.bump-down { animation: bump-down 0.8s ease-out; }
@keyframes bump-up { 40% { transform: scale(1.25); box-shadow: 0 0 0 3px rgb(47 107 67 / 35%); } }
@keyframes bump-down { 40% { transform: scale(0.85); box-shadow: 0 0 0 3px rgb(179 49 29 / 35%); } }
.tok-text-C { color: var(--coin); font-weight: 700; }
.tok-text-S { color: var(--sus); font-weight: 700; }
.tok-text-E { color: var(--ex); font-weight: 700; }

/* ---------- Game: desktop board ---------- */

.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.25rem;
  max-width: 1440px;
  margin: 0 auto;
  padding-block: 1.1rem 2.5rem;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}
.main-col { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.side-col { position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); align-self: start; min-width: 0; padding: 0.9rem 1rem 1rem; }
@media (max-width: 980px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; }
}
.table-center { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.1rem; align-items: start; }
@media (max-width: 640px) { .table-center { grid-template-columns: minmax(0, 1fr); } }

/* ---------- The tables ----------
   Everyone sits in turn order going clockwise, you on the near side. Desktop: one long oak
   banquet table with a red runner; seats across the far side, one at each end, the rest beside
   you; the draw piles and the current step lie on the runner. Phone: a round table with the
   draw piles and the current Work of Mercy in the middle; the current step is below it. */

.game-desktop { zoom: var(--desk-zoom, 1); }
/* The side panel takes the room to the right of the table that used to sit empty, wide enough
   that the Notepad grid and Chat's phrase tabs fit without scrolling sideways. */
.game-desktop .board { grid-template-columns: minmax(0, 1fr) 400px; max-width: 1600px; }
.game-desktop .side-col .qw-tabs { flex-wrap: wrap; overflow-x: visible; }
@media (max-width: 980px) {
  .game-desktop .board { grid-template-columns: minmax(0, 1fr); }
  .game-desktop .side-col { position: static; }
}
.banquet {
  display: grid;
  grid-template-columns: minmax(140px, 176px) minmax(0, 1fr) minmax(140px, 176px);
  grid-template-areas: ". far ." "left table right" ". near .";
  column-gap: 0.9rem;
  align-items: center;
  padding-block: 0.3rem 0.4rem;
}
.bq-far, .bq-near { display: flex; justify-content: center; gap: 1rem; position: relative; z-index: 2; min-width: 0; }
.bq-far { grid-area: far; align-items: flex-end; margin-bottom: -18px; }
.bq-near { grid-area: near; align-items: flex-start; margin-top: -18px; }
.bq-far .player, .bq-near .player { flex: 0 1 178px; min-width: 0; }
.bq-near .player.mine { flex-basis: 204px; }
.bq-end { position: relative; z-index: 2; min-width: 0; }
.bq-left { grid-area: left; }
.bq-right { grid-area: right; }
.bq-left .player { margin-right: -16px; }
.bq-right .player { margin-left: -16px; }
.bq-table {
  grid-area: table;
  min-width: 0;
  padding: 34px 26px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgb(255 214 160 / 14%), transparent 70%),
    linear-gradient(180deg, transparent 55%, rgb(0 0 0 / 22%)),
    var(--wood-table) 50% 0 / 1024px 256px repeat,
    #5e3b21;
  box-shadow: 0 0 0 8px #36241a, 0 0 0 10px #8a6a3a, 0 34px 70px rgb(0 0 0 / 55%), inset 0 2px 30px rgb(0 0 0 / 45%);
}
.bq-runner {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
}
/* The runner is a red band down the length of the table; the piles and the parchment lie on it. */
.bq-runner::before {
  content: "";
  position: absolute;
  left: -26px;
  right: -26px;
  top: 18%;
  bottom: 18%;
  background: linear-gradient(180deg, #6b1a12, #4e120c);
  border-top: 3px double var(--gold-2);
  border-bottom: 3px double var(--gold-2);
  box-shadow: 0 8px 14px rgb(0 0 0 / 40%);
}
.bq-runner > * { position: relative; }
.bq-runner .deck-label { color: var(--vellum-2); }
@media (max-width: 860px) {
  .banquet { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "left far right" "table table table" ". near ."; row-gap: 0.6rem; }
  .bq-far { margin-bottom: 0; }
  .bq-left .player, .bq-right .player { margin: 0; width: 150px; }
  .bq-runner { grid-template-columns: minmax(0, 1fr); }
  .bq-runner .decks { flex-direction: row; justify-content: space-around; }
}

.round-phone { position: relative; margin: 0.4rem var(--gutter-r) 0.2rem var(--gutter-l); }
.rt-table {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 66%;
  height: 68%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 38%, rgb(255 214 160 / 16%), transparent 50%, rgb(0 0 0 / 22%) 82%, rgb(0 0 0 / 42%)),
    var(--wood-table) 50% 50% / 640px 160px repeat,
    #5e3b21;
  box-shadow: 0 0 0 7px #36241a, 0 0 0 9px #8a6a3a, 0 24px 50px rgb(0 0 0 / 60%), inset 0 2px 24px rgb(0 0 0 / 55%);
}
.rt-table::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 1.5px solid rgb(214 174 85 / 42%); }
.rt-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.game-mobile .rt-center .decks { flex-direction: row; gap: 0.55rem; }
.game-mobile .rt-center .deck-label { display: none; }
.game-mobile .rt-center .deck-pile .card { width: 32px; }
.game-mobile .rt-center .deck-count { font-size: 1rem; }
.rt-card .card { width: 62px; }
.rt-pos { position: absolute; width: 108px; transform: translate(-50%, -50%); z-index: 2; }
.rt-pos.me { z-index: 3; }
.round-phone .player { position: relative; padding: 0.35rem 0.4rem 0.4rem; }
.round-phone .seat-head strong { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-phone .seat-label { font-size: 0.66rem; }
.round-phone .thinking { position: absolute; top: 0.3rem; right: 0.3rem; margin: 0; }
.round-phone .thinking svg { width: 13px; height: 13px; }
.round-phone .thinking span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.round-phone .seat-toks { margin: 0.2rem 0 0.15rem; }
.round-phone .tokrow { gap: 2px; flex-wrap: nowrap; }
.round-phone .tokrow .tok { padding: 0 3px 0 1px; gap: 1px; }
.round-phone .tokrow .tok svg { width: 11px; height: 11px; }
.round-phone .tokrow .tok b { font-size: 0.7rem; }
.round-phone .seat-cards { gap: 0.3rem; font-size: 0.7rem; }
.round-phone .deltas, .round-phone .cleared { display: none; }
.round-phone .tag { font-size: 0.62rem; padding: 0 0.25rem; }
@media (max-width: 370px) { .rt-pos { width: 100px; } }

/* ---------- Seats ---------- */

.seats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 0.6rem; }
.player {
  position: relative;
  min-width: 0;
  padding: 0.55rem 0.6rem 0.6rem;
  color: var(--ink);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 20% 10%, rgb(255 255 255 / 35%), transparent 60%),
    linear-gradient(180deg, #f1e4c4, var(--vellum-2));
  box-shadow: inset 0 0 0 1px rgb(120 86 36 / 45%), inset 0 -10px 18px rgb(130 92 38 / 18%), 0 6px 14px rgb(0 0 0 / 40%);
  transition: transform 0.65s cubic-bezier(.2,.8,.25,1), box-shadow 0.65s ease;
}
.player.mine { background: radial-gradient(ellipse at 20% 10%, rgb(255 255 255 / 40%), transparent 60%), linear-gradient(180deg, #f7ecd0, #eadbb5); }
.player.active { box-shadow: inset 0 0 0 1px rgb(120 86 36 / 45%), 0 0 0 2px var(--gold-2), 0 0 26px rgb(255 190 90 / 50%), 0 6px 14px rgb(0 0 0 / 40%); }
.player.spot-from { transform: translateY(-3px) scale(1.04); box-shadow: inset 0 0 0 1px rgb(120 86 36 / 45%), 0 0 0 3px var(--gold-2), 0 0 34px rgb(255 196 90 / 75%), 0 10px 22px rgb(0 0 0 / 50%); z-index: 2; }
.player.spot-to { transform: translateY(-2px) scale(1.03); box-shadow: inset 0 0 0 1px rgb(120 86 36 / 45%), 0 0 0 3px var(--lapis-2), 0 0 30px rgb(110 160 230 / 70%), 0 10px 22px rgb(0 0 0 / 50%); z-index: 2; }
.player.spot-hit { transform: translateY(-2px) scale(1.03); box-shadow: inset 0 0 0 1px rgb(120 86 36 / 45%), 0 0 0 3px #c2412c, 0 0 30px rgb(235 90 60 / 70%), 0 10px 22px rgb(0 0 0 / 50%); z-index: 2; }
.seat-head { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.seat-head strong { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.player { position: relative; }
/* Each seat's character: yours shows your Role, everyone else is a hooded pilgrim until the reveal. */
.avatar { flex: none; width: 30px; height: 30px; display: inline-grid; border-radius: 50%; box-shadow: 0 1px 3px rgb(0 0 0 / 40%); }
.avatar svg { width: 100%; height: 100%; display: block; }
.round-phone .avatar, .seats-row.compact .avatar { width: 22px; height: 22px; }
.round-phone .dot, .seats-row.compact .dot { display: none; }
.seat-accuse { margin-left: auto; flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; color: var(--ink-soft); background: rgb(255 250 235 / 60%); border: 1px solid rgb(140 114 83 / 50%); box-shadow: none; opacity: 0.55; transition: opacity 0.3s ease, color 0.3s ease, background 0.3s ease; }
.seat-accuse svg { width: 15px; height: 15px; }
.player:hover .seat-accuse, .seat-accuse:focus-visible, .seat-accuse.on { opacity: 1; color: var(--rubric); background: #fff6df; }
.round-phone .seat-accuse { width: 22px; height: 22px; opacity: 0.8; }
.round-phone .seat-accuse svg { width: 13px; height: 13px; }
.round-phone .seat-head strong { flex: 1 1 auto; }
.accuse-pop { position: absolute; left: 50%; top: calc(100% - 4px); transform: translateX(-50%); z-index: 12; display: flex; flex-direction: column; align-items: stretch; gap: 0.25rem; width: max-content; min-width: 160px; padding: 0.55rem 0.6rem; border-radius: 8px; background: linear-gradient(180deg, #f7ecd0, #e8d4a2); box-shadow: 0 0 0 1px var(--gold), 0 14px 30px rgb(0 0 0 / 55%); animation: none; }
.accuse-pop .pop-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--rubric); padding: 0 0.2rem 0.15rem; }
.accuse-pop button.small { justify-content: flex-start; text-align: left; min-height: 32px; }
.accuse-pop button.villain { color: var(--rubric); font-weight: 700; }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, 6px) scale(0.97); } }
.role-portrait { flex: none; width: 64px; height: 64px; display: inline-grid; border-radius: 50%; box-shadow: 0 2px 8px rgb(0 0 0 / 35%); }
.role-portrait svg { width: 100%; height: 100%; }
.you-tag { font-size: 0.72rem; font-variant-caps: small-caps; color: var(--rubric); letter-spacing: 0.05em; }
.seat-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--ink-faint); font-variant-caps: small-caps; letter-spacing: 0.05em; margin-top: 0.05rem; }
.player.active .seat-label { color: var(--rubric); font-weight: 700; }
.candle { width: 7px; height: 11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff3c4, #ffb340 55%, #d9521c); box-shadow: 0 0 8px 2px rgb(255 170 60 / 70%); animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); opacity: 1; } 40% { transform: scale(0.9, 1.08) rotate(3deg); opacity: 0.85; } 70% { transform: scale(1.06, 0.95) rotate(-1deg); } }
.thinking { display: flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; color: var(--lapis); font-style: italic; margin-top: 0.05rem; }
.thinking svg { width: 15px; height: 15px; animation: quill 1.1s ease-in-out infinite; transform-origin: 20% 90%; }
@keyframes quill { 50% { transform: rotate(-14deg) translateX(1px); } }
.seat-toks { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin: 0.35rem 0 0.3rem; }
.deltas { display: inline-flex; gap: 0.2rem; flex-wrap: wrap; }
.delta { font-size: 0.72rem; font-weight: 700; padding: 0 0.3rem; border-radius: 4px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); background: rgb(47 107 67 / 14%); }
.delta.down { color: var(--rubric-2); background: rgb(179 49 29 / 12%); }
.seat-cards { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-soft); }
.mini-stack { display: inline-flex; align-items: center; }
.mini-stack .mb { width: 13px; height: 19px; border-radius: 2px; margin-right: -8px; background: var(--art-back-vicevirtue, linear-gradient(160deg, #2e5a33, #1c3a20)) center / cover; box-shadow: 0 0 0 1px rgb(255 240 210 / 60%), 1px 1px 2px rgb(0 0 0 / 35%); }
.mini-stack .mb-saint { background: linear-gradient(160deg, #f6ecd2, #d9c08b); box-shadow: 0 0 0 1px rgb(120 86 36 / 60%), 1px 1px 2px rgb(0 0 0 / 30%); }
.mini-stack b { margin-left: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-stack.held b { margin-left: 10px; }
.mini-stack .mb-empty { background: none; box-shadow: inset 0 0 0 1px rgb(120 86 36 / 55%); }
.gave { font-size: 0.76rem; color: var(--ink-faint); margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.cleared { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.35rem; }
.seal { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 0.85rem; color: #ffe9cf; background: radial-gradient(circle at 35% 30%, #c6402b, var(--rubric) 60%, #5d0f08); box-shadow: 0 1px 2px rgb(0 0 0 / 35%), inset 0 0 0 2px rgb(255 255 255 / 12%); }

/* ---------- Decks on the table ---------- */

.decks { display: flex; flex-direction: column; gap: 0.9rem; padding: 0.35rem 0.2rem; }
.deck { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 0.55rem; align-items: center; color: var(--vellum-2); }
.deck-pile { grid-row: span 2; position: relative; line-height: 0; }
.deck-pile .card { box-shadow: 0 0 0 1px rgb(0 0 0 / 40%), 2px 2px 0 #d8c69a, 3px 3px 0 rgb(0 0 0 / 40%), 4px 4px 0 #d0bd8e, 5px 5px 0 rgb(0 0 0 / 40%), 6px 8px 12px rgb(0 0 0 / 45%); }
.deck-pile.empty { opacity: 0.35; }
.deck-count { font-family: var(--font-display); font-size: 1.5rem; color: var(--gold-3); line-height: 1; text-shadow: 0 1px 0 #000; }
.deck-label { font-size: 0.82rem; color: var(--vellum-3); font-variant-caps: small-caps; letter-spacing: 0.04em; max-width: 9em; line-height: 1.1; }

/* ---------- Stage ---------- */

.stage { min-height: 160px; }
.stage.your-move { box-shadow: inset 0 0 0 1px rgb(120 86 36 / 40%), inset 0 0 34px rgb(130 92 38 / 30%), 0 0 0 2px var(--gold-2), 0 0 34px rgb(255 190 90 / 30%), var(--shadow-sheet); }
.wax-seal {
  position: absolute;
  top: -14px;
  right: 14px;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.6rem;
  border-radius: 46% 54% 50% 50% / 52% 46% 54% 48%;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 0.95;
  color: #ffe2c6;
  background: radial-gradient(circle at 35% 30%, #d14a33, var(--rubric) 55%, #5b0f08);
  box-shadow: 0 3px 8px rgb(0 0 0 / 45%), inset 0 0 0 4px rgb(255 255 255 / 10%), inset 0 0 0 6px rgb(0 0 0 / 12%);
  transform: rotate(-10deg);
  z-index: 2;
}
.stage h2 { padding-right: 5rem; }
.waiting-line { display: flex; align-items: center; gap: 0.45rem; color: var(--ink-soft); font-style: italic; }
.waiting-line svg { width: 20px; height: 20px; color: var(--lapis); flex: none; animation: quill 1.1s ease-in-out infinite; transform-origin: 20% 90%; }
.trade-tally { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }
.tally-card { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; font-size: 0.72rem; color: var(--ink-faint); opacity: 0.4; transition: opacity 0.3s, transform 0.3s; }
.tally-card.down { opacity: 1; transform: translateY(-3px); color: var(--ink-soft); }
.tally-card small { max-width: 5.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hand-fan { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0.6rem 0 0.8rem; align-items: flex-start; }
.hand-card { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0; border: none; background: none; box-shadow: none; min-height: 0; transition: transform 0.18s ease; }
.hand-card:hover { transform: translateY(-4px); }
button.hand-card:hover:not(:disabled) { box-shadow: none; }
.hand-card.selected { transform: translateY(-10px); }
.hand-card.selected .card { box-shadow: 0 0 0 3px var(--gold-2), 0 0 18px rgb(255 190 90 / 60%), 0 8px 16px rgb(0 0 0 / 35%); }
.clear-btn { min-height: 28px; padding: 0.05rem 0.55rem; font-size: 0.8rem; }
.pool { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.5rem 0; }
.pool-card { padding: 0; border: none; background: none; box-shadow: none; min-height: 0; line-height: 0; transition: transform 0.18s; }
.pool-card:hover:not(:disabled) { transform: translateY(-5px) rotate(-2deg); box-shadow: none; }
.pool-card.gone { width: 84px; aspect-ratio: 330 / 476; border: 1px dashed var(--ink-faint); border-radius: 6px; line-height: 1.2; display: grid; place-items: center; }
.taken { font-size: 0.8rem; color: var(--ink-faint); }
.drawn { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.4rem 0 0.7rem; }
.drawn-cards { display: flex; gap: 0.35rem; }
.token-card { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 0.4rem 0 0.6rem; }
.token-card .card { box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 8px 18px rgb(40 20 5 / 40%); transform: rotate(-2deg); }
.token-card-text { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.token-card-text strong { font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); line-height: 1.05; }
.costs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.cost { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.5rem 0.1rem 0.3rem; border-radius: 999px; border: 1px solid currentColor; background: rgb(255 250 235 / 70%); }
.cost svg { width: 18px; height: 18px; }
.cost b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Gift editor */
.gift-editor { margin: 0.5rem 0; }
.gift-summary { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 0.35rem; color: var(--ink-faint); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.gift-summary span { display: inline-flex; align-items: center; gap: 0.25rem; }
.gift-summary svg { width: 16px; height: 16px; }
.gift-summary .ok { color: var(--ok); font-weight: 700; }
.gift-table { border-collapse: collapse; width: 100%; max-width: 560px; }
.gift-table th, .gift-table td { padding: 0.25rem 0.2rem; text-align: center; font-size: 0.95rem; }
.gift-table thead th { font-weight: 600; color: var(--ink-soft); font-size: 0.85rem; }
.th-tok { display: inline-block; vertical-align: -3px; margin-right: 0.2rem; }
.th-tok svg { width: 16px; height: 16px; }
.gift-table tbody th { text-align: left; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-table tbody tr { border-top: 1px solid rgb(140 114 83 / 30%); }
.stepper { display: inline-flex; align-items: center; gap: 0.25rem; }
.stepper button { min-height: 32px; width: 32px; padding: 0; border-radius: 50%; font-size: 1.1rem; line-height: 1; }
.stepper span { min-width: 2.2ch; font-variant-numeric: tabular-nums; }
.stepper span.has { font-weight: 700; color: var(--rubric); }

/* ---------- Your place ---------- */

.roles { display: grid; gap: 0.65rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.role-card { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.55rem 0.65rem; border-radius: 6px; background: rgb(255 250 235 / 55%); border: 1px solid rgb(179 134 43 / 45%); }
.role-card > div { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.role-card strong { font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); line-height: 1; }
.role-card.villain { border-color: var(--rubric); background: rgb(142 28 18 / 7%); }
.role-card.villain strong { color: var(--rubric); }
.special-list { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); align-items: start; }
.special { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.55rem 0.6rem; border-radius: 6px; background: rgb(255 250 235 / 55%); border: 1px solid rgb(179 134 43 / 40%); min-width: 0; }
.special.fresh { box-shadow: 0 0 0 2px var(--gold-2), 0 0 14px rgb(255 190 90 / 35%); }
.special-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.special-head { display: flex; justify-content: space-between; gap: 0.4rem; align-items: flex-start; }
.special-head button { flex: none; white-space: nowrap; }
.inline-form { margin-top: 0.5rem; padding: 0.6rem 0.7rem; border-radius: 6px; background: rgb(255 252 242 / 85%); border: 1px solid var(--vellum-3); }

/* ---------- Ballot and results ---------- */

.ballot { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.villain-row { color: var(--rubric); font-weight: 600; }
.villains { list-style: none; padding: 0; margin: 0 0 0.8rem; display: grid; gap: 0.5rem; }
.villains li { display: flex; gap: 0.7rem; align-items: center; padding: 0.45rem 0.55rem; border-radius: 6px; border: 1px solid; }
.villains .caught { color: var(--ok); border-color: rgb(47 107 67 / 45%); background: rgb(47 107 67 / 7%); }
.villains .escaped { color: var(--rubric); border-color: rgb(142 28 18 / 45%); background: rgb(142 28 18 / 6%); }
.villains li > span { color: var(--ink); }
.results { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.results th, .results td { border-bottom: 1px solid rgb(140 114 83 / 35%); padding: 0.4rem 0.35rem; text-align: left; }
.results th:nth-child(n+2), .results td:nth-child(n+2) { text-align: center; }
.results .res-roles { display: block; font-size: 0.82em; color: var(--ink-soft); }
.stage .results { font-size: 0.88rem; }
.results th { font-variant-caps: small-caps; color: var(--ink-soft); }
.results tr.winner { background: rgb(214 174 85 / 20%); }
.crown { color: var(--gold); }
body[data-layout="mobile"] .results { font-size: 0.8rem; }
body[data-layout="mobile"] .results th, body[data-layout="mobile"] .results td { padding: 0.35rem 0.22rem; }
body[data-layout="mobile"] .villains li { font-size: 0.92rem; }

/* ---------- Chronicle, chat, notepad, rules ---------- */

.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid rgb(179 134 43 / 55%); margin: -0.2rem -0.2rem 0.6rem; }
.tab { flex: 1; min-height: 38px; border: none; border-radius: 5px 5px 0 0; background: none; box-shadow: none; padding: 0.3rem 0.2rem; font-size: 0.92rem; color: var(--ink-faint); font-variant-caps: small-caps; letter-spacing: 0.04em; }
.tab.on { color: var(--rubric); font-weight: 700; background: rgb(179 134 43 / 14%); box-shadow: inset 0 -3px 0 var(--rubric); }
.tab:hover:not(:disabled) { box-shadow: inset 0 -3px 0 rgb(179 134 43 / 60%); }
.tab.on:hover:not(:disabled) { box-shadow: inset 0 -3px 0 var(--rubric); }
.feed { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; font-size: 0.95rem; }
@media (min-width: 981px) { .game-desktop .feed { max-height: calc(100vh / var(--desk-zoom, 1) - 290px); } .game-desktop .feed.private { max-height: 170px; } }
.ledger { background: repeating-linear-gradient(180deg, transparent 0 1.55em, rgb(140 114 83 / 22%) 1.55em calc(1.55em + 1px)); }
.log-line { padding: 0.08rem 0.1rem; line-height: 1.55em; }
.log-turn { font-family: var(--font-display); color: var(--rubric); font-size: 1.15rem; margin-top: 0.35rem; }
.feed.private { border-top: 1px solid rgb(179 134 43 / 45%); margin-top: 0.3rem; padding-top: 0.3rem; color: var(--lapis); font-style: italic; }
.side-body h3 { margin-top: 0.7rem; }
.chat-line { padding: 0.18rem 0; overflow-wrap: anywhere; }
.chat-line.system { color: var(--ink-faint); font-style: italic; }
.chat-line.accuse { border-left: 3px solid var(--rubric); padding-left: 0.5rem; background: rgb(142 28 18 / 6%); }
.chat-line.mine strong { color: var(--rubric); }
.accuse-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed rgb(140 114 83 / 50%); }
.accuse-row select { min-height: 34px; padding: 0.2rem 0.45rem; flex: 1 1 110px; min-width: 0; }
.chat-form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.chat-form input { flex: 1; min-width: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.quick-words { margin-top: 0.55rem; }
.quick-words summary { cursor: pointer; font-size: 0.85rem; color: var(--lapis); font-variant-caps: small-caps; letter-spacing: 0.04em; }
.chat-line.action { display: flex; align-items: center; gap: 0.35rem; font-style: italic; color: var(--ink-soft); }
.chat-line .b-icon, .fx-bubble .b-icon { flex: none; display: inline-grid; width: 18px; height: 18px; color: var(--rubric); }
.chat-line .b-icon svg, .fx-bubble .b-icon svg { width: 100%; height: 100%; }
.accuse-label { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-caps: small-caps; letter-spacing: 0.04em; color: var(--rubric); font-weight: 600; flex-basis: 100%; }
.accuse-label svg { width: 16px; height: 16px; }
.stage .accuse-row { margin-top: 1rem; }

/* Speech scrolls and gestures above a seat. */
.fx-bubble { position: absolute; left: 0; top: 0; z-index: 27; display: flex; align-items: center; gap: 0.4rem; max-width: min(260px, calc(100vw - 24px)); padding: 0.4rem 0.75rem 0.45rem; font-size: 0.9rem; line-height: 1.3; color: var(--ink); background: linear-gradient(180deg, #fbf3dd, #ecdcb3); border-radius: 10px; box-shadow: 0 0 0 1px rgb(179 134 43 / 70%), 0 10px 22px rgb(0 0 0 / 50%); pointer-events: none; }
.fx-bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg); background: #ecdcb3; box-shadow: 1px 1px 0 rgb(179 134 43 / 70%); }
.fx-bubble.below::after { top: -7px; bottom: auto; background: #fbf3dd; box-shadow: -1px -1px 0 rgb(179 134 43 / 70%); }
.fx-bubble b { color: var(--rubric); }
.fx-bubble.b-gesture { font-style: italic; }

/* The gesture tray: your character in the corner. */
.gesture-dock { position: fixed; z-index: 30; right: var(--gutter-r); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 0.5rem; }
.game-mobile .gesture-dock { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.dock-btn { width: 56px; height: 56px; padding: 0; min-height: 0; border-radius: 50%; border: none; background: none; box-shadow: 0 0 0 2px var(--gold-2), 0 8px 18px rgb(0 0 0 / 55%); transition: transform 0.35s cubic-bezier(.2,.8,.25,1), box-shadow 0.35s ease; }
.dock-btn svg { width: 100%; height: 100%; display: block; }
.dock-btn:hover, .gesture-dock.open .dock-btn { transform: translateY(-2px) scale(1.05); box-shadow: 0 0 0 3px var(--gold-3), 0 10px 22px rgb(0 0 0 / 55%), 0 0 22px rgb(255 200 110 / 55%); }
.game-mobile .dock-btn { width: 48px; height: 48px; }
.dock-tray { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; padding: 0.55rem; border-radius: 10px; background: linear-gradient(180deg, #f7ecd0, #e8d4a2); box-shadow: 0 0 0 1px var(--gold), 0 16px 34px rgb(0 0 0 / 55%); }
.dock-tray.enter { animation: tray-in 0.4s cubic-bezier(.2,.8,.25,1); }
@keyframes tray-in { from { opacity: 0; transform: translateY(8px); } }
.dock-g { display: flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0.3rem 0.7rem 0.3rem 0.45rem; font-size: 0.9rem; color: var(--ink); background: rgb(255 250 235 / 70%); border: 1px solid rgb(179 134 43 / 45%); border-radius: 7px; box-shadow: none; white-space: nowrap; }
.dock-g svg { width: 20px; height: 20px; color: var(--rubric); flex: none; }
.dock-g:hover:not(:disabled) { background: #fff8e6; border-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .accuse-pop, .dock-tray { animation: none; } }

/* Next-step hints: a slow, soft glow on what you can act on, and a manicule at the main action. */
.hint { animation: hint-glow 2.8s ease-in-out infinite; }
.hint-card { animation: hint-card 2.8s ease-in-out infinite; }
.tok.hint-tok { animation: hint-tok 2.8s ease-in-out infinite; }
.tok.hint-hit { animation: hint-hit 2.2s ease-in-out infinite; }
@keyframes hint-glow { 0%, 100% { box-shadow: 0 0 0 0 rgb(214 174 85 / 0%); } 50% { box-shadow: 0 0 0 3px rgb(214 174 85 / 60%), 0 0 18px rgb(255 200 110 / 45%); } }
@keyframes hint-card { 0%, 100% { box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 6px 14px rgb(0 0 0 / 40%); } 50% { box-shadow: 0 0 0 3px var(--gold-2), 0 0 22px rgb(255 200 110 / 65%), 0 6px 14px rgb(0 0 0 / 40%); } }
@keyframes hint-tok { 0%, 100% { box-shadow: 0 0 0 0 rgb(214 174 85 / 0%); transform: none; } 50% { box-shadow: 0 0 0 3px rgb(214 174 85 / 75%), 0 0 12px rgb(255 200 110 / 60%); transform: scale(1.06); } }
@keyframes hint-hit { 0%, 100% { box-shadow: 0 0 0 0 rgb(194 65 44 / 0%); } 50% { box-shadow: 0 0 0 3px rgb(194 65 44 / 70%), 0 0 12px rgb(235 90 60 / 55%); } }
.hint-arrow { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 0.45rem; vertical-align: middle; color: var(--rubric); filter: drop-shadow(0 1px 1px rgb(0 0 0 / 25%)); animation: hint-point 1.9s ease-in-out infinite; }
.hint-arrow svg { width: 100%; height: 100%; }
@keyframes hint-point { 0%, 100% { transform: translateX(-4px); opacity: 0.75; } 50% { transform: translateX(1px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .hint, .hint-card, .tok.hint-tok, .tok.hint-hit, .hint-arrow { animation: none; }
  .hint { box-shadow: 0 0 0 3px rgb(214 174 85 / 60%); }
  .hint-card { box-shadow: 0 0 0 3px var(--gold-2); }
  .tok.hint-tok { box-shadow: 0 0 0 3px rgb(214 174 85 / 75%); }
}
.notepad { border-collapse: collapse; font-size: 0.8rem; }
.notepad th { padding: 0.15rem; font-weight: 600; text-align: left; white-space: nowrap; }
.notepad thead th { height: 84px; vertical-align: bottom; }
.notepad thead th span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); }
.note-cell { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 5px; font-weight: 700; }
.note-cell.m1 { color: var(--ink-soft); }
.note-cell.m2 { color: var(--ok); background: rgb(47 107 67 / 12%); }
.note-cell.m3 { color: var(--rubric); background: rgb(142 28 18 / 8%); }
.rules { font-size: 0.95rem; }
.rules ol { padding-left: 1.2rem; margin: 0.4rem 0; }
.illuminated::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.3em;
  line-height: 0.85;
  padding: 0.12em 0.14em 0.06em;
  margin: 0.05em 0.35rem 0 0;
  color: var(--gold-3);
  background: var(--lapis);
  border: 2px solid var(--gold);
  border-radius: 2px;
}
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 0.5rem; margin-top: 0.4rem; justify-items: center; }

/* ---------- Mobile layout ---------- */

.game-mobile { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.mobile-top { padding-block: 0.4rem; }
.mobile-top .layout-toggle span { display: none; }
.mobile-top { flex-wrap: nowrap; gap: 0.4rem; }
.mobile-top .topbar-right { flex-wrap: nowrap; gap: 0.3rem; }
.mobile-top .brand-mark.small .brand-name { font-size: 1.2rem; }
.mobile-top .pill { white-space: nowrap; padding-inline: 0.55rem; font-size: 0.8rem; }
.mobile-top .layout-toggle button { padding-inline: 0.4rem; }
.seats-row.compact {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-block: 0.7rem 0.6rem;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  scrollbar-width: thin;
}
.seats-row.compact .player { flex: 0 0 132px; scroll-snap-align: start; padding: 0.45rem 0.5rem 0.5rem; }
.seats-row.compact .seat-head strong { font-size: 0.95rem; }
.mobile-body { display: flex; flex-direction: column; gap: 0.9rem; padding-block: 0.2rem 1rem; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.game-mobile .decks { flex-direction: row; justify-content: space-around; gap: 0.6rem; padding: 0; }
.game-mobile .deck { grid-template-columns: auto; justify-items: center; text-align: center; row-gap: 0.15rem; }
.game-mobile .deck-pile { grid-row: auto; }
.game-mobile .deck-pile .card { width: 40px; }
.game-mobile .deck-count { font-size: 1.15rem; }
.game-mobile .deck-label { font-size: 0.72rem; }
.game-mobile .vellum { padding: 1rem 1rem 1.1rem; }
.game-mobile .stage { scroll-margin-top: calc(64px + env(safe-area-inset-top, 0px)); }
.game-mobile h2 { font-size: 1.5rem; }
.game-mobile .wax-seal { width: 60px; height: 60px; font-size: 0.85rem; top: -10px; right: 10px; }
.game-mobile .stage h2 { padding-right: 4rem; }
.game-mobile .card-m { width: 72px; }
.game-mobile .gift-table tbody th { max-width: 76px; font-size: 0.85rem; }
.game-mobile .stepper button { width: 30px; min-height: 30px; }
.game-mobile .feed { max-height: none; }
.game-mobile .ledger { max-height: 62vh; }
.sheet { min-width: 0; }
.mnav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--mobile-max, 100%));
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-block: 0.3rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: linear-gradient(180deg, rgb(45 31 21 / 97%), rgb(29 19 12 / 99%));
  border-top: 1px solid rgb(214 174 85 / 50%);
  box-shadow: 0 -8px 18px rgb(0 0 0 / 40%);
}
.mnav-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; min-height: 52px; padding: 0.2rem 0; border: none; border-radius: 6px; background: none; box-shadow: none; color: var(--vellum-3); font-size: 0.74rem; font-variant-caps: small-caps; letter-spacing: 0.04em; }
.mnav-btn svg { width: 22px; height: 22px; }
.mnav-btn.on { color: var(--gold-3); background: rgb(214 174 85 / 12%); }
.mnav-btn.on svg { color: var(--gold-2); }
.mnav-btn .badge { position: absolute; top: 2px; right: calc(50% - 22px); }
.mnav-btn:hover:not(:disabled) { box-shadow: none; color: var(--gold-3); }
.your-move-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 9;
  width: min(calc(100% - 32px), 420px);
  min-height: 46px;
  color: var(--gold-3);
  font-weight: 700;
  background: linear-gradient(180deg, #a52a1a, var(--rubric) 55%, #6c140c);
  border: 1px solid var(--gold);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 45%), 0 0 22px rgb(255 160 80 / 35%);
}
.your-move-bar:hover:not(:disabled) { border-color: var(--gold-3); box-shadow: 0 6px 18px rgb(0 0 0 / 45%), 0 0 26px rgb(255 160 80 / 50%); }
.your-move-bar:active:not(:disabled) { transform: translateX(-50%) translateY(1px); }

/* Mobile layout chosen on a wide screen: show it as a phone-width column. */
@media (min-width: 761px) {
  body[data-layout="mobile"] { --mobile-max: 460px; }
  #app[data-layout="mobile"] .game-mobile,
  #app[data-layout="mobile"] .lobby,
  #app[data-layout="mobile"] .home { max-width: 460px; margin: 0 auto; box-shadow: 0 0 0 1px rgb(214 174 85 / 30%), 0 0 60px rgb(0 0 0 / 50%); min-height: 100vh; }
  #app[data-layout="mobile"] .lobby-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Toast and lightbox ---------- */

.toast { position: fixed; right: var(--gutter-r); top: calc(env(safe-area-inset-top, 0px) + 70px); z-index: 20; max-width: min(420px, calc(100% - 32px)); padding: 0.6rem 1rem; color: var(--ink); background: var(--vellum); border: 1px solid var(--gold); border-radius: 6px; box-shadow: 0 10px 26px rgb(0 0 0 / 50%); }
.home .toast, .lobby .toast { top: auto; right: auto; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); }
.game-mobile .toast { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(min(100%, var(--mobile-max, 100%)) - 32px); padding: 0.35rem 0.8rem; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem; background: rgb(8 5 3 / 85%); padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); cursor: zoom-out; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; max-width: min(360px, 100%); }
.lightbox img { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 14px; box-shadow: 0 0 0 1px rgb(214 174 85 / 50%), 0 14px 44px rgb(0 0 0 / 60%); }
.lightbox figcaption { color: var(--ink); background: var(--vellum); font-size: 0.92rem; text-align: center; padding: 0.45rem 0.75rem; border-radius: 6px; border: 1px solid var(--gold); }

/* ---------- Move playback ---------- */

.fx-layer { position: fixed; inset: 0; z-index: 33; pointer-events: none; overflow: hidden; }
.fx-piece { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.fx-reveal { perspective: 900px; }
.fx-reveal .card { box-shadow: 0 0 0 2px var(--gold-2), 0 0 50px rgb(255 190 90 / 55%), 0 24px 50px rgb(0 0 0 / 60%); }
.fx-piece .card-s { box-shadow: 0 0 0 1px rgb(0 0 0 / 40%), 0 8px 18px rgb(0 0 0 / 55%); }
.fx-tokens { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.6rem 0.25rem 0.35rem; border-radius: 999px; background: #fff6df; border: 2px solid currentColor; box-shadow: 0 0 0 3px rgb(0 0 0 / 15%), 0 8px 18px rgb(0 0 0 / 50%), 0 0 22px rgb(255 210 120 / 55%); }
.fx-tokens svg { width: 26px; height: 26px; }
.fx-tokens b { color: var(--ink); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.fx-shield { display: grid; place-items: center; width: 110px; height: 110px; color: #6a4a9a; filter: drop-shadow(0 0 18px rgb(170 130 255 / 80%)) drop-shadow(0 6px 10px rgb(0 0 0 / 50%)); }
.fx-shield svg { width: 100%; height: 100%; }
/* Who to whom: names in the caption match the seat highlights (gold acts, blue receives, red loses). */
.fx-medal { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: var(--rubric); background: radial-gradient(circle at 40% 35%, #fff8e4, #ead6a4); box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 1px rgb(60 36 16 / 45%); }
.fx-medal svg { width: 62%; height: 62%; }
.fx-name { font-weight: 700; padding: 0 0.35em 0.05em; border-radius: 4px; white-space: nowrap; }
.fx-name.n-to { color: #fff; background: var(--lapis); }
.fx-name.n-hit { color: #fff; background: #a3271a; }
.fx-caption.tone-alarm .fx-name.n-hit { color: var(--rubric); background: #fff1dc; }
.fx-name.n-vice { color: #fff; background: linear-gradient(180deg, #8e2a18, #5e140b); }
.fx-name.n-virtue { color: #fff; background: linear-gradient(180deg, #3b67a3, #21436e); }

/* The inked line between two seats; its dots march toward whoever receives. */
.fx-tether { position: absolute; left: 0; top: 0; overflow: visible; filter: drop-shadow(0 0 3px rgb(0 0 0 / 75%)); --tc: #f4d27c; }
.fx-tether.tone-you { --tc: #9cc3ff; }
.fx-tether.tone-hit { --tc: #ff7f62; }
.fx-tether .t-glow { fill: none; stroke: var(--tc); stroke-width: 10; stroke-linecap: round; opacity: 0.32; }
.fx-tether .t-dots { fill: none; stroke: var(--tc); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0.1 13; animation: fx-march 1.4s linear infinite; }
.fx-tether .t-head { fill: var(--tc); stroke: rgb(30 18 8 / 60%); stroke-width: 1; }
@keyframes fx-march { to { stroke-dashoffset: -13.1; } }

/* Banners pinned to the seats in a move. */
.fx-tag { position: absolute; left: 0; top: 0; padding: 0.05rem 0.95rem 0.12rem; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; font-variant-caps: small-caps; line-height: 1.3; white-space: nowrap; clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%, 7px 50%); filter: drop-shadow(0 3px 5px rgb(0 0 0 / 55%)); }
.fx-tag.tag-from { color: var(--ink); background: linear-gradient(180deg, #f8de93, #c99a36); }
.fx-tag.tag-to { color: #fff; background: linear-gradient(180deg, #4f7fc0, #21436e); }
.fx-tag.tag-hit { color: #fff; background: linear-gradient(180deg, #c8462f, #7e1a10); }

/* Emblems stamped on a seat: gilt roundels, or red wax when someone loses out. */
.fx-roundel { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; color: #6b4a14; background: radial-gradient(circle at 40% 35%, #fff8e4, #e3cd96); box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 6px rgb(255 255 255 / 35%), 0 0 0 2px rgb(40 24 12 / 60%), 0 10px 22px rgb(0 0 0 / 55%), 0 0 28px rgb(255 200 110 / 70%); }
.fx-roundel svg { width: 58%; height: 58%; }
.fx-roundel.tone-you { color: var(--lapis); box-shadow: inset 0 0 0 3px var(--gold), 0 0 0 2px rgb(40 24 12 / 60%), 0 10px 22px rgb(0 0 0 / 55%), 0 0 28px rgb(120 170 255 / 75%); }
.fx-roundel.tone-hit { color: var(--gold-3); background: radial-gradient(circle at 38% 32%, #d65a3f, #8e1c12 58%, #5a0f08); border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%; box-shadow: inset 0 0 0 4px rgb(255 255 255 / 10%), inset 0 -4px 8px rgb(0 0 0 / 35%), 0 0 0 2px rgb(60 10 5 / 70%), 0 10px 22px rgb(0 0 0 / 55%), 0 0 26px rgb(255 110 80 / 70%); }

/* Virtue over vice. */
.fx-burst { width: 340px; height: 340px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgb(255 222 140 / 75%) 0deg 5deg, transparent 5deg 15deg); -webkit-mask: radial-gradient(circle, #000 16%, transparent 68%); mask: radial-gradient(circle, #000 16%, transparent 68%); }
.fx-vice .card { box-shadow: 0 0 0 2px #7a2014, 0 0 44px rgb(255 100 40 / 65%), 0 24px 50px rgb(0 0 0 / 60%); }
.fx-victor .card { box-shadow: 0 0 0 2px var(--gold-2), 0 0 64px rgb(255 214 130 / 85%), 0 24px 50px rgb(0 0 0 / 60%); }
.fx-saintlight { display: grid; place-items: center; width: 160px; height: 160px; border-radius: 50%; color: var(--gold); background: radial-gradient(circle, rgb(255 248 220 / 95%), rgb(255 214 130 / 75%) 42%, transparent 70%); }
.fx-saintlight svg { width: 56%; height: 56%; }
.fx-gauntlet { display: grid; place-items: center; width: 64px; height: 64px; color: #c3c8d2; filter: drop-shadow(0 0 1px #1a1a1a) drop-shadow(0 0 1px #1a1a1a) drop-shadow(0 6px 10px rgb(0 0 0 / 60%)); }
.fx-gauntlet svg { width: 100%; height: 100%; }
.fx-caption {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  z-index: 34;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(640px, calc(100% - 32px));
  padding: 0.55rem 2.2rem 0.6rem;
  color: var(--ink);
  background: linear-gradient(180deg, #f6ebd0, var(--vellum-2));
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 50%, 100% 100%, 0 100%, 16px 50%);
  filter: drop-shadow(0 8px 14px rgb(0 0 0 / 55%));
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.2,.8,.25,1);
}
.fx-caption.show { opacity: 1; transform: translate(-50%, 0); }
.fx-who { font-family: var(--font-display); font-size: 1.45rem; color: var(--rubric); line-height: 1; }
.fx-text { font-size: 1.05rem; }
.fx-caption.tone-you { background: linear-gradient(180deg, #f9eccd, #ecd59a); }
.fx-caption.tone-you .fx-who { color: var(--lapis); }
.fx-caption.tone-alarm { background: linear-gradient(180deg, #a52a1a, var(--rubric)); color: #ffe9d2; }
.fx-caption.tone-alarm .fx-who { color: var(--gold-3); }
.fx-caption.tone-turn .fx-who { color: var(--ink); }
body[data-layout="mobile"] .fx-caption { bottom: calc(env(safe-area-inset-bottom, 0px) + 128px); max-width: calc(min(100%, var(--mobile-max, 100%)) - 24px); padding-inline: 1.6rem; }
body[data-layout="mobile"] .fx-who { font-size: 1.2rem; }
body[data-layout="mobile"] .fx-text { font-size: 0.98rem; }
body[data-layout="mobile"] .fx-medal { width: 2rem; height: 2rem; }
body[data-layout="mobile"] .fx-tag { font-size: 0.74rem; padding-inline: 0.75rem; }
body[data-layout="mobile"] .fx-roundel { width: 60px; height: 60px; }

@media (prefers-reduced-motion: reduce) {
  .candle, .thinking svg, .waiting-line svg { animation: none; }
  .tok.bump-up, .tok.bump-down { animation: none; }
  .player, .hand-card, .pool-card, .fx-caption { transition: none; }
  .fx-tether .t-dots { animation: none; }
}

/* ---------- Learn to Play ----------
   A practice table on the left (on top on a phone) and an illuminated page of the
   rules on the right, with chapters as numbered leaves across the top. */

.learn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
.learn svg { width: 20px; height: 20px; }
.rules > .learn { margin-bottom: 0.8rem; }
.tutorial { min-height: 100vh; padding-bottom: 2rem; }
.tutorial .topbar { position: sticky; }
.tut-steps { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.7rem var(--gutter-r) 0.5rem var(--gutter-l); scrollbar-width: thin; }
.tut-step { flex: 0 0 auto; display: flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0.2rem 0.75rem 0.2rem 0.3rem; border-radius: 999px; color: var(--vellum-2); background: rgb(255 255 255 / 5%); border: 1px solid rgb(214 174 85 / 35%); box-shadow: none; transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease; }
.tut-step .num { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 999px; font-family: var(--font-display); font-size: 1rem; color: var(--gold-3); background: rgb(0 0 0 / 30%); }
.tut-step .lbl { font-size: 0.85rem; white-space: nowrap; }
.tut-step.done .num { color: var(--oak-0); background: var(--gold-2); }
.tut-step.on { color: var(--ink); background: linear-gradient(180deg, #f6ebd0, var(--vellum-2)); border-color: var(--gold); }
.tut-step.on .num { color: #fff3e0; background: var(--rubric); }
.tut-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 1.4rem; align-items: start; max-width: 1280px; margin: 0.4rem auto 0; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.tut-table { position: relative; height: 520px; }
.tut-wood { position: absolute; left: 50%; top: 50%; width: 70%; height: 66%; transform: translate(-50%, -50%); border-radius: 50%; background: repeating-linear-gradient(100deg, rgb(255 230 190 / 3.5%) 0 2px, transparent 2px 10px), radial-gradient(ellipse at 50% 38%, #87603e, #694830 45%, #4b3220 80%, #36241a); box-shadow: 0 0 0 9px #36241a, 0 0 0 11px #8a6a3a, 0 30px 60px rgb(0 0 0 / 55%), inset 0 2px 26px rgb(0 0 0 / 50%); }
.tut-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.tut-decks { display: flex; gap: 0.5rem; }
.tut-decks .card { width: 46px; }
.tut-center > .card { width: 78px; }
.tut-pos { position: absolute; width: 170px; transform: translate(-50%, -50%); z-index: 2; }
.tut-page { position: sticky; top: calc(70px + env(safe-area-inset-top, 0px)); }
.tut-kicker { margin: 0 0 0.2rem; font-size: 0.85rem; font-variant-caps: small-caps; letter-spacing: 0.05em; color: var(--ink-soft); }
.tut-text p { margin: 0.55rem 0; }
.tut-try { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px dashed rgb(140 114 83 / 55%); }
.tut-try h3 { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.25rem; color: var(--rubric); font-weight: 700; }
.tut-try .row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tut-try .row button { display: inline-flex; align-items: center; gap: 0.3rem; }
.tut-try .row button svg { width: 18px; height: 18px; }
.tut-ok { padding: 0.5rem 0.65rem; border-radius: 6px; background: rgb(47 107 67 / 9%); color: var(--ink); }
.tut-ok svg { display: inline-block; width: 20px; height: 20px; color: var(--ok); vertical-align: -4px; margin-right: 0.35rem; }
.tut-role, .tut-card { display: flex; gap: 0.8rem; align-items: center; }
.tut-carousel { display: flex; align-items: center; gap: 0.5rem; }
.tut-carousel > button { flex: none; width: 40px; min-height: 40px; font-size: 1.4rem; line-height: 1; }
.tut-gifts .stepper button { min-height: 32px; width: 32px; }
.tut-gifts th svg { width: 16px; height: 16px; vertical-align: -3px; }
.tut-nav { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 1.2rem; }
.tut-nav button { display: inline-flex; align-items: center; gap: 0.35rem; }
.tut-nav svg { width: 18px; height: 18px; }
@media (max-width: 900px) {
  .tut-body { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .tut-page { position: relative; top: auto; }
  /* The practice table stays in view while you read and tap below it. */
  .tut-table { position: sticky; top: calc(51px + env(safe-area-inset-top, 0px)); z-index: 5; height: 330px; margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r)); background: linear-gradient(180deg, rgb(0 0 0 / 12%), rgb(0 0 0 / 30%)), var(--wood-wall) 50% 0 / 1440px 1024px, var(--oak-1); box-shadow: 0 10px 18px rgb(0 0 0 / 45%); }
  .tut-wood { width: 62%; height: 62%; }
  .tut-decks .card { width: 34px; }
  .tut-center > .card { width: 56px; }
  .tut-pos { width: 118px; }
  .tut-step .lbl { display: none; }
  .tut-step { padding-right: 0.3rem; }
  .tut-table .player { padding: 0.35rem 0.4rem 0.4rem; }
  .tut-table .seat-head strong { font-size: 0.88rem; }
  .tut-table .tokrow .tok { padding: 0 3px 0 1px; gap: 1px; }
  .tut-table .tokrow .tok svg { width: 11px; height: 11px; }
  .tut-table .tokrow .tok b { font-size: 0.7rem; }
  .tut-table .tokrow { flex-wrap: nowrap; gap: 2px; }
}

/* Your own sin: the vice of your own Role, holding its Scapular back. */
.own-sin { display: flex; gap: 0.35rem; align-items: flex-start; margin-top: 0.3rem; color: var(--rubric); }
.own-sin svg { width: 15px; height: 15px; flex: none; margin-top: 0.15rem; }
.hand-card .sin-tag {
  position: absolute;
  top: -0.8rem;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--rubric);
  color: var(--vellum);
  font-size: 0.7rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgb(0 0 0 / 40%);
}
.hand-card.is-own-sin .card { box-shadow: 0 0 0 2px var(--rubric-2), 0 6px 14px rgb(0 0 0 / 30%); }
.false-witness { display: flex; gap: 0.4rem; align-items: flex-start; color: var(--ink-soft); }
.false-witness svg { width: 16px; height: 16px; flex: none; margin-top: 0.2rem; color: var(--rubric); }

/* Learn to Play: later chapters stay locked until you do each Try it. */
.tut-step.locked { opacity: 0.45; cursor: not-allowed; }
.tut-step.locked .num svg { width: 14px; height: 14px; color: var(--vellum-2); }
.tut-lock { display: flex; gap: 0.4rem; align-items: center; justify-content: flex-end; margin: 0.5rem 0 0; color: var(--ink-faint); font-style: italic; }
.tut-lock svg { width: 14px; height: 14px; flex: none; }
.tut-choices { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.5rem 0; }
.tut-choices button { justify-content: flex-start; text-align: left; }
.tut-choices button.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-2); }

/* Leaving the table */
.leave-btn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 34px; padding: 0.15rem 0.7rem; font-size: 0.9rem; color: var(--vellum); background: rgb(255 255 255 / 6%); border: 1px solid rgb(214 174 85 / 45%); box-shadow: none; }
.leave-btn:hover { background: rgb(255 255 255 / 12%); }
.leave-btn svg { width: 17px; height: 17px; }
.game-mobile .leave-btn { width: 36px; height: 36px; padding: 0; justify-content: center; }
.game-mobile .leave-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.leave-scrim { position: fixed; inset: 0; z-index: 60; background: rgb(10 6 3 / 55%); }
.leave-scrim.enter, .leave-dialog.enter { animation: fade-in 0.4s ease; }
.leave-dialog { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); padding: 1.3rem 1.4rem 1.2rem; color: var(--ink); }
.leave-dialog .row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.leave-dialog button svg { width: 18px; height: 18px; }
.results-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.results-actions button { display: inline-flex; align-items: center; gap: 0.4rem; }
.results-actions svg { width: 18px; height: 18px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .leave-scrim, .leave-dialog { animation: none; } }

/* Full screen */
.fs-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; min-height: 0; padding: 0; color: var(--vellum); background: rgb(255 255 255 / 6%); border: 1px solid rgb(214 174 85 / 45%); box-shadow: none; }
.fs-btn:hover { background: rgb(255 255 255 / 12%); }
.fs-btn svg { width: 17px; height: 17px; }
.sheet .fs-btn { display: inline-flex; gap: 0.45rem; width: auto; height: auto; min-height: 40px; padding: 0.3rem 0.9rem; margin-top: 0.4rem; color: var(--ink); background: linear-gradient(180deg, #fbf3df, var(--vellum-2)); border-color: var(--gold); }
.home-top { gap: 0.5rem; }

/* ---- Your hand, in front of the table ---------------------------------------------- */
.hand-btn {
  position: fixed; z-index: 31; left: var(--gutter-l); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  width: 64px; height: 64px; min-height: 0; padding: 0; border-radius: 50%;
  color: var(--gold-3); background: radial-gradient(circle at 50% 35%, #5a3a24, #2a1a10);
  border: none; box-shadow: 0 0 0 2px var(--gold-2), 0 8px 18px rgb(0 0 0 / 55%);
  transition: transform 0.4s cubic-bezier(.2,.8,.25,1), box-shadow 0.4s ease;
}
.hand-btn svg { width: 28px; height: 28px; }
.hand-btn .hb-label { font-size: 0.7rem; font-variant-caps: all-small-caps; letter-spacing: 0.05em; line-height: 1; margin-top: 1px; }
.hand-btn .hb-count { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; font: 700 0.78rem/1 var(--font-body); color: #fff6e3; background: var(--rubric); box-shadow: 0 0 0 2px var(--oak-0); }
.hand-btn:hover, .hand-btn.open { transform: translateY(-2px) scale(1.05); box-shadow: 0 0 0 3px var(--gold-3), 0 10px 22px rgb(0 0 0 / 55%), 0 0 22px rgb(255 200 110 / 50%); }
.game-mobile .hand-btn { width: 56px; height: 56px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.game-mobile .hand-btn svg { width: 24px; height: 24px; }

.hand-sheet { position: fixed; z-index: 29; left: 0; right: 0; bottom: 0; color: var(--vellum); }
.hand-sheet.enter { animation: sheet-up 0.6s cubic-bezier(.2,.8,.25,1); }
.game-mobile .hand-sheet { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.hs-head { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; }
.hs-roles { display: flex; gap: 0.5rem; flex-wrap: wrap; min-width: 0; }
.hs-role { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.65rem 0.2rem 0.25rem; border-radius: 999px; background: rgb(255 240 210 / 9%); border: 1px solid rgb(214 174 85 / 40%); }
.hs-role.villain { border-color: rgb(179 49 29 / 70%); }
.hs-face { width: 30px; height: 30px; flex: none; }
.hs-face svg { width: 100%; height: 100%; display: block; }
.hs-role b { display: block; font-family: var(--font-display); font-size: 1.05rem; line-height: 1; color: var(--gold-3); }
.hs-role small { display: block; font-size: 0.74rem; color: var(--vellum-2); line-height: 1.2; }
.hs-role em { color: #ffb4a0; font-style: normal; }
.hs-close { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 34px; padding: 0.15rem 0.7rem; font-size: 0.85rem; color: var(--vellum); background: rgb(255 255 255 / 7%); border: 1px solid rgb(214 174 85 / 45%); box-shadow: none; flex: none; }
.hs-close svg { width: 16px; height: 16px; }

/* Tray: a carved wooden tray rises in front of the lower table; the table shows above it. */
.hand-sheet.hs-tray {
  margin: 0 auto; max-width: 980px; max-height: 52vh; display: flex; flex-direction: column;
  padding: 0.5rem 1rem 0.9rem; border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, rgb(52 35 23 / 88%), rgb(29 19 12 / 94%)), var(--wood-wall) 50% 0 / 720px 512px;
  box-shadow: 0 -1px 0 1px rgb(214 174 85 / 55%), 0 -18px 40px rgb(0 0 0 / 55%);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.hs-grip { width: 48px; height: 5px; margin: 0 auto 0.45rem; border-radius: 3px; background: rgb(214 174 85 / 55%); }
.hand-sheet.hs-tray .hs-scroll { overflow-y: auto; min-height: 0; padding-top: 0.2rem; }
.hand-sheet.hs-tray h3 { color: var(--gold-2); margin: 0.6rem 0 0.35rem; font-size: 0.9rem; }
.hand-sheet.hs-tray .hs-row { display: flex; gap: 0.6rem; overflow-x: auto; padding: 0.7rem 0.1rem 0.35rem; scroll-snap-type: x proximity; }
.hand-sheet.hs-tray .hs-row > * { scroll-snap-align: start; flex: none; }
.hs-special { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; width: 92px; text-align: center; color: var(--vellum-2); }
.hand-sheet.hs-tray .inline-form { color: var(--ink); background: var(--vellum); border-radius: 8px; padding: 0.5rem 0.7rem; }

/* Fan: the cards held in your hand, fanned in an arc at the bottom of the screen. */
.hand-sheet.hs-fan {
  padding: 3.5rem var(--gutter-r) 0 var(--gutter-l);
  background: linear-gradient(180deg, transparent, rgb(20 12 7 / 88%) 2.2rem, rgb(16 10 6 / 94%) 60%);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.hand-sheet.hs-fan .hs-head, .hand-sheet.hs-fan .fan-tabs, .hand-sheet.hs-fan .fan-actions, .hand-sheet.hs-fan .fan-hint { max-width: 900px; margin-left: auto; margin-right: auto; }
.fan-tabs { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.fan-tabs button { min-height: 34px; padding: 0.15rem 0.75rem; font-size: 0.85rem; color: var(--vellum-2); background: rgb(255 255 255 / 6%); border: 1px solid rgb(214 174 85 / 35%); box-shadow: none; }
.fan-tabs button.on { color: var(--ink); background: linear-gradient(180deg, #f6ebd0, var(--vellum-2)); border-color: var(--gold); }
.fan-tabs b { margin-left: 0.25rem; color: var(--rubric); }
.fan-hint { margin: 0.5rem auto 0; font-size: 0.85rem; color: var(--vellum-2); font-style: italic; }
.fan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.fan-actions strong { font-family: var(--font-display); font-size: 1.25rem; color: var(--gold-3); }
.fan-row { position: relative; height: 210px; margin-top: 0.4rem; overflow: hidden; }
.fan-card {
  position: absolute; left: 50%; bottom: -26px; width: auto; min-height: 0; padding: 0; border: none; background: none; box-shadow: none;
  transform-origin: 50% 140%;
  transform: translateX(-50%) translateX(calc(var(--d) * min(64px, 72vw / var(--n)))) rotate(calc(var(--d) * 6deg)) translateY(calc(var(--d) * var(--d) * 3px));
  transition: transform 0.5s cubic-bezier(.2,.8,.25,1), filter 0.4s ease;
}
.fan-card .card { width: 112px; box-shadow: 0 6px 16px rgb(0 0 0 / 55%); }
.fan-card:hover { filter: brightness(1.06); }
.fan-card.lift { z-index: 5; transform: translateX(-50%) translateX(calc(var(--d) * min(64px, 72vw / var(--n)))) rotate(0deg) translateY(-34px) scale(1.08); }
.fan-card.lift .card { box-shadow: 0 0 0 3px var(--gold-2), 0 0 22px rgb(255 190 90 / 55%), 0 12px 22px rgb(0 0 0 / 55%); }
.fan-card.is-own-sin .card { box-shadow: 0 0 0 2px var(--rubric-2), 0 6px 16px rgb(0 0 0 / 55%); }
.sin-tag.inline { position: static; transform: none; display: inline-block; padding: 0 0.45rem; border-radius: 999px; background: var(--rubric); color: var(--vellum); font-size: 0.75rem; }
.game-mobile .fan-row { height: 180px; }
.game-mobile .fan-card .card { width: 92px; }
@media (prefers-reduced-motion: reduce) { .hand-sheet, .fan-card { animation: none; transition: none; } }

/* Phones: the hand button steps aside while the hand is open (the sheet has its own way back). */
.game-mobile .hand-btn.open { display: none; }
.game-mobile .hs-head { align-items: flex-start; }
.game-mobile .hs-roles { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.game-mobile .hs-role { flex: none; padding-right: 0.5rem; }
.game-mobile .hs-face { width: 26px; height: 26px; }
.game-mobile .hs-role b { font-size: 0.95rem; }
.game-mobile .hs-role small { font-size: 0.68rem; }
.game-mobile .hs-close span { display: none; }
.game-mobile .hs-close { width: 38px; height: 38px; padding: 0; justify-content: center; }
.game-mobile .hand-sheet.hs-tray { max-height: calc(100vh - 66px - 116px); max-height: calc(100dvh - 66px - 116px - env(safe-area-inset-bottom, 0px)); padding: 0.45rem 0.8rem 0.7rem; }
.game-mobile .hand-sheet.hs-fan { padding-top: 2.4rem; }

/* ---- Chat: quick words in groups, phrases aimed at a player, reactions -------------- */
.quick-words { margin-top: 0.5rem; }
.qw-tabs { display: flex; gap: 0.3rem; overflow-x: auto; padding-bottom: 0.3rem; scrollbar-width: thin; }
.qw-tab { flex: none; min-height: 32px; padding: 0.1rem 0.65rem; font-size: 0.85rem; color: var(--ink-soft); background: rgb(255 250 235 / 50%); border: 1px solid rgb(179 134 43 / 40%); box-shadow: none; }
.qw-tab.on { color: #fff6e3; background: var(--rubric); border-color: var(--rubric); }
.qw-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.qw-say { min-height: 32px; font-size: 0.88rem; }
.qw-aim { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.qw-who { min-height: 30px; padding: 0.05rem 0.6rem; font-size: 0.85rem; border-radius: 999px; box-shadow: none; }
.qw-who.on { color: var(--ink); background: linear-gradient(180deg, #fbf3df, var(--gold-3)); border-color: var(--gold); font-weight: 600; }
.chat-line { position: relative; }
.chat-line.to-you { background: rgb(214 174 85 / 22%); box-shadow: inset 3px 0 0 var(--gold); border-radius: 4px; padding-left: 0.45rem; }
.rx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin-top: 0.15rem; }
.rx, .rx-pick { min-height: 24px; padding: 0 0.45rem; font-size: 0.75rem; border-radius: 999px; box-shadow: none; color: var(--ink-soft); background: rgb(255 250 235 / 60%); border: 1px solid rgb(179 134 43 / 40%); }
.rx b { color: var(--rubric); margin-left: 0.1rem; }
.rx.mine { background: rgb(214 174 85 / 35%); border-color: var(--gold); color: var(--ink); }
.rx-pick:hover, .rx:hover { background: #fff8e6; border-color: var(--gold); }
.rx-bar { display: inline-flex; gap: 0.25rem; animation: fade-in 0.3s ease; }
.rx-open { width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 50%; font-size: 0.9rem; line-height: 1; color: var(--ink-faint); background: transparent; border: 1px dashed rgb(140 114 83 / 55%); box-shadow: none; opacity: 0.55; transition: opacity 0.3s ease; }
.chat-line:hover .rx-open, .rx-open:focus-visible, .rx-open[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .rx-open { opacity: 0.8; } }

.chat-line:not(.system):not(.action) { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.4rem; }
.chat-line .rx-row { display: inline-flex; margin-top: 0; }

button.hs-role { min-height: 0; font: inherit; color: inherit; text-align: left; box-shadow: none; cursor: pointer; }
button.hs-role.on { border-color: var(--gold-2); background: rgb(255 240 210 / 16%); }
.hs-role-detail { margin: 0.45rem 0 0; padding: 0.45rem 0.7rem; border-radius: 8px; color: var(--vellum); background: rgb(255 240 210 / 8%); border: 1px solid rgb(214 174 85 / 30%); }
.hs-role-detail .own-sin { color: #ffb4a0; }
.hs-special .small + button { margin-top: 0.15rem; }
.hs-special.open .card { box-shadow: 0 0 0 3px var(--gold-2), 0 0 18px rgb(255 190 90 / 50%); }
.hs-form { max-width: 900px; margin: 0.5rem auto 0; padding: 0.6rem 0.8rem; border-radius: 10px; color: var(--ink); background: linear-gradient(180deg, #f6ebd0, var(--vellum-2)); box-shadow: 0 0 0 1px var(--gold), 0 10px 24px rgb(0 0 0 / 45%); max-height: 38vh; overflow-y: auto; }
.hs-form .inline-form { background: none; padding: 0; }
.fan-actions .small { color: var(--vellum-2); }
.fan-actions button.small { color: var(--ink); }
@keyframes hand-call { 0%, 100% { box-shadow: 0 0 0 2px var(--gold-2), 0 8px 18px rgb(0 0 0 / 55%); transform: none; } 50% { box-shadow: 0 0 0 4px var(--gold-3), 0 0 26px rgb(255 200 110 / 70%), 0 8px 18px rgb(0 0 0 / 55%); transform: scale(1.06); } }
.hand-btn.hint { animation: hand-call 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .hand-btn.hint { animation: none; box-shadow: 0 0 0 4px var(--gold-3), 0 8px 18px rgb(0 0 0 / 55%); } }

.accuse-pop.enter { animation: pop-in 0.36s cubic-bezier(.2,.8,.25,1); }

/* The tab to look at next calls for attention: a soft gold pulse and a dot. */
@keyframes tab-call { 0%, 100% { box-shadow: 0 0 0 0 rgb(214 174 85 / 0%); } 50% { box-shadow: 0 0 0 2px rgb(214 174 85 / 70%), 0 0 18px rgb(255 200 110 / 55%); } }
.mnav-btn.nudge, .tab[data-nudge] { position: relative; animation: tab-call 2.2s ease-in-out infinite; color: var(--gold-3); }
.tab[data-nudge] { color: var(--rubric); }
.mnav-btn.nudge::after, .tab[data-nudge]::after { content: ""; position: absolute; top: 6px; right: 14%; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 0 2px var(--oak-0); }
.tab[data-nudge]::after { top: 2px; right: 2px; box-shadow: 0 0 0 2px var(--vellum); background: var(--rubric-2); }
@media (prefers-reduced-motion: reduce) { .mnav-btn.nudge, .tab[data-nudge] { animation: none; } }
.clues-h { margin-top: 1.1rem; }
.clues { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.clues li { font-size: 0.9rem; line-height: 1.35; padding: 0.3rem 0.5rem; border-radius: 6px; background: rgb(255 250 235 / 55%); border: 1px solid rgb(179 134 43 / 30%); }
.clue-turn { display: inline-block; margin-right: 0.3rem; font-size: 0.78rem; color: var(--rubric); font-variant-caps: all-small-caps; letter-spacing: 0.04em; }
/* Phones: toasts wrap and sit above the Hand and gesture buttons. */
.game-mobile .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); width: calc(100% - 32px); max-width: 440px; white-space: normal; overflow: visible; text-overflow: clip; text-align: center; line-height: 1.3; z-index: 32; }
.field-note { font-variant-caps: normal; letter-spacing: 0; text-transform: none; }

/* ---- Computer: the sections as a dock along the bottom ------------------------------ */
.dnav {
  position: fixed; z-index: 30; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 0.25rem; padding: 0.3rem 0.45rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgb(52 35 23 / 94%), rgb(29 19 12 / 97%));
  box-shadow: 0 0 0 1px rgb(214 174 85 / 50%), 0 14px 32px rgb(0 0 0 / 55%);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.dnav-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
  min-width: 78px; min-height: 52px; padding: 0.2rem 0.55rem; border: none; border-radius: 10px;
  color: var(--vellum-2); background: none; box-shadow: none;
  font-size: 0.78rem; font-variant-caps: all-small-caps; letter-spacing: 0.05em;
}
.dnav-btn svg { width: 22px; height: 22px; }
.dnav-btn:hover:not(:disabled) { color: var(--gold-3); background: rgb(255 240 210 / 7%); box-shadow: none; }
.dnav-btn.on { color: var(--gold-3); background: rgb(214 174 85 / 16%); }
.dnav-btn.current { color: var(--gold-3); }
.dnav-btn.current::before { content: ""; position: absolute; left: 22%; right: 22%; bottom: 3px; height: 2px; border-radius: 2px; background: var(--gold-2); }
.dnav-btn .badge { position: absolute; top: 2px; right: 10px; }
.dnav-sep { width: 1px; margin: 0.4rem 0.2rem; background: rgb(214 174 85 / 30%); }
.dnav-btn.nudge { animation: tab-call 2.2s ease-in-out infinite; color: var(--gold-3); }
.dnav-btn.nudge::after { content: ""; position: absolute; top: 5px; left: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 0 2px var(--oak-0); }
@media (prefers-reduced-motion: reduce) { .dnav-btn.nudge { animation: none; } }
.game-desktop .board { padding-bottom: 96px; }
.game-desktop .hand-sheet { bottom: 84px; }
.game-desktop .hand-sheet.hs-tray { border-radius: 16px; }
/* The tray grows with your hand up to just under the top bar, so your Saints and Scapulars show
   without scrolling; it only scrolls when there's truly more than fits. */
.game-desktop .hand-sheet.hs-tray { max-height: calc(100vh / var(--desk-zoom, 1) - 184px); max-height: calc(100dvh / var(--desk-zoom, 1) - 184px); }
.game-desktop .hand-btn { display: none; }
.side-body h3 { margin-top: 1.2rem; }

/* ---- Phone: the current step pops up over the table ---------------------------------- */
.step-bar {
  position: fixed; z-index: 28; left: var(--gutter-l); right: var(--gutter-r);
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 0.6rem; min-height: 58px; padding: 0.4rem 0.5rem 0.4rem 0.85rem;
  color: var(--vellum); text-align: left; border: none; border-radius: 14px;
  background: linear-gradient(180deg, rgb(58 39 26 / 96%), rgb(33 22 14 / 98%));
  box-shadow: 0 0 0 1px rgb(214 174 85 / 55%), 0 10px 24px rgb(0 0 0 / 50%);
}
.step-bar .sb-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.step-bar .sb-text b { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold-3); }
.step-bar .sb-text span { font-size: 0.85rem; color: var(--vellum-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-bar .sb-open { flex: none; padding: 0.35rem 0.75rem; border-radius: 999px; font-size: 0.85rem; color: var(--vellum-2); border: 1px solid rgb(214 174 85 / 45%); }
.step-bar.mine { animation: tab-call 2.2s ease-in-out infinite; }
.step-bar.mine .sb-open { color: #fff3e0; background: var(--rubric); border-color: var(--rubric); font-weight: 600; }
.step-sheet {
  position: fixed; z-index: 28; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px);
  padding: 0 var(--gutter-r) 0.5rem var(--gutter-l);
}
.step-sheet.enter { animation: sheet-up 0.6s cubic-bezier(.2,.8,.25,1); }
.step-hide { align-self: center; display: inline-flex; flex-direction: column; align-items: center; gap: 0.2rem; min-height: 0; margin-bottom: 0.35rem; padding: 0.35rem 1.1rem 0.4rem; font-size: 0.8rem; color: var(--vellum); border: none; border-radius: 999px; background: rgb(29 19 12 / 88%); box-shadow: 0 0 0 1px rgb(214 174 85 / 45%); }
.step-hide .hs-grip { margin: 0; }
.step-scroll { overflow-y: auto; min-height: 0; border-radius: 10px; box-shadow: 0 -12px 30px rgb(0 0 0 / 45%); }
.step-scroll .stage { margin: 0; }
.game-mobile.step-open .hand-btn, .game-mobile.step-open .gesture-dock { display: none; }
.game-mobile .hand-btn { bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.game-mobile .gesture-dock { bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.game-mobile .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 206px); }
.game-mobile .your-move-bar { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
@media (prefers-reduced-motion: reduce) { .step-bar.mine, .step-sheet.enter { animation: none; } }

/* Tight round table: when the screen is short, seats show just name and tokens. */
.round-phone.tight .seat-label, .round-phone.tight .seat-cards, .round-phone.tight .gave { display: none; }
.round-phone.tight .player { padding: 0.25rem 0.35rem 0.3rem; }
.round-phone.tight .seat-toks { margin: 0.15rem 0 0; }

/* Phone, other tabs: everyone in one slim row. */
.seat-chips { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.45rem var(--gutter-r) 0.45rem var(--gutter-l); scrollbar-width: none; }
.chip-seat { flex: none; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.5rem 0.2rem 0.2rem; border-radius: 999px; color: var(--ink); background: linear-gradient(180deg, #f6ebd0, var(--vellum-2)); box-shadow: 0 0 0 1px rgb(179 134 43 / 50%); font-size: 0.85rem; }
.chip-seat .avatar { width: 26px; height: 26px; }
.chip-seat.active { box-shadow: 0 0 0 2px var(--gold-2), 0 0 12px rgb(255 190 90 / 50%); }
.chip-toks { display: inline-flex; gap: 0.2rem; }
.ct { min-width: 1.7em; padding: 0 0.25rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-align: center; color: #fff; }
.ct-C { background: var(--coin); }
.ct-S { background: var(--sus); }
.ct-E { background: var(--ex); }

/* Computer: the whole game fits one screen. The table fills the height between the top bar and
   the dock; the side panel scrolls inside itself; steps with a lot to choose pop up over the table. */
.game-desktop .stage-body { overflow-y: auto; overscroll-behavior: contain; padding-right: 0.2rem; }
.game-desktop .ballot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.main-col { position: relative; }
@media (min-width: 981px) {
  .game-desktop { display: flex; flex-direction: column; height: calc(100vh / var(--desk-zoom, 1)); height: calc(100dvh / var(--desk-zoom, 1)); }
  .game-desktop > .topbar { flex: none; }
  .game-desktop .board { flex: 1 1 auto; min-height: 0; width: 100%; padding-block: 0.6rem 84px; }
  .game-desktop .main-col { min-height: 0; }
  .game-desktop .banquet { height: 100%; grid-template-rows: auto minmax(230px, 1fr) auto; padding-block: 0; }
  .game-desktop .bq-table { align-self: stretch; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding-block: 12px; }
  .game-desktop .bq-runner { min-height: 0; max-height: 100%; }
  .game-desktop .bq-runner > .stage { align-self: center; max-height: 100%; min-height: 0; display: flex; flex-direction: column; }
  .game-desktop .bq-runner > .stage .stage-body { flex: 0 1 auto; min-height: 0; }
  .game-desktop .side-col { position: static; align-self: stretch; min-height: 0; display: flex; flex-direction: column; }
  .game-desktop .side-col > .tabs { flex: none; }
  .game-desktop .side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
  .game-desktop .side-body > * { flex-shrink: 0; }
  .game-desktop .side-body > .feed { max-height: none; flex: 1 1 0; min-height: 140px; }
  .game-desktop .side-body > .feed.private { flex: 0 1 auto; max-height: 150px; min-height: 0; }
}
.stage-card .stage-body p { margin-top: 0.2rem; }

/* The pop-up: a parchment over the dimmed table; the side panel stays usable beside it. */
.desk-scrim { position: absolute; z-index: 20; inset: -6px; border-radius: 18px; background: rgb(14 9 5 / 55%); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); cursor: pointer; }
.desk-step { position: absolute; z-index: 21; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; pointer-events: none; }
.desk-step > * { pointer-events: auto; }
.desk-step .stage { width: min(860px, 100%); max-height: calc(100% - 52px); min-height: 0; margin: 0; display: flex; flex-direction: column; box-shadow: 0 30px 70px rgb(0 0 0 / 60%), 0 0 0 1px rgb(214 174 85 / 60%); }
.desk-step .stage-body { flex: 1 1 auto; min-height: 0; }
.desk-step .step-hide { flex-direction: row; gap: 0.4rem; margin: 0; padding: 0.4rem 1rem; font-size: 0.9rem; }
.desk-step .step-hide svg { width: 16px; height: 16px; }
.desk-scrim.enter { animation: fade-in 0.45s ease; }
.desk-step.enter .stage { animation: pop-in 0.55s cubic-bezier(.2,.8,.25,1); }
@keyframes pop-in { from { transform: translateY(24px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .desk-scrim.enter, .desk-step.enter .stage { animation: none; } }

/* Phone: the table dims behind the step; tap it to fold the step away. */
.step-scrim { position: fixed; z-index: 27; left: 0; right: 0; top: 0; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); background: rgb(14 9 5 / 45%); }
.step-scrim.enter { animation: fade-in 0.45s ease; }
.game-mobile.step-open .toast, .game-mobile.hand-open .toast { top: calc(env(safe-area-inset-top, 0px) + 58px); bottom: auto; }

/* "Open your hand" in the step */
.open-hand { display: inline-flex; align-items: center; gap: 0.45rem; }
.open-hand svg { width: 22px; height: 22px; flex: none; }

/* Phone gift grid: icons for column heads, smaller steppers, so three columns fit. */
.game-mobile .gift-table .th-name { display: none; }
.game-mobile .gift-table .th-tok svg { width: 20px; height: 20px; }
.game-mobile .gift-table th, .game-mobile .gift-table td { padding: 0.2rem 0.05rem; }
.game-mobile .gift-table tbody th { max-width: 64px; font-size: 0.82rem; }
.game-mobile .stepper { gap: 0.1rem; }
.game-mobile .stepper button { width: 28px; min-height: 28px; font-size: 1rem; }
.game-mobile .stepper span { min-width: 2ch; font-size: 0.9rem; }
.game-mobile .step-sheet .stage { padding-left: 0.85rem; padding-right: 0.85rem; }

/* The hand tray: Saints and Scapulars as full cards with their powers. */
.hs-specials { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.6rem; padding-bottom: 0.3rem; }
.hand-sheet .special { color: var(--ink); }

/* Folding sections: tap the heading to open or close. */
.fold { margin: 0.2rem 0 0.4rem; }
.fold > summary { display: flex; flex-direction: column; gap: 0.05rem; cursor: pointer; list-style: none; padding: 0.4rem 2rem 0.4rem 0; position: relative; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; position: absolute; right: 0.4rem; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: translateY(-70%) rotate(45deg); transition: transform 0.35s ease; }
.fold[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
.fold > summary > span { font-family: var(--font-display); font-size: 1.3rem; color: var(--rubric); line-height: 1.1; }
.fold > summary > small { font-size: 0.82rem; color: var(--ink-faint); }
.side-body .fold > summary > span { font-size: 1.15rem; }
.settings-fold > summary > span { font-size: 1.1rem; color: var(--ink-soft); }
.clues-fold { margin-top: 0.9rem; }
.lobby-start { margin-top: 0.8rem; }
#app[data-layout="mobile"] .lobby .lobby-start { position: sticky; bottom: 0; z-index: 5; padding: 0.6rem 0 0.2rem; background: linear-gradient(180deg, rgb(238 224 191 / 0%), var(--vellum) 30%); }
#app[data-layout="mobile"] .lobby-preview { display: none; }
#app[data-layout="mobile"] .lobby .seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 0.6rem; }
#app[data-layout="mobile"] .lobby .seat { min-width: 0; }
#app[data-layout="mobile"] .lobby .seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Phone: the Work of Mercy card sits small beside its name, so the gift grid starts sooner. */
.game-mobile .token-card { flex-wrap: nowrap; gap: 0.75rem; margin: 0.2rem 0 0.4rem; }
.game-mobile .token-card .card { flex: none; }
.game-mobile .token-card-text strong { font-size: 1.25rem; }
.game-mobile .token-card .costs { gap: 0.25rem; }
.game-mobile .token-card .cost { font-size: 0.85rem; padding: 0 0.4rem 0 0.2rem; }
.game-mobile .token-card .cost svg { width: 15px; height: 15px; }
.game-mobile .step-sheet .stage h2 { font-size: 1.55rem; }
.game-mobile .step-sheet .trade-tally { gap: 0.3rem; }
.game-mobile .step-sheet .tally-card .card { width: 26px; }
.gift-editor .table-wrap { overflow-y: hidden; }
.desk-step .gift-table { max-width: 720px; }

/* In the pop-ups, the button that finishes the step stays in view while the rest scrolls. */
.stage-body .step-go, .step-sheet .step-go, .desk-step .step-go { position: sticky; bottom: 0; z-index: 2; margin-bottom: 0; padding: 0.7rem 0 0.15rem; background: linear-gradient(180deg, rgb(238 224 191 / 0%), rgb(238 224 191 / 97%) 40%); }
/* Phone ballot: two Roles to a row so the whole vote fits with little scrolling. */
.game-mobile .ballot { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 0.6rem; }
.game-mobile .ballot .field { font-size: 0.9rem; }
.game-mobile .ballot select { min-height: 40px; padding-left: 0.5rem; font-size: 0.95rem; }

/* ---- Your Role: the goal strip and the guide ----------------------------------------- */
.goal-strip {
  display: flex; align-items: center; gap: 0.6rem; min-width: 0; min-height: 0;
  padding: 0.28rem 0.4rem 0.28rem 0.3rem; border-radius: 999px; text-align: left;
  color: var(--vellum); background: rgb(255 240 210 / 7%); border: 1px solid rgb(214 174 85 / 50%); box-shadow: none;
  font-size: 0.85rem; line-height: 1.15;
}
.goal-strip:hover:not(:disabled) { background: rgb(255 240 210 / 13%); box-shadow: none; }
.gs-item { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.gs-item + .gs-item { padding-left: 0.6rem; border-left: 1px solid rgb(214 174 85 / 30%); }
.gs-face { width: 30px; height: 30px; flex: none; }
.gs-face svg { width: 100%; height: 100%; display: block; }
.gs-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.gs-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; color: var(--gold-3); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-line { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; color: var(--vellum-2); font-size: 0.8rem; }
.gs-line b { color: #fff3dc; font-variant-numeric: tabular-nums; }
.gs-line > svg { width: 14px; height: 14px; }
.gs-met .gs-line { color: #c6e6ae; }
.gs-held .gs-line, .gs-villain .gs-line { color: #ffb9a3; }
.goal-strip .g-tok { display: inline-grid; place-items: center; width: 17px; height: 17px; padding: 2px; border-radius: 50%; background: #fff3dc; }
.goal-strip .g-tok svg { width: 100%; height: 100%; }
.gs-more { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-variant-caps: all-small-caps; letter-spacing: 0.05em; color: var(--gold-3); border: 1px solid rgb(214 174 85 / 45%); }
.goal-strip.call .gs-more { animation: tab-call 2.2s ease-in-out infinite; background: rgb(214 174 85 / 18%); }
.goal-strip.flash { animation: goal-flash 1.8s ease; }
@keyframes goal-flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px var(--gold-2), 0 0 26px rgb(255 200 110 / 65%); } }
@media (prefers-reduced-motion: reduce) { .goal-strip.call .gs-more, .goal-strip.flash { animation: none; } }
.topbar .goal-strip { margin-inline: auto; }
.game-mobile .goal-strip {
  width: calc(100% - var(--gutter-l) - var(--gutter-r)); margin: 0.35rem var(--gutter-r) 0 var(--gutter-l); padding: 0.2rem 0.4rem 0.2rem 0.3rem; border-radius: 12px;
  background: linear-gradient(180deg, rgb(52 35 23 / 94%), rgb(29 19 12 / 96%)); box-shadow: 0 6px 16px rgb(0 0 0 / 35%);
}
.game-mobile .goal-strip .gs-face { width: 26px; height: 26px; }

.guide-scrim { position: fixed; inset: 0; z-index: 50; background: rgb(10 6 3 / 60%); }
.guide {
  position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(700px, calc(100vw - 24px)); max-height: min(88vh, 840px); max-height: min(88dvh, 840px);
  display: flex; flex-direction: column; padding: 0.9rem 1.1rem 0.6rem; color: var(--ink);
}
.guide-scrim.enter { animation: fade-in 0.35s ease; }
.guide.enter { animation: guide-in 0.5s cubic-bezier(.2,.8,.25,1); }
@keyframes guide-in { from { transform: translate(-50%, calc(-50% + 22px)); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
.game-mobile .guide { top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-height: calc(100dvh - 36px); border-radius: 14px 14px 0 0; padding: 0.7rem var(--gutter-r) 0.5rem var(--gutter-l); }
.game-mobile .guide.enter { animation: sheet-up 0.5s cubic-bezier(.2,.8,.25,1); }
@media (prefers-reduced-motion: reduce) { .guide.enter, .guide-scrim.enter, .game-mobile .guide.enter { animation: none; } }
.guide-head { flex: none; display: flex; align-items: flex-end; gap: 0.6rem; }
.guide-head .tabs { flex: 1; margin: 0; }
.guide-close { flex: none; display: inline-flex; align-items: center; gap: 0.35rem; min-height: 34px; padding: 0.15rem 0.7rem; margin-bottom: 0.3rem; font-size: 0.85rem; }
.guide-close svg { width: 16px; height: 16px; }
.game-mobile .guide-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.guide-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.3rem 0.3rem 0.4rem 0; }
.guide-foot { flex: none; margin: 0.35rem 0 0; }
.g-sec { padding: 0.75rem 0 0.8rem; border-top: 1px solid rgb(179 134 43 / 35%); }
.g-sec:first-child { border-top: none; padding-top: 0.35rem; }
.g-sec h3 { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.4rem; font-size: 1.25rem; color: var(--rubric); }
.g-sec h3 > svg, .g-sec h3 > .g-tok { width: 22px; height: 22px; flex: none; }
.g-sec h4 { margin: 0.85rem 0 0.3rem; font-size: 1.05rem; color: var(--ink); }
.g-sec p { margin: 0.3rem 0; }
.g-role-head { display: flex; align-items: center; gap: 0.75rem; }
.g-role-head h3 { margin: 0; font-size: 1.7rem; }
.g-role-head p { margin: 0.1rem 0 0; }
.g-face { width: 54px; height: 54px; flex: none; }
.g-face svg { width: 100%; height: 100%; display: block; }
.guide .g-tok { display: inline-grid; place-items: center; }
.guide .g-tok svg { width: 100%; height: 100%; }
.g-meter { display: flex; align-items: center; gap: 0.55rem; margin: 0.75rem 0 0.35rem; }
.g-meter .g-tok { width: 30px; height: 30px; flex: none; }
.g-count { min-width: 2ch; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.g-bar { flex: 1; height: 10px; border-radius: 999px; overflow: hidden; background: rgb(60 40 20 / 14%); box-shadow: inset 0 1px 2px rgb(0 0 0 / 22%); }
.g-fill { display: block; height: 100%; border-radius: inherit; background: currentColor; transition: width 0.6s ease; }
.g-zero { font-size: 1.1rem; color: var(--ink-faint); }
.g-status { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.4rem 0; padding: 0.5rem 0.7rem; border-radius: 8px; line-height: 1.4; background: rgb(255 250 235 / 60%); border: 1px solid rgb(179 134 43 / 40%); }
.g-status > svg, .g-status > .g-tok { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.g-status.ok { background: rgb(222 238 208 / 65%); border-color: rgb(47 107 67 / 45%); }
.g-status.ok > svg { color: var(--ok); }
.g-status.bad { background: rgb(248 226 214 / 70%); border-color: rgb(142 28 18 / 40%); }
.g-status.bad > svg { color: var(--rubric); }
.g-tips, .g-steps { margin: 0.2rem 0 0.4rem; padding-left: 1.25rem; }
.g-tips li, .g-steps li { margin: 0.3rem 0; line-height: 1.4; font-size: 0.95rem; }
.g-vices { list-style: none; margin: 0.2rem 0 0.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.g-vices li { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.35rem 0.6rem; border-radius: 6px; background: rgb(255 250 235 / 55%); border: 1px solid rgb(179 134 43 / 30%); }
.g-vices li.ready { border-color: rgb(47 107 67 / 55%); }
.g-vices li.ready .small b { color: var(--ok); }
.g-vice { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--rubric); }
.g-vice svg { width: 16px; height: 16px; }
.g-vice em { font-style: normal; font-size: 0.72rem; padding: 0.05rem 0.45rem; border-radius: 999px; color: #fff3e0; background: var(--rubric); }
.g-powers { margin-top: 0.6rem; }
.g-power-list { list-style: none; margin: 0.3rem 0 0.2rem; padding: 0; display: grid; gap: 0.45rem; }
.g-power-list li { display: flex; align-items: flex-start; gap: 0.55rem; font-size: 0.92rem; line-height: 1.35; }
.g-power-list b { display: block; }
.g-power-icon { width: 26px; height: 26px; flex: none; color: var(--rubric); }
.g-power-icon svg { width: 100%; height: 100%; }
.g-chart { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0.5rem; }
.g-chart-row { display: flex; gap: 0.6rem; padding: 0.5rem 0.65rem; border-radius: 8px; background: rgb(255 250 235 / 55%); border: 1px solid rgb(179 134 43 / 35%); }
.g-chart-row.mine { box-shadow: 0 0 0 2px var(--gold-2); background: rgb(255 246 222 / 85%); }
.g-chart-row .g-face { width: 42px; height: 42px; }
.g-chart-row p { margin: 0.12rem 0; line-height: 1.35; }
.g-chart-name b { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; }
.g-chart-name em { margin-left: 0.4rem; padding: 0 0.45rem; border-radius: 999px; font-style: normal; font-size: 0.8rem; font-variant-caps: all-small-caps; color: var(--ink); background: var(--gold-2); }
.g-chart-row.villain .g-chart-name b { color: var(--rubric); }
.guide-btn { display: flex; align-items: center; gap: 0.75rem; width: 100%; margin: 0.1rem 0 0.6rem; padding: 0.6rem 0.85rem; text-align: left; }
.guide-btn svg { width: 26px; height: 26px; flex: none; color: var(--rubric); }
.guide-btn b { display: block; font-size: 1.02rem; }
.guide-btn small { display: block; color: var(--ink-faint); font-size: 0.82rem; }
.hs-role-detail .link { margin-left: 0.5rem; color: var(--gold-3); }
/* Phone: the goal strip stays bright and reachable above a popped-up step or hand. */
.game-mobile .goal-strip { position: relative; z-index: 30; }
.game-mobile.goal-on .step-sheet { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); }
.game-mobile.goal-on.step-open .toast, .game-mobile.goal-on.hand-open .toast { top: calc(env(safe-area-inset-top, 0px) + 108px); }

/* Goal strip: a soft fill behind each Role shows how far along you are, and a slow light
   passes across it now and then so it catches the eye. */
.goal-strip { position: relative; overflow: hidden; isolation: isolate; }
.gs-item { position: relative; padding: 0.12rem 0.55rem 0.12rem 0.15rem; border-radius: 999px; }
.gs-item { --fill: 214 174 85; }
.gs-met { --fill: 126 186 96; }
.gs-held { --fill: 200 70 45; }
/* The fill fades out at its leading edge, like light spreading along the strip. */
.gs-item::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: linear-gradient(90deg, rgb(var(--fill) / 38%) 0%, rgb(var(--fill) / 24%) calc(var(--p, 0%) * 0.75), rgb(var(--fill) / 0%) var(--p, 0%)); }
.gs-item + .gs-item { margin-left: 0.1rem; padding-left: 0.4rem; border-left: none; }
.gs-sweep {
  position: absolute; top: 0; bottom: 0; left: 0; width: 45%; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgb(255 236 190 / 18%) 30%, rgb(255 244 214 / 40%) 46%, rgb(255 252 238 / 58%) 50%, rgb(255 244 214 / 40%) 54%, rgb(255 236 190 / 18%) 70%, transparent);
  transform: translateX(-110%); animation: gs-sweep 7.5s ease-in-out infinite;
}
@keyframes gs-sweep { 0% { transform: translateX(-110%); } 55%, 100% { transform: translateX(330%); } }
@media (prefers-reduced-motion: reduce) { .gs-sweep { display: none; } }
.gs-sin { display: inline-flex; align-items: center; gap: 0.15rem; margin-left: 0.25rem; padding: 0 0.35rem; border-radius: 999px; color: #ffeadb; background: rgb(170 44 26 / 85%); font-size: 0.72rem; }
.gs-sin svg { width: 12px; height: 12px; }
.topbar .goal-strip { min-width: 380px; padding: 0.32rem 0.45rem 0.32rem 0.32rem; border: 1.5px solid rgb(214 174 85 / 80%); background: rgb(255 240 210 / 10%); box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 0 18px rgb(214 174 85 / 18%); }
.topbar .goal-strip .gs-face { width: 36px; height: 36px; }
.topbar .goal-strip .gs-name { font-size: 1.2rem; }
.topbar .goal-strip .gs-line { font-size: 0.88rem; }

/* Your goal inside the steps: the trade, giving tokens, the Manipulator, your turn. */
.step-goal { margin: 0.2rem 0 0.7rem; padding: 0.55rem 0.7rem 0.5rem; border-radius: 8px; background: linear-gradient(180deg, rgb(255 251 238 / 88%), rgb(250 240 214 / 78%)); border: 1px solid rgb(179 134 43 / 55%); border-left: 4px solid var(--gold); box-shadow: 0 2px 8px rgb(60 40 20 / 12%); }
.sg-head { display: flex; align-items: center; gap: 0.55rem; }
.step-goal .sg-head:not(:first-child) { margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px dashed rgb(179 134 43 / 45%); }
.sg-face { width: 38px; height: 38px; flex: none; }
.sg-face svg { width: 100%; height: 100%; display: block; }
.sg-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.12; }
.sg-title b { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; color: var(--rubric); }
.sg-title span { font-size: 0.98rem; font-weight: 700; color: var(--ink); }
.sg-count { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.6rem 0.18rem 0.3rem; border-radius: 999px; background: #fffaf0; border: 1px solid rgb(179 134 43 / 55%); font-size: 0.9rem; white-space: nowrap; }
.sg-count b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.sg-count.ok { color: var(--ok); border-color: rgb(47 107 67 / 50%); }
.sg-count > svg { width: 18px; height: 18px; }
.step-goal .g-tok { display: inline-grid; place-items: center; }
.step-goal .g-tok svg { width: 100%; height: 100%; }
.sg-count .g-tok { width: 20px; height: 20px; }
.sg-line { display: flex; align-items: flex-start; gap: 0.45rem; margin: 0.4rem 0 0.1rem; font-size: 0.95rem; line-height: 1.38; }
.sg-line > svg, .sg-line > .g-tok { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.sg-line.bad > svg { color: var(--rubric); }
.sg-line.ok > svg { color: var(--ok); }
.sg-line.tip > svg { color: var(--gold); }
.sg-meter { display: flex; align-items: center; gap: 0.5rem; margin: 0.45rem 0 0.1rem; font-variant-numeric: tabular-nums; }
.sg-meter b { min-width: 2ch; font-size: 1rem; }
.sg-meter b.zero { color: var(--ok); }
.sg-bar { position: relative; flex: 1; height: 9px; border-radius: 999px; overflow: hidden; background: rgb(60 40 20 / 14%); box-shadow: inset 0 1px 2px rgb(0 0 0 / 18%); }
.sg-fill, .sg-gain { position: absolute; top: 0; bottom: 0; transition: width 0.5s ease, left 0.5s ease; }
.sg-fill { left: 0; background: currentColor; opacity: 0.85; }
.sg-gain { background: repeating-linear-gradient(45deg, currentColor 0 4px, transparent 4px 8px); opacity: 0.65; }
.sg-note { margin: 0.35rem 0 0; color: var(--ink-faint); }
.game-mobile .sg-title b { font-size: 1.2rem; }
.game-mobile .sg-line { font-size: 0.9rem; }
.game-mobile .step-goal { padding: 0.45rem 0.6rem 0.4rem; }

/* Blind trade: each card says whether to keep it; the best one to put down is marked. */
.trade-tag { display: block; width: 100%; padding: 0.05rem 0.35rem; border-radius: 7px; font-size: 0.74rem; line-height: 1.2; text-align: center; font-variant-caps: all-small-caps; letter-spacing: 0.03em; }
.tt-bad { color: #fff1e0; background: var(--rubric); }
.tt-warn { color: #7a2a14; background: #f6e0c8; border: 1px solid rgb(142 28 18 / 40%); }
.tt-good { color: var(--ok); background: rgb(47 107 67 / 12%); border: 1px solid rgb(47 107 67 / 40%); }
.tt-muted { color: var(--ink-soft); background: rgb(60 40 20 / 7%); border: 1px solid rgb(179 134 43 / 35%); }
.tt-best { color: var(--ink); font-weight: 700; background: var(--gold-2); box-shadow: 0 0 10px rgb(255 190 90 / 65%); }
.hand-card.suggest:not(.selected) .card { box-shadow: 0 0 0 2px var(--gold-2), 0 0 14px rgb(255 190 90 / 55%), 0 6px 14px rgb(0 0 0 / 25%); }
.trade-pick .hand-card { width: min-content; }
.guide-move { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; padding-top: 0.4rem; border-top: 1px solid rgb(179 134 43 / 35%); }
.guide-move span { color: var(--rubric); font-weight: 700; }

/* How to play: a gold pill at the top right, opening client/rules.html in a new tab (same idea as Apis). */
.rules-link {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0.2rem 0.85rem; border-radius: 999px;
  font-family: var(--font-body); font-size: 0.92rem; font-weight: 700; 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 / 22%), 0 0 0 1px rgb(0 0 0 / 45%), 0 0 14px rgb(241 214 144 / 35%);
}
.rules-link:hover { background: linear-gradient(180deg, #fff0c2, var(--gold-3)); }
/* Phone game bar: the scales stand in for the title so How to play fits at the top right. */
.mobile-top:has(.rules-link) .brand-name { display: none; }
.mobile-top .rules-link { font-size: 0.8rem; padding: 0.1rem 0.6rem; min-height: 30px; }
/* Phone lobby bar: the layout switch shows its icons only, so the bar stays on one row under the title. */
@media (max-width: 520px) {
  .lobby .topbar .layout-toggle span { display: none; }
  .lobby .topbar .layout-toggle button { padding-inline: 0.4rem; }
}
@media (max-width: 380px) {
  .mobile-top .topbar-right { gap: 0.2rem; }
  .mobile-top .pill { padding-inline: 0.4rem; }
  .mobile-top .rules-link { padding: 0.1rem 0.45rem; font-size: 0.76rem; }
  .lobby .topbar .topbar-right { gap: 0.3rem; }
  .lobby .topbar .rules-link { padding: 0.1rem 0.6rem; font-size: 0.85rem; }
}
/* Very small phones (320 wide): the bar may take a second row rather than run off the screen. */
@media (max-width: 340px) {
  .mobile-top, .mobile-top .topbar-right { flex-wrap: wrap; justify-content: flex-end; row-gap: 0.25rem; }
}
/* Your turn: a one-line goal box (the top strip already names the Role) and the drawn cards
   with their names beside them, so the turn's buttons fit without scrolling. */
.drawn { flex-wrap: nowrap; gap: 0.7rem; margin: 0.3rem 0 0.4rem; }
.drawn > .small { min-width: 0; line-height: 1.35; }
.step-goal.compact { padding: 0.35rem 0.6rem 0.35rem; margin: 0.15rem 0 0.45rem; }
.step-goal.compact .sg-face { width: 28px; height: 28px; }
.step-goal.compact .sg-title { flex-direction: row; align-items: baseline; gap: 0.45rem; }
.step-goal.compact .sg-title b { font-size: 1.1rem; }
.step-goal.compact .sg-title span { font-size: 0.9rem; }
.step-goal.compact .sg-count { padding: 0.1rem 0.5rem 0.1rem 0.25rem; font-size: 0.82rem; }
.step-goal.compact .sg-count b { font-size: 1rem; }
.step-goal.compact .sg-line { margin-top: 0.25rem; font-size: 0.9rem; }
/* Phone hand tray: Saints and Scapulars as compact rows, so four or five fit on screen. */
.game-mobile .hs-specials { grid-template-columns: 1fr; gap: 0.4rem; }
.game-mobile .hs-specials .special { align-items: center; gap: 0.55rem; padding: 0.3rem 0.5rem; }
.game-mobile .hs-specials .special .card-s { width: 42px; }
.game-mobile .hs-specials .special-body { gap: 0.05rem; }
.game-mobile .hs-specials .special-head strong { font-size: 1rem; line-height: 1.15; }
.game-mobile .hs-specials .special-head button { min-height: 32px; padding: 0.1rem 0.7rem; }
.game-mobile .hs-specials .special .small { font-size: 0.82rem; line-height: 1.28; }
.game-mobile .hs-specials .special .tag { font-size: 0.66rem; }
.game-mobile .hand-sheet.hs-tray h3 { margin: 0.4rem 0 0.25rem; }
