/* Card Lounge — a felt table under everything; chrome is smoked glass on the
   felt, sheets are paper. The table colour (data-table) and the light/dark
   paper (data-theme) are the player's; the cards are the deck's own art. */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 0.75, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.35, 0.5, 1);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .7 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --cw: 70px;
  --ch: 98px;

  /* felt (data-table) */
  --felt: #22684c;
  --felt-hi: #2f835f;
  --felt-lo: #10382a;
  --grain: 0.42;
  --on-table: #f7f1e1;
  --on-table-soft: rgba(247, 241, 225, 0.7);
  --chrome: rgba(4, 22, 15, 0.26);
  --chrome-hover: rgba(4, 22, 15, 0.42);
  --chrome-line: rgba(255, 255, 255, 0.12);
  --outline: rgba(255, 255, 255, 0.22);

  /* accents */
  --gold: #e3bd62;
  --gold-2: #b98c33;
  --gold-ink: #2b2010;
  --glow: rgba(255, 214, 110, 0.85);
  --hint: #8ff0cf;
  --hint-glow: rgba(143, 240, 207, 0.9);
  --danger: #ff8a7a;
  --seat-0: #f2c94c;
  --seat-1: #6fc3ff;
  --seat-2: #ff8fa3;
  --seat-3: #9be27a;

  /* paper (data-theme) */
  color-scheme: light;
  --paper: #fbf6ea;
  --paper-2: #efe7d4;
  --paper-3: #e4d9c0;
  --ink: #2a251d;
  --ink-soft: #6c6252;
  --line: rgba(60, 45, 25, 0.13);
  --backdrop: rgba(6, 18, 12, 0.5);
  --ca-accent: #1d6a4b; /* the accounts SDK's buttons: white on it reaches 4.5:1 */
}

[data-table="blue"] { --felt: #1f4a78; --felt-hi: #2c6198; --felt-lo: #0d2140; --chrome: rgba(4, 12, 30, 0.28); --chrome-hover: rgba(4, 12, 30, 0.44); }
[data-table="wine"] { --felt: #6e1f2c; --felt-hi: #8c2d3b; --felt-lo: #340a12; --chrome: rgba(30, 4, 8, 0.28); --chrome-hover: rgba(30, 4, 8, 0.44); --grain: 0.34; }
[data-table="graphite"] { --felt: #33373f; --felt-hi: #444955; --felt-lo: #16181c; --chrome: rgba(0, 0, 0, 0.26); --chrome-hover: rgba(0, 0, 0, 0.42); --grain: 0.3; }

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1b211e;
  --paper-2: #252d29;
  --paper-3: #313b36;
  --ink: #ece6d6;
  --ink-soft: #a3ab9f;
  --line: rgba(255, 255, 255, 0.1);
  --backdrop: rgba(0, 4, 2, 0.62);
  --felt-hi: color-mix(in oklab, var(--felt) 88%, white);
}
[data-theme="dark"] .felt { filter: brightness(0.72) saturate(0.9); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; --paper: #1b211e; --paper-2: #252d29; --ink: #ece6d6; --ink-soft: #a3ab9f; --line: rgba(255, 255, 255, 0.1); }
}

* { box-sizing: border-box; }
/* iPhone, iPad: no double-tap zoom — js/touch-guard.js adds the same rule plus
   a JS fallback; this copy covers Safari before 16.4 under the strict CSP */
:where(html, body, body *) { touch-action: manipulation; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--sans);
  color: var(--on-table);
  background: var(--felt-lo);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; }
.sheet-body.text p, .sheet-body.text li { -webkit-user-select: text; user-select: text; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- the felt */
.felt {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(125% 95% at 50% 42%, transparent 40%, rgba(0, 0, 0, 0.48) 100%),
    radial-gradient(90% 75% at 50% 36%, var(--felt-hi), var(--felt) 56%, var(--felt-lo));
  transition: background 0.6s, filter 0.6s;
}
.felt::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--noise);
  opacity: var(--grain);
  mix-blend-mode: overlay;
}
.felt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 40% at 50% 100%, rgba(255, 236, 190, 0.07), transparent 70%);
}

/* ---------------------------------------------------------------- screens */
.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.enter { animation: screen-in 0.42s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } }

.top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 4px 14px;
  width: 100%;
  max-width: 980px;
  justify-self: center;
  min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img { flex: 0 0 auto; width: 38px; height: 38px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35)); }
