/* Four Souls Character Chooser. One stylesheet for the pick screen and the editor. */

/* Fonts ship with the app, so it works with no internet.
   Title and body: "font-souls", a fan-made replica of the card game's lettering by Matheus Assis and the Four Souls
   community (MIT License, see fonts/FONT-SOULS-LICENSE.txt; https://github.com/AssisrMatheus/font-souls).
   Bricolage Grotesque (SIL Open Font License, see fonts/OFL-LICENSE.txt) fills in any character those two lack. */
@font-face { font-family: 'Font Souls Title'; src: url('/client/fonts/font-souls-title.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Font Souls Body'; src: url('/client/fonts/font-souls-body.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('/client/fonts/bricolage-grotesque.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #4a2c1b;
  /* The chest: its floor and its rim are the picked color, pulled toward wood. */
  --wood: color-mix(in srgb, var(--bg) 82%, #7a4a26);
  --rim-wood: color-mix(in srgb, var(--bg) 45%, #c9853c);
  --rim: 14px;
  --panel: color-mix(in srgb, var(--bg) 62%, #000);
  --panel-2: color-mix(in srgb, var(--bg) 70%, #fff 8%);
  --line: color-mix(in srgb, var(--bg) 55%, #fff 26%);
  --ink: #f7efe6;
  --muted: color-mix(in srgb, var(--ink) 62%, var(--bg));
  --paper: #f3e9dc;
  --dark-ink: #24161b;
  /* The trim: the gold of the straps, the main buttons and the highlights. Yours to pick, like the wood. */
  --go: #e6b44c;
  --go-ink: #24161b;
  --danger: #e2546b;
  --focus: #ffd76a;
  --radius: 14px;
  --font: 'Font Souls Body', 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --title: 'Font Souls Title', 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--wood); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

/* The background: you are inside a wooden chest, looking down at its floor. The planks, seams, nails and grain are
   drawn in black and white with see-through gaps, so the wood takes the color you pick. A warm light drifts slowly
   across, as if the lid were open. The rim and its gold straps frame the screen. */
/* The four layers sit at the bottom of the page's own stack (floor, light, rim, straps, in that order) and the page
   goes above them. They are not behind the body, so a browser or extension that paints the body can't cover them. */
#app { position: relative; z-index: 1; }
html::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22560%22 height=%22224%22%3E%3Cfilter id=%22g%22 x=%220%22 y=%220%22 width=%22100%25%22 height=%22100%25%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.006 0.55%22 numOctaves=%223%22 seed=%227%22 stitchTiles=%22stitch%22/%3E%3CfeColorMatrix values=%220 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.5 0.95%22/%3E%3C/filter%3E%3Cfilter id=%22s%22 x=%220%22 y=%220%22 width=%22100%25%22 height=%22100%25%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.02 0.9%22 numOctaves=%222%22 seed=%223%22 stitchTiles=%22stitch%22/%3E%3CfeColorMatrix values=%220 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 -2.2 0.9%22/%3E%3C/filter%3E%3Crect width=%22560%22 height=%22224%22 filter=%22url(%23g)%22 opacity=%22.5%22/%3E%3Crect width=%22560%22 height=%22224%22 filter=%22url(%23s)%22 opacity=%22.1%22/%3E%3Crect y=%220%22 width=%22560%22 height=%2256%22 fill=%22%23000%22 opacity=%220%22/%3E%3Crect y=%220%22 width=%22560%22 height=%223%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Crect y=%223%22 width=%22560%22 height=%221.5%22 fill=%22%23fff%22 opacity=%22.07%22/%3E%3Crect x=%22150%22 y=%223%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22153%22 y=%223%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22141%22 cy=%2215%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22140.4%22 cy=%2214.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22141%22 cy=%2244%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22140.4%22 cy=%2243.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22162%22 cy=%2215%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22161.4%22 cy=%2214.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22162%22 cy=%2244%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22161.4%22 cy=%2243.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect x=%22430%22 y=%223%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22433%22 y=%223%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22421%22 cy=%2215%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22420.4%22 cy=%2214.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22421%22 cy=%2244%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22420.4%22 cy=%2243.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22442%22 cy=%2215%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22441.4%22 cy=%2214.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22442%22 cy=%2244%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22441.4%22 cy=%2243.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect y=%2256%22 width=%22560%22 height=%2256%22 fill=%22%23000%22 opacity=%220.07%22/%3E%3Crect y=%2256%22 width=%22560%22 height=%223%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Crect y=%2259%22 width=%22560%22 height=%221.5%22 fill=%22%23fff%22 opacity=%22.07%22/%3E%3Crect x=%2260%22 y=%2259%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%2263%22 y=%2259%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%2251%22 cy=%2271%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%2250.4%22 cy=%2270.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%2251%22 cy=%22100%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%2250.4%22 cy=%2299.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%2272%22 cy=%2271%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%2271.4%22 cy=%2270.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%2272%22 cy=%22100%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%2271.4%22 cy=%2299.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect x=%22330%22 y=%2259%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22333%22 y=%2259%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22321%22 cy=%2271%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22320.4%22 cy=%2270.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22321%22 cy=%22100%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22320.4%22 cy=%2299.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22342%22 cy=%2271%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22341.4%22 cy=%2270.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22342%22 cy=%22100%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22341.4%22 cy=%2299.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect y=%22112%22 width=%22560%22 height=%2256%22 fill=%22%23000%22 opacity=%220.03%22/%3E%3Crect y=%22112%22 width=%22560%22 height=%223%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Crect y=%22115%22 width=%22560%22 height=%221.5%22 fill=%22%23fff%22 opacity=%22.07%22/%3E%3Crect x=%22220%22 y=%22115%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22223%22 y=%22115%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22211%22 cy=%22127%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22210.4%22 cy=%22126.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22211%22 cy=%22156%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22210.4%22 cy=%22155.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22232%22 cy=%22127%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22231.4%22 cy=%22126.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22232%22 cy=%22156%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22231.4%22 cy=%22155.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect x=%22500%22 y=%22115%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22503%22 y=%22115%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22491%22 cy=%22127%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22490.4%22 cy=%22126.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22491%22 cy=%22156%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22490.4%22 cy=%22155.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22512%22 cy=%22127%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22511.4%22 cy=%22126.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22512%22 cy=%22156%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22511.4%22 cy=%22155.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect y=%22168%22 width=%22560%22 height=%2256%22 fill=%22%23000%22 opacity=%220.1%22/%3E%3Crect y=%22168%22 width=%22560%22 height=%223%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Crect y=%22171%22 width=%22560%22 height=%221.5%22 fill=%22%23fff%22 opacity=%22.07%22/%3E%3Crect x=%22110%22 y=%22171%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22113%22 y=%22171%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22101%22 cy=%22183%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22100.4%22 cy=%22182.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22101%22 cy=%22212%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22100.4%22 cy=%22211.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22122%22 cy=%22183%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22121.4%22 cy=%22182.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22122%22 cy=%22212%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22121.4%22 cy=%22211.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Crect x=%22390%22 y=%22171%22 width=%223%22 height=%2253%22 fill=%22%23000%22 opacity=%22.45%22/%3E%3Crect x=%22393%22 y=%22171%22 width=%221.5%22 height=%2253%22 fill=%22%23fff%22 opacity=%22.06%22/%3E%3Ccircle cx=%22381%22 cy=%22183%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22380.4%22 cy=%22182.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22381%22 cy=%22212%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22380.4%22 cy=%22211.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22402%22 cy=%22183%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22401.4%22 cy=%22182.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3Ccircle cx=%22402%22 cy=%22212%22 r=%222.2%22 fill=%22%23000%22 opacity=%22.5%22/%3E%3Ccircle cx=%22401.4%22 cy=%22211.4%22 r=%22.8%22 fill=%22%23fff%22 opacity=%22.25%22/%3E%3C/svg%3E") 0 0 / 560px 224px, var(--wood); }
body::before,
body::after { content: ''; position: fixed; pointer-events: none; }
body::before {
  z-index: 0; inset: -30%;
  background:
    radial-gradient(34% 30% at 32% 30%, color-mix(in srgb, var(--wood) 30%, #ffc56e) 0%, transparent 70%),
    radial-gradient(30% 28% at 72% 70%, color-mix(in srgb, var(--wood) 45%, #ff9a5a) 0%, transparent 72%);
  mix-blend-mode: soft-light; opacity: 0.75;
  animation: lamplight 46s ease-in-out infinite alternate;
}
body::after {
  z-index: 0; inset: 0;
  box-shadow:
    inset 0 0 0 2px #0009,
    inset 0 0 0 calc(var(--rim) - 3px) var(--rim-wood),
    inset 0 0 0 var(--rim) #000a,
    inset 0 0 26px calc(var(--rim) + 6px) #0008,
    inset 0 0 160px 30px #000b;
}
/* The gold straps at the corners sit on top of the rim. */
html::after { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  --strap: linear-gradient(color-mix(in srgb, var(--go) 55%, #fff), var(--go) 45%, color-mix(in srgb, var(--go) 55%, #000));
  --strap-v: linear-gradient(90deg, color-mix(in srgb, var(--go) 55%, #fff), var(--go) 45%, color-mix(in srgb, var(--go) 55%, #000));
  background:
    var(--strap) 0 0 / 72px var(--rim) no-repeat, var(--strap-v) 0 0 / var(--rim) 72px no-repeat,
    var(--strap) 100% 0 / 72px var(--rim) no-repeat, var(--strap-v) 100% 0 / var(--rim) 72px no-repeat,
    var(--strap) 0 100% / 72px var(--rim) no-repeat, var(--strap-v) 0 100% / var(--rim) 72px no-repeat,
    var(--strap) 100% 100% / 72px var(--rim) no-repeat, var(--strap-v) 100% 100% / var(--rim) 72px no-repeat;
  filter: drop-shadow(0 1px 2px #000a);
}
@keyframes lamplight {
  0% { transform: translate(-4%, -3%) rotate(0deg) scale(1); }
  50% { transform: translate(4%, 2%) rotate(7deg) scale(1.1); }
  100% { transform: translate(-2%, 4%) rotate(-5deg) scale(1.05); }
}

/* The two hand-lettered fonts come in one weight each, so emphasis is the title font, never a faked bold. */
body { font-synthesis: none; }
b, strong, h1, h2, .btn, .tab, .chip, .card-name, .card-badge, .field > span, .field-label, .stepper-label, .stepper output, .toast, .error {
  font-family: var(--title); font-weight: 400; letter-spacing: 0.01em;
}

.page { max-width: 720px; margin: 0 auto; padding: calc(var(--rim) + 14px) calc(var(--rim) + 12px) calc(var(--rim) + 26px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.page-wide { max-width: 1100px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo { margin: 0; font-size: clamp(2rem, 8vw, 3rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.02em; }
.logo span { display: block; font-size: 0.42em; font-weight: 500; letter-spacing: 0.02em; color: var(--go); margin-top: 6px; }
.logo-small { font-size: 1.7rem; }
h2 { margin: 0; font-size: 1.15rem; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 0.95rem; }
.foot { text-align: center; }
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 0.95rem; display: flex; flex-direction: column; gap: 8px; }
.error { color: var(--danger); font-weight: 600; min-height: 1.2em; }
.error:empty { display: none; }

.panel { background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(6px); }

/* ---------------------------------------------------------------- controls */

.btn { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-go { background: var(--go); border-color: var(--go); color: var(--go-ink); }
.btn-big { font-size: 1.2rem; padding: 14px 20px; min-height: 56px; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); margin-left: auto; }
.btn-round { width: 44px; padding: 0; font-size: 1.4rem; border-radius: 50%; }
.link { appearance: none; background: none; border: 0; padding: 0; color: var(--go); font: inherit; text-decoration: underline; cursor: pointer; }
.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

input, select { font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; min-width: 0; }
input[type='search'] { flex: 1 1 200px; }
input[type='checkbox'] { min-height: 0; width: 22px; height: 22px; accent-color: var(--go); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span, .field-label, .stepper-label { font-weight: 600; font-size: 0.95rem; }
.field-label { margin-bottom: 6px; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }
.field-inline input { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.bg-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.bg-pick input { width: 34px; height: 34px; min-height: 0; padding: 2px; border-radius: 50%; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; font: inherit; font-size: 0.92rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; min-height: 38px; cursor: pointer; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.chip.on { color: var(--dark-ink); background: var(--paper); border-color: var(--paper); font-weight: 600; text-decoration: none; }
.chip small { opacity: 0.7; font-weight: 500; }
.pool-count { font-size: 1.05rem; }
.pool-count b { color: var(--go); font-size: 1.3em; }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper-buttons { display: flex; align-items: center; gap: 12px; }
.stepper output { font-size: 1.6rem; font-weight: 800; min-width: 1.4ch; text-align: center; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.tab { appearance: none; font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; min-height: 44px; cursor: pointer; }
.tab.on { color: var(--ink); border-bottom-color: var(--go); }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--paper); color: var(--dark-ink); font-weight: 600; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 30px #0008; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px); z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- cards */

.card { container-type: inline-size; position: relative; aspect-ratio: 5 / 7; border-radius: 12px; overflow: hidden; background: var(--paper); color: var(--dark-ink); box-shadow: 0 6px 18px #0006; border: 3px solid var(--paper); display: flex; flex-direction: column; text-align: left; }
.card-art { flex: 1; min-height: 0; width: 100%; object-fit: cover; display: block; border-radius: 8px 8px 0 0; }
.card-blank { display: grid; place-items: center; background: radial-gradient(120% 90% at 30% 20%, hsl(var(--hue) 55% 42%), hsl(calc(var(--hue) + 40) 50% 18%)); }
.card-blank span { font-size: clamp(2rem, 38cqw, 6rem); font-weight: 800; color: #fff; opacity: 0.85; text-shadow: 0 3px 0 #0004; }
.card-text { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 1px; }
.card-name { font-weight: 800; font-size: 1rem; line-height: 1.1; }
.card-set { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.65; }
.card-item { font-size: 0.9rem; font-weight: 600; color: #8a2740; }
.card-item::before { content: 'Starts with '; font-weight: 400; color: var(--dark-ink); opacity: 0.7; }
.card-badge { position: absolute; top: 6px; right: 6px; background: var(--dark-ink); color: var(--paper); font-size: 0.7rem; font-weight: 700; padding: 3px 7px; border-radius: 999px; }
.card-number { position: absolute; top: 6px; left: 6px; min-width: 1.7em; text-align: center; background: var(--dark-ink); color: var(--paper); font-family: var(--title); font-size: 0.75rem; padding: 3px 6px; border-radius: 999px; }
.base-panel ul { margin: 0; padding-left: 1.2em; }
.tappable { cursor: pointer; }
.tappable:hover { transform: translateY(-2px); }
.card.out { opacity: 0.38; filter: grayscale(0.7); }
.card.in { border-color: var(--go); }
.card.taken { border-color: var(--go); box-shadow: 0 0 0 3px var(--go), 0 10px 26px #0008; }
.card.passed { opacity: 0.4; filter: grayscale(0.6); }

/* Card view: a card with a picture is the whole picture and nothing else (for scans of the real cards). The paper,
   the crop and the printed name go away; cards with no picture keep their usual look. */
.view-card .card.has-art { aspect-ratio: auto; background: none; border-color: transparent; box-shadow: none; overflow: visible; align-self: start; }
.view-card .card.has-art .card-art { flex: none; width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; border-radius: 10px; box-shadow: 0 6px 18px #0006; }
.view-card .card.has-art .card-text { display: none; }
.view-card .card.has-art.in .card-art, .view-card .pair.taken .card.has-art .card-art, .view-card .card.has-art.taken .card-art { outline: 3px solid var(--go); outline-offset: 2px; }
.view-card .pair.taken .card.has-art { box-shadow: none; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg { appearance: none; font-family: var(--title); font-size: 0.85rem; color: var(--muted); background: transparent; border: 0; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.seg.on { background: var(--paper); color: var(--dark-ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

.hand { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.hand-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; border-radius: 14px; }
/* The two cards of a pair are the same height, whichever has the longer name. */
.pair .card { aspect-ratio: auto; }
.pair .card-art { flex: none; aspect-ratio: 10 / 11; }
.pair .card-text { flex: 1; }
.pair.tappable:hover { transform: translateY(-2px); }
.pair.taken .card { border-color: var(--go); box-shadow: 0 0 0 3px var(--go), 0 10px 26px #0008; }
.pair.passed .card { opacity: 0.4; filter: grayscale(0.6); }
/* The starting item: a treasure, so it wears the trim color. */
.item-card { border-color: color-mix(in srgb, var(--go) 70%, var(--paper)); }
.item-face { clip-path: none; }
.item-face.card-blank { background: radial-gradient(90% 70% at 50% 45%, hsl(var(--hue) 45% 46%), hsl(calc(var(--hue) + 30) 45% 16%)); }
.item-face span { display: grid; place-items: center; width: 62%; aspect-ratio: 1; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--go) 80%, #fff); background: #0004; font-size: clamp(1.6rem, 30cqw, 4.5rem); }
.item-none { display: grid; place-items: center; background: repeating-linear-gradient(45deg, #0000 0 10px, #0001 10px 20px), #cfc4b6; }
.item-none span { color: #0006; border-color: #0003; background: none; font-family: var(--title); }
.no-item { border-color: var(--paper); }
.deal-in-late { animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
.slot { display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }
.deal-in { animation: deal-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes deal-in { from { opacity: 0; transform: translateY(26px) rotate(-5deg) scale(0.92); } }

/* ---------------------------------------------------------------- the editor */

.editor { display: grid; grid-template-columns: minmax(260px, 400px) 1fr; gap: 20px; align-items: start; }
.editor-preview { display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }
.editor-form { display: flex; flex-direction: column; gap: 12px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.deck-count { margin-left: auto; color: var(--go); }
.btn-danger + .deck-count { margin-left: 0; }
.deck-list { display: flex; flex-direction: column; gap: 10px; }
.deck-row { appearance: none; font: inherit; color: var(--ink); text-align: left; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
button.deck-row:hover { border-color: var(--go); }
.approvals { display: flex; flex-direction: column; gap: 14px; }
.picture-buttons { display: flex; flex-direction: column; gap: 6px; }
.approval { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 14px; align-items: start; }
.approval > div:last-child { display: flex; flex-direction: column; gap: 8px; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details .row { margin-top: 8px; }

@media (max-width: 560px) {
  .editor { grid-template-columns: 1fr; }
  .approval { grid-template-columns: 1fr; }
  .hand-cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .deal-in { animation: none; }
  .tappable:hover { transform: none; }
}

/* Alternate art, under the character's two pictures in the editor */
.alts { margin-top: 14px; }
.alt-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: flex-start; }
.alt { display: flex; flex-direction: column; gap: 4px; width: 84px; }
.alt img { width: 84px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 12px #0006; }
.alt-add { align-self: center; }

/* ================================================================ the playtest table (everything above is the
   Character Chooser's stylesheet, so the lobby is the same chest) */

.hidden { display: none !important; }
.choice { display: flex; flex-direction: column; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-family: var(--title); font-size: 1.4rem; }
.code-input::placeholder { letter-spacing: 0.05em; font-size: 1rem; }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; }
select { width: 100%; }
.segmented.wide { display: flex; }
.segmented.wide .seg { flex: 1; min-height: 44px; font-size: 1rem; }
.offline { position: fixed; top: calc(var(--rim) + 6px); left: 50%; transform: translateX(-50%); z-index: 20; background: var(--danger); color: #fff; font-family: var(--title); padding: 8px 14px; border-radius: 12px; box-shadow: 0 8px 30px #0008; max-width: calc(100vw - 48px); text-align: center; }

/* The invite: QR code, room code, link */
.invite { flex-direction: row; align-items: center; gap: 16px; }
.join-qr { background: #fff; border-radius: 12px; padding: 8px; width: 128px; flex: none; }
.join-qr svg { display: block; width: 100%; height: auto; }
.invite-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.invite-code { font-family: var(--title); font-size: 3rem; letter-spacing: 0.08em; color: var(--go); line-height: 1; }
.invite-url { font-size: 0.8rem; word-break: break-all; }

/* Who's in */
.lobby-seats { display: grid; gap: 8px; }
.lobby-seat { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.seat-name { display: grid; line-height: 1.15; min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; font-family: var(--title); }
.seat-name small { font-family: var(--font); font-size: 0.85rem; color: var(--go); }
.seat-name small.is-waiting { color: var(--muted); }
.tag { font-family: var(--title); font-size: 0.7rem; color: var(--go-ink); background: var(--go); border-radius: 999px; padding: 2px 8px; flex: none; }
.tag.is-bot { background: var(--muted); color: var(--dark-ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #5fd08a; flex: none; }
.dot.is-off { background: var(--line); }
.thumb { width: 40px; height: 56px; border-radius: 6px; object-fit: cover; flex: none; display: grid; place-items: center; box-shadow: 0 2px 8px #0006; }
.thumb-none { border: 2px dashed var(--line); color: var(--muted); box-shadow: none; font-family: var(--title); }
.thumb-blank { background: radial-gradient(120% 90% at 30% 20%, hsl(var(--hue) 55% 42%), hsl(calc(var(--hue) + 40) 50% 18%)); color: #fff; font-family: var(--title); font-size: 1.3rem; }
.thumb-btn { appearance: none; border: 0; background: none; padding: 0; position: relative; cursor: pointer; flex: none; display: flex; border-radius: 6px; }
.swap-mark { position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--go); color: var(--go-ink); font-style: normal; font-size: 0.8rem; display: grid; place-items: center; }

/* Your character, and flipping through its art */
.mine { display: flex; flex-direction: column; gap: 10px; max-width: 420px; width: 100%; align-self: center; container-type: inline-size; }
.art-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.art-count { font-family: var(--title); min-width: 8ch; text-align: center; }
.card[aria-disabled='true'] { cursor: not-allowed; }
.card-badge { max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The bar at the bottom: leave on the left, start on the right */
.has-bar { padding-bottom: calc(var(--rim) + 110px + env(safe-area-inset-bottom)); }
.bar { position: fixed; z-index: 5; left: var(--rim); right: var(--rim); bottom: var(--rim); display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 94%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.bar-note { flex: 1; min-width: 0; color: var(--muted); font-size: 0.9rem; }
.bar .btn-danger { margin-left: 0; }

/* The table, until there is a game on it */
.table-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.table-seat { display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }

/* The party view (a TV): the code to join on the left, the players on the right */
.party { position: relative; z-index: 1; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 4vw; align-items: center; padding: calc(var(--rim) + 4vh) calc(var(--rim) + 4vw); font-size: clamp(16px, 1.35vw, 28px); }
.party .logo { font-size: clamp(2.4rem, 5vw, 6rem); }
.party-join { display: grid; gap: 2.4vh; }
.join-how { font-family: var(--title); font-size: 1.3em; }
.join-code { font-family: var(--title); font-size: clamp(80px, 12vw, 230px); letter-spacing: 0.06em; line-height: 0.9; color: var(--go); text-shadow: 0 4px 0 #0006; }
.join-row { display: flex; gap: 2.5vw; align-items: center; }
.party .join-qr { width: min(30vh, 300px); padding: 12px; border-radius: 16px; }
.join-url { font-size: 1.05em; color: var(--muted); word-break: break-all; }
.party-room { display: grid; gap: 1em; align-content: center; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2em; backdrop-filter: blur(6px); }
.party h2 { font-size: 1.4em; }
.party-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11em), 1fr)); gap: 1em; }
.party-seat { display: flex; flex-direction: column; gap: 0.4em; min-width: 0; container-type: inline-size; }
.party-name { display: flex; align-items: center; gap: 0.5em; min-width: 0; }
.party-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-name .dot { width: 0.6em; height: 0.6em; }
.party-empty { aspect-ratio: 10 / 7; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 0.5em; }
.party-seat .card-name { font-size: clamp(0.7rem, 9cqw, 1rem); }
.party-seat .card-set { font-size: clamp(0.5rem, 6cqw, 0.8rem); }
.party-table { grid-template-columns: 1fr; align-content: center; }
.party-table .party-seats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16em), 1fr)); gap: 2em; }

@media (max-width: 800px) {
  .party { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .join-qr { width: 104px; }
  .invite-code { font-size: 2.4rem; }
  .bar .btn-big { font-size: 1rem; padding: 10px 14px; }
}

/* A card with two faces: the button that turns it over (a look only; it starts the game on its main face) */
.flip-btn { position: absolute; top: 6px; left: 6px; z-index: 2; appearance: none; border: 1px solid #fff5; background: #000a; color: #fff; font-family: var(--title); font-size: 0.75rem; padding: 5px 10px; border-radius: 999px; cursor: pointer; min-height: 30px; }
.flip-btn:hover, .flip-btn[aria-pressed='true'] { background: var(--go); color: var(--go-ink); border-color: var(--go); }

/* ================================================================ the card library page */

/* Rules text is read closely, so it's set in the plain font. */
:root { --plain: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif; }
textarea { font: inherit; font-family: var(--plain); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; resize: vertical; min-height: 88px; }
.grow { flex: 1 1 140px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; background: var(--panel-2); border-radius: 6px; padding: 1px 6px; text-transform: none; letter-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat-row input { width: 100%; }
.lib-preview { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.lib-preview .slot { flex: 1 1 150px; max-width: 260px; }
/* A card with no picture yet: its rules text where the picture would be. */
.lib-face { align-content: center; gap: 6px; padding: 10px; text-align: center; color: #fff; overflow: hidden; }
.lib-face p { font-family: var(--plain); font-size: clamp(0.6rem, 6.2cqw, 0.95rem); line-height: 1.25; text-transform: none; letter-spacing: 0; white-space: pre-wrap; overflow: hidden; }
.lib-face b { font-size: clamp(0.65rem, 7cqw, 1rem); }
.lib-face small { font-size: clamp(0.55rem, 5.5cqw, 0.8rem); opacity: 0.85; }
.lib-text { white-space: pre-wrap; font-family: var(--plain); text-transform: none; letter-spacing: 0; }
.lib-pack { cursor: default; gap: 6px; }
.lib-list { margin: 6px 0 0 18px; display: grid; gap: 2px; font-size: 0.9rem; text-transform: none; letter-spacing: 0; font-family: var(--plain); }
.lib-table { overflow-x: auto; margin-top: 8px; }
.lib-table table { border-collapse: collapse; font-size: 0.8rem; font-family: var(--plain); text-transform: none; letter-spacing: 0; }
.lib-table th, .lib-table td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }

/* Card packs in the lobby */
.pack-list { display: grid; gap: 6px; }
.pack-row { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 12px; padding: 8px 12px; }
.pack-row.is-off { opacity: 0.55; }
.pack-row .seat-name small { color: var(--muted); }
.row > select { width: auto; flex: 1 1 170px; }
.lib-flavor { font-style: italic; color: var(--muted); }

/* ---------------------------------------------------------------- the table (the game itself) */
.table { display: grid; gap: 12px; }
.table h2 { font-size: 0.95rem; margin: 0; display: flex; align-items: baseline; gap: 8px; }
.table h3, .sheet h3 { font-size: 0.85rem; margin: 6px 0 0; color: var(--muted); }
.table .panel { padding: 12px; gap: 10px; }
.small { font-size: 0.8rem; }
.rules { font-family: var(--plain); text-transform: none; letter-spacing: 0; white-space: pre-wrap; margin: 4px 0 0; line-height: 1.35; }
.prompt { position: sticky; top: calc(var(--rim) + 4px); z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 96%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.prompt.is-you { border-color: var(--go); box-shadow: 0 0 0 2px color-mix(in srgb, var(--go) 45%, transparent); }
.prompt p { margin: 0; flex: 1 1 200px; font-family: var(--plain); text-transform: none; letter-spacing: 0; }
.prompt-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.stack ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.stack li { padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border-left: 4px solid var(--line); }
.stack li.is-now { border-left-color: var(--go); }
.die { display: inline-grid; place-items: center; width: 30px; height: 30px; margin: 0 6px; border-radius: 7px; background: var(--paper); color: var(--dark-ink); font-family: var(--title); font-size: 1.1rem; vertical-align: middle; }
.die-tools { display: inline-flex; gap: 4px; vertical-align: middle; }
/* Small cards: a picture, or the card's name, numbers and the start of its text. */
.tc-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; align-items: stretch; }
.tc { appearance: none; position: relative; flex: none; width: 96px; aspect-ratio: 5 / 7; border-radius: 9px; border: 1px solid hsl(var(--hue, 205) 45% 55% / 0.7); padding: 6px; display: flex; flex-direction: column; gap: 3px; text-align: left; color: #fff; font: inherit; cursor: pointer; overflow: hidden; background: radial-gradient(120% 90% at 30% 15%, hsl(var(--hue, 205) 48% 34%), hsl(calc(var(--hue, 205) + 25) 45% 15%)); box-shadow: 0 2px 8px #0006; transition: transform 0.15s; }
.tc b { font-size: 0.72rem; line-height: 1.1; }
.tc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tc-stats { font-size: 0.68rem; font-family: var(--plain); white-space: nowrap; }
.tc-over { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 5px; background: #000a; }
.tc-text { font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 0.58rem; line-height: 1.2; opacity: 0.9; overflow: hidden; white-space: pre-wrap; flex: 1; }
.tc-marks { position: absolute; top: 3px; right: 3px; display: flex; gap: 2px; }
.tc-mark { background: var(--paper); color: var(--dark-ink); border-radius: 999px; padding: 0 5px; font-size: 0.65rem; font-family: var(--title); }
.tc.is-spent { transform: rotate(6deg) scale(0.94); filter: saturate(0.5) brightness(0.75); }
.tc.is-target { outline: 3px solid var(--danger); outline-offset: 1px; }
.tc.is-stacked { box-shadow: 4px 4px 0 #0008, 0 2px 8px #0006; }
.tc.is-soul { --hue: 265; }
.tc.is-curse { --hue: 300; }
.tc-back { cursor: default; background: repeating-linear-gradient(45deg, var(--panel-2) 0 6px, var(--panel) 6px 12px); border-color: var(--line); }
.tc-empty { cursor: default; background: none; border: 2px dashed var(--line); box-shadow: none; color: var(--muted); align-items: center; justify-content: center; font-size: 0.75rem; }
.deck-chip { appearance: none; flex: none; width: 96px; aspect-ratio: 5 / 7; border-radius: 9px; border: 2px solid hsl(var(--hue) 45% 55% / 0.6); background: repeating-linear-gradient(135deg, hsl(var(--hue) 35% 22%) 0 8px, hsl(var(--hue) 35% 18%) 8px 16px); color: #fff; font: inherit; cursor: pointer; display: grid; place-content: center; text-align: center; gap: 2px; padding: 4px; }
.deck-chip b { font-size: 1.3rem; }
.deck-chip span { font-size: 0.68rem; }
.deck-chip small { font-size: 0.6rem; opacity: 0.8; font-family: var(--plain); text-transform: none; letter-spacing: 0; }
.seats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.seat.is-turn { border-color: var(--go); }
.seat.is-dead { opacity: 0.7; }
.seat-head { appearance: none; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left; flex-wrap: wrap; }
.seat-who { display: grid; flex: 1 1 110px; min-width: 0; }
.seat-who small { color: var(--muted); font-family: var(--plain); text-transform: none; letter-spacing: 0; }
.seat-nums { display: flex; gap: 6px; flex-wrap: wrap; font-family: var(--plain); font-size: 0.85rem; }
.seat-nums span { background: var(--panel-2); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.log ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--muted); }
.log li:first-child { color: var(--ink); }
/* A sheet slides up over the table: one card, one player, one deck, or the tools. */
.sheet-shade { position: fixed; inset: 0; background: #0009; z-index: 20; }
.sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 86dvh; overflow-y: auto; margin: 0 auto; max-width: 560px; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; display: grid; gap: 10px; box-shadow: 0 -10px 40px #000a; }
.sheet h2 { margin: 0; padding-right: 70px; }
.sheet-x { position: absolute; top: 12px; right: 12px; }
.sheet-card { border-left: 5px solid hsl(var(--hue) 50% 55%); padding-left: 12px; display: grid; gap: 6px; }
.sheet-card p { margin: 0; }
.sheet-pic { max-height: 46dvh; max-width: 100%; border-radius: 12px; justify-self: center; }
.sheet-stats { font-family: var(--plain); text-transform: none; letter-spacing: 0; margin: 0; }
.sheet-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.byhand { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }
.byhand h3 { margin: 0; }
.pm { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pm > span { flex: 1 1 110px; font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.pm select, .sheet input[type='search'] { font: inherit; font-family: var(--plain); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; flex: 1 1 120px; }
.pm .pm { flex: 1 1 100%; }
.give-hit { appearance: none; display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; cursor: pointer; }
.give-hit small { color: var(--muted); font-family: var(--plain); text-transform: none; letter-spacing: 0; }
/* The TV: no buttons, bigger cards, two columns when there's room. */
.table-tv .tc, .table-tv .deck-chip { width: clamp(96px, 8vw, 150px); }
.party-table .table { width: 100%; text-align: left; }
@media (min-width: 900px) {
  .tc, .deck-chip { width: 116px; }
  .tc b { font-size: 0.8rem; }
  .tc-text { font-size: 0.66rem; }
}
@media (min-width: 1200px) {
  .table-tv { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .table-tv > .prompt, .table-tv > .stack, .table-tv > .log { grid-column: 1 / -1; }
  .table-tv > .seats { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- the table as one mat with a camera */
body.at-table { overflow: hidden; overscroll-behavior: none; }
.tt { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; background: radial-gradient(120% 90% at 50% 35%, #2b211c, #0c0908 75%); color: var(--ink); }
.tt-top { flex: none; display: grid; gap: 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; z-index: 2; }
.tt-top .prompt { position: static; padding: 8px 10px; }
.ticker { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-family: var(--plain); font-size: 0.8rem; text-transform: none; letter-spacing: 0; text-align: left; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ticker span { color: var(--go); margin-right: 8px; font-family: var(--title); }
.tt-view { flex: 1; min-height: 0; position: relative; overflow: hidden; perspective: 1300px; perspective-origin: 50% 40%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.tt-view:active { cursor: grabbing; }
.tt-tilt { position: absolute; inset: 0; transform-origin: 50% 55%; transition: transform 0.3s; }
.tt-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; border-radius: 34px; border: 16px solid #1d130d; box-sizing: content-box; margin: -16px; box-shadow: 0 30px 0 #0d0806, 0 60px 90px #000c; background-size: cover; background-position: center; }
/* The mats that come with the site. An uploaded picture replaces the background and keeps the zones. */
.mat-wood { background-color: #7a5433; background-image: repeating-linear-gradient(90deg, #0000 0 318px, #0003 318px 322px), repeating-linear-gradient(0deg, #0000 0 158px, #00000040 158px 161px), repeating-linear-gradient(3deg, #ffffff07 0 6px, #0000 6px 19px), linear-gradient(180deg, #8a6039, #6b4829); }
.mat-felt { background-color: #1f5c3d; background-image: radial-gradient(90% 80% at 50% 45%, #2f7a52, #153f2a), repeating-linear-gradient(45deg, #ffffff05 0 3px, #0000 3px 7px); background-blend-mode: normal; }
.mat-basement { background-color: #3d302a; background-image: repeating-linear-gradient(90deg, #0000 0 236px, #0005 236px 240px), repeating-linear-gradient(0deg, #0000 0 236px, #0005 236px 240px), radial-gradient(100% 90% at 50% 40%, #54423a, #2a201c); }
.mat-slate { background-color: #2a2f36; background-image: radial-gradient(100% 90% at 50% 40%, #3a414b, #1d2126), repeating-linear-gradient(120deg, #ffffff05 0 2px, #0000 2px 11px); }
.mat-void { background: #0b0b0d; }
.zone { position: absolute; box-sizing: border-box; border: 4px solid hsl(var(--zh) 65% 62% / 0.6); border-radius: 22px; background: hsl(var(--zh) 45% 14% / 0.38); padding: 44px 16px 14px; }
.zone > h3 { position: absolute; left: 18px; top: 8px; margin: 0; font-size: 22px; color: hsl(var(--zh) 80% 82%); text-shadow: 0 2px 4px #000a; }
.zone.is-hot { box-shadow: 0 0 0 6px hsl(var(--zh) 80% 60% / 0.35), 0 0 60px hsl(var(--zh) 80% 55% / 0.4); }
.no-lines .zone { border-color: transparent; background: none; }
.zone-cards { display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; align-items: flex-start; }
.zone-note { margin: 60px 0 0; font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 22px; color: #fff9; }
.tt-world .tc, .tt-world .deck-chip { width: 120px; }
.tt-world .tc b { font-size: 14px; }
.tt-world .tc-stats { font-size: 13px; }
.tt-world .tc-text { font-size: 10.5px; }
.tt-world .tc-empty { font-size: 15px; text-align: center; color: #fff8; border-color: #fff5; }
.tt-world .deck-chip b { font-size: 34px; }
.tt-world .deck-chip span { font-size: 13px; }
.tc.is-discard { filter: brightness(0.8); }
.tc.is-now { outline: 5px solid var(--go); outline-offset: 2px; }
.tc-token { align-items: center; text-align: center; }
.die-big { width: 62px; height: 62px; font-size: 40px; border-radius: 12px; margin: 14px auto; }
.stack-arrow { align-self: center; font-size: 46px; color: #fff8; margin: 0 -4px; }
.zone-player { padding-top: 96px; }
.zone-player.is-turn { border-color: var(--go); box-shadow: 0 0 0 6px color-mix(in srgb, var(--go) 40%, transparent), 0 0 70px color-mix(in srgb, var(--go) 45%, transparent); }
.zone-player.is-asked { border-style: dashed; }
.zone-player.is-dead { filter: grayscale(0.7) brightness(0.8); }
.plate { appearance: none; position: absolute; left: 12px; right: 12px; top: 10px; height: 76px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: 14px; background: hsl(var(--zh) 45% 12% / 0.75); color: #fff; font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.plate .thumb { width: 46px; height: 64px; }
.plate-who { display: grid; flex: 1; min-width: 0; }
.plate-who b { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-who small { font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 15px; color: #fffb; white-space: nowrap; }
.tok { flex: none; background: #000a; border: 2px solid #fff3; border-radius: 999px; padding: 4px 12px; font-family: var(--plain); font-size: 22px; white-space: nowrap; }
.tok-hp { color: #ff6b81; }
.tok-hp i { font-style: normal; opacity: 0.3; }
.tok-coin { color: #ffd76a; }
/* What never pans away: your numbers, your hand, and where to look. */
.tt-dock { flex: none; display: grid; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 96%, #000); border-top: 1px solid var(--line); z-index: 2; }
.dock-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dock-row .tok { font-size: 0.9rem; padding: 2px 9px; border-width: 1px; }
.dock-note { flex: 1; min-width: 0; color: var(--muted); font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 0.85rem; text-align: right; }
.dock-hand .tc { width: 84px; }
.dock-hand { min-height: 40px; align-items: center; }
.jumps { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.jumps .chip { flex: none; }
.tt-tv .tt-dock { background: none; border: 0; padding-top: 0; justify-items: center; }
.tt-tv .tt-top { max-width: 1200px; width: 100%; margin: 0 auto; }
.sheet ul.log, .sheet ol.stack { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sheet ul.log { font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.sheet input[type='range'] { flex: 2 1 160px; accent-color: var(--go); }
.sheet input[type='file'] { font: inherit; font-family: var(--plain); color: var(--ink); max-width: 100%; }
@media (min-width: 900px) {
  .tt-top { grid-template-columns: 1fr; max-width: 1100px; width: 100%; margin: 0 auto; }
  .tt-dock { justify-items: center; }
  .dock-hand .tc { width: 104px; }
  .dock-row, .dock-hand, .jumps { max-width: 1100px; width: 100%; }
}
.jumps .chip { text-decoration: none; color: var(--ink); background: var(--panel-2); min-height: 34px; padding: 5px 12px; white-space: nowrap; }
.zone-link { appearance: none; position: absolute; right: 16px; bottom: 8px; border: 0; background: none; color: #fffc; font: inherit; font-size: 17px; text-decoration: underline; cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { appearance: none; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #0006; background: hsl(var(--zh) 65% 55%); cursor: pointer; padding: 0; flex: none; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px hsl(var(--zh) 65% 55%); }
.swatch-dot { width: 14px; height: 14px; border-width: 2px; cursor: default; display: inline-block; }
.deck-chip.has-back { background-size: cover; background-position: center; align-content: end; padding: 0; overflow: hidden; }
.deck-chip.has-back b, .deck-chip.has-back span { background: #000b; padding: 1px 4px; }
/* Decks and slots sit in the middle of their zone and shift as slots are added. Players' cards still start at the left. */
.zone:not(.zone-player) > .zone-cards { justify-content: center; }
.zone:not(.zone-player) > .zone-cards > .zone-note { margin-top: 60px; text-align: center; }
.side { font-style: normal; font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 15px; margin-left: 10px; padding: 2px 10px; border-radius: 999px; background: var(--paper); color: var(--dark-ink); vertical-align: middle; }
.turn-arrow { position: absolute; z-index: 2; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; line-height: 1; color: #fff; background: #000b; border: 3px solid #fff5; pointer-events: none; }
.turn-arrow.is-next { background: var(--go); color: var(--go-ink); border-color: #fff; }
/* Rooms are landscape. The room in play lies under the room deck and its discard pile. */
.tt-world .tc.is-wide { width: 168px; aspect-ratio: 7 / 5; }
.zone-break { flex-basis: 100%; height: 0; }
/* Bonus souls: three in a row, or in 4 bonus souls mode two over two. */
.souls-3 > .zone-cards { height: 100%; align-content: center; padding-bottom: 30px; box-sizing: border-box; }
.souls-4 > .zone-cards { width: 252px; margin: 0 auto; }
/* Tokens: a figure standing on the top edge of a zone, over the middle of its cards. */
.token { position: absolute; z-index: 2; transform: translateX(-50%); object-fit: contain; pointer-events: none; filter: drop-shadow(0 8px 6px #000a); }
.token-empty { display: grid; place-items: center; align-content: center; border-radius: 50%; border: 4px dashed #fff8; background: #0009; filter: none; }
.token-empty i { font-style: normal; font-size: 56px; line-height: 1; }
.token-empty small { font-family: var(--plain); text-transform: none; letter-spacing: 0; font-size: 14px; color: #fffc; }
.no-lines .token-empty { display: none; }
/* With the outlines off (a painted mat shows the zones itself), their names go too. Empty slots and turn arrows stay. */
.no-lines .zone > h3 { display: none; }
.aim-list { display: grid; gap: 2px; }
.btn-wide { flex: 1 1 100%; text-align: left; white-space: normal; text-transform: none; font-family: var(--plain); letter-spacing: 0; }
.zone-player.is-target { outline: 6px solid var(--danger); outline-offset: 2px; }
