/* 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. */
html::before { content: ''; position: fixed; inset: 0; z-index: -4; 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: -3; 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: -2; 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: -1; 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; }
.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); }

.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; }
}