.brand span, .titles { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; overflow: hidden; }
.brand b, .titles b { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: 0.015em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small, .titles small { font-size: 11px; color: var(--on-table-soft); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.titles { flex: 1; }
.status-inline { display: none; }
.titles b { font-size: 20px; }
.menu { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.account-slot { display: inline-flex; margin-left: 4px; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s var(--spring);
}
.icon-btn:hover { background: var(--chrome-hover); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg, .btn svg, .chev, .opt svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--chrome-line);
  background: var(--chrome);
  color: var(--on-table);
  font: 600 15px/1 var(--sans);
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background 0.2s, transform 0.2s var(--spring), opacity 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--chrome-hover); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.42; cursor: default; transform: none; }
.btn.primary { color: var(--gold-ink); background: linear-gradient(180deg, var(--gold), var(--gold-2)); border-color: rgba(0, 0, 0, 0.18); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(227, 189, 98, 0.25), 0 6px 16px -8px rgba(0, 0, 0, 0.6); } }

/* ---------------------------------------------------------------- lounge */
.lounge { grid-template-rows: auto minmax(0, 1fr); }
.lounge-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px 16px 28px;
  width: 100%;
  max-width: 980px;
  justify-self: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.section { margin: 8px 4px -4px; font: 600 13px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-table-soft); animation: tile-in 0.5s var(--ease) both; }
.greet { margin: 6px 4px 0; font-family: var(--serif); font-size: 17px; color: var(--on-table-soft); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tile {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 4px 14px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)), var(--chrome);
  border: 1px solid var(--chrome-line);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.35s var(--spring), box-shadow 0.3s, background 0.3s;
  animation: tile-in 0.6s var(--ease) both;
  text-align: left;
  color: inherit;
  font: inherit;
}
.tile:nth-child(2) { animation-delay: 0.06s; }
.tile:nth-child(3) { animation-delay: 0.12s; }
#tiles-table .tile { animation-delay: 0.16s; }
#tiles-table .tile:nth-child(2) { animation-delay: 0.22s; }
#tiles-table .tile:nth-child(3) { animation-delay: 0.28s; }
@keyframes tile-in { from { opacity: 0; transform: translateY(14px); } }
.tile:hover { transform: translateY(-2px); box-shadow: 0 24px 48px -26px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.tile:active { transform: scale(0.985); }
.tile-art { grid-row: 1 / span 3; position: relative; width: 112px; height: 112px; }
.tile-art img {
  position: absolute;
  width: 52px;
  height: 72.8px;
  left: 30px;
  top: 20px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--tr, 0deg)) scale(var(--ts, 1));
  transition: transform 0.5s var(--spring);
}
.tile:hover .tile-art img { transform: translate(calc(var(--tx, 0px) * 1.12), calc(var(--ty, 0px) * 1.08)) rotate(calc(var(--tr, 0deg) * 1.2)) scale(var(--ts, 1)); }
.tile h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: 0.01em; }
.tile p { margin: 0; font-size: 13.5px; line-height: 1.35; color: var(--on-table-soft); }
.tile-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; background: rgba(0, 0, 0, 0.22); font-size: 12px; font-weight: 600; color: var(--on-table-soft); }
.pill svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.pill.go { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: var(--gold-ink); }
.tile .rules-mini { position: absolute; right: 8px; top: 8px; width: 38px; height: 38px; color: var(--on-table-soft); }

