/* Infinite Uno. One stylesheet for the landing page, the party view (TV) and the player view (phone). */

/* Fonts ship with the game (SIL Open Font License, see fonts/OFL-LICENSES.txt), so it works on a LAN with no internet. */
@font-face { font-family: 'Bricolage Grotesque'; src: url('/infuno/client/fonts/bricolage-grotesque.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/infuno/client/fonts/pixelify-sans-600.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/infuno/client/fonts/pixelify-sans-700.woff2') format('woff2'); font-weight: 700 800; font-display: swap; }
/* Pixel-font digits are hard to read (an 8 looks like a B, a 1 like a 7), so the display font takes its numbers from Bricolage. */
@font-face { font-family: 'Infuno Digits'; src: url('/infuno/client/fonts/bricolage-grotesque.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0030-0039, U+0024, U+0025, U+002B, U+2212; }

:root {
  --table: #1e1b3a;
  --table-2: #29254f;
  --table-3: #363068;
  --line: #4a4485;
  --ink: #f3f1ff;
  --muted: #aaa5d8;
  --paper: #fffdf7;
  --dark-ink: #1c1a2e;

  --red: #e8363c;
  --yellow: #f5c518;
  --green: #22a04a;
  --blue: #1f6fd1;
  --black: #2b2935;
  --white: #f4f1e8;
  --purple: #8a4fd8;
  --orange: #f07c1e;
  --pink: #f06fb0;
  --gray: #8e93a0;
  --brown: #8a5a33;
  --none: #c4c0d6;

  --focus: var(--yellow);
  --nope: #ff4fa3;
  --good: #3ddc84;

  --font: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  background: var(--table);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--table-3);
  color: var(--ink);
  padding: 0.7em 1.2em;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 80ms ease;
  white-space: nowrap;
  touch-action: manipulation;
}
a.btn, label.btn { display: inline-block; text-decoration: none; text-align: center; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-go { background: var(--yellow); color: var(--dark-ink); }
.btn-nope { background: var(--nope); color: #fff; }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn-big { font-size: 1.25em; padding: 0.8em 1.6em; }
.btn small { font-weight: 600; opacity: 0.75; margin-left: 0.3em; }

input[type='text'] {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--table-2);
  border-radius: 12px;
  padding: 0.75em 0.9em;
  font-size: 1.1em;
}
input[type='text']:focus { border-color: var(--focus); outline: none; }

/* ---------------------------------------------------------------- cards */

.card {
  --w: 84px;
  --fill: var(--none);
  --on-fill: var(--dark-ink);
  --window-ink: var(--fill);
  position: relative;
  flex: none;
  width: var(--w);
  aspect-ratio: 5 / 7;
  border-radius: calc(var(--w) * 0.1);
  background: var(--fill);
  color: var(--on-fill);
  font-size: calc(var(--w) * 0.125);
  padding: 0.45em 0.5em 0.5em;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), inset 0 0 0 0.22em rgba(255, 255, 255, 0.85);
  overflow: hidden;
  user-select: none;
  transition: transform 120ms ease, opacity 120ms ease;
}
.card.c-red { --fill: var(--red); --on-fill: #fff; }
.card.c-yellow { --fill: var(--yellow); --on-fill: var(--dark-ink); }
.card.c-green { --fill: var(--green); --on-fill: #fff; }
.card.c-blue { --fill: var(--blue); --on-fill: #fff; }
.card.c-black { --fill: var(--black); --on-fill: #fff; --window-ink: var(--black); }
.card.c-custom { --fill: var(--card-ink); --on-fill: #fff; }
.card.c-none {
  --fill: var(--none);
  --window-ink: #5d5875;
  background: repeating-linear-gradient(135deg, #cfcbe0 0 6px, #bdb8d0 6px 12px);
}
.card.c-wild {
  --on-fill: #fff;
  --window-ink: var(--dark-ink);
  background: conic-gradient(from 45deg, var(--red) 0 25%, var(--yellow) 0 50%, var(--green) 0 75%, var(--blue) 0);
}
.card.c-wild .card-name, .card.c-wild .card-kind { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }

.card-corner { font-weight: 800; font-size: 1.05em; line-height: 1; }
.card-glyph {
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 88%;
  aspect-ratio: 1.15;
  border-radius: 50%;
  background: var(--paper);
  color: var(--window-ink);
  font-weight: 800;
  font-size: 2.7em;
  line-height: 1;
  transform: rotate(-8deg);
  letter-spacing: -0.04em;
}
.card-glyph.is-long { font-size: 1.7em; }
/* Long numbers in groups of four, stacked (a credit card's 16 digits) */
.card-glyph.is-huge { font-size: 1.15em; display: grid; align-content: center; justify-items: center; gap: 0.05em; letter-spacing: 0.02em; line-height: 1; }
.card-glyph.is-huge.is-many { font-size: 0.95em; }
.card-name {
  font-weight: 800;
  font-size: 0.95em;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-kind { font-size: 0.78em; font-weight: 600; opacity: 0.85; line-height: 1.1; margin-top: 0.15em; }
.card-types::before { content: ' / '; opacity: 0.6; }
.card-order, .card-tag {
  position: absolute;
  top: -0.1em;
  right: -0.1em;
  min-width: 1.9em;
  height: 1.9em;
  border-radius: 0 0 0 0.9em;
  background: var(--focus);
  color: var(--dark-ink);
  font-weight: 800;
  display: grid;
  place-items: center;
}
.card-tag { padding: 0 0.45em; font-size: 0.9em; }

.card.size-xs { --w: 40px; grid-template-rows: 1fr; padding: 0.3em; }
.card.size-xs .card-corner, .card.size-xs .card-name, .card.size-xs .card-kind { display: none; }
.card.size-xs .card-glyph { font-size: 2.2em; }
.card.size-sm { --w: 62px; }
.card.size-sm .card-kind { display: none; }
.card.size-md { --w: 88px; }
.card.size-lg { --w: 150px; }
.card.size-xl { --w: min(26vh, 300px); }

.card.is-dim { opacity: 0.6; filter: saturate(0.45) brightness(0.85); }
.card.is-playable { box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), inset 0 0 0 0.22em rgba(255, 255, 255, 0.85), 0 0 0 3px rgba(255, 255, 255, 0.55); }
.card.is-selected {
  transform: translateY(-14%) rotate(-2deg);
  box-shadow: 0 0.4em 0.6em rgba(0, 0, 0, 0.45), inset 0 0 0 0.22em rgba(255, 255, 255, 0.85), 0 0 0 4px var(--focus);
}

.card-back {
  background: repeating-linear-gradient(45deg, #3c3576 0 8px, #322c66 8px 16px);
  box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), inset 0 0 0 0.22em #6c64b8;
  display: grid;
  place-items: center;
  color: #8f87dc;
  font-weight: 800;
  font-size: calc(var(--w) * 0.5);
}

/* ---------------------------------------------------------------- familiars on the board */

.fam {
  --fill: var(--none);
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 0.1em 0.5em;
  align-items: center;
  padding: 0.35em 0.6em 0.4em;
  border-radius: 10px;
  background: var(--table-3);
  border-left: 6px solid var(--fill);
  font-size: 0.85em;
  position: relative;
}
.fam.c-red { --fill: var(--red); } .fam.c-yellow { --fill: var(--yellow); } .fam.c-green { --fill: var(--green); }
.fam.c-blue { --fill: var(--blue); } .fam.c-black { --fill: #6e6a80; } .fam.c-wild { --fill: var(--nope); }
.fam-name { font-weight: 800; grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11em; }
.fam-slots { display: flex; gap: 3px; }
.slot { width: 1.5em; height: 1.5em; border-radius: 5px; border: 2px dashed var(--line); display: grid; place-items: center; font-weight: 800; }
.slot.is-full { border: 0; background: var(--paper); color: var(--dark-ink); }
.fam-atk { font-weight: 700; color: var(--muted); white-space: nowrap; }
.fam.is-shield .fam-atk { color: var(--good); }
.fam.is-selectable { cursor: pointer; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4); }
.fam.is-picked { box-shadow: 0 0 0 3px var(--focus); }
.fam .card-order { font-size: 0.9em; border-radius: 0 10px 0 10px; }

/* ---------------------------------------------------------------- stats */

.stat { display: inline-flex; align-items: center; gap: 0.25em; font-weight: 700; white-space: nowrap; }
.stat-charge::before { content: '⚡'; }
.stat-gold::before { content: ''; width: 0.8em; height: 0.8em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe27a, #d9a400); display: inline-block; }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 0.65em; height: 0.65em; border-radius: 50%; background: var(--line); }
.pip.is-on { background: #3d8bff; box-shadow: 0 0 6px rgba(61, 139, 255, 0.75); }
/* Mana shapes: spell mana blue circles, combat mana red squares (after a small gap), Lord mana purple diamonds */
.pips-combat { display: inline-flex; gap: 3px; margin-left: 4px; }
.pip.pip-combat.is-on { background: var(--red); box-shadow: 0 0 6px rgba(229, 57, 53, 0.7); border-radius: 2px; }

.uno-badge { background: var(--yellow); color: var(--dark-ink); border-radius: 999px; padding: 0.05em 0.55em; font-weight: 800; font-size: 0.85em; }
.uno-badge.is-open { background: var(--nope); color: #fff; animation: throb 0.9s ease-in-out infinite; }
@keyframes throb { 50% { transform: scale(1.12); } }

/* ---------------------------------------------------------------- big moments */

.splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 50;
  font-weight: 800;
  font-size: clamp(56px, 16vw, 260px);
  letter-spacing: -0.04em;
  color: #fff;
  -webkit-text-stroke: 0.035em var(--dark-ink);
  paint-order: stroke fill;
  text-shadow: 0 0.06em 0 var(--dark-ink);
  opacity: 0;
  text-align: center;
  line-height: 0.95;
  padding: 0 4vw;
}
.splash.tone-nope { color: var(--nope); }
.splash.tone-uno { color: var(--yellow); }
.splash.tone-caught { color: var(--red); }
.splash.tone-win { color: var(--yellow); }
.splash.tone-hit { color: #fff; }
.splash.tone-turn { color: #8fd3ff; }
.splash.tone-vote { color: var(--good); }
.splash.is-on { animation: slam 1.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes slam {
  0% { opacity: 0; transform: scale(2.4) rotate(-6deg); }
  14% { opacity: 1; transform: scale(1) rotate(-4deg); }
  78% { opacity: 1; transform: scale(1.04) rotate(-4deg); }
  100% { opacity: 0; transform: scale(1.1) rotate(-4deg); }
}

.countdown { height: 10px; border-radius: 999px; background: var(--table-3); overflow: hidden; }
.countdown > i { display: block; height: 100%; background: var(--nope); width: 100%; transform-origin: left; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--dark-ink);
  padding: 0.7em 1.1em;
  border-radius: 12px;
  font-weight: 700;
  z-index: 60;
  max-width: min(92vw, 520px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.offline {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--red);
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 0.3em;
  z-index: 70;
}

@media (prefers-reduced-motion: reduce) {
  .splash.is-on { animation: fade 1.6s both; }
  @keyframes fade { 0%, 100% { opacity: 0; } 15%, 80% { opacity: 1; } }
  .uno-badge.is-open { animation: none; }
  .card, .btn { transition: none; }
}

/* ================================================================ landing page */

.landing { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.landing-inner { width: min(100%, 440px); display: grid; gap: 28px; }
.logo { font-size: clamp(44px, 12vw, 72px); line-height: 0.9; letter-spacing: -0.04em; }
.logo span { display: block; color: var(--yellow); transform: rotate(-3deg); transform-origin: left; }
.landing-fan { display: flex; justify-content: center; height: 120px; margin-bottom: -12px; }
.landing-fan .card { margin: 0 -20px; }
.landing-fan .card:nth-child(1) { transform: rotate(-16deg) translateY(14px); }
.landing-fan .card:nth-child(2) { transform: rotate(-6deg); }
.landing-fan .card:nth-child(3) { transform: rotate(5deg); }
.landing-fan .card:nth-child(4) { transform: rotate(15deg) translateY(14px); }
.panel { background: var(--table-2); border-radius: 20px; padding: 20px; display: grid; gap: 12px; }
.panel h2 { font-size: 1.3em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 800; text-align: center; }
.error { color: #ff9aa2; font-weight: 700; min-height: 1.4em; }

/* ================================================================ party view (TV) */

.party { height: 100%; overflow: hidden; display: grid; grid-template-columns: minmax(280px, 25vw) 1fr minmax(280px, 25vw); gap: 2vw; padding: 2.2vh 2vw; font-size: clamp(15px, 1.25vw, 26px); }
.party-col { display: flex; flex-direction: column; gap: 2vh; min-height: 0; }

.seat { background: var(--table-2); border-radius: var(--radius); padding: 0.7em 0.9em; display: grid; gap: 0.45em; position: relative; }
.seat.is-turn { background: var(--table-3); box-shadow: inset 6px 0 0 var(--focus); }
.seat.is-turn .seat-name::after { content: 'Their turn'; margin-left: 0.6em; font-size: 0.7em; font-weight: 700; color: var(--dark-ink); background: var(--focus); padding: 0.1em 0.5em; border-radius: 999px; vertical-align: middle; }
.seat-top { display: flex; align-items: center; gap: 0.6em; }
.seat-name { font-size: 1.25em; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-hand { display: flex; align-items: center; gap: 0.5em; }
.seat-fan { display: flex; }
.seat-fan .card { margin-right: -26px; }
.seat-count { font-weight: 800; font-size: 1.3em; margin-left: 30px; }
.seat-stats { display: flex; gap: 1em; align-items: center; color: var(--muted); flex-wrap: wrap; }
.seat-fams { display: flex; flex-wrap: wrap; gap: 0.4em; }
.seat-lord { font-size: 0.85em; color: var(--yellow); font-weight: 700; }
.seat.is-off { opacity: 0.5; }

.party-center { display: grid; grid-template-rows: auto 1fr auto; gap: 2vh; min-height: 0; }
.status-line { text-align: center; font-size: 1.6em; font-weight: 800; }
.status-line .dir { color: var(--muted); font-weight: 700; font-size: 0.7em; margin-left: 0.4em; }
.pile-area { display: flex; align-items: center; justify-content: center; gap: 5vw; min-height: 0; }
.pile { position: relative; display: grid; place-items: center; }
.pile .card { grid-area: 1 / 1; }
.pile-under-1 { transform: rotate(9deg) translate(6%, 2%); opacity: 0.9; }
.pile-under-2 { transform: rotate(-11deg) translate(-7%, 3%); opacity: 0.8; }
.pile-top { transform: rotate(-3deg); }
.pile-top.is-new { animation: drop 380ms cubic-bezier(0.2, 1.3, 0.5, 1); }
@keyframes drop { from { transform: translateY(-30%) rotate(-14deg) scale(1.15); } }
.pile-label { text-align: center; margin-top: 4vh; color: var(--muted); font-weight: 700; }
.draw-pile .card { --w: min(16vh, 180px); }
.window-box { display: grid; gap: 0.6em; text-align: center; font-weight: 800; font-size: 1.4em; }

.scene { background: var(--table-2); border-radius: var(--radius); padding: 0.9em 1em; display: grid; gap: 0.5em; }
.scene-row { display: grid; grid-template-columns: 6.5em 1fr; gap: 0.6em; align-items: baseline; }
.scene-row b { color: var(--muted); font-weight: 700; }
.scene-row span { font-weight: 800; }
.scene-prompt { font-size: 1.15em; font-weight: 800; line-height: 1.2; }
.scene-answer { color: var(--yellow); font-weight: 800; }
.shop-box { background: var(--table-2); border-radius: var(--radius); padding: 0.9em 1em; display: grid; gap: 0.6em; }
.shop-cards { display: flex; gap: 0.8em; align-items: flex-end; }
.party .shop-cards .card { --w: clamp(62px, 5.5vw, 120px); }
.party .seat-fan .card { --w: clamp(28px, 2vw, 44px); }
.feed { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.35em; color: var(--muted); font-size: 0.9em; -webkit-mask-image: linear-gradient(transparent, #000 35%); mask-image: linear-gradient(transparent, #000 35%); }
.feed p { margin: 0; }
.feed p:last-child { color: var(--ink); font-weight: 700; }

/* Lobby on the TV */
.party-lobby { height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; gap: 5vw; padding: 6vh 6vw; align-items: center; font-size: clamp(16px, 1.4vw, 28px); }
.join-code { font-size: clamp(80px, 13vw, 240px); font-weight: 800; letter-spacing: 0.06em; line-height: 0.9; color: var(--yellow); }
.join-how { font-size: 1.3em; font-weight: 700; }
.join-url { font-size: 1.1em; color: var(--muted); word-break: break-all; }
.join-qr { background: #fff; border-radius: 16px; padding: 12px; width: min(30vh, 280px); }
.join-qr svg { display: block; width: 100%; height: auto; }
.lobby-seats { display: grid; gap: 0.6em; }
.lobby-seat { display: flex; align-items: center; gap: 0.7em; background: var(--table-2); border-radius: 12px; padding: 0.6em 0.9em; font-weight: 800; font-size: 1.2em; }
.lobby-seat .tag { font-size: 0.65em; color: var(--dark-ink); background: var(--yellow); border-radius: 999px; padding: 0.1em 0.6em; }
.lobby-seat .tag.is-bot { background: var(--muted); }
.lobby-seat .x { margin-left: auto; }
.dot { width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--good); flex: none; }
.dot.is-off { background: var(--line); }
.host-controls { display: grid; gap: 0.8em; margin-top: 1em; }
.deck-pick { display: grid; gap: 0.5em; }
.deck-opt { text-align: left; border-radius: 12px; padding: 0.6em 0.9em; background: var(--table-2); border: 2px solid transparent; cursor: pointer; }
.deck-opt.is-on { border-color: var(--yellow); }
.deck-opt b { display: block; }
.deck-opt span { color: var(--muted); font-size: 0.85em; }

/* Overlays on the TV */
.overlay { position: fixed; inset: 0; background: rgba(20, 17, 44, 0.86); display: grid; place-items: center; z-index: 40; padding: 5vw; text-align: center; }
.overlay-inner { display: grid; gap: 3vh; justify-items: center; max-width: 1100px; }
.vote-prompt { font-size: clamp(28px, 3.4vw, 60px); font-weight: 800; line-height: 1.1; }
.vote-answer { font-size: clamp(32px, 4.4vw, 80px); font-weight: 800; color: var(--yellow); line-height: 1.05; transform: rotate(-2deg); }
.winner-name { font-size: clamp(60px, 10vw, 180px); font-weight: 800; color: var(--yellow); line-height: 0.9; }

/* Steam Deck and other small "TVs": tighten up */
@media (max-width: 1100px) {
  .party { grid-template-columns: 30vw 1fr; grid-template-rows: 1fr auto; }
  .party-right { grid-column: 1 / -1; flex-direction: row; }
  .party-right > * { flex: 1; }
  .feed { display: none; }
}

/* ================================================================ player view (phone) */

.play { min-height: 100%; display: flex; flex-direction: column; }
.play-top { position: sticky; top: 0; z-index: 10; background: var(--table); padding: 10px 12px 8px; display: grid; gap: 8px; border-bottom: 1px solid var(--table-3); }
.opps { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.opp { flex: none; background: var(--table-2); border-radius: 12px; padding: 0.35em 0.7em; display: flex; gap: 0.5em; align-items: center; font-weight: 700; font-size: 0.9em; }
.opp.is-turn { box-shadow: inset 0 -3px 0 var(--focus); background: var(--table-3); }
.opp-count { font-weight: 800; }
.mebar { display: flex; align-items: center; gap: 12px; }
.mebar .card { --w: 52px; }
.me-status { flex: 1; min-width: 0; }
.me-turn { font-weight: 800; font-size: 1.15em; line-height: 1.15; }
.me-turn.is-mine { color: var(--yellow); }
.me-sub { color: var(--muted); font-size: 0.85em; }
.me-stats { display: flex; gap: 10px; }

.play-mid { padding: 10px 12px 0; display: grid; gap: 10px; }
.my-fams { display: flex; gap: 6px; flex-wrap: wrap; }
.banner { border-radius: 14px; padding: 12px; background: var(--table-2); display: grid; gap: 8px; font-weight: 700; }
.banner.is-alert { background: #46204a; box-shadow: inset 0 0 0 2px var(--nope); }
.peek { display: flex; gap: 6px; align-items: center; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px; min-height: 64px; align-items: center; }
.actions .hint { color: var(--muted); font-weight: 600; font-size: 0.95em; }

.hand { flex: 1; padding: 22px 12px calc(110px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 16px 8px; align-content: start; justify-items: center; }
.hand .card { --w: min(calc((100vw - 48px) / 4), 116px); cursor: pointer; }

.uno-dock { position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; z-index: 20; }
.btn-uno { background: var(--yellow); color: var(--dark-ink); font-size: 1.5em; font-weight: 800; padding: 0.55em 1.1em; transform: rotate(-4deg); }
.btn-catch { background: var(--nope); color: #fff; font-size: 1.1em; }

/* Bottom sheets: pickers for targets, feeding, the shop, blocking, voting */
.sheet-back { position: fixed; inset: 0; background: rgba(15, 12, 34, 0.6); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--table-2); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto; display: grid; gap: 14px; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.45); animation: up 180ms ease-out; }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.sheet h3 { font-size: 1.25em; }
.sheet .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet .opt { border-radius: 12px; padding: 0.6em 0.9em; background: var(--table-3); border: 2px solid transparent; font-weight: 700; cursor: pointer; }
.sheet .opt.is-on { border-color: var(--yellow); }
.sheet .opt:disabled { opacity: 0.4; }
.sheet .cards-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet .foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: -18px; background: var(--table-2); padding: 8px 0 0; }
.digit-chip { width: 2.6em; height: 2.6em; border-radius: 10px; background: var(--table-3); font-weight: 800; font-size: 1.1em; border: 2px solid transparent; cursor: pointer; }
.digit-chip.is-on { background: var(--paper); color: var(--dark-ink); border-color: var(--yellow); }

.join-box { padding: 24px 16px; display: grid; gap: 14px; max-width: 440px; margin: 0 auto; width: 100%; }
.lobby-me { padding: 20px 16px; display: grid; gap: 16px; max-width: 520px; margin: 0 auto; width: 100%; }
.lobby-me .big { font-size: 2em; font-weight: 800; }

/* The ticker: the last thing that happened, and the button that opens the table. */
.ticker { appearance: none; border: 0; background: var(--table-2); border-radius: 10px; padding: 0.45em 0.5em 0.45em 0.8em; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer; }
.ticker-line { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 600; font-size: 0.9em; }
.ticker-btn { flex: none; background: var(--table-3); border-radius: 999px; padding: 0.2em 0.8em; font-weight: 800; font-size: 0.85em; }
.me-top { display: grid; justify-items: center; gap: 2px; }
.me-top .card { --w: 64px; }
.me-dir { font-size: 0.72em; color: var(--muted); font-weight: 700; white-space: nowrap; }

/* The table: other players, the scene, the shop, the log. Behind a button on phones, always visible on wide screens. */
.play-table { display: none; padding: 10px 12px 0; }
.play-table.is-open { display: block; }
.tbl { display: grid; gap: 10px; }
.tbl-pile { display: none; }
.tbl-seats { display: grid; gap: 8px; }
.tbl .seat { padding: 0.6em 0.8em; gap: 0.35em; }
.tbl .seat-name { font-size: 1.05em; }
.tbl .seat-count { margin-left: auto; font-size: 0.95em; font-weight: 800; }
.tbl .seat.is-turn .seat-name::after { content: none; }
.tbl-side { display: grid; gap: 10px; }
.tbl .shop-cards .card { --w: 56px; }
.tbl-log { display: grid; gap: 2px; font-size: 0.85em; color: var(--muted); }
.tbl-log p { margin: 0; }
.tbl-log p:last-child { color: var(--ink); font-weight: 700; }

/* Phone lobby: the invite */
.invite { display: flex; gap: 16px; align-items: center; background: var(--table-2); border-radius: 18px; padding: 14px; }
.invite .join-qr { width: 128px; flex: none; padding: 8px; border-radius: 12px; }
.invite-code { font-size: 3em; font-weight: 800; letter-spacing: 0.06em; color: var(--yellow); line-height: 1; }
.invite-url { font-size: 0.8em; word-break: break-all; margin-top: 4px; }

/* A wide screen (PC, Steam Deck) playing without a TV: show the table above the hand, always. */
@media (min-width: 900px) {
  .play-table, .play-table.is-open { display: block; padding: 16px 24px 0; }
  .ticker-btn { display: none; }
  .ticker { cursor: default; }
  .me-top { display: none; }
  .tbl { grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: start; }
  .tbl-pile { display: flex; gap: 16px; align-items: center; justify-content: center; align-self: center; }
  .tbl-log { display: none; }
  .hand { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); padding-left: 24px; padding-right: 24px; }
  .hand .card { --w: 120px; }
  .play-top, .play-mid, .actions { padding-left: 24px; padding-right: 24px; }
}

/* ================================================================ the table (Tabletop Simulator camera, Balatro juice)
   Every texture and color here is a theme token, so tables, felts and card backs can be swapped later. */

.theme-classic {
  --wall-a: #3b1730;
  --wall-b: #0f2f3a;
  --wall-c: #1d1036;
  --wood-base: #6e3f1f;
  --wood-light: #9c6332;
  --wood-dark: #3f220e;
  --felt-light: #2f9157;
  --felt-dark: #145332;
  --chip: #d8343c;
  --font-display: 'Infuno Digits', 'Pixelify Sans', 'Bricolage Grotesque', system-ui, sans-serif;
}

.room {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--wall-c);
}
/* A slow psychedelic swirl behind everything, like a card table in a dream. */
.room::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 18%, rgba(0, 0, 0, 0.35) 60%),
    conic-gradient(from 0deg at 50% 50%, var(--wall-a), var(--wall-b), var(--wall-c), var(--wall-a), var(--wall-b), var(--wall-c), var(--wall-a));
  filter: blur(40px) saturate(1.2);
  animation: swirl 60s linear infinite;
}
.room::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.55));
}
@keyframes swirl { to { transform: rotate(360deg); } }

.world { position: absolute; inset: 0; width: 200vw; display: flex; transition: transform 1.1s cubic-bezier(0.65, 0, 0.25, 1); z-index: 1; }
.world.at-shop { transform: translateX(-100vw); }
.stage { position: relative; width: 100vw; height: 100%; flex: none; perspective: 1500px; perspective-origin: 50% -10%; }

/* The table: wooden rim, felt middle, tipped away from the camera */
.table { position: absolute; left: -4vw; right: -4vw; bottom: -6vh; height: 66vh; transform-style: preserve-3d; }
.table-rim {
  position: absolute;
  inset: 0;
  transform: rotateX(46deg);
  transform-origin: 50% 100%;
  border-radius: 9vw / 12vh;
  padding: 3.4vh;
  background:
    repeating-linear-gradient(91deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 11px, rgba(255, 255, 255, 0.04) 11px 13px, transparent 13px 23px),
    linear-gradient(180deg, var(--wood-light), var(--wood-base) 40%, var(--wood-dark));
  box-shadow: 0 4vh 6vh rgba(0, 0, 0, 0.6), inset 0 0.6vh 0 rgba(255, 255, 255, 0.18), inset 0 -0.8vh 0 rgba(0, 0, 0, 0.35);
}
.table-felt {
  width: 100%;
  height: 100%;
  border-radius: 7.5vw / 10vh;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse at 50% 35%, var(--felt-light), var(--felt-dark) 75%);
  background-blend-mode: multiply, normal;
  box-shadow: inset 0 0 0 0.5vh rgba(0, 0, 0, 0.25), inset 0 2vh 5vh rgba(0, 0, 0, 0.45);
}

/* Heads-up: room code, story scene, shop sign */
.hud { position: absolute; top: 2.4vh; left: 2.4vw; right: 2.4vw; display: flex; align-items: flex-start; gap: 2vw; z-index: 3; font-size: clamp(13px, 1.05vw, 22px); }
.hud-code { display: grid; background: rgba(10, 6, 20, 0.55); border-radius: 14px; padding: 0.5em 0.9em; }
.hud-code b { font-family: var(--font-display); font-size: 2.2em; line-height: 1; color: var(--yellow); letter-spacing: 0.08em; }
.hud-code span { color: var(--muted); font-weight: 700; font-size: 0.85em; }
.hud-scene { flex: 1; display: flex; gap: 0.8vw; justify-content: center; flex-wrap: wrap; }
.placard { background: #efe4c8; color: #3a2716; border-radius: 6px; padding: 0.45em 0.8em 0.5em; display: grid; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); transform: rotate(-1.5deg); max-width: 22vw; }
.placard:nth-child(even) { transform: rotate(1.2deg); }
.placard b { font-size: 0.75em; opacity: 0.7; }
.placard span { font-weight: 800; line-height: 1.15; }
.placard em { font-style: normal; color: #8a3b2e; font-weight: 800; margin-top: 0.2em; }
.placard-prompt { max-width: 30vw; }
.hud-shop { display: grid; justify-items: center; gap: 0.4em; }
.sign { font-family: var(--font-display); font-size: 1.4em; background: linear-gradient(var(--wood-light), var(--wood-base)); color: #ffe9c2; padding: 0.15em 0.7em; border-radius: 8px; box-shadow: 0 4px 0 var(--wood-dark); text-shadow: 0 2px 0 var(--wood-dark); }
.sign::after { content: ' →'; }
.hud-shop-cards { display: flex; gap: 6px; }

/* Seats around the far edge of the table */
.seats { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.seat {
  position: absolute;
  left: var(--x);
  /* Seats follow the curve of the table: the middle seat at the far rim, the outer ones down its sides. */
  top: calc(27vh + var(--depth) * 3.5vh + var(--depth) * var(--depth) * 2.2vh);
  width: clamp(150px, 15vw, 280px);
  transform: translateX(-50%) scale(calc(1 - var(--depth) * 0.07));
  transform-origin: 50% 0;
  display: grid;
  justify-items: center;
  gap: 0.6vh;
  transition: left 0.75s cubic-bezier(0.5, 0, 0.2, 1.15), top 0.75s ease, transform 0.75s ease, filter 0.4s;
  font-size: clamp(13px, 1.05vw, 22px);
  filter: brightness(0.92);
  background: none;
  padding: 0;
  border-radius: 0;
}
.room .seat.is-turn { top: 24vh; transform: translateX(-50%) scale(1.12); filter: none; z-index: 2; background: none; box-shadow: none; }
.room .seat.is-turn .seat-name::after, .room .seat .seat-name::after { content: none; }
.seat.is-turn .nameplate { background: var(--yellow); color: var(--dark-ink); box-shadow: 0 0 0 3px #fff3, 0 0 30px rgba(245, 197, 24, 0.55), 0 5px 0 #8a6a00; }
.seat-hand { height: clamp(74px, 9.5vh, 140px); display: grid; place-items: end center; }
.nameplate {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: rgba(20, 12, 30, 0.85);
  border-radius: 999px;
  padding: 0.35em 0.9em;
  font-weight: 800;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
.nameplate.is-off { opacity: 0.55; }
.np-name { font-size: 1.15em; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.np-stats { display: inline-flex; gap: 0.6em; align-items: center; font-size: 0.85em; }
.mat { margin-top: 1.4vh; display: flex; flex-wrap: wrap; gap: 0.4em; justify-content: center; max-width: 100%; }
.mat .fam { background: rgba(8, 40, 22, 0.75); font-size: 0.8em; }
.mat-lord { display: flex; align-items: center; gap: 0.4em; font-weight: 800; color: var(--yellow); font-size: 0.8em; }

/* A hand held like a poker hand */
.fan { position: relative; width: 10em; height: 100%; }
.fan-card { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%) translateY(var(--y)) rotate(var(--r)); transform-origin: 50% 130%; }
.fan.size-sm .card { --w: clamp(38px, 3.4vw, 64px); }
.fan.size-md .card { --w: clamp(46px, 4.2vw, 80px); }
.fan.size-xs .card { --w: 26px; }
.fan-count {
  position: absolute;
  right: -0.2em;
  bottom: -0.3em;
  z-index: 2;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.15em;
  color: #fff;
  background: var(--chip);
  box-shadow: inset 0 0 0 0.22em #fff, inset 0 0 0 0.34em var(--chip), 0 4px 0 rgba(0, 0, 0, 0.45);
}

/* The piles, two thirds of the way down, on the felt */
.pile-zone { position: absolute; left: 50%; top: 66vh; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4vw; z-index: 2; }
.pile-zone .card.size-lg { --w: clamp(110px, 10.5vw, 210px); }
.draw-stack { position: relative; display: grid; }
.draw-stack > .card { grid-area: 1 / 1; }
.draw-stack > .card:first-child { transform: translate(5px, 5px); }
.stack-count { position: absolute; left: 50%; bottom: -0.9em; transform: translateX(-50%); font-family: var(--font-display); font-size: clamp(16px, 1.4vw, 28px); background: rgba(0, 0, 0, 0.6); border-radius: 999px; padding: 0 0.6em; }
.discard { position: relative; display: grid; }
.discard > * { grid-area: 1 / 1; }
.pile-under.u0 { transform: rotate(8deg) translate(4%, 2%); }
.pile-under.u1 { transform: rotate(-10deg) translate(-5%, 3%); }
.pile-under.u2 { transform: rotate(16deg) translate(7%, 5%); }
.pile-top { animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 14px 10px rgba(0, 0, 0, 0.45)); }
.pile-top.is-new { animation: slapdown 420ms cubic-bezier(0.2, 1.5, 0.5, 1), bob 3.2s ease-in-out 420ms infinite; }
@keyframes bob { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(-1.5deg) translateY(-6px); } }
@keyframes slapdown { 0% { transform: translateY(-40vh) rotate(-25deg) scale(1.3); } 70% { transform: translateY(0) rotate(2deg) scale(0.96); } }

.plaque {
  position: absolute;
  left: 50%;
  bottom: 3.5vh;
  transform: translateX(-50%);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 0.4em;
  min-width: 34vw;
  background: rgba(16, 8, 24, 0.82);
  border-radius: 16px;
  padding: 0.6em 1.4em 0.75em;
  font-size: clamp(15px, 1.3vw, 26px);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5);
  text-align: center;
}
.plaque .muted { font-size: 0.75em; font-weight: 700; }
.plaque .countdown { width: 100%; }
.nope-ask { color: var(--nope); font-family: var(--font-display); font-size: 1.3em; }
.stage-main .feed { position: absolute; left: 2vw; bottom: 3.5vh; width: 22vw; height: auto; z-index: 3; font-size: clamp(12px, 0.85vw, 18px); mask-image: none; -webkit-mask-image: none; }

/* The shop: a little table of its own, with the shopkeeper standing behind it */
.shop-scene { position: absolute; inset: 0; }
.shop-sign { position: absolute; top: 5vh; left: 50%; transform: translateX(-50%) rotate(-2deg); font-family: var(--font-display); font-size: clamp(40px, 5vw, 96px); color: #ffe9c2; background: linear-gradient(var(--wood-light), var(--wood-base)); padding: 0.05em 0.6em; border-radius: 14px; box-shadow: 0 8px 0 var(--wood-dark); text-shadow: 0 4px 0 var(--wood-dark); z-index: 2; }
.shopkeeper { position: absolute; left: 50%; top: 22vh; transform: translateX(-50%); z-index: 1; }
.shopkeeper .character { width: clamp(130px, 11vw, 220px); }
.shop-table { position: absolute; left: 18vw; right: 18vw; bottom: 4vh; height: 42vh; z-index: 2; }
.shop-table-top {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5vw;
  padding: 4vh 3vw;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 14px, rgba(255, 255, 255, 0.05) 14px 16px, transparent 16px 30px),
    linear-gradient(180deg, var(--wood-light), var(--wood-base) 50%, var(--wood-dark));
  box-shadow: 0 3vh 5vh rgba(0, 0, 0, 0.6), inset 0 6px 0 rgba(255, 255, 255, 0.2);
}
.ware { display: grid; justify-items: center; gap: 0.6vh; position: relative; }
.ware .card { --w: clamp(96px, 8.5vw, 170px); }
.price { position: absolute; top: -0.6em; right: -0.8em; z-index: 2; width: 2.6em; height: 2.6em; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); color: #3a2716; background: #ffd25e; box-shadow: inset 0 0 0 0.2em #fff6, 0 4px 0 #8a6a00; font-size: clamp(14px, 1.1vw, 22px); }
.ware-name { font-weight: 800; color: #ffe9c2; text-shadow: 0 2px 0 var(--wood-dark); max-width: 10em; text-align: center; line-height: 1.1; font-size: clamp(13px, 1vw, 20px); }
.hazard-token { width: clamp(96px, 8.5vw, 170px); aspect-ratio: 5 / 7; border-radius: 10%; display: grid; place-items: center; font-size: clamp(40px, 4vw, 80px); background: repeating-linear-gradient(135deg, #2b2935 0 10px, #3a3746 10px 20px); color: #ff8a8a; box-shadow: inset 0 0 0 4px #ff8a8a55; }
.shop-who { position: absolute; left: 3vw; top: 6vh; font-family: var(--font-display); font-size: clamp(20px, 2vw, 40px); color: var(--yellow); max-width: 26vw; }
.shop-log { position: absolute; left: 3vw; top: 14vh; max-width: 24vw; color: var(--ink); font-weight: 700; font-size: clamp(13px, 1vw, 20px); display: grid; gap: 0.3em; }
.shop-log p { margin: 0; background: rgba(0, 0, 0, 0.45); padding: 0.3em 0.6em; border-radius: 8px; }

/* Character cards: avatars and the shopkeeper. No mechanics, just presence. */
.character { width: clamp(140px, 13vw, 260px); aspect-ratio: 5 / 7; background: #efe4c8; border-radius: 14px; padding: 10px; display: grid; grid-template-rows: 1fr auto auto; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 5px #c9a86a; color: #3a2716; animation: sway 5s ease-in-out infinite; }
.character-art { background: radial-gradient(circle at 50% 30%, #f7d98a, #c98a3a); border-radius: 8px; display: grid; place-items: end center; overflow: hidden; }
.character-art svg { width: 82%; height: auto; display: block; }
.character-name { font-family: var(--font-display); font-size: clamp(16px, 1.4vw, 28px); text-align: center; margin-top: 6px; }
.character-kind { text-align: center; font-size: 0.8em; font-weight: 700; opacity: 0.7; }
@keyframes sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg) translateY(-4px); } }

.overlay.is-win .winner-name { font-family: var(--font-display); }
.splash { font-family: var(--font-display); }

@media (prefers-reduced-motion: reduce) {
  .room::before, .pile-top, .pile-top.is-new, .character { animation: none; }
  .world, .seat { transition: none; }
}

/* ================================================================ phone: your seat at the table
   The felt in front of you (with the card to match), and your hand resting on the wooden edge. */

.ph {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse at 50% 30%, var(--felt-light), var(--felt-dark) 80%);
  background-blend-mode: multiply, normal;
}
.ph-felt { min-height: 0; display: grid; grid-template-rows: auto 1fr; }
.ph-opps {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 10px 12px 8px;
  background: linear-gradient(rgba(0, 0, 0, 0.35), transparent);
}
.mseat { flex: none; display: grid; justify-items: center; gap: 2px; padding: 4px 8px 6px; border-radius: 12px; min-width: 70px; }
.mseat.is-turn { background: rgba(245, 197, 24, 0.16); box-shadow: inset 0 0 0 2px var(--yellow); }
.mseat .fan { width: 4.2em; height: 40px; }
.mseat .fan .card { --w: 24px; }
.mseat .fan-count { font-size: 0.85em; }
.mseat-name { font-weight: 800; font-size: 0.85em; max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mseat.is-turn .mseat-name { color: var(--yellow); }

.ph-scroll { min-height: 0; overflow-y: auto; padding: 4px 12px 16px; display: grid; gap: 10px; align-content: start; }
.ph-status { display: flex; align-items: center; gap: 10px; }
.ph-status .me-turn { font-family: var(--font-display); font-size: 1.45em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }

/* The card you have to match, with what you can match it on spelled out next to it */
.ph-pile { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.ph-top { display: grid; justify-items: center; gap: 6px; }
.ph-top .card { --w: clamp(112px, 34vw, 160px); animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.45)); }
.ph-draw { font-size: 0.8em; font-weight: 700; color: #d6f5e0; opacity: 0.85; }
.ph-info { display: grid; gap: 6px; min-width: 0; }
.ph-kind { font-weight: 800; color: #d6f5e0; font-size: 0.9em; }
.aspects { display: grid; gap: 5px; }
.aspect { display: grid; grid-template-columns: 3.6em 1fr; gap: 6px; align-items: center; background: rgba(0, 0, 0, 0.32); border-radius: 8px; padding: 5px 8px; font-size: 0.92em; }
.aspect b { color: #b7e3c6; font-weight: 700; font-size: 0.85em; }
.aspect span { font-weight: 800; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.aspect.is-none span { opacity: 0.45; font-weight: 600; }
.swatch { width: 0.95em; height: 0.95em; border-radius: 3px; flex: none; background: var(--none); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5); }
.swatch.c-red { background: var(--red); } .swatch.c-yellow { background: var(--yellow); } .swatch.c-green { background: var(--green); }
.swatch.c-blue { background: var(--blue); } .swatch.c-black { background: #15131c; } .swatch.c-custom { background: #8d8aa0; }
.swatch.c-wild { background: conic-gradient(var(--red) 0 25%, var(--yellow) 0 50%, var(--green) 0 75%, var(--blue) 0); }

.ph .ticker { background: rgba(0, 0, 0, 0.3); }
.ph .ticker-line { color: #e6f7ec; }
.ph .banner { background: rgba(10, 20, 14, 0.75); }
.ph .banner.is-alert { background: rgba(70, 20, 60, 0.9); }
.ph .play-table { padding: 0; }
.ph .tbl .seat { background: rgba(0, 0, 0, 0.3); position: static; width: auto; transform: none; filter: none; top: auto; left: auto; }
.ph .tbl .seat.is-turn { box-shadow: inset 4px 0 0 var(--yellow); }
.ph .tbl .shop-box, .ph .tbl .scene { background: rgba(0, 0, 0, 0.3); }
.ph .my-fams { align-items: center; }
.ph .my-fams .fam { background: rgba(0, 0, 0, 0.35); }

/* The wooden edge of the table, where your hand rests */
.ph-rail {
  position: relative;
  padding: 0 0 env(safe-area-inset-bottom);
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 13px, rgba(255, 255, 255, 0.05) 13px 15px, transparent 15px 27px),
    linear-gradient(180deg, var(--wood-light), var(--wood-base) 30%, var(--wood-dark));
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.45), inset 0 4px 0 rgba(255, 255, 255, 0.22);
  max-height: 52vh;
  display: grid;
}
.ph-rail .actions { padding: 10px 12px 2px; min-height: 0; }
.ph-rail .actions .hint { color: #ffe9c2; text-shadow: 0 1px 0 var(--wood-dark); }
.ph-rail .actions .btn-ghost { box-shadow: inset 0 0 0 2px rgba(255, 233, 194, 0.5); color: #ffe9c2; }
.rail-hand {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 26px 18px 14px;
  scroll-padding: 18px;
  scrollbar-width: thin;
}
.rail-hand .card { --w: clamp(84px, 24vw, 118px); margin-right: calc(var(--w) * -0.18); cursor: pointer; transition: transform 140ms ease, margin 140ms ease; }
.rail-hand .card:last-child { margin-right: 0; }
.rail-hand .card:nth-child(odd) { transform: rotate(-1.5deg); }
.rail-hand .card:nth-child(even) { transform: rotate(1.5deg) translateY(3px); }
.rail-hand .card.is-selected { transform: translateY(-20px) rotate(-2deg); margin-right: calc(var(--w) * 0.02); z-index: 1; }
.rail-hand .card.is-dim { filter: saturate(0.5) brightness(0.7); opacity: 1; }
.ph .uno-dock { bottom: auto; top: 54px; right: 10px; }

/* The shop, from your phone */
.ph-shop { display: grid; gap: 10px; justify-items: center; }
.ph-shopkeeper .character { width: 112px; }
.ph-shop-table {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 10px 14px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 14px),
    linear-gradient(180deg, var(--wood-light), var(--wood-base) 50%, var(--wood-dark));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45), inset 0 4px 0 rgba(255, 255, 255, 0.2);
}
.ph-shop-table .ware { appearance: none; border: 0; background: none; padding: 4px; border-radius: 12px; cursor: pointer; color: inherit; font: inherit; }
.ph-shop-table .ware .card { --w: 76px; }
.ph-shop-table .ware.is-on { box-shadow: 0 0 0 3px var(--yellow); background: rgba(245, 197, 24, 0.15); }
.ph-shop-table .ware:disabled { opacity: 0.45; }
.ph-shop-table .price { font-size: 13px; }
.ph-shop-table .ware-name { font-size: 0.8em; }
.ph-shop-sums { display: grid; gap: 4px; text-align: center; background: rgba(0, 0, 0, 0.35); border-radius: 12px; padding: 8px 12px; font-size: 0.92em; }

@media (prefers-reduced-motion: reduce) {
  .ph-top .card { animation: none; }
}

/* Wide screens playing without a TV: the table stays open */
@media (min-width: 900px) {
  .ph .play-table { display: block; }
  .ph .tbl { grid-template-columns: 1fr 1fr; }
  .ph .tbl-pile { display: none; }
  .ph-scroll { padding-left: 24px; padding-right: 24px; }
}

/* ================================================================ round 2 of the table look */

/* Familiars are their cards, upright on the felt. Unfed ones lie sideways: defense mode. */
.famcard { --fam-w: 72px; position: relative; display: inline-grid; justify-items: center; gap: 3px; vertical-align: top; }
.famcard-card { display: grid; place-items: center; }
.famcard-card .card { --w: var(--fam-w); }
.famcard.is-shield .famcard-card { width: calc(var(--fam-w) * 1.4); height: var(--fam-w); }
.famcard.is-shield .famcard-card .card { transform: rotate(-90deg); }
.famcard-slots { display: flex; gap: 2px; }
.famcard-slots .slot { width: 1.35em; height: 1.35em; font-size: calc(var(--fam-w) * 0.17); border-color: rgba(255, 255, 255, 0.45); background: rgba(0, 0, 0, 0.35); }
.famcard-slots .slot.is-full { background: var(--paper); }
.famcard-stat {
  position: absolute;
  top: calc(var(--fam-w) * -0.14);
  right: calc(var(--fam-w) * -0.14);
  min-width: 2.3em;
  height: 2.3em;
  padding: 0 0.3em;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: calc(var(--fam-w) * 0.19);
  line-height: 0.9;
  color: #fff;
  background: var(--red);
  box-shadow: inset 0 0 0 0.18em #fff, 0 3px 0 rgba(0, 0, 0, 0.45);
  z-index: 2;
}
.famcard-stat small { display: block; font-size: 0.55em; font-family: var(--font); font-weight: 800; }
.famcard.is-shield .famcard-stat { background: #1f8a52; font-size: calc(var(--fam-w) * 0.15); padding: 0 0.6em; }
.famcard.is-selectable { cursor: pointer; }
.famcard.is-selectable .famcard-card .card { box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), inset 0 0 0 0.22em rgba(255, 255, 255, 0.85), 0 0 0 3px rgba(255, 255, 255, 0.5); }
.famcard.is-picked .famcard-card .card { box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), inset 0 0 0 0.22em rgba(255, 255, 255, 0.85), 0 0 0 4px var(--focus); }
.famcard .card-order { top: auto; bottom: -0.4em; right: -0.4em; border-radius: 999px; font-size: calc(var(--fam-w) * 0.18); }
.mat .famcard { --fam-w: clamp(46px, 4.2vw, 88px); }
.mat { gap: 0.8em; align-items: flex-end; }
.ph .my-fams .famcard { --fam-w: clamp(54px, 17vw, 78px); }
.tbl .famcard { --fam-w: clamp(44px, 13vw, 58px); }
.sheet .famcard { --fam-w: 70px; margin: 8px 6px 0 0; }
.sheet .cards-row { gap: 12px; }

/* Character cards: generic face cards stand behind each seat until players pick their own */
.face-card {
  --face-w: 90px;
  position: relative;
  width: var(--face-w);
  aspect-ratio: 5 / 7;
  border-radius: calc(var(--face-w) * 0.08);
  background: linear-gradient(160deg, #fbf4e2, #e9dcbd);
  color: #22202a;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4), inset 0 0 0 calc(var(--face-w) * 0.035) #c9a86a;
  display: grid;
  place-items: center;
  grid-template-rows: 1fr auto auto;
  padding: 10% 8% 9%;
  font-size: calc(var(--face-w) * 0.13);
}
.face-card.is-red { color: #c4262c; }
.face-corner { position: absolute; left: 7%; top: 5%; font-family: var(--font-display); font-size: 1em; line-height: 0.95; text-align: center; }
.face-corner.is-flip { left: auto; top: auto; right: 7%; bottom: 5%; transform: rotate(180deg); }
.face-rank { font-family: var(--font-display); font-size: 3.4em; line-height: 0.8; align-self: end; }
.face-suit { font-size: 1.8em; line-height: 1; }
.face-name { font-weight: 800; font-size: 0.72em; color: #5a4a35; text-align: center; line-height: 1.05; }

.seat-char { margin-bottom: -2.8vh; z-index: 0; animation: sway 6s ease-in-out infinite; }
.seat-char .face-card { --face-w: clamp(60px, 5.6vw, 112px); }
.seat:nth-child(even) .seat-char { animation-delay: -2s; }
.seat .seat-hand { position: relative; z-index: 1; }
.seat .nameplate { position: relative; z-index: 1; }
.room .seat { top: calc(11vh + var(--depth) * 3.5vh + var(--depth) * var(--depth) * 2.2vh); }
.room .seat.is-turn { top: 8.5vh; }
.room .seat.is-turn .seat-char .face-card { box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4), inset 0 0 0 calc(var(--face-w) * 0.035) #c9a86a, 0 0 32px rgba(245, 197, 24, 0.6); }

/* The shopkeeper: your art if it's there */
.character.has-art { padding: 0; background: none; box-shadow: none; aspect-ratio: auto; display: block; }
.character.has-art .character-fallback { display: none; }
.character-fallback { display: contents; }
.character-img { width: 100%; height: auto; display: block; border-radius: 12px; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.4), 0 0 40px rgba(255, 200, 80, 0.25); }
.shopkeeper .character { width: clamp(150px, 13vw, 250px); }
.ph-shopkeeper .character { width: 124px; }

/* Phones: the camera pans over to the shop and back */
.scene-wrap.pan-in { animation: pan-in 0.7s cubic-bezier(0.65, 0, 0.25, 1); }
.scene-wrap.pan-back { animation: pan-back 0.7s cubic-bezier(0.65, 0, 0.25, 1); }
@keyframes pan-in { from { transform: translateX(110%); } }
@keyframes pan-back { from { transform: translateX(-110%); } }
.ph-scroll { overflow-x: hidden; }

/* A Balatro-style hand: an arc on the wooden edge that squeezes tighter as it grows */
.rail-hand { --w: clamp(76px, 22vw, 116px); display: block; overflow: visible; padding: 0; height: calc(var(--w) * 1.4 + 44px); position: relative; }
.hand-fan { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(calc(100% - 20px), calc(var(--n) * var(--w) * 0.82 + var(--w) * 0.18)); }
.hand-slot { position: absolute; top: 26px; left: calc(var(--t) * (100% - var(--w))); transform: translateY(var(--y)) rotate(var(--r)); transform-origin: 50% 120%; transition: left 180ms ease, transform 180ms ease; }
.rail-hand .hand-slot .card { --w: inherit; width: var(--w); margin: 0; transform: none; }
.rail-hand .hand-slot .card.is-selected { transform: translateY(-24px) scale(1.04); }
.rail-hand .hand-slot:has(.is-selected) { z-index: 50 !important; }
.rail-hand .hand-slot .card:active { transform: translateY(-8px); }

@media (prefers-reduced-motion: reduce) {
  .scene-wrap.pan-in, .scene-wrap.pan-back, .seat-char { animation: none; }
  .hand-slot { transition: none; }
}
/* Keep the scene placards clear of the middle seat's character card */
.hud-scene { justify-content: flex-start; flex: 0 1 46vw; }
.hud { justify-content: space-between; }
.hud-shop { margin-left: auto; }
/* Keep the arc inside the screen; centre the card to match when there's room */
.hand-fan { width: min(calc(100% - 92px), calc(var(--n) * var(--w) * 0.82 + var(--w) * 0.18)); }
.ph-scroll { align-content: safe center; }

/* Landing page, round 2 */
html { background: var(--table); }
.landing { align-items: start; padding-top: max(56px, 6vh); }
.landing-fan { margin-bottom: 8px; }
.panel-label { font-weight: 800; font-size: 1.1em; }
.name-panel { cursor: text; }
.choice { display: grid; gap: 6px; }
.choice + .choice { padding-top: 12px; border-top: 1px solid var(--table-3); }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-row .btn { white-space: normal; padding-left: 0.6em; padding-right: 0.6em; }

/* ================================================================ card faces people recognize */

/* Standard playing cards: white face, corner indices, real pip layouts */
.card.pc {
  --ink: #1d1b24;
  background: linear-gradient(160deg, #fffdf8, #f1ede2);
  color: var(--ink);
  box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  padding: 0;
  display: block;
}
.card.pc-red { --ink: #c8222b; }
.pc-idx { position: absolute; left: 7%; top: 4.5%; font-weight: 800; font-size: 1.15em; line-height: 0.92; text-align: center; letter-spacing: -0.04em; }
.pc-idx.is-flip { left: auto; top: auto; right: 7%; bottom: 4.5%; transform: rotate(180deg); }
.pc-body { position: absolute; inset: 15% 24% 15%; }
.pip-s { position: absolute; transform: translate(-50%, -50%); font-style: normal; font-size: 1.55em; line-height: 1; }
.pip-s.is-flip { transform: translate(-50%, -50%) rotate(180deg); }
.pc-ace { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.6em; line-height: 1; }
.pc-face { position: absolute; inset: -6% -14%; border: 0.12em solid currentColor; border-radius: 0.4em; display: grid; place-items: center; align-content: center; background: repeating-linear-gradient(45deg, transparent 0 0.35em, rgba(0, 0, 0, 0.04) 0.35em 0.7em); }
.pc-face b { font-family: var(--font-display); font-size: 3.2em; line-height: 0.85; }
.pc-face span { font-size: 1.8em; line-height: 1; }
.card.pc-joker { --ink: #6b2fb8; }
.pc-joker-word { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); font-family: var(--font-display); font-size: 1.9em; letter-spacing: 0.08em; background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pc-joker-star { position: absolute; right: 12%; top: 14%; font-size: 1.4em; color: var(--yellow); text-shadow: 0 1px 0 #8a6a00; }

/* Uno-style: color fills the card inside a white border; the number sits in a tilted white oval */
.card.uno { --uc: var(--red); background: #fff; padding: 0; display: block; box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.card.uno::before { content: ''; position: absolute; inset: 6.5%; border-radius: 0.55em; background: var(--uc); }
.card.uno-red { --uc: #d7262e; } .card.uno-yellow { --uc: #f2c200; } .card.uno-green { --uc: #1f9a45; } .card.uno-blue { --uc: #1667c9; } .card.uno-black { --uc: #19171f; }
.card.uno-wild { --uc: #19171f; }
.uno-oval {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64%;
  height: 74%;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) rotate(28deg);
  display: grid;
  place-items: center;
}
.uno-oval b { transform: rotate(-28deg); font-family: var(--font-display); font-size: 3.4em; line-height: 1; color: var(--uc); text-shadow: 0.04em 0.04em 0 rgba(0, 0, 0, 0.35); }
.uno-oval b.is-long { font-size: 2.3em; }
.card.uno-wild .uno-oval { background: conic-gradient(from -28deg, #d7262e 0 25%, #1667c9 0 50%, #f2c200 0 75%, #1f9a45 0); }
.card.uno-wild .uno-oval b { color: #fff; -webkit-text-stroke: 0.06em #19171f; paint-order: stroke fill; }
.uno-corner { position: absolute; left: 12%; top: 9%; z-index: 1; font-family: var(--font-display); font-size: 1.25em; line-height: 1; color: #fff; text-shadow: 0.05em 0.05em 0 rgba(0, 0, 0, 0.45); }
.uno-corner.is-flip { left: auto; top: auto; right: 12%; bottom: 9%; transform: rotate(180deg); }
.card.uno u, .uno-oval u { text-decoration-thickness: 0.08em; text-underline-offset: 0.08em; }

/* Crazy eights (and other wilds drawn as normal cards) get a rainbow flag */
.wild-flag {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.05em 0.55em;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.72em;
  color: #fff;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue));
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.card.pc .wild-flag { bottom: 3.5%; }

/* Real card images, with a strip showing what they match on in this game */
.card.is-framed .card-window { align-self: stretch; justify-self: stretch; margin: 0.25em 0; border-radius: 0.5em; overflow: hidden; background: var(--paper); box-shadow: inset 0 0 0 0.15em rgba(0, 0, 0, 0.25); min-height: 0; }
.card.is-framed .card-window img { width: 100%; height: 100%; object-fit: fill; /* stretched to fit: nothing gets cut off */ display: block; pointer-events: none; }
.card.size-xs.is-framed .card-window { margin: 0; }
.inspect-powers { margin: 0.5em 0 0; padding: 0; list-style: none; display: grid; gap: 0.35em; font-size: 0.92em; }
.inspect-powers b { color: #c9a6ff; }
.inspect-text { margin: 0.6em 0 0; font-style: italic; white-space: pre-wrap; }
.card.has-img { padding: 0; display: block; background: #222; box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.45); }
.card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; /* stretched to fit: nothing gets cut off */ border-radius: inherit; display: block; pointer-events: none; }
.card-vals {
  position: absolute;
  left: 6%;
  bottom: 4%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.15em 0.5em;
  border-radius: 999px;
  background: rgba(14, 10, 24, 0.82);
  color: #fff;
  font-size: 0.78em;
  font-weight: 800;
  max-width: 88%;
  white-space: nowrap;
  overflow: hidden;
}
.card-vals em { font-style: normal; opacity: 0.85; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }

/* Tiny cards (fans, previews) just show their corner */
.card.size-xs.pc .pc-body, .card.size-xs.pc .pc-idx.is-flip, .card.size-xs.uno .uno-corner, .card.size-xs .wild-flag, .card.size-xs .card-vals { display: none; }
.card.size-xs.pc .pc-idx { font-size: 1.8em; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.card.size-xs .uno-oval b { font-size: 2.4em; }
.card.size-sm .pc-idx { font-size: 1.3em; }
.pc-body { inset: 19% 30% 19%; }
.pip-s { font-size: 1.4em; }
.card.size-lg .pip-s, .card.size-xl .pip-s { font-size: 1.5em; }

/* Unplayable cards are properly grey, not just dim */
.card.is-dim,
.rail-hand .card.is-dim { filter: grayscale(1) brightness(0.62) contrast(0.9); opacity: 0.85; }
.rail-hand .card.is-playable { box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 16px rgba(255, 240, 160, 0.55); }

/* The fan: the card under your finger lifts and its neighbours part */
.hand-fan { touch-action: none; }
.hand-slot { transition: left 180ms ease, transform 180ms ease, translate 160ms cubic-bezier(0.3, 1.4, 0.5, 1); }
.hand-slot.is-focus { z-index: 60 !important; }
.hand-slot.is-focus .card { transform: translateY(-34px) scale(1.14) rotate(calc(var(--r) * -1)); filter: none; }
.hand-slot.is-focus .card.is-dim { filter: grayscale(1) brightness(0.75); }
.rail-hand .hand-slot.is-focus .card.is-selected { transform: translateY(-40px) scale(1.14) rotate(calc(var(--r) * -1)); }
@media (prefers-reduced-motion: reduce) {
  .hand-slot { transition: none; }
}

/* ================================================================ the player view on a PC or Steam Deck
   The TV's table, with your seat at the near edge: the card to match spelled out beside the pile,
   and your hand on the wooden edge. */
.desk { --hw: clamp(92px, 6.4vw, 128px); --rail: calc(var(--hw) * 1.5 + 46px); }
.desk-table { position: absolute; inset: 0; }
.desk .table { bottom: calc(var(--rail) - 7vh); height: calc(70vh - var(--rail) * 0.55); }
.desk .pile-zone { top: calc((100vh - var(--rail)) * 0.7); }
.desk .pile-zone .card.size-lg { --w: clamp(100px, 8.6vw, 180px); }
.desk .plaque { bottom: calc(var(--rail) + 1.6vh); min-width: 26vw; font-size: clamp(14px, 1.05vw, 22px); }
.desk .stage-main .feed { bottom: calc(var(--rail) + 1.6vh); width: 20vw; }
.desk .shop-table { bottom: calc(var(--rail) + 1vh); height: calc(64vh - var(--rail)); }
.desk .shopkeeper { top: 12vh; }
.desk .shop-sign { top: 2vh; }
.desk-ui { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.desk-ui > * { pointer-events: auto; }

.desk-panel {
  position: absolute;
  top: calc((100vh - var(--rail)) * 0.7);
  right: calc(50% + clamp(110px, 9.6vw, 200px) + 2vw);
  transform: translateY(-50%);
  width: clamp(240px, 19vw, 360px);
  display: grid;
  gap: 6px;
  background: rgba(8, 30, 18, 0.72);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  font-size: clamp(13px, 0.9vw, 18px);
}
.desk-panel .me-turn { font-family: var(--font-display); font-size: 1.6em; line-height: 1; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.desk-panel .me-turn.is-mine { color: var(--yellow); }
.desk-panel .me-sub { color: #b7e3c6; font-weight: 600; font-size: 0.92em; }
.desk-panel .ph-kind { margin-top: 4px; }

.desk-banners { position: absolute; right: 2vw; top: 30vh; width: clamp(260px, 22vw, 400px); display: grid; gap: 10px; }
.desk-banners .banner { background: rgba(10, 20, 14, 0.85); }
.desk-banners .banner.is-alert { background: rgba(70, 20, 60, 0.92); }
.desk-mine { position: absolute; right: 2vw; bottom: calc(var(--rail) + 1.6vh); display: flex; gap: 0.8em; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; max-width: 30vw; }
.desk-mine .famcard { --fam-w: clamp(56px, 4.6vw, 92px); }

.desk-rail { position: absolute; left: 0; right: 0; bottom: 0; height: var(--rail); max-height: none; grid-template-columns: clamp(200px, 17vw, 300px) 1fr clamp(150px, 13vw, 240px); grid-template-rows: auto 1fr; align-items: start; }
.desk-me { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 10px; padding: 12px 14px 0; font-weight: 800; color: #ffe9c2; text-shadow: 0 1px 0 var(--wood-dark); }
.desk-me-name { font-size: 1.1em; }
.desk-rail .actions { grid-column: 1; grid-row: 2; flex-direction: column; align-items: stretch; padding: 10px 14px; }
.desk-rail .actions .btn { width: 100%; }
.desk-rail .rail-hand { grid-column: 2; grid-row: 1 / 3; --w: var(--hw); height: var(--rail); }
.desk-rail .hand-slot { top: 14px; }
.desk-rail .hand-fan { width: min(calc(100% - 20px), calc(var(--n) * var(--w) * 0.82 + var(--w) * 0.18)); }
.desk-rail .uno-dock { position: static; grid-column: 3; grid-row: 1 / 3; padding: 14px; align-self: center; }
.desk .ware.is-buy { appearance: none; border: 0; background: none; padding: 6px; border-radius: 14px; cursor: pointer; color: inherit; font: inherit; }
.desk .ware.is-buy.is-on { box-shadow: 0 0 0 4px var(--yellow); background: rgba(245, 197, 24, 0.15); }
.desk .ware.is-buy:disabled { opacity: 0.45; cursor: default; }
.desk .shop-log p.muted { color: var(--muted); font-weight: 600; }

/* Colors beyond Uno's four: Magic's white, Pokémon's Psychic purple, Fighting orange, Fairy pink, Metal gray, and brown */
.card.c-white { --fill: var(--white); --on-fill: var(--dark-ink); --window-ink: #6b6250; }
.card.c-purple { --fill: var(--purple); --on-fill: #fff; }
.card.c-orange { --fill: var(--orange); --on-fill: #fff; }
.card.c-pink { --fill: var(--pink); --on-fill: #fff; }
.card.c-gray { --fill: var(--gray); --on-fill: #fff; }
.card.c-brown { --fill: var(--brown); --on-fill: #fff; }
.swatch.c-white { background: var(--white); } .swatch.c-purple { background: var(--purple); } .swatch.c-orange { background: var(--orange); }
.swatch.c-pink { background: var(--pink); } .swatch.c-gray { background: var(--gray); } .swatch.c-brown { background: var(--brown); }
.fam.c-white { --fill: var(--white); } .fam.c-purple { --fill: var(--purple); } .fam.c-orange { --fill: var(--orange); }
.fam.c-pink { --fill: var(--pink); } .fam.c-gray { --fill: var(--gray); } .fam.c-brown { --fill: var(--brown); }
/* Shorter screens (Steam Deck, laptops): a tighter panel so it clears the seats and the turn plaque */
.desk .plaque { min-width: 0; width: clamp(240px, 22vw, 440px); }
.desk-panel .aspects { gap: 3px; }
.desk-panel .aspect { padding: 3px 8px; }
@media (max-height: 900px) {
  .desk-panel { font-size: 12px; padding: 9px 11px; gap: 4px; width: 220px; }
  .desk-panel .me-turn { font-size: 1.45em; }
  .desk .pile-zone { top: calc((100vh - var(--rail)) * 0.68); }
  .desk-panel { top: calc((100vh - var(--rail)) * 0.68); }
}

/* Big moments sit in the upper part of the screen, above the pile, so they never hide the card you have to match */
.splash { place-items: start center; padding-top: 13vh; font-size: clamp(48px, 11vw, 190px); }
.splash.is-on { animation-duration: 1.3s; }

/* ================================================================ character cards: your avatar, from assets/characterCard */
.face-card.has-art { padding: 0; background: none; overflow: hidden; display: block; }
.face-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.char-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.char-opt { appearance: none; border: 0; background: rgba(0, 0, 0, 0.25); color: inherit; font: inherit; border-radius: 12px; padding: 6px; display: grid; gap: 4px; justify-items: center; cursor: pointer; }
.char-opt img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 8px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); }
.char-opt span { font-size: 0.78em; font-weight: 800; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.char-opt.is-on { box-shadow: 0 0 0 3px var(--yellow); background: rgba(245, 197, 24, 0.16); }
.char-opt.is-taken { opacity: 0.4; cursor: default; }
.char-opt.is-taken img { filter: grayscale(1); }
.char-opt.is-random b { width: 100%; aspect-ratio: 5 / 7; display: grid; place-items: center; border-radius: 8px; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 8px, transparent 8px 16px); font-family: var(--font-display); font-size: 2.2em; color: var(--muted); }
.picker-empty { margin: 0; }
.char-panel { display: grid; gap: 8px; }
.lobby-you { display: flex; gap: 14px; align-items: center; }
.lobby-you .btn { margin-top: 6px; }
.lobby-avatar .face-card { --face-w: 84px; }
.lobby-thumb { display: inline-block; margin-right: 8px; vertical-align: middle; }
.lobby-thumb .face-card { --face-w: 30px; font-size: 4px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.lobby-thumb .face-card:not(.has-art) > * { display: none; }
.mseat-char { width: 30px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); margin-bottom: -10px; position: relative; z-index: 0; }
.join-box .char-picker { max-height: 38vh; }

/* Shop wares that aren't cards: a card of the kind you name, a charge, getting rid of a card */
.ware-token { width: clamp(96px, 8.5vw, 170px); aspect-ratio: 5 / 7; border-radius: 10%; display: grid; place-items: center; font-family: var(--font-display); font-size: clamp(40px, 4vw, 80px); background: repeating-linear-gradient(135deg, #2b2935 0 10px, #3a3746 10px 20px); color: #ffe9c2; box-shadow: inset 0 0 0 4px rgba(255, 233, 194, 0.3); }
.ph-shop-table .ware-token { width: 64px; font-size: 30px; }
.ph-shop-table { flex-wrap: wrap; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pick-chips .chip { appearance: none; border: 0; font: inherit; font-weight: 800; border-radius: 999px; padding: 0.4em 0.9em; background: rgba(0, 0, 0, 0.45); color: #ffe9c2; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255, 233, 194, 0.4); }
.pick-chips .chip.is-on { background: var(--yellow); color: var(--dark-ink); }
.shop-log .pick-chips { justify-content: flex-start; margin-bottom: 0.4em; }

/* A wild on top of the pile: the color its player named */
.named-color { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 800; background: rgba(0, 0, 0, 0.7); color: #fff; border-radius: 999px; padding: 0.15em 0.7em; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); white-space: nowrap; }
.discard .named-color { position: absolute; left: 50%; bottom: -0.9em; transform: translateX(-50%); z-index: 3; font-size: clamp(14px, 1.2vw, 24px); }
.ph-top { position: relative; }
.color-opts { display: grid; gap: 8px; }
.color-opt { display: flex; align-items: center; gap: 0.6em; }
.color-opt .swatch { width: 1.3em; height: 1.3em; }

/* Hold a card to look at it: big, with its archetype, aspects and what it does */
.card { -webkit-touch-callout: none; }
.inspect {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  background: rgba(8, 6, 16, 0.72);
  backdrop-filter: blur(4px);
  pointer-events: none;
  animation: inspect-in 140ms ease-out;
}
@keyframes inspect-in { from { opacity: 0; transform: scale(0.94); } }
.inspect-card .card.size-xl { --w: min(36vh, 300px, 60vw); }
.inspect-info { display: grid; gap: 8px; width: min(360px, 90vw); background: rgba(20, 14, 34, 0.92); border-radius: 16px; padding: 14px 16px; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.4); }
.inspect-name { font-family: var(--font-display); font-size: 1.5em; line-height: 1.05; color: var(--yellow); }
.inspect-kind { font-weight: 800; color: var(--muted); }
.inspect-rules { margin: 2px 0 0; line-height: 1.35; }
@media (max-width: 700px) {
  .inspect { flex-direction: column; gap: 14px; }
  .inspect-card .card.size-xl { --w: min(30vh, 220px); }
}
@media (prefers-reduced-motion: reduce) { .inspect { animation: none; } }
/* The display font everywhere, including overlays outside the table (the held-card view) */
:root { --font-display: 'Infuno Digits', 'Pixelify Sans', 'Bricolage Grotesque', system-ui, sans-serif; }
/* Origin: flavor, not something cards match on */
.aspect.is-flavor { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.aspect.is-flavor span { font-weight: 600; font-style: italic; }
.inspect-info .aspect { grid-template-columns: 4.2em 1fr; }

/* Lords: their own mana (purple diamonds, separate from the mana pips) and powers */
.lord-mana { display: inline-flex; gap: 3px; margin-left: 0.5em; vertical-align: middle; }
.lord-mana .lm { width: 0.7em; height: 0.7em; transform: rotate(45deg); border-radius: 2px; background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.lord-mana .lm.is-on { background: #a86bff; box-shadow: 0 0 6px rgba(168, 107, 255, 0.75); }
.lord-panel { display: grid; gap: 8px; background: rgba(0, 0, 0, 0.35); border-radius: 14px; padding: 8px 10px; box-shadow: inset 0 0 0 2px rgba(255, 157, 58, 0.35); max-width: 100%; }
.lord-head { display: flex; gap: 10px; align-items: center; }
.lord-head .card { --w: 44px; }
.lord-head b { color: var(--yellow); }
.lord-powers { display: flex; flex-wrap: wrap; gap: 6px; }
.lord-btn { font-size: 0.85em; padding: 0.45em 0.8em; }
.lord-btn small { color: #ff9d3a; font-weight: 800; }
.pick-card { appearance: none; border: 0; background: none; padding: 2px; cursor: pointer; border-radius: 10px; }
.pick-card:hover { box-shadow: 0 0 0 3px var(--yellow); }
.desk-mine .lord-panel { font-size: clamp(12px, 0.85vw, 16px); max-width: 26vw; }
.ph .my-fams .lord-panel { flex-basis: 100%; }
.ph .my-fams { flex-wrap: wrap; }
.ph .my-fams .lord-panel { width: 100%; min-width: 0; box-sizing: border-box; }
.lord-head > div { min-width: 0; }
/* Long log lines and wide panels never push the phone view sideways */
.ph-scroll { grid-template-columns: minmax(0, 1fr); }
.ticker { min-width: 0; }
.ticker-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hurry up! */
.btn-hurry { background: #ff9d3a; color: var(--dark-ink); }
.btn-hurry:disabled { opacity: 0.7; }
.btn-hurry small { font-weight: 800; opacity: 0.75; }
.plaque .hurry { color: #ff9d3a; font-family: var(--font-display); }
.hurry-banner .hurry-left { color: #ff9d3a; }

/* ---------------------------------------------------------------- card editor and deck builder (/editor, /decks) */

.ed-body { height: auto; min-height: 100%; }
.ed-body #app { height: auto; }
.ed-body .chip { appearance: none; border: 0; font: inherit; font-weight: 700; font-size: 0.9em; border-radius: 999px; padding: 0.35em 0.85em; background: var(--table-3); color: var(--ink); cursor: pointer; }
.ed-body .chip.is-on { background: var(--yellow); color: var(--dark-ink); }
.ed-body .chip small { opacity: 0.7; margin-left: 0.3em; }
.ed-body input[type='number'], .ed-body select, .ed-body textarea, .ed-body input.ed-small {
  border: 2px solid var(--line); background: var(--table-2); border-radius: 10px; padding: 0.45em 0.6em; font-size: 1em; color: var(--ink); min-width: 0;
}
.ed-body textarea { width: 100%; resize: vertical; font: inherit; }
.ed-body input[type='number'] { width: 7em; }
.ed-body input:focus, .ed-body select:focus, .ed-body textarea:focus { border-color: var(--focus); outline: none; }
.ed-body code { background: var(--table-3); padding: 0.05em 0.35em; border-radius: 6px; font-size: 0.9em; }

.ed-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--table); border-bottom: 2px solid var(--table-3); flex-wrap: wrap; }
.ed-home { font-family: 'Pixelify Sans', var(--font); font-weight: 700; font-size: 1.4em; color: var(--ink); text-decoration: none; }
.ed-home span { color: var(--yellow); margin-left: 0.2em; }
.ed-tabs { display: flex; gap: 6px; }
.ed-tab { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 800; font-size: 1.1em; padding: 0.4em 0.9em; border-radius: 999px; cursor: pointer; }
.ed-tab.is-on { background: var(--table-3); color: var(--ink); }
.ed-head-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ed-head-tools .btn { padding: 0.5em 1em; }

.ed-main { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 20px; padding: 20px; align-items: start; }
.ed-browser { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; background: var(--table-2); border-radius: 18px; padding: 14px; display: grid; gap: 12px; align-content: start; }
.ed-filters { display: grid; gap: 8px; }
.ed-filters input[type='text'] { font-size: 1em; padding: 0.55em 0.8em; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-check { display: flex; align-items: center; gap: 0.4em; font-size: 0.95em; color: var(--muted); cursor: pointer; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.ed-pick { appearance: none; border: 0; background: transparent; padding: 3px; border-radius: 12px; cursor: pointer; position: relative; display: grid; place-items: center; }
.ed-pick:hover { background: var(--table-3); }
.ed-pick.is-on { background: var(--yellow); }
.ed-badge { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 0.62em; font-weight: 800; background: var(--purple); color: #fff; border-radius: 999px; padding: 0 0.5em; white-space: nowrap; }
.ed-more { justify-self: center; }
.ed-tip { margin: 0; font-size: 0.92em; }
.ed-picking { background: var(--yellow); color: var(--dark-ink); border-radius: 12px; padding: 0.6em 0.8em; display: flex; align-items: center; gap: 0.6em; justify-content: space-between; font-weight: 600; }
.ed-picking .btn { color: var(--dark-ink); box-shadow: inset 0 0 0 2px var(--dark-ink); padding: 0.35em 0.9em; }

.ed-work { min-width: 0; display: grid; gap: 16px; align-content: start; }
.ed-empty { background: var(--table-2); border-radius: 18px; padding: 24px; display: grid; gap: 10px; max-width: 640px; }
.ed-empty .btn { justify-self: start; }
.ed-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.ed-preview { position: sticky; top: 80px; display: grid; gap: 10px; justify-items: center; }
.ed-preview .card.size-xl { --w: min(34vh, 280px); }
.ed-art-drop { position: relative; padding: 14px; border-radius: 22px; border: 3px dashed var(--line); display: grid; place-items: center; gap: 8px; }
.ed-art-hint { font-size: 0.85em; color: var(--muted); text-align: center; }
.ed-art-hint.is-touch { display: none; }
@media (hover: none) { .ed-art-hint.is-mouse { display: none; } .ed-art-hint.is-touch { display: block; } }
.ed-art-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ed-art-tools .btn { padding: 0.5em 1em; }
.ed-seg { display: inline-flex; background: var(--table-3); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.ed-seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 0.9em; padding: 0.35em 0.85em; border-radius: 999px; cursor: pointer; }
.ed-seg button.is-on { background: var(--paper); color: var(--dark-ink); }
.ed-form { display: grid; gap: 14px; background: var(--table-2); border-radius: 18px; padding: 18px; min-width: 0; }
.ed-field { display: grid; gap: 6px; min-width: 0; }
.ed-field > span { font-weight: 800; }
.ed-field > span small { font-weight: 500; color: var(--muted); }
.ed-field input[type='text'] { font-size: 1em; padding: 0.55em 0.8em; }
.ed-note { margin: 0; font-size: 0.88em; }
.ed-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-color { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; background: var(--fill, #888); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.ed-color.c-red { --fill: var(--red); } .ed-color.c-yellow { --fill: var(--yellow); } .ed-color.c-green { --fill: var(--green); } .ed-color.c-blue { --fill: var(--blue); }
.ed-color.c-black { --fill: var(--black); } .ed-color.c-white { --fill: var(--white); } .ed-color.c-purple { --fill: var(--purple); } .ed-color.c-orange { --fill: var(--orange); }
.ed-color.c-pink { --fill: var(--pink); } .ed-color.c-gray { --fill: var(--gray); } .ed-color.c-brown { --fill: var(--brown); }
.ed-color.c-none { background: repeating-linear-gradient(135deg, #cfcbe0 0 4px, #bdb8d0 4px 8px); }
.ed-color.is-on { box-shadow: 0 0 0 3px var(--table-2), 0 0 0 6px var(--yellow); }
.ed-colors .ed-small { width: 9em; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-danger { color: #ff8d8d; }
.ed-ok { color: var(--good); font-weight: 700; }
.ed-err { color: #ff8d8d; font-weight: 700; }
.ed-power { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: var(--table-3); }
.ed-power-row { display: flex; gap: 6px; align-items: center; }
.ed-power-row .ed-small { flex: 1; }
.ed-power .btn { padding: 0.35em 0.7em; }
.ed-inline { display: inline-flex; align-items: center; gap: 0.5em; font-weight: 700; }
.ed-inline input[type='number'] { width: 5em; }

.ed-decklist { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-deck { display: grid; gap: 14px; background: var(--table-2); border-radius: 18px; padding: 18px; }
.ed-rows { display: grid; gap: 10px; }
.ed-row { background: var(--table-3); border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; }
.ed-row-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ed-row-head .ed-small { flex: 1 1 10em; font-weight: 700; }
.ed-row-head .btn { padding: 0.3em 0.65em; box-shadow: none; }
.ed-pool { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-sample { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 20px; }
.ed-row-cards { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ed-copy { display: grid; gap: 4px; justify-items: center; }
.ed-stepper { display: inline-flex; align-items: center; gap: 6px; background: var(--table-2); border-radius: 999px; padding: 2px; }
.ed-stepper button { appearance: none; border: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--table-3); color: var(--ink); font-weight: 800; cursor: pointer; }
.ed-stepper b { min-width: 1.4em; text-align: center; }
.ed-add { appearance: none; border: 2px dashed var(--line); background: transparent; color: var(--muted); border-radius: 10px; width: 92px; aspect-ratio: 5 / 7; font: inherit; font-weight: 700; font-size: 0.85em; cursor: pointer; padding: 6px; }
.ed-add.is-on { border-color: var(--yellow); color: var(--yellow); }
.ed-summary { position: sticky; bottom: 0; background: var(--table); border-top: 2px solid var(--table-3); padding: 12px 0; display: grid; gap: 10px; }
.ed-total { font-size: 1.2em; }
.ed-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; gap: 2px; font-size: 0.75em; font-weight: 700; }
.ed-bar-seg { display: grid; place-items: center; overflow: hidden; white-space: nowrap; color: #fff; background: var(--gray); min-width: 3px; }
.ed-bar-seg.a-numbers { background: var(--blue); } .ed-bar-seg.a-wilds { background: var(--pink); } .ed-bar-seg.a-mana { background: #2f8fd8; }
.ed-bar-seg.a-familiars { background: var(--green); } .ed-bar-seg.a-actions { background: var(--red); } .ed-bar-seg.a-equipment { background: var(--brown); }
.ed-bar-seg.a-resources { background: var(--orange); } .ed-bar-seg.a-lords { background: var(--purple); } .ed-bar-seg.a-story { background: #3aa59a; } .ed-bar-seg.a-hazards { background: var(--black); }
.ed-warn { margin: 0; padding-left: 1.2em; color: #ffcf6e; font-size: 0.92em; }
.ed-sim { background: var(--table-2); border-radius: 14px; padding: 12px 16px; }
.ed-sim h3 { font-size: 1em; margin-bottom: 6px; }
.ed-sim dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.ed-sim dt { font-weight: 800; }
.ed-sim dd { margin: 0; }

.ed-drop { position: fixed; inset: 0; z-index: 80; background: rgba(20, 18, 40, 0.75); display: grid; place-items: center; pointer-events: none; }
.ed-drop div { border: 4px dashed var(--yellow); color: var(--yellow); border-radius: 24px; padding: 40px 60px; font-size: 1.6em; font-weight: 800; background: rgba(0, 0, 0, 0.35); }

@media (max-width: 900px) {
  .ed-main { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .ed-browser { position: static; max-height: 46vh; }
  .ed-card { grid-template-columns: minmax(0, 1fr); }
  .ed-preview { position: static; }
  .ed-two { grid-template-columns: minmax(0, 1fr); }
  .ed-head { padding: 8px 12px; gap: 10px; }
}

/* ---------------------------------------------------------------- Customize: name, character card, card back */

.customize { display: grid; gap: 12px; }
.cust-name { display: grid; gap: 6px; cursor: text; }
.cust-label { font-weight: 800; }
.cust-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cust-pick { appearance: none; border: 0; background: rgba(0, 0, 0, 0.25); color: inherit; font: inherit; border-radius: 14px; padding: 10px 8px; display: grid; justify-items: center; gap: 2px; cursor: pointer; transition: box-shadow 120ms ease; }
.cust-pick:hover { background: rgba(0, 0, 0, 0.35); }
.cust-pick.is-open { box-shadow: 0 0 0 3px var(--yellow); background: rgba(245, 197, 24, 0.12); }
.cust-face { width: 72px; aspect-ratio: 5 / 7; display: grid; place-items: center; margin-bottom: 6px; }
.cust-face img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); }
.cust-face .card { --w: 72px; }
.cust-face.is-random { border-radius: 8px; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 8px, transparent 8px 16px); }
.cust-face.is-random b { font-family: var(--font-display); font-size: 2em; color: var(--muted); }
.cust-value { font-size: 0.85em; color: var(--muted); font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.cust-menu { background: rgba(0, 0, 0, 0.22); border-radius: 14px; padding: 8px; animation: cust-drop 160ms ease-out; transform-origin: top; }
@keyframes cust-drop { from { opacity: 0; transform: scaleY(0.85) translateY(-6px); } to { opacity: 1; transform: none; } }
.back-picker .char-opt .card { --w: 100%; width: 100%; font-size: 14px; }
.back-picker .picker-empty { grid-column: 1 / -1; margin: 0; }
.lobby-customize { background: var(--table-2); border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
.cust-title { font-weight: 800; font-size: 1.1em; }
.join-box .customize { text-align: left; }
@media (prefers-reduced-motion: reduce) { .cust-menu { animation: none; } }

/* ---------------------------------------------------------------- move animations (client/fx.ts) */

.fx-layer { position: fixed; inset: 0; z-index: 45; pointer-events: none; overflow: hidden; }
.fx-card { position: absolute; left: 0; top: 0; width: 88px; transform-origin: 50% 50%; will-change: transform, opacity; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.45)); }
.fx-card .card { --w: 88px; }
.fx-ghost { position: absolute; display: grid; place-items: center; }
.fx-ghost *, .fx-piece * { animation: none !important; transition: none !important; }
.fx-piece { position: absolute; display: grid; place-items: center; will-change: transform, opacity; }
.fx-fill { width: 100%; height: 100%; display: grid; place-items: center; }
.fx-fill .card { --w: 100%; width: 100%; }
.fx-spark { position: absolute; left: 0; top: 0; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; will-change: transform, opacity; }
.fx-flash { position: absolute; border-radius: 50%; mix-blend-mode: screen; will-change: transform, opacity; }
.fx-diamond { position: absolute; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #a86bff; box-shadow: 0 0 12px #c9a6ff, inset 0 0 0 2px rgba(255, 255, 255, 0.5); border-radius: 2px; will-change: transform, opacity; }

/* A Peek: the next cards to draw, beside the discard pile and a little smaller than it (only you see it) */
.peek-side { display: grid; gap: 4px; justify-items: start; }
.peek-label { font-size: 0.78em; font-weight: 800; color: #d6f5e0; }
.peek-label small { font-weight: 600; opacity: 0.7; }
.peek-fan { display: flex; }
.peek-fan .card { --w: clamp(56px, 19vw, 104px); box-shadow: 0 0.18em 0 rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(143, 211, 255, 0.6); }
.peek-fan .card + .card { margin-left: calc(var(--w) * -0.55); }
.pile-zone .peek-side { font-size: clamp(12px, 1vw, 18px); }
.pile-zone .peek-fan .card { --w: clamp(80px, 7.6vw, 160px); }
.mat:has(> .famcard ~ .famcard ~ .famcard ~ .famcard) .famcard { --fam-w: clamp(40px, 3.3vw, 70px); }
.ph .my-fams:has(> .famcard ~ .famcard ~ .famcard ~ .famcard) .famcard { --fam-w: clamp(46px, 13vw, 64px); }
.card.size-xs .card-glyph.is-huge { font-size: 0.85em; }
.ed-badge.is-edited { background: var(--orange); }
.ed-builtin { background: var(--table-3); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.ed-add.is-small { width: 56px; font-size: 0.72em; }

/* ---------------------------------------------------------------- the rules and the how-to pages (/rules, /guide) */

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-small { padding: 0.4em 0.9em; font-size: 0.9em; }
.doc-body { height: auto; min-height: 100%; }
.doc-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 20px; background: var(--table); border-bottom: 2px solid var(--table-3); }
.doc-links { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-links a { color: var(--muted); text-decoration: none; font-weight: 800; padding: 0.35em 0.9em; border-radius: 999px; }
.doc-links a[aria-current='page'] { background: var(--table-3); color: var(--ink); }
.doc { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; line-height: 1.55; }
.doc h1 { font-size: clamp(1.9em, 6vw, 2.6em); margin: 0.2em 0 0.3em; }
.doc h2 { font-size: 1.35em; margin: 0 0 0.4em; color: var(--yellow); }
.doc section { background: var(--table-2); border-radius: 18px; padding: 18px 20px; margin: 14px 0; scroll-margin-top: 70px; }
.doc p { margin: 0.5em 0; }
.doc ul, .doc ol { margin: 0.4em 0; padding-left: 1.3em; }
.doc li { margin: 0.25em 0; }
.doc a { color: #8fd3ff; }
.doc .btn { color: inherit; }
.doc .btn-go { color: var(--dark-ink); }
.doc-lead { font-size: 1.12em; color: var(--muted); }
.doc-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.doc-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.doc-toc a { background: var(--table-3); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.9em; padding: 0.3em 0.8em; border-radius: 999px; }
.doc-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0.5em 0; }
.doc-dl dt { font-weight: 800; }
.doc-dl dd { margin: 0; }
.doc-table { width: 100%; border-collapse: collapse; margin: 0.5em 0; }
.doc-table th, .doc-table td { text-align: left; padding: 0.45em 0.6em; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table th { color: var(--muted); font-size: 0.9em; }
@media (max-width: 560px) {
  .doc-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .doc-dl dd { margin-bottom: 8px; }
  .doc section { padding: 14px 14px; }
}

/* ---------------------------------------------------------------- owner mode and the approval queue */
.ed-role { font-weight: 700; color: #ffd166; padding: 0 .4rem; align-self: center; }
.ed-count { font-style: normal; background: #ef476f; color: #fff; border-radius: 999px; padding: 0 .45em; font-size: .8em; margin-left: .25em; }
.ed-guest { background: rgba(255, 209, 102, .12); border: 1px solid rgba(255, 209, 102, .35); border-radius: 10px; margin: .5rem 1rem 0; padding: .55rem .8rem; font-size: .92rem; }
.ed-main.is-queue { grid-template-columns: 1fr; }
.ed-main.is-queue .ed-browser { display: none; }
.ed-queue { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.ed-qitem { display: flex; gap: 1rem; padding: 1rem; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); align-items: flex-start; }
.ed-qprev { flex: none; --w: 120px; }
.ed-qinfo { display: grid; gap: .4rem; min-width: 0; }
.ed-qwhat { font-weight: 700; }
.ed-qdeck { width: 150px; display: grid; gap: .2rem; font-size: .85rem; }
.ed-qdeck ul { margin: 0; padding-left: 1.1em; color: var(--muted, #aab); }
.ed-modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 90; }
.ed-modal { position: fixed; z-index: 91; left: 50%; top: 18vh; transform: translateX(-50%); width: min(380px, calc(100vw - 32px)); background: #26224a; border-radius: 16px; padding: 1.2rem; display: grid; gap: .7rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.ed-modal h2 { margin: 0; }
.ed-modal input { font: inherit; padding: .6rem .7rem; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .25); color: inherit; }