.deck-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border-radius: 20px;
  border: 1px solid var(--chrome-line);
  background: var(--chrome);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  animation: tile-in 0.6s 0.18s var(--ease) both;
  transition: background 0.2s;
}
.deck-strip:hover { background: var(--chrome-hover); }
.deck-fan { position: relative; width: 92px; height: 64px; flex: 0 0 auto; }
.deck-fan img { position: absolute; left: 30px; top: 2px; width: 40px; height: 56px; border-radius: 3px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); transform-origin: 50% 120%; transform: rotate(var(--tr, 0deg)); }
.deck-strip-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.deck-strip-text b { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.deck-strip-text small { color: var(--on-table-soft); font-size: 13px; }
.chev { opacity: 0.7; }

/* ---------------------------------------------------------------- game */
.game { grid-template-rows: auto minmax(0, 1fr) auto; }
.table-wrap { position: relative; min-height: 0; }
.table { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.table.busy .slot { pointer-events: none; }
.slots { position: absolute; inset: 0; z-index: 0; }
.ghosts { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.ghosts i { position: absolute; left: 0; top: 0; width: var(--w); height: var(--h); transform: translate(var(--x), var(--y)) rotate(var(--rot)); border-radius: calc(var(--w) * 0.08); border: 1.5px dashed rgba(255, 255, 255, 0.16); background: rgba(0, 0, 0, 0.06); }
.cards { position: absolute; inset: 0; pointer-events: none; z-index: 1; isolation: isolate; }
.overlay { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  transform-origin: 50% 50%;
  will-change: transform;
  perspective: 900px;
  pointer-events: auto;
  cursor: pointer;
}
.card-flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.38s cubic-bezier(0.3, 0.7, 0.3, 1);
  border-radius: calc(var(--cw) * 0.072);
}
.card.down .card-flip { transform: rotateY(180deg); }
.card.no-flip-anim .card-flip { transition: none; }
.card-face, .card-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: inherit;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.28), 0 2px 5px rgba(0, 0, 0, 0.14);
  transition: box-shadow 0.25s, filter 0.25s;
}
.card-back { transform: rotateY(180deg); }
.card.moving .card-face, .card.moving .card-back, .card.dragging .card-face, .card.dragging .card-back { box-shadow: 0 10px 22px -6px rgba(0, 0, 0, 0.5), 0 2px 5px rgba(0, 0, 0, 0.2); }
.card.dragging { cursor: grabbing; }
.card.hint .card-face, .card.hint .card-back { box-shadow: 0 0 0 2.5px var(--hint), 0 0 18px 2px var(--hint-glow); animation: glow 1.1s ease-in-out infinite; }
.card.selected .card-face { box-shadow: 0 0 0 2.5px var(--gold), 0 0 16px 2px var(--glow), 0 8px 16px -6px rgba(0, 0, 0, 0.5); }
.card.target .card-face, .card.target .card-back { box-shadow: 0 0 0 2.5px var(--gold), 0 0 14px 1px var(--glow); }
.card.capture .card-face { box-shadow: 0 0 0 3px #ffb35c, 0 0 20px 3px rgba(255, 170, 70, 0.85); }
.card.taken .card-face { box-shadow: 0 0 0 3px #ffd36b, 0 0 28px 6px rgba(255, 214, 110, 0.95); }
.card.playable .card-face { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 4px 10px -4px rgba(0, 0, 0, 0.5); }
.card.dim .card-face { filter: brightness(0.72) saturate(0.8); }
.card.lost .card-face { filter: grayscale(0.7) brightness(0.8); }
@keyframes glow { 50% { box-shadow: 0 0 0 2.5px var(--hint), 0 0 6px 0 var(--hint-glow); } }

.slot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  height: var(--h);
  transform: translate(var(--x), var(--y)) rotate(var(--rot, 0deg));
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--cw) * 0.08);
  background: transparent;
  color: var(--outline);
  cursor: pointer;
  font: 600 calc(var(--cw) * 0.34) / 1 var(--serif);
}
.slot.empty::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  border: 2px solid var(--outline);
  background: rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.18);
}
.slot-column.empty::before { height: var(--ch); }
.slot-cell.empty::before { border-style: dashed; border-width: 1.5px; background: rgba(0, 0, 0, 0.08); }
.slot.hot::before { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 16px var(--glow); background: rgba(255, 214, 110, 0.12); }
.slot:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.slot:disabled { cursor: default; }
.slot-stock.empty::before { content: "↻"; font-size: calc(var(--cw) * 0.5); color: var(--on-table-soft); }
.slot-stock.empty.done::before { content: ""; }

/* labels the views place on the table */
.seat {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot, 0deg));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px 0 6px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--on-table);
  font: 600 13px/1 var(--sans);
  white-space: nowrap;
  transition: background 0.3s, box-shadow 0.3s, opacity 0.3s;
  font-variant-numeric: tabular-nums;
}
.seat .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c, var(--seat-0)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); display: grid; place-items: center; }
.seat .dot svg { width: 12px; height: 12px; fill: none; stroke: rgba(0, 0, 0, 0.6); stroke-width: 2.4; }
.seat .score { color: var(--gold); margin-left: 2px; }
.seat.active { background: rgba(0, 0, 0, 0.42); box-shadow: 0 0 0 2px var(--c, var(--gold)), 0 0 18px -2px var(--c, var(--gold)); }
.seat.thinking .dot { animation: think 0.9s ease-in-out infinite; }
@keyframes think { 50% { transform: scale(0.8); opacity: 0.7; } }
.seat.out { opacity: 0.55; }

.float {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot, 0deg));
  font: 700 22px/1 var(--serif);
  color: #ffe29a;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  animation: float-up 1.3s var(--ease) forwards;
  white-space: nowrap;
}
.float small { display: block; font: 600 11px/1.3 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-table); text-align: center; }
@keyframes float-up { 0% { opacity: 0; margin-top: 8px; } 15% { opacity: 1; margin-top: 0; } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -26px; } }

.prompt {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot, 0deg));
  max-width: 92%;
  padding: 7px 14px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--on-table);
  font: 500 13.5px/1.25 var(--sans);
  text-align: center;
  transition: opacity 0.3s;
}
.prompt b { color: var(--c, var(--gold)); }
.label-small { position: absolute; left: 0; top: 0; transform: translate(var(--x), var(--y)) translate(-50%, -50%) rotate(var(--rot, 0deg)); font: 600 11px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-table-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translate(-50%, 16px);
  max-width: min(92%, 440px);
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(10, 16, 13, 0.82);
  color: #f6f0e0;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.4s var(--spring);
  z-index: 9000;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px 10px;
  width: 100%;
  max-width: 760px;
  justify-self: center;
  min-height: 62px;
}
.actions:empty { min-height: 8px; padding: 0; }
.actions .btn { flex: 1 1 0; max-width: 170px; min-width: 0; padding: 0 10px; }
.btn .stack { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; gap: 2px; min-width: 0; }
.btn .stack small { font-size: 12.5px; font-weight: 700; opacity: 0.85; font-variant-numeric: tabular-nums; }
.actions .btn span { overflow: hidden; text-overflow: ellipsis; }
.status { margin: 0; align-self: center; text-align: center; padding: 10px 16px; border-radius: 16px; background: var(--chrome); border: 1px solid var(--chrome-line); font-size: 15px; line-height: 1.3; max-width: 560px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: tile-in 0.3s var(--ease); }
.status b { color: var(--c, var(--gold)); }
.example > i { display: inline-block; width: 12px; }
.hud-line { align-self: center; color: var(--on-table-soft); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- sheets */
dialog { color: var(--ink); }
.sheet, .dialog {
  border: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.04);
  max-height: min(88dvh, 820px);
}
.sheet { width: min(94vw, 460px); border-radius: 26px; display: none; flex-direction: column; overflow: hidden; }
.sheet.wide { width: min(94vw, 640px); }
.sheet[open] { display: flex; animation: sheet-in 0.36s var(--ease); }
.sheet.closing { animation: sheet-out 0.22s ease-in forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(12px) scale(0.98); } }
.sheet::backdrop, .dialog::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in 0.3s; }
@keyframes fade-in { from { opacity: 0; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 12px 8px 22px; }
.sheet h2, .dialog h2 { font-family: var(--serif); font-weight: 600; font-size: 23px; margin: 0; letter-spacing: 0.01em; }
.sheet .icon-btn { color: var(--ink-soft); }
.sheet .icon-btn:hover { background: var(--paper-2); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 22px 22px; -webkit-overflow-scrolling: touch; }
.sheet-body h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; margin: 22px 0 6px; }
.sheet-body .lead { margin: 0 0 14px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.sheet-foot { padding: 10px 22px 20px; display: flex; gap: 10px; }
.sheet-foot.two .btn { flex: 1; }
.sheet .btn, .dialog .btn { color: var(--ink); background: var(--paper-2); border-color: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet .btn:hover, .dialog .btn:hover { background: var(--paper-3); }
.sheet .btn.primary, .dialog .btn.primary { color: var(--gold-ink); background: linear-gradient(180deg, var(--gold), var(--gold-2)); border-color: rgba(0, 0, 0, 0.15); }
.sheet .btn svg { width: 19px; height: 19px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 54px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.row > span:first-child { flex: 1; min-width: 0; }
select {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  min-height: 40px;
  padding: 0 12px;
}
.version { color: var(--ink-soft); font-size: 13px; margin: 18px 0 0; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); }
.seg button {
  appearance: none;
  border: 0;
  min-height: 34px;
  min-width: 44px;
  padding: 0 11px;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font: 600 13.5px/1 var(--sans);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.seg button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.swatches { display: inline-flex; gap: 8px; }
.swatches button { appearance: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--line); cursor: pointer; background: var(--sw); transition: transform 0.2s var(--spring), box-shadow 0.2s; }
.swatches button[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--gold); transform: scale(1.06); }
.sw-green { --sw: radial-gradient(circle at 35% 30%, #3a9a6e, #1a5a40); }
.sw-blue { --sw: radial-gradient(circle at 35% 30%, #3b74b0, #15335a); }
.sw-wine { --sw: radial-gradient(circle at 35% 30%, #a0384a, #4c0f1a); }
.sw-graphite { --sw: radial-gradient(circle at 35% 30%, #5d6370, #22252b); }

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 50px;
  height: 30px;
  border-radius: 99px;
  background: var(--paper-3);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex: 0 0 auto;
  margin: 0;
}
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--spring); }
.switch:checked { background: #2f9a6c; }
.switch:checked::after { transform: translateX(20px); }

.tabs { display: flex; gap: 4px; padding: 0 18px 8px; overflow-x: auto; scrollbar-width: none; }
.tabs button { appearance: none; border: 0; flex: 0 0 auto; min-height: 38px; padding: 0 14px; border-radius: 99px; background: var(--paper-2); color: var(--ink-soft); font: 600 14px/1 var(--sans); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

.menu-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 22px; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); font: 600 15.5px/1.2 var(--sans); cursor: pointer; text-align: left; transition: background 0.2s; }
.opt:hover { background: var(--paper-3); }
.opt small { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.opt.danger { color: #b3261e; }
[data-theme="dark"] .opt.danger { color: var(--danger); }

/* rules */
.text { font-size: 15px; line-height: 1.55; }
.text p { margin: 0 0 12px; }
.text ul { margin: 0 0 12px; padding-left: 20px; }
.text li { margin: 4px 0; }
.text h3:first-child { margin-top: 6px; }
.example { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 4px 0 14px; padding: 12px; border-radius: 14px; background: radial-gradient(90% 90% at 50% 40%, var(--felt-hi), var(--felt) 70%); }
.example img { width: 44px; height: 61.6px; border-radius: 3.5px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.example img.lit { box-shadow: 0 0 0 2px #ffb35c, 0 0 12px rgba(255, 170, 70, 0.8); }
.example .op { color: #fff; font: 700 18px/1 var(--serif); padding: 0 2px; }
.example .grid4 { display: grid; grid-template-columns: repeat(4, 44px); gap: 5px; }
.example .grid4 i { width: 44px; height: 61.6px; border-radius: 4px; border: 1.5px dashed rgba(255, 255, 255, 0.25); }
.example .grid3 { display: grid; grid-template-columns: repeat(3, 44px); gap: 5px; }
.example figcaption { flex-basis: 100%; text-align: center; color: #f6f0e0; font-size: 12.5px; margin-top: 4px; }

/* statistics */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.stat { padding: 12px 14px; border-radius: 16px; background: var(--paper-2); }
.stat b { display: block; font: 600 24px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--ink-soft); }
.hist { list-style: none; margin: 4px 0 0; padding: 0; }
.hist li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist li span:last-child { color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist .win { color: #2f9a6c; font-weight: 600; }
.empty-note { color: var(--ink-soft); font-size: 14px; margin: 8px 0; }
.friends { margin-top: 6px; min-height: 60px; }

/* decks */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; }
.deck-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.3s var(--spring), border-color 0.2s, box-shadow 0.2s;
}
.deck-card:hover { transform: translateY(-2px); }
.deck-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.deck-card .fan { position: relative; height: 96px; border-radius: 12px; background: radial-gradient(100% 100% at 50% 30%, var(--felt-hi), var(--felt) 70%); overflow: hidden; }
.deck-card .fan img { position: absolute; left: 50%; top: 12px; width: 48px; height: 67.2px; margin-left: -24px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35); transform-origin: 50% 130%; transform: rotate(var(--tr, 0deg)); transition: transform 0.4s var(--spring); }
.deck-card:hover .fan img { transform: rotate(calc(var(--tr, 0deg) * 1.25)); }
.deck-card.locked .fan img { filter: grayscale(0.85) brightness(0.75); }
.deck-card b { font-family: var(--serif); font-weight: 600; font-size: 16.5px; }
.deck-card small { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; }
.deck-card .state { position: absolute; right: 16px; top: 16px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); color: #fff; }
.deck-card .state svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.deck-card[aria-pressed="true"] .state { background: var(--gold); color: var(--gold-ink); }
.bar { height: 6px; border-radius: 99px; background: var(--paper-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: inherit; transition: width 0.6s var(--ease); }

/* setup */
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.seat-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-radius: 16px; background: var(--paper-2); animation: tile-in 0.35s var(--ease); }
.seat-row .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); }
.seat-row input { width: 100%; min-width: 0; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 500 15px/1 var(--sans); }
.seat-row .kind { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.seat-row .kind button { appearance: none; border: 0; width: 38px; height: 34px; border-radius: 8px; background: transparent; color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; }
.seat-row .kind button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.seat-row .kind svg, .seat-row .remove svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seat-row .remove { appearance: none; border: 0; width: 34px; height: 34px; border-radius: 50%; background: transparent; color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; }
.seat-row .remove:disabled { visibility: hidden; }
.seat-row .level { grid-column: 2 / -1; display: flex; gap: 6px; }
.seat-row .level .seg { width: 100%; }
.seat-row .level .seg button { flex: 1; }
.add-seat { margin-top: 8px; }
.setup-note { color: var(--ink-soft); font-size: 13px; margin: 8px 2px 0; line-height: 1.4; }

/* results */
#sheet-result { text-align: center; }
#sheet-result h2 { padding: 0 22px; margin-top: 4px; font-size: 27px; }
.result-art { position: relative; height: 112px; margin-top: 18px; }
.result-art img { position: absolute; left: 50%; top: 6px; width: 62px; height: 86.8px; margin-left: -31px; border-radius: 5px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); transform-origin: 50% 140%; animation: fan-in 0.8s var(--spring) both; transform: rotate(var(--tr)); }
@keyframes fan-in { from { transform: rotate(0deg) translateY(16px); opacity: 0; } }
.result-sub { color: var(--ink-soft); margin: 6px 0 12px; font-size: 15px; }
.score-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-variant-numeric: tabular-nums; font-size: 14px; }
.score-table th, .score-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.score-table th:first-child, .score-table td:first-child { text-align: left; }
.score-table .me td { font-weight: 700; }
.score-table .win td:first-child::after { content: " ★"; color: var(--gold-2); }
.score-wrap { overflow-x: auto; }
.unlock-box { margin: 14px 0 4px; padding: 14px; border-radius: 18px; background: linear-gradient(160deg, rgba(227, 189, 98, 0.25), rgba(227, 189, 98, 0.08)); border: 1px solid rgba(185, 140, 51, 0.35); text-align: center; }
.unlock-box b { display: block; font-family: var(--serif); font-size: 18px; margin-bottom: 8px; }
.unlock-box .fan { position: relative; height: 92px; margin-bottom: 10px; }
.unlock-box .fan img { position: absolute; left: 50%; top: 4px; width: 52px; height: 72.8px; margin-left: -26px; border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transform-origin: 50% 140%; transform: rotate(var(--tr)); animation: fan-in 0.9s 0.3s var(--spring) both; }

.dialog { border-radius: 24px; padding: 22px; width: min(90vw, 380px); }
.dialog[open] { animation: sheet-in 0.3s var(--ease); }
.dialog p { margin: 8px 0 18px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.dialog .row { border: 0; padding: 0; min-height: 0; gap: 10px; }
.dialog .row .btn { flex: 1; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 380px) {
  .brand small { display: none; }
  .top { padding-left: 10px; }
  .tile { grid-template-columns: 92px minmax(0, 1fr); padding: 12px; }
  .tile-art { width: 92px; height: 100px; transform: scale(0.86); transform-origin: 0 50%; }
  .actions .btn { font-size: 14px; gap: 6px; }
  .actions .btn svg { width: 20px; height: 20px; }
}
@media (max-width: 340px) {
  .actions .btn span { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .top { min-height: 46px; padding-top: 4px; padding-bottom: 0; }
  .titles small { display: none; }
  .titles .status-inline:not(:empty) { display: block; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--on-table); }
  .titles .status-inline b { font: inherit; font-weight: 700; letter-spacing: 0; text-shadow: none; color: var(--c, var(--gold)); }
  .actions:has(.status) { display: none; }
  .actions { min-height: 52px; padding-bottom: 6px; }
  .actions .btn { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
