:root {
  /* Spacing and radius tokens (US-125); new rules use them, older ones keep their literals until they are touched. */
  --space-1: .25rem; --space-2: .5rem; --space-3: 1rem; --space-4: 1.5rem; --radius-sm: 10px; --radius-md: 16px;
  color: #f8f5ea;
  background: #071a20;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font-sans);
  font-synthesis: none;
  --ink: #fffaf2;
  --muted: #c5c5df;
  --night: #171333;
  --panel: rgba(35, 30, 78, .84);
  --felt: #0d9678;
  --felt-dark: #066551;
  --gold: #ffd166;
  --gold-soft: #ffe7a8;
  --red: #ff647c;
  --aqua: #63e6d3;
  --violet: #8c73ff;
  --pink: #ff7eb6;
  --paper: #fffdf8;
  --black-card: #172125;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  /* The comic table and cards (US-086). US-087 overrides these per theme. */
  --card-ink: #111;
  --outline-width: 3px;
  --radius-card: 7px;
  --radius-chip: 999px;
  --shadow-hard: 4px 4px 0 var(--card-ink);
  --felt: #1f9d8a;
  --felt-dot: rgba(0, 0, 0, .12);
  --rim: #5b2b82;
  --rim-edge: var(--card-ink);
  --card-paper: #fffdf2;
  --card-red: #d62839;
  --card-black: #1b1b2f;
  --card-back-a: #5b2b82;
  --card-back-b: #ffd23f;
  --seat-bg: #2a1d5c;
  /* The cartoon site (US-100): the tilt of sticker cards and the corner of paper panels. */
  --tilt: 1.2deg;
  /* White text on the felt is outlined in ink, as on the table. */
  --text-outline: 1px 1px 0 var(--card-ink), -1px 1px 0 var(--card-ink), 1px -1px 0 var(--card-ink), -1px -1px 0 var(--card-ink), 2px 2px 0 var(--card-ink);
  /* The same outline without the drop, for small text where a 2px drop reads as doubled letters (US-111). */
  --text-outline-thin: 1px 1px 0 var(--card-ink), -1px 1px 0 var(--card-ink), 1px -1px 0 var(--card-ink), -1px -1px 0 var(--card-ink);
  --radius-panel: 12px;
}

/* Table themes (US-087): each overrides only the table and card-back tokens; comic is the default above. */
body[data-theme="classic-green"] { --felt: #2f8f4e; --felt-dot: rgba(0, 0, 0, .13); --rim: #7a4a22; --seat-bg: #3b2a18; --card-back-a: #b3202f; --card-back-b: #f1e3b5; }
body[data-theme="midnight"] { --felt: #1b2a5e; --felt-dot: rgba(255, 255, 255, .09); --rim: #3d4f9e; --seat-bg: #0f1738; --card-back-a: #1b2a5e; --card-back-b: #4cc9f0; }
body[data-theme="forest"] { --felt: #1f6b4a; --felt-dot: rgba(255, 255, 255, .08); --rim: #5a7d3a; --seat-bg: #10281c; --card-back-a: #1f6b4a; --card-back-b: #c9e4a1; }
body[data-theme="ruby"] { --felt: #8c1d3b; --felt-dot: rgba(255, 255, 255, .08); --rim: #c2566f; --seat-bg: #3d0e1c; --card-back-a: #8c1d3b; --card-back-b: #f4c3d0; }
body[data-theme="gilded"] { --felt: #6b5314; --felt-dot: rgba(255, 255, 255, .09); --rim: #d4a017; --seat-bg: #2e2306; --card-back-a: #d4a017; --card-back-b: #2e2306; }
body[data-theme="sunset"] { --felt: #e8704a; --felt-dot: rgba(0, 0, 0, .1); --rim: #8c2f39; --seat-bg: #5a1f2b; --card-back-a: #ff5d8f; --card-back-b: #ffd23f; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--night); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  /* The page is the table's felt (US-100), so the four themes recolour the whole site. */
  background: radial-gradient(var(--felt-dot) 1.4px, transparent 1.6px) 0 0 / 9px 9px, var(--felt);
}

button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }

.shell {
  margin: 0 auto;
  min-height: 100vh;
  padding: 1.6rem clamp(1rem, 4vw, 3rem) 4rem;
  position: relative;
  z-index: 1;
  width: min(100%, 1240px);
}

/* The brand is a paper sticker (US-100). */
.brand {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-hard);
  display: inline-flex;
  line-height: 0;
  padding: .2rem .7rem;
  text-decoration: none;
  transform: rotate(calc(var(--tilt) * -1));
}
.brand img { display: block; height: 3rem; width: auto; }

.home-view, .destination-view { margin-top: clamp(3.8rem, 9vw, 7rem); }
:is([data-view="table"]) { margin-top: 2.8rem; }

.eyebrow {
  color: #fff;
  text-shadow: var(--text-outline);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .2em;
  margin: 0 0 .75rem;
  text-transform: uppercase;
}
h1 {
  font-family: var(--font-sans);
  font-size: clamp(3rem, 8vw, 6.8rem);
  font-weight: 900;
  letter-spacing: -.065em;
  line-height: 1.05;
  margin: 0 0 1.25rem;
  max-width: 850px;
  text-shadow: var(--text-outline);
}
h1 em { color: var(--gold); font-style: normal; position: relative; }
h2, h3 { letter-spacing: -.025em; text-shadow: var(--text-outline); }
.intro, .destination-view > p:not(.eyebrow) {
  color: #fff;
  font-weight: 700;
  text-shadow: var(--text-outline);
  font-family: inherit;
  font-size: clamp(1.08rem, 2vw, 1.3rem);
  line-height: 1.6;
  max-width: 42rem;
}

/* The hero deal (US-092): four card backs are dealt out to the four seats and gathered again. Full loops it;
   Reduced and Off leave the cards dealt out. */
.hero-deal { height: 0; pointer-events: none; position: relative; }
.deal-stage { height: 11rem; position: absolute; right: 8%; top: 1rem; width: 11rem; }
.deal-card {
  --dx: 0px; --dy: 0px; --dr: 0deg;
  animation: hero-deal 6s cubic-bezier(.3, 1.3, .5, 1) infinite;
  background: repeating-conic-gradient(var(--card-back-a) 0 15deg, var(--card-back-b) 15deg 30deg);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-card);
  box-shadow: 2px 2px 0 var(--card-ink);
  height: 4.6rem;
  left: calc(50% - 1.6rem);
  position: absolute;
  top: calc(50% - 2.3rem);
  width: 3.2rem;
}
.deal-card:nth-child(1) { --dx: 0px; --dy: -3.6rem; --dr: 8deg; animation-delay: 0s; }
.deal-card:nth-child(2) { --dx: 3.8rem; --dy: 0px; --dr: 98deg; animation-delay: .25s; }
.deal-card:nth-child(3) { --dx: 0px; --dy: 3.6rem; --dr: -6deg; animation-delay: .5s; }
.deal-card:nth-child(4) { --dx: -3.8rem; --dy: 0px; --dr: 82deg; animation-delay: .75s; }
@keyframes hero-deal {
  0%, 8% { transform: translate(0, 0) rotate(calc(var(--dr) * .1)); }
  26%, 68% { transform: translate(var(--dx), var(--dy)) rotate(var(--dr)); }
  90%, 100% { transform: translate(0, 0) rotate(calc(var(--dr) * .1)); }
}
.welcome-badges { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.3rem; }
.account-bar { margin-top: 1.4rem; }
.account-bar p { align-items: center; color: #fff; font-weight: 700; text-shadow: var(--text-outline); display: flex; flex-wrap: wrap; font-size: .88rem; gap: .6rem .9rem; margin: 0; }
.account-bar .button { font-size: .8rem; margin-top: 0; padding: .55rem 1rem; }
#account-name { color: #fff; font-weight: 900; }
/* Headings inside paper are ink without the felt's outline. */
.sign-in-panel :is(h2, h3), .private-form :is(h2, h3), .settings-panel :is(h2, h3), .stats-panel :is(h2, h3), .round-result :is(h2, h3) { text-shadow: none; }
/* Paper panels (US-100): an ink outline, the hard shadow and ink text; --ink and --muted are re-pointed so the
   existing light-on-dark rules inside read dark on paper. */
.sign-in-panel, .private-form, .settings-panel, .stats-tile, .stats-panel, .setting-choice {
  --ink: var(--card-ink);
  --muted: #4b4358;
  --gold-soft: #6b4300;
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-hard);
  color: var(--card-ink);
}
.sign-in-panel {
  display: grid;
  gap: .8rem;
  margin-top: 1rem;
  max-width: 34rem;
  padding: 1.1rem;
}
.passkey-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.passkey-warning { display: grid; gap: .6rem; }
.passkey-warning p { color: var(--ink); font-size: .88rem; font-weight: 600; margin: 0; }
.sign-in-panel .button { font-size: .8rem; justify-self: start; margin-top: 0; padding: .55rem 1rem; }
.sign-in-panel .sign-in-status:empty { display: none; }
.sign-in-panel .sign-in-status { color: var(--gold-soft); font-size: .85rem; margin: 0; }
.welcome-badges span { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--card-ink); color: var(--card-ink); font-size: .74rem; font-weight: 900; padding: .35rem .8rem; }
.welcome-badges span:nth-child(odd) { transform: rotate(calc(var(--tilt) * -1)); }
.welcome-badges span:nth-child(even) { transform: rotate(var(--tilt)); }

.mode-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 3rem;
}
/* Mode cards (US-100): sticker cards, each its own colour, alternately tilted. The tilt is a resting state kept at every
   effects level; hover lifts and bounces the card on its tilt (Full), or only lifts it (Reduced), or not at all (Off). */
button.mode-card { cursor: pointer; font: inherit; text-align: left; width: 100%; }
/* The "New to Belote?" banner (US-104): a paper sticker above the mode cards. */
.tutorial-banner { align-items: center; background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: var(--radius-panel); box-shadow: var(--shadow-hard); color: var(--card-ink); display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin: 1.4rem 0 1rem; padding: .9rem 1.2rem; }
.tutorial-banner[hidden] { display: none; }
.tutorial-banner p { flex: 1 1 14rem; font-size: 1.05rem; font-weight: 900; margin: 0; }
.tutorial-banner .button { margin-top: 0; }
.tutorial-banner .text-button { color: var(--card-ink); }
.customise-line { margin: .8rem 0 0; }
.mode-card {
  --card-tilt: calc(var(--tilt) * -1);
  align-items: center;
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-hard);
  color: var(--card-ink);
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 3.4rem 1fr auto;
  min-height: 120px;
  padding: 1.35rem;
  position: relative;
  text-decoration: none;
  transform: rotate(var(--card-tilt));
  transition: transform .2s ease, box-shadow .2s ease;
}
.mode-card:nth-child(even) { --card-tilt: var(--tilt); }
.mode-card:hover, .mode-card:focus-visible {
  box-shadow: 6px 10px 0 var(--card-ink);
  transform: translateY(-6px) rotate(var(--card-tilt));
}
.mode-card:focus-visible { outline: 3px solid var(--card-paper); outline-offset: 4px; }
.mode-card:hover, .mode-card:focus-visible { animation: mode-bounce .45s cubic-bezier(.3, 1.6, .5, 1); }
.mode-card:active { animation: none; box-shadow: 1px 1px 0 var(--card-ink); transform: translate(3px, 3px) rotate(var(--card-tilt)); }
@keyframes mode-bounce {
  from { transform: translateY(0) rotate(var(--card-tilt)); }
  50% { transform: translateY(-12px) rotate(var(--card-tilt)); }
  to { transform: translateY(-6px) rotate(var(--card-tilt)); }
}
body[data-effects="reduced"] .mode-card:hover,
body[data-effects="reduced"] .mode-card:focus-visible { animation: none; }
body[data-effects="off"] .mode-card:hover,
body[data-effects="off"] .mode-card:focus-visible,
body[data-effects="off"] .mode-card:active { animation: none; transform: rotate(var(--card-tilt)); }
body[data-effects="reduced"] .mode-card:active { transform: rotate(var(--card-tilt)); }
body[data-effects="off"] .mode-card { transition: none; }

/* A view entered from the home screen arrives (US-092); Reduced only fades it in, Off shows it at once. */
.view-arrive { animation: view-arrive .35s ease-out both; }
@keyframes view-arrive { from { opacity: 0; transform: translateY(18px); } }
body[data-effects="reduced"] .view-arrive { animation: fade-in var(--effect-fast) both; }
body[data-effects="off"] .view-arrive { animation: none; }
.mode-card:nth-child(1) { background: var(--gold); }
.mode-card:nth-child(2) { background: var(--pink); }
.mode-card:nth-child(3) { background: var(--aqua); }
.mode-card:nth-child(4) { background: var(--violet); }
.mode-card:nth-child(5) { background: var(--card-paper); }
.mode-card:nth-child(6) { background: var(--gold-soft); }
.card-icon {
  align-items: center;
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 12px;
  display: flex;
  font-size: 1.8rem;
  height: 3.4rem;
  justify-content: center;
  width: 3.4rem;
}
.mode-card .card-icon { transform: rotate(-4deg); }
.mode-card:hover .card-icon { transform: rotate(5deg) scale(1.08); transition: transform .2s ease; }
.mode-copy { display: grid; gap: .35rem; }
.mode-copy strong { font-family: var(--font-sans); font-size: 1.25rem; }
.mode-copy small { color: inherit; font-size: .84rem; font-weight: 600; line-height: 1.45; }
.rule-note { color: #fff; font-weight: 700; text-shadow: var(--text-outline); font-size: .76rem; margin-top: 1.5rem; text-align: center; }

/* The button set (US-100): a gold pill with an ink outline and the hard shadow; hover lifts it, a press pushes it into
   its shadow. Secondary is paper, danger is red; a disabled button is flat. */
.button {
  background: var(--gold);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 999px;
  box-shadow: var(--shadow-hard);
  color: var(--card-ink);
  cursor: pointer;
  display: inline-flex;
  font-size: .9rem;
  font-weight: 900;
  gap: .45rem;
  justify-content: center;
  margin-top: 1.5rem;
  padding: .75rem 1.25rem;
  text-decoration: none;
  text-shadow: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.play-now { font-size: 1.25rem; margin-top: .4rem; padding: .9rem 2.2rem; }
#play-now-message:empty { display: none; }
.button:hover:not(:disabled) { box-shadow: 4px 6px 0 var(--card-ink); transform: translateY(-2px); }
.button:active:not(:disabled) { box-shadow: 1px 1px 0 var(--card-ink); transform: translate(3px, 3px); }
.button:disabled { box-shadow: none; cursor: not-allowed; opacity: .55; }
/* The focus ring: an ink gap and a paper ring, visible on felt, paper and gold alike. */
.button:focus-visible, .tab:focus-visible, .brand:focus-visible, .text-link:focus-visible,
.playing-card[role="button"]:focus-visible, input:focus-visible, select:focus-visible {
  box-shadow: 0 0 0 3px var(--card-ink);
  outline: 3px solid var(--card-paper);
  outline-offset: 3px;
}
.text-link { color: #fff; font-size: .84rem; font-weight: 900; text-decoration: underline; text-shadow: var(--text-outline); }
.text-link:hover { text-decoration-thickness: 3px; }
.your-data { margin-top: 1.5rem; }
.your-data h2 { margin-top: 0; }
.your-data-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .75rem; }
.delete-confirm { display: grid; gap: .6rem; margin-top: 1rem; }
.delete-confirm input { max-width: 16rem; }
.danger-button { background: var(--red); color: var(--card-ink); }
.account-notice { font-weight: 800; margin: 0 0 .5rem; }
.home-footer { margin-top: .75rem; text-align: center; }
.app-version { margin-left: .5rem; font-size: .85em; opacity: .75; user-select: text; }
.app-version::before { content: "·"; margin-right: .5rem; }
.sign-in-privacy { margin: .5rem 0 0; }
.privacy-view section { margin-top: 1.5rem; }
.privacy-view ul { display: grid; gap: .6rem; padding-left: 1.2rem; }
.privacy-facts { display: grid; gap: .35rem 1rem; grid-template-columns: minmax(8rem, max-content) 1fr; margin: .75rem 0; }
.privacy-facts dt { font-weight: 800; }
.privacy-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .privacy-facts { grid-template-columns: 1fr; } .privacy-facts dd { margin-bottom: .5rem; } }
.text-button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 900;
  margin-left: auto;
  text-decoration: underline;
}

.setup-help { color: #fff; margin-top: .8rem; text-shadow: var(--text-outline); }
.setup-help summary { cursor: pointer; font-size: .84rem; font-weight: 900; text-decoration: underline; }
.setup-help p { font-size: .9rem; font-weight: 700; line-height: 1.45; margin: .4rem 0 0; max-width: 36rem; }

/* The score bar (US-096): stays at the top of the page through the whole game. Its z-index is above the seats
   (at most 30) and below the pass-and-play cover (1000). Only its progress bars transition (US-091); the effects
   rules below shorten that to --effect-fast at Reduced and remove it at Off. */
.score-bar {
  align-items: center;
  background: var(--seat-bg);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 18px;
  box-shadow: var(--shadow-hard);
  display: grid;
  flex: none;
  gap: .3rem .8rem;
  grid-template-columns: 1fr auto 1fr;
  margin: 0 0 .5rem;
  padding: .3rem .5rem;
}
/* The table header (US-106): the score bar and the menu/status bar stick together, under the pass-and-play cover. */
.table-header { position: sticky; top: 0; z-index: 40; }
.table-bar { align-items: center; background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 18px; box-shadow: 3px 3px 0 var(--card-ink); color: var(--card-ink); display: flex; gap: .6rem; margin: 0 0 .5rem; padding: .25rem .5rem; position: relative; }
.table-bar[hidden] { display: none; }
.table-menu-toggle { background: var(--gold); border: 2px solid var(--card-ink); border-radius: 999px; color: var(--card-ink); cursor: pointer; flex: none; font-size: .8rem; font-weight: 900; padding: .35rem .8rem; }
.table-menu-toggle:focus-visible, .table-menu :is(a, button):focus-visible { outline: 3px solid var(--card-ink); outline-offset: 2px; }
.table-undo { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: var(--radius-panel); color: var(--card-ink); cursor: pointer; font: inherit; font-weight: 900; min-height: 2.75rem; padding: 0 .8rem; text-shadow: none; }
.table-undo[hidden] { display: none; }
.table-status { flex: 1; font-size: .95rem; font-weight: 900; margin: 0; min-width: 0; text-align: right; }
.table-menu { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 14px; box-shadow: var(--shadow-hard); color: var(--card-ink); display: grid; left: .5rem; min-width: 12rem; padding: .3rem; position: absolute; top: calc(100% + .3rem); z-index: 5; }
.table-menu[hidden], .table-menu [hidden] { display: none; }
.table-menu :is(a, button) { background: none; border: 0; border-radius: 10px; color: var(--card-ink); cursor: pointer; font: inherit; font-size: .9rem; font-weight: 800; padding: .65rem .8rem; text-align: left; text-decoration: none; }
.table-menu :is(a, button):hover { background: var(--gold); }
/* Leaving is set apart under a divider, away from the frequent entries. */
.table-menu .table-menu-leave { border-top: 2px solid var(--card-ink); border-radius: 0 0 10px 10px; color: #8c1d1d; margin-top: .5rem; padding-top: .8rem; }
.score-team {
  align-items: baseline;
  border: var(--outline-width) solid transparent;
  border-radius: var(--radius-chip);
  display: flex;
  flex-wrap: wrap;
  gap: .15rem .45rem;
  min-width: 0;
  padding: .1rem .7rem;
}
.score-team[data-team="1"] { justify-content: flex-end; }
/* Each chip's distance to the target: the outlined track shows even at 0; only the fill's transform moves. */
.score-progress {
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--card-ink);
  border-radius: var(--radius-chip);
  box-sizing: border-box;
  display: block;
  flex: 0 0 100%;
  height: 6px;
  overflow: hidden;
}
.score-progress i {
  background: var(--gold);
  display: block;
  height: 100%;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  transition: transform 700ms ease-out;
}
.score-team.progress-snap .score-progress i { transition: none; }
.score-team.mine { background: rgba(255, 209, 102, .14); border-color: var(--gold); }
.team-name { color: var(--muted); font-size: .78rem; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.match-points { color: var(--gold); font-size: 1.35rem; font-variant-numeric: tabular-nums; font-weight: 900; }
.round-points { color: var(--aqua); font-size: .8rem; font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1.2; }
.round-points:empty { display: none; }
.you-mark {
  align-self: center;
  background: var(--gold);
  border-radius: var(--radius-chip);
  color: var(--card-ink);
  font-size: .62rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
  padding: .1rem .4rem;
  text-transform: uppercase;
}
.score-target { color: var(--ink); font-size: .78rem; font-weight: 800; text-align: center; white-space: nowrap; }

/* Phone: each team's chip takes two lines, name and match score above, round points and "You" below. */
@media (max-width: 600px) {
  .score-bar { border-width: 2px; box-shadow: 3px 3px 0 var(--card-ink); gap: .4rem; margin-bottom: .2rem; padding: .2rem .3rem; }
  .score-team {
    align-content: center;
    display: grid;
    gap: 0 .35rem;
    grid-template-columns: auto auto;
    justify-content: start;
    padding: .1rem .5rem calc(.1rem + 7px);
    position: relative;
  }
  .score-team[data-team="1"] { justify-content: end; }
  .team-name { font-size: .66rem; }
  .match-points { font-size: 1.1rem; line-height: 1.2; }
  .round-points { font-size: .7rem; grid-column: 1; }
  .you-mark { font-size: .55rem; grid-column: 2; grid-row: 2; justify-self: start; }
  /* Out of the grid, so the track always spans the chip's content width, whatever the digits. */
  .score-progress { bottom: .1rem; left: .5rem; position: absolute; right: .5rem; }
  .score-target { font-size: .68rem; }
}

.card-table {
  aspect-ratio: 1.65;
  background: radial-gradient(var(--felt-dot) 1.4px, transparent 1.6px) 0 0 / 9px 9px, var(--felt);
  border: 10px solid var(--rim);
  border-radius: 34% / 22%;
  box-shadow: 0 0 0 4px var(--rim-edge), 8px 10px 0 var(--card-ink);
  margin: 1.5rem 0 1rem;
  min-height: 610px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
.card-table::before {
  border: 2px dashed rgba(255,255,255,.22);
  border-radius: inherit;
  content: "";
  inset: 7%;
  pointer-events: none;
  position: absolute;
}
.card-table::after {
  color: rgba(255,255,255,.13);
  content: "♠  BEELOT  ♣";
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 4vw, 3.5rem);
  font-weight: 800;
  left: 50%;
  letter-spacing: .25em;
  position: absolute;
  top: 48%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  z-index: -1;
}

/* The turned card is read at a glance (US-107): larger than the cards of the hand. */

.upturned-card .playing-card { height: var(--ch); width: var(--cw); }

.secondary-button { background: var(--card-paper); color: var(--card-ink); }

.player-station {
  align-items: center;
  background: var(--seat-bg);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-chip);
  box-shadow: 3px 3px 0 var(--card-ink);
  display: flex;
  gap: .55rem;
  min-width: 145px;
  padding: .42rem .75rem .42rem .42rem;
  position: absolute;
  rotate: -1.5deg;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  z-index: 4;
}
.player-station.active-player {
  box-shadow: 0 0 0 var(--outline-width) var(--aqua), 3px 3px 0 var(--outline-width) var(--card-ink);
  transform: translateY(-2px);
}
.station-top.active-player, .station-bottom.active-player { transform: translateX(-50%) translateY(-2px); }
.player-station.active-player::after {
  background: var(--aqua);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--aqua);
  content: "";
  height: 7px;
  position: absolute;
  right: 9px;
  top: -4px;
  width: 7px;
}

.player-call {
  animation: call-pop .28s cubic-bezier(.2, .9, .3, 1.25) both;
  background: var(--paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 12px 12px 12px 4px;
  box-shadow: 3px 3px 0 var(--card-ink);
  color: #34224d;
  font-size: .68rem;
  font-weight: 900;
  left: 50%;
  max-width: 130px;
  padding: .4rem .55rem;
  position: absolute;
  text-align: center;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 8;
}

.station-top .player-call {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

.station-left .player-call,
.station-right .player-call,
.station-bottom .player-call {
  bottom: calc(100% + 7px);
  top: auto;
}

.player-call { font-size: .8rem; padding: .5rem .7rem; }
.player-call.call-arriving { animation: call-pop .7s cubic-bezier(.2, .9, .3, 1.1) both; }
.player-call.stale { opacity: .6; }
.player-call[data-red="true"] { color: #c2263f; }
.player-call[data-kind="bid"], .player-call[data-kind="trump"] { background: #fff7d6; }
.player-call[data-kind="pass"] { background: #d9d4e8; color: #5a5378; font-weight: 700; }
.player-call[data-kind="coinche"] { animation: call-pop .7s cubic-bezier(.2, .9, .3, 1.1) both, call-shake .5s .3s ease-in-out; background: #ff5d73; color: #fff; }

/* The station reacts to its player's call with a coloured ripple, tinted by the kind of call. */
.player-station { --call-color: rgba(255, 209, 102, .7); }
.player-station[data-call-kind="pass"] { --call-color: rgba(154, 147, 184, .8); }
.player-station[data-call-kind="coinche"] { --call-color: rgba(255, 93, 115, .9); }
.player-station.call-flash { animation: call-ripple 1.3s ease-out; }

.player-station.deciding {
  animation: deciding-glow 1s ease-in-out infinite;
  border-color: var(--gold);
}
.deciding .player-call:not(.player-thinking) { visibility: hidden; }
.player-thinking { align-items: center; display: flex; gap: 4px; }
.player-thinking i {
  animation: thinking-dot 1s ease-in-out infinite;
  animation-delay: calc(var(--dot) * .18s);
  background: #34224d;
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.auction-waiting-view { cursor: wait; }
.auction-waiting-view .active-player .player-avatar { animation: bidder-thinking .9s ease-in-out infinite; }

.player-avatar {
  align-items: center;
  background: linear-gradient(145deg, var(--gold), #ff9f43);
  border-radius: 50%;
  color: #173530;
  display: flex;
  flex: 0 0 auto;
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 900;
  height: 2.2rem;
  justify-content: center;
  width: 2.2rem;
}
.station-left .player-avatar { background: linear-gradient(145deg, var(--pink), #ff647c); color: #4b1730; }
.station-top .player-avatar { background: linear-gradient(145deg, var(--aqua), #36bfc0); color: #083c3b; }
.station-right .player-avatar { background: linear-gradient(145deg, #b19cff, #7a61f2); color: #21164d; }
/* A bot draws its character, which carries its own coloured disc: no station gradient behind it. */
.player-avatar.bot-avatar { background: none; }
.player-details { display: grid; line-height: 1.1; }
.player-details strong { font-family: var(--font-sans); font-size: .82rem; white-space: nowrap; }
.player-details small { color: var(--muted); font-size: .58rem; margin-top: .2rem; white-space: nowrap; }

.station-top { left: 50%; top: 3%; transform: translateX(-50%); }
.station-left { left: 2%; top: 30%; }
.station-right { right: 2%; top: 30%; }
.station-bottom { bottom: 19%; left: 50%; transform: translateX(-50%); }

.hidden-hand {
  height: 104px;
  left: 50%;
  position: absolute;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  width: 132px;
}
.station-left .hidden-hand { left: calc(100% + 36px); top: 50%; transform: rotate(90deg) translate(-50%, -50%); transform-origin: top left; }
.station-right .hidden-hand { left: -42px; top: 50%; transform: rotate(90deg) translate(-50%, -50%); transform-origin: top left; }

.card-back {
  background: repeating-conic-gradient(var(--card-back-a) 0 15deg, var(--card-back-b) 15deg 30deg);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-card);
  box-shadow: 2px 2px 0 var(--card-ink);
  height: 104px;
  left: calc(var(--card-index) * 8px);
  position: absolute;
  top: 0;
  transform: rotate(calc((var(--card-index) - 3.5) * 2deg));
  transform-origin: 50% 110%;
  width: 72px;
}

.card-back::after {
  background: var(--card-paper);
  border: 2px solid var(--card-ink);
  border-radius: 50%;
  color: var(--card-ink);
  content: "B";
  font: 900 .95rem/1.45rem var(--font-sans);
  height: 1.7rem;
  left: 50%;
  margin: -.85rem 0 0 -.85rem;
  position: absolute;
  text-align: center;
  top: 50%;
  width: 1.7rem;
}

.table-center {
  left: 50%;
  position: absolute;
  text-align: center;
  top: 49%;
  transform: translate(-50%, -50%);
  width: min(46%, 420px);
  z-index: 2;
}
.trick-progress {
  background: rgba(35,26,83,.86);
  border-radius: 999px;
  color: var(--muted);
  display: inline-block;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin-bottom: .55rem;
  padding: .35rem .65rem;
  text-transform: uppercase;
}
.current-trick {
  align-items: center;
  color: #fff;
  display: flex;
  font-size: .74rem;
  font-weight: 700;
  /* Ink outline: the table message stays readable on every theme's felt. */
  text-shadow: 1px 1px 0 var(--card-ink), -1px 1px 0 var(--card-ink), 1px -1px 0 var(--card-ink), -1px -1px 0 var(--card-ink);
  gap: .45rem;
  justify-content: center;
  min-height: 92px;
  padding: .5rem;
}
.current-trick > * { text-shadow: none; }
.current-trick .playing-card.card-arriving {
  animation: card-drop .45s cubic-bezier(.2, .8, .3, 1.15) var(--reveal-delay, 0ms) both;
}
/* A card with a known origin (Full effects) flies in from it, then squashes on landing. card-land has no
   fill mode so it does not override the flight's scale; the card then rests at its own angle. */
.current-trick .playing-card.card-arriving.flies {
  animation: card-fly .28s cubic-bezier(.2, .7, .3, 1) var(--reveal-delay, 0ms) both,
    card-land .12s ease-out calc(var(--reveal-delay, 0ms) + 280ms);
}
.trick-slot .playing-card { rotate: var(--rest-angle, 0deg); }
.current-trick .trick-player.card-arriving { animation: label-in .3s ease var(--reveal-delay, 0ms) both; }
.arriving-late { animation: fade-up .45s ease var(--reveal-delay, 0ms) both; }
.trick-diamond {
  height: 240px;
  margin: 0 auto;
  position: relative;
  width: 280px;
}
.trick-diamond::before {
  background: rgba(21, 103, 82, .28);
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 12px;
  content: "";
  height: 100px;
  left: 90px;
  position: absolute;
  top: 65px;
  transform: rotate(45deg);
  width: 100px;
}
.trick-slot { height: 104px; position: absolute; width: 72px; z-index: 1; }
.trick-slot-top { left: 104px; top: 0; }
.trick-slot-right { right: 0; top: 68px; }
.trick-slot-bottom { bottom: 0; left: 104px; }
.trick-slot-left { left: 0; top: 68px; }
.trick-player {
  background: rgba(35, 26, 83, .88);
  border-radius: 999px;
  bottom: -15px;
  color: var(--ink);
  font-size: .52rem;
  font-weight: 800;
  left: 50%;
  max-width: 78px;
  overflow: hidden;
  padding: .18rem .35rem;
  position: absolute;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}
.trick-winner { z-index: 3; }
/* A collected trick slides towards the seat of the player who won it. */
.trick-collecting { --collect-x: 0px; --collect-y: 0px; }
.trick-collecting.collect-to-bottom { --collect-y: 170px; }
.trick-collecting.collect-to-top { --collect-y: -170px; }
.trick-collecting.collect-to-left { --collect-x: -280px; }
.trick-collecting.collect-to-right { --collect-x: 280px; }
.trick-collecting::before { animation: label-in .3s ease reverse forwards; }
.trick-collecting .trick-slot { animation: trick-collect .52s cubic-bezier(.5, 0, .75, .4) forwards; }
.trick-collecting .trick-player, .trick-collecting .trick-points { opacity: 0; transition: opacity .15s ease; }
.trick-winner .winning-card {
  animation: winning-card-pop .4s ease-out;
  border-color: var(--gold);
  box-shadow: 0 0 0 var(--outline-width) var(--gold), 4px 4px 0 var(--outline-width) var(--card-ink);
  transform: translateY(-4px) scale(1.08);
}
.trick-winner .trick-player { bottom: auto; top: -20px; }
.trick-points {
  background: linear-gradient(135deg, var(--gold), #ff9f43);
  border: 2px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .35);
  color: #34224d;
  font-size: .68rem;
  left: 50%;
  padding: .2rem .42rem;
  position: absolute;
  top: calc(100% + 5px);
  transform: translateX(-50%);
  white-space: nowrap;
}

.card-hand { display: flex; flex-wrap: wrap; gap: .45rem; }
.table-hand {
  bottom: 2.5%;
  flex-wrap: nowrap;
  gap: 0;
  justify-content: center;
  left: 50%;
  max-width: 70%;
  position: absolute;
  transform: translateX(-50%);
  width: max-content;
  z-index: 5;
}
.playing-card {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-hard);
  color: var(--card-black);
  container-type: inline-size;
  display: block;
  flex: 0 0 auto;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 900;
  height: 104px;
  overflow: hidden;
  position: relative;
  transition: transform .16s ease, rotate .16s ease, translate .16s ease, box-shadow .16s ease;
  width: 72px;
}
.table-hand .playing-card {
  animation: hand-in .28s cubic-bezier(.2,.8,.2,1) both;
  /* The place in the fan, set by fillHand; composes with the transform lifts below. */
  rotate: var(--fan-rot, 0deg);
  translate: 0 var(--fan-y, 0px);
}
.table-hand .playing-card + .playing-card { margin-left: -11px; }
.playing-card.hearts, .playing-card.diamonds { color: var(--card-red); }
.card-index {
  align-items: center;
  display: flex;
  flex-direction: column;
  left: 4px;
  line-height: 1;
  position: absolute;
  top: 3px;
  z-index: 2;
}
.card-index strong { font-size: 24cqw; }
.card-index .suit { display: block; height: 40cqw; width: 40cqw; }
.card-face.court-face { bottom: 0; height: 76%; position: absolute; right: 2%; width: 76%; }
.court-art { display: block; height: 100%; width: 100%; }
.playing-card.legal-card { box-shadow: 0 0 0 var(--outline-width) var(--gold), 4px 4px 0 var(--outline-width) var(--card-ink); cursor: pointer; transform: translateY(-5px); }
/* Why a card cannot be played (US-089): a status bubble above the hand, empty when there is nothing to say. */
.hand-reason {
  background: var(--paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--card-ink);
  bottom: 31%;
  color: #2b2350;
  font-size: .85rem;
  font-weight: 800;
  left: 50%;
  margin: 0;
  max-width: 80%;
  padding: .4rem .8rem;
  pointer-events: none;
  position: absolute;
  text-align: center;
  transform: translateX(-50%);
  z-index: 8;
}
.hand-reason:empty { display: none; }
/* On a wide table the player's own seat sits higher, so the reason goes above it, in the gap under the trick. */
@media (min-width: 761px) { .hand-reason { bottom: 41%; } }
.playing-card.card-shake { animation: card-shake .3s ease-in-out; }
/* A hand card keeps its entrance in the list, so ending the shake does not start it again. */
.table-hand .playing-card.card-shake { animation: hand-in .28s cubic-bezier(.2,.8,.2,1) both, card-shake .3s ease-in-out; }
@keyframes card-shake {
  20%, 60% { rotate: calc(var(--fan-rot, 0deg) - 6deg); }
  40%, 80% { rotate: calc(var(--fan-rot, 0deg) + 6deg); }
}
@keyframes card-dim { 50% { opacity: .45; } }
.playing-card.hint-card { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--gold), 6px 6px 0 6px var(--card-ink); transform: translateY(-12px); }
.hint-bid { outline: 3px dashed var(--gold); outline-offset: 3px; }
.hint-reason { color: var(--gold); font-weight: 600; margin: .4rem 0; text-align: center; }
.playing-card.legal-card:hover, .playing-card.legal-card:focus-visible, .playing-card.legal-card:active {
  box-shadow: 0 0 0 var(--outline-width) var(--gold), 6px 6px 0 var(--outline-width) var(--card-ink);
  rotate: 0deg;
  transform: translateY(-15px);
}

/* A switch (US-100): paper when off, gold when on, and the thumb's side says which as well. */
.setting-choice input[type="checkbox"] {
  appearance: none;
  background: radial-gradient(circle, var(--card-ink) 0 .36rem, transparent .4rem) .15rem center / 1.1rem 100% no-repeat, var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--card-ink);
  flex: none;
  height: 1.6rem;
  margin: 0;
  transition: background-color .15s ease, background-position .15s ease;
  width: 3rem;
}
.setting-choice input[type="checkbox"]:checked {
  background-color: var(--gold);
  background-position: calc(100% - .15rem) center;
}

.announcement-cards { display: inline-flex; gap: 2px; }
.announcement-cards .playing-card { zoom: .5; }

.round-result {
  background: linear-gradient(145deg, #ffe484, #ffb65f);
  border: 3px solid rgba(255,255,255,.65);
  border-radius: 25px 25px 25px 9px;
  box-shadow: var(--shadow), 0 0 45px rgba(255,209,102,.18);
  color: #39254a;
  margin: 1.5rem auto;
  max-width: 720px;
  padding: 1.5rem;
  text-align: center;
}
.round-result h2, .round-result h3 { font-family: var(--font-sans); margin-top: 0; }

.upturned-card {
  align-items: center;
  background: radial-gradient(circle, rgba(16,135,99,.24), transparent 70%);
  display: flex;
  justify-content: center;
  margin: 1.3rem 0;
  min-height: 105px;
  width: 120px;
}
.hand-label { color: var(--gold-soft); font-size: .78rem; font-weight: 900; letter-spacing: .08em; margin-top: 1.5rem; text-transform: uppercase; }
.trump-options {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 18px;
  margin-top: 1rem;
  max-width: 720px;
  padding: 1rem;
}
.trump-options button {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  margin: .2rem;
  padding: .65rem .9rem;
}
.trump-options button:hover:not(:disabled) { background: var(--gold); color: #173530; }
.trump-options .suit, .suit-choice .suit { height: 1.1em; vertical-align: -.2em; width: 1.1em; }
.trump-options button:disabled { cursor: not-allowed; opacity: .3; }

.private-options {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2rem;
}
.private-form, .settings-panel { padding: 1.35rem; }
.private-form h2 { font-family: var(--font-sans); margin: 0 0 1rem; }
.private-form label { color: var(--muted); display: block; font-size: .72rem; font-weight: 800; margin: .8rem 0 .35rem; }
.private-form input:not([type="radio"]):not([type="checkbox"]) {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 8px;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .18);
  color: var(--card-ink);
  padding: .65rem .75rem;
  width: 100%;
}
.private-form .button { margin-top: .7rem; width: 100%; }
.form-message { color: var(--gold-soft); font-size: .8rem; min-height: 1.2rem; }

.seat {
  align-items: center;
  background: rgba(54,43,109,.58);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  display: flex;
  justify-content: space-between;
  padding: .75rem .9rem;
}
.seat span { color: var(--muted); font-size: .72rem; }
.seat-team { color: var(--muted); display: block; font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.empty-seat { background: transparent; border-style: dashed; }
.empty-seat strong { color: var(--muted); font-weight: 600; }

.timer-settings { align-items: center; display: flex; flex-wrap: wrap; gap: .6rem; }
.timer-settings label { color: var(--muted); font-size: .75rem; }

.rules-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 2rem 0; }
.rules-grid section {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 17px;
  padding: 1.1rem;
}
.rules-grid h2 { color: var(--gold-soft); font-family: var(--font-sans); font-size: 1.2rem; margin: 0 0 .5rem; }
.rules-grid p { color: var(--muted); font-size: .85rem; line-height: 1.55; margin: 0; }
.tutorial-cards { display: flex; gap: .8rem; margin: 2rem 0; }
.tutorial-card { cursor: pointer; }
.tutorial-correct { box-shadow: 0 0 0 4px var(--gold), 0 15px 30px rgba(0,0,0,.3); transform: translateY(-8px); }
.tutorial-feedback { color: var(--gold); font-family: var(--font-sans); font-weight: 700; min-height: 2.5rem; }
/* The pass-and-play cover is a sheet that fills the screen and cannot be dismissed (US-116). */
dialog.handoff[data-sheet] {
  animation: none;
  background: #171236;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: 100%;
  inset: 0;
  justify-content: center;
  align-items: center;
  margin: 0;
  max-height: none;
  max-width: none;
  padding: 1.5rem;
  width: 100%;
}
dialog.handoff[open] { display: flex; }
.handoff-card { max-width: 460px; text-align: center; }
.handoff-card h2 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin: 0 0 .8rem; }
.handoff-card p:not(.eyebrow) { color: var(--muted); }

.stats-message { color: var(--muted); margin: 2rem 0; }
.stats-message p { margin: 0 0 1rem; }
.stats-content { display: grid; gap: 1.2rem; margin: 2rem 0; }
.stats-tiles { display: grid; gap: .8rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.stats-tile {
  display: grid;
  gap: .2rem;
  margin: 0;
  padding: 1rem 1.1rem;
}
.stats-tile strong { color: var(--card-ink); font-size: 1.9rem; line-height: 1.1; }
.stats-tile span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stats-columns { display: grid; gap: 1.2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-panel {
  min-width: 0;
  padding: 1.2rem 1.35rem;
}
.stats-panel h2 { font-family: var(--font-sans); font-size: 1rem; margin: 0 0 .8rem; }
.stats-scroll { overflow-x: auto; }
.stats-table { border-collapse: collapse; font-size: .88rem; width: 100%; }
.stats-table th, .stats-table td { border-bottom: 2px dashed rgba(17,17,17,.2); padding: .5rem .6rem; text-align: right; }
.stats-table th:first-child, .stats-table td:first-child { padding-left: 0; text-align: left; }
.stats-table tr:first-child th { color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; }
.stats-table tbody th, .stats-table tr:not(:first-child) th { font-weight: 700; }
.stats-recent th, .stats-recent td { text-align: left; white-space: nowrap; }
.stats-won { color: #0b6b45; font-weight: 800; }
.stats-lost { color: #b3202f; font-weight: 800; }
.stats-facts { display: grid; gap: .45rem 1.2rem; grid-template-columns: 1fr auto; margin: 0; }
.stats-facts dt { color: var(--muted); }
.stats-facts dd { font-weight: 800; margin: 0; text-align: right; }
@media (max-width: 720px) {
  .stats-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-columns { grid-template-columns: 1fr; }
  .stats-panel { padding: 1rem; }
  .stats-table { font-size: .8rem; }
  .stats-table th, .stats-table td { padding: .45rem .35rem; }
  .stats-table tr:first-child th { font-size: .66rem; letter-spacing: 0; }
  .stats-facts { grid-template-columns: 1fr; gap: .1rem; }
  .stats-facts dd { margin-bottom: .55rem; text-align: left; }
}

.settings-panel { display: grid; gap: .7rem; margin: 2rem 0; max-width: 620px; }
.setting-choice {
  align-items: center;
  background: color-mix(in srgb, var(--card-paper) 80%, var(--gold));
  border-width: 2px;
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  gap: .8rem;
  padding: .9rem;
}
.setting-choice span { display: grid; gap: .15rem; }
.setting-choice small { color: var(--muted); }

.table-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.table-actions .button { margin-top: 0; }

.table-hand.dealing { pointer-events: none; }
.table-hand .playing-card.undealt { animation: none; visibility: hidden; }
.table-hand .playing-card.dealt-in { animation: deal-in .32s cubic-bezier(.2, .8, .2, 1) both; }
.deal-packet {
  height: 68px;
  left: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 48px;
  z-index: 20;
}
.deal-packet .card-back { height: 68px; left: calc(var(--card-index) * 3px); top: calc(var(--card-index) * -2px); transform: none; width: 48px; }
.dealer-chip {
  align-items: center;
  background: linear-gradient(135deg, var(--gold), #ff9f43);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--card-ink);
  color: var(--card-ink);
  display: flex;
  height: 28px;
  justify-content: center;
  position: absolute;
  right: -6px;
  top: -12px;
  width: 28px;
  z-index: 2;
}
.dealer-chip svg { height: 20px; width: 20px; }
.dealer-chip:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }
.dealer-chip::after {
  background: var(--card-ink);
  border-radius: 8px;
  color: #fff;
  content: attr(data-label);
  font-size: .75rem;
  font-weight: 800;
  opacity: 0;
  padding: .2rem .5rem;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  transition: opacity .15s ease;
  white-space: nowrap;
}
/* The left seat sits against the table edge: its tooltip opens towards the table. */
.station-left .dealer-chip::after { left: 0; right: auto; }
.dealer-chip:hover::after, .dealer-chip:focus-visible::after { opacity: 1; }
.dealer-chip:focus-visible::after { transition: none; }
/* Seats are stacking contexts: lift the one whose tooltip is open above its neighbours. */
.player-station.dealer-moving, .player-station:has(.dealer-chip:hover), .player-station:has(.dealer-chip:focus-visible) { z-index: 30; }
@media (max-width: 760px) {
  .dealer-chip { height: 24px; right: -5px; top: -10px; width: 24px; }
  .dealer-chip svg { height: 17px; width: 17px; }
}
/* Seats shrink to their avatar here: the chip hangs off the pill's corner instead of covering the avatar. */
@media (max-width: 430px) {
  .dealer-chip { right: -13px; top: -13px; }
}
/* The contract badge is a flex item at the end of the seat pill, after the name: it cannot overlap the avatar, the name,
   the dealer chip (absolute, top right) or the call bubble (absolute, above or beside the pill). */
.contract-badge {
  align-items: center;
  background: #fff7d6;
  border: 2px solid var(--card-ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--card-ink);
  color: #34224d;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 900;
  gap: .2rem;
  flex: none;
  line-height: 1;
  margin-right: .75rem; /* keeps clear of the dealer chip, which hangs over the pill's top right corner */
  padding: .2rem .45rem;
  white-space: nowrap;
}
.contract-badge.badge-bounce { animation: badge-bounce .5s cubic-bezier(.2, .9, .3, 1.3) both; }
.contract-badge[data-red="true"] { color: #c2263f; }
.contract-badge .suit-inline { height: 1em; width: 1em; }
.contract-mark { font-size: .6rem; font-weight: 900; }
@keyframes badge-bounce {
  0% { transform: scale(.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
@keyframes deal-in { from { opacity: 0; transform: translateY(-30px) scale(.6) rotate(-10deg); } }
@keyframes card-fly {
  from { opacity: 0; translate: var(--fly-x, 0) var(--fly-y, 0); rotate: calc(var(--rest-angle, 0deg) - 14deg); scale: 1.1; }
  25% { opacity: 1; }
  to { opacity: 1; translate: 0 0; rotate: var(--rest-angle, 0deg); scale: 1; }
}
@keyframes card-land { 50% { scale: 1.08 .92; } }
@keyframes winning-card-pop { 40% { scale: 1.18; } }
@keyframes card-drop { from { opacity: 0; transform: translateY(-40px) scale(1.15) rotate(-8deg); } }
@keyframes label-in { from { opacity: 0; } }
@keyframes trick-collect {
  25% { opacity: 1; translate: 0 0; scale: 1; }
  to { opacity: 0; translate: var(--collect-x) var(--collect-y); scale: .55; }
}
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes call-pop { 0% { opacity: 0; scale: .35; } 55% { opacity: 1; scale: 1.28; } 100% { opacity: 1; scale: 1; } }
@keyframes call-shake { 20%, 60% { rotate: -4deg; } 40%, 80% { rotate: 4deg; } 100% { rotate: 0deg; } }
@keyframes call-ripple {
  0% { box-shadow: 0 0 0 0 var(--call-color), 0 0 0 0 var(--call-color); }
  100% { box-shadow: 0 0 0 18px transparent, 0 0 46px 6px transparent; }
}
@keyframes deciding-glow { 50% { box-shadow: 0 0 0 5px rgba(255, 209, 102, .3), 0 0 28px var(--gold); } }
@keyframes thinking-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@keyframes bidder-thinking { 50% { box-shadow: 0 0 0 6px rgba(255, 209, 102, .22), 0 0 24px var(--gold); } }
@keyframes pulse { 50% { opacity: .45; transform: scale(.8); } }
@keyframes hand-in { from { opacity: 0; transform: translateY(18px) rotate(3deg); } }

.reaction-layer { inset: 0; pointer-events: none; position: absolute; z-index: 6; }
.reaction-bubble {
  animation: reaction-pop .25s ease-out;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  color: #2b2350;
  font-size: .9rem;
  font-weight: 800;
  margin: 0;
  padding: .45rem .8rem;
  position: absolute;
  white-space: nowrap;
}
.reaction-bottom { bottom: 31%; left: 50%; transform: translateX(-50%); }
.reaction-top { left: 50%; top: 22%; transform: translateX(-50%); }
.reaction-left { left: 4%; top: 31%; }
.reaction-right { right: 4%; top: 31%; }
/* A bot's line (US-088): a cartoon bubble in the table, beside the speaking seat, clear of the cards. */
.bot-line {
  animation: bot-line-pop .2s ease-out;
  background: var(--paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--card-ink);
  color: #2b2350;
  font-size: .85rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  max-width: min(11rem, 46%);
  padding: .4rem .7rem;
  pointer-events: none;
  position: absolute;
  z-index: 7;
}
.bot-line-top { left: 50%; top: 19%; transform: translateX(-50%); }
.bot-line-left { left: 2%; top: 21%; }
.bot-line-right { right: 2%; top: 21%; }
.bot-line-bottom { bottom: 31%; left: 50%; transform: translateX(-50%); }
/* On a wide table the top seat's line goes beside it, clear of the trick and the trick counter. */
@media (min-width: 761px) {
  .bot-line-top { left: calc(50% + 7.5rem); top: 3%; transform: none; }
  .bot-line-left, .bot-line-right { top: 8%; }
}
@keyframes bot-line-pop { from { opacity: 0; scale: .8; } to { opacity: 1; scale: 1; } }
@keyframes reaction-pop { from { opacity: 0; scale: .8; } to { opacity: 1; scale: 1; } }

.reaction-button {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  padding: .4rem .75rem;
}
.reaction-button:hover, .reaction-button:focus-visible { background: rgba(255,255,255,.16); }

/*
 * Effects level (US-094): <body data-effects="full|reduced|off">.
 * Patterns for every animation, present or future:
 *  - one-shot movement: Full as authored; Reduced maps it to fade-in (or fade-out) of --effect-fast; Off removes it;
 *  - a loop: Full as authored; Reduced and Off stop it and keep a static state that shows the same information;
 *  - only transform, translate, scale and opacity are animated.
 */
body[data-effects="reduced"] { --effect-fast: 150ms; }
body[data-effects="off"] { --effect-fast: 0s; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes bot-expression-bounce {
  0% { transform: scale(.72); }
  65% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.bot-avatar.expression-change { animation: bot-expression-bounce 200ms ease-out; }

body[data-effects="reduced"] .table-hand .playing-card.card-shake { animation: fade-in var(--effect-fast) both, card-dim var(--effect-fast) ease-in-out; }
body[data-effects="off"] .table-hand .playing-card.card-shake { animation: none; }
/* The lift and the straightening of a card follow the level: short at Reduced, instant at Off. */
body[data-effects="reduced"] .playing-card,
body[data-effects="off"] .playing-card { transition-duration: var(--effect-fast); }

/* Reduced: movement becomes a short fade. */
body[data-effects="reduced"] .table-hand .playing-card,
body[data-effects="reduced"] .table-hand .playing-card.dealt-in,
body[data-effects="reduced"] .current-trick .playing-card.card-arriving,
body[data-effects="reduced"] .current-trick .trick-player.card-arriving,
body[data-effects="reduced"] .arriving-late,
body[data-effects="reduced"] .player-call.call-arriving,
body[data-effects="reduced"] .player-call[data-kind="coinche"],
body[data-effects="reduced"] .bot-line,
body[data-effects="reduced"] .reaction-bubble {
  animation: fade-in var(--effect-fast) var(--reveal-delay, 0ms) both;
}
body[data-effects="reduced"] .table-hand .playing-card.undealt { animation: none; }
/* A badge that is merely re-rendered must not pop again; only .call-arriving fades (rule above). */
body[data-effects="reduced"] .player-call { animation: none; }
body[data-effects="off"] .bot-line { animation: none; }
body[data-effects="reduced"] .bot-avatar.expression-change {
  animation: fade-in var(--effect-fast) ease-out both;
}
body[data-effects="reduced"] .contract-badge.badge-bounce, body[data-effects="off"] .contract-badge.badge-bounce { animation: none; }
body[data-effects="reduced"] .trick-collecting .trick-slot { animation: fade-out var(--effect-fast) forwards; }
/* A one-shot transition: Reduced shortens it to --effect-fast; Off removes it (the rule for every element below). */
body[data-effects="reduced"] .score-progress i { transition: transform var(--effect-fast) ease-out; }
body[data-effects="off"] .score-progress i { transition: none; }

/* Celebrations (US-090): a sticker over the trick with confetti or stars. Full pops, wobbles and fades it out in
   1.8 s (celebrations.js removes it then); Reduced fades it in and stays still; Off shows it still. Confetti only at Full. */
.celebration {
  align-items: center;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  z-index: 6;
}
.celebration-sticker {
  animation: celebration-pop 1.8s both;
  background: var(--gold);
  border: 4px solid var(--card-ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--card-ink);
  color: var(--card-ink);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: .02em;
  padding: .35rem 1.4rem;
  text-transform: uppercase;
  transform: rotate(-6deg);
}
.celebration[data-kind="contractLost"] .celebration-sticker {
  animation-name: celebration-droop;
  background: #9fb4c7;
  color: #1d2b3a;
}
.celebration-chips {
  animation: celebration-chips 1.8s both;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: center;
  margin-top: .55rem;
  transform: rotate(-3deg);
}
.celebration-chips:empty { display: none; }
.celebration-chip {
  background: var(--card-paper);
  border: 3px solid var(--card-ink);
  border-radius: var(--radius-chip);
  box-shadow: 2px 2px 0 var(--card-ink);
  color: var(--card-ink);
  font-size: .8rem;
  font-weight: 900;
  padding: .05rem .6rem;
}
.celebration i,
.match-end-confetti i {
  animation: celebration-fall 1.8s ease-in var(--delay) both;
  background: var(--colour);
  border: 2px solid var(--card-ink);
  border-radius: 2px;
  height: 14px;
  left: 50%;
  position: absolute;
  top: 42%;
  width: 9px;
}
.celebration[data-effect="large-confetti"] i { height: 18px; width: 12px; }
.celebration[data-effect="light-confetti"] i { height: 11px; width: 7px; }
.celebration[data-effect="stars"] i {
  background: none;
  border: 0;
  color: var(--colour);
  font-size: 1.3rem;
  font-style: normal;
  height: auto;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--card-ink);
  width: auto;
}
.celebration[data-effect="stars"] i::before { content: "★"; }
@keyframes celebration-pop {
  0% { opacity: 0; transform: rotate(-6deg) scale(0); }
  12% { opacity: 1; transform: rotate(-6deg) scale(1.25); }
  20% { transform: rotate(-6deg) scale(1); }
  28% { transform: rotate(-3deg) scale(1.04); }
  36% { transform: rotate(-7deg) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: rotate(-6deg) scale(.9); }
}
@keyframes celebration-droop {
  0% { opacity: 0; transform: rotate(-2deg) translateY(-14px) scale(.8); }
  15% { opacity: 1; transform: rotate(-2deg) translateY(0) scale(1); }
  70% { opacity: 1; transform: rotate(-5deg) translateY(10px) scale(1); }
  100% { opacity: 0; transform: rotate(-6deg) translateY(24px) scale(1); }
}
@keyframes celebration-chips {
  0%, 20% { opacity: 0; translate: 0 10px; }
  30%, 80% { opacity: 1; translate: 0 0; }
  100% { opacity: 0; }
}
@keyframes celebration-fall {
  0% { opacity: 0; rotate: 0deg; translate: 0 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; rotate: calc(var(--r) * 2); translate: var(--x) 150px; }
}
body[data-effects="reduced"] .celebration .celebration-sticker,
body[data-effects="reduced"] .celebration .celebration-chips { animation: fade-in var(--effect-fast) both; }
body[data-effects="off"] .celebration .celebration-sticker,
body[data-effects="off"] .celebration .celebration-chips { animation: none; }
body[data-effects="reduced"] .celebration i,
body[data-effects="off"] .celebration i,
body[data-effects="reduced"] .match-end-confetti i,
body[data-effects="off"] .match-end-confetti i { display: none; }

/* The round review (US-066): a full-screen felt with the four hands face-up around the trick. The viewer's seat is at
   the bottom. There is no animation of its own, so Reduced and Off need no rules. */
.round-review {
  align-items: center;
  background: radial-gradient(var(--felt-dot) 1.4px, transparent 1.6px) 0 0 / 9px 9px, var(--felt);
  display: flex;
  flex-direction: column;
  gap: .7rem;
  inset: 0;
  justify-content: center;
  overflow: auto;
  padding: 1rem;
  position: fixed;
  z-index: 880;
}
.round-review[hidden] { display: none; }
.round-review h2 { color: #fff; margin: 0; text-shadow: 2px 2px 0 var(--card-ink); }
.review-table {
  align-items: center;
  display: grid;
  gap: .4rem;
  grid-template-areas: ". top ." "left trick right" ". bottom .";
  grid-template-columns: auto auto auto;
  justify-items: center;
}
.review-hand-top { grid-area: top; }
.review-hand-left { grid-area: left; }
.review-hand-right { grid-area: right; }
.review-hand-bottom { grid-area: bottom; }
.review-trick { grid-area: trick; height: 8.6rem; position: relative; width: 8.6rem; }
.review-hand {
  align-items: center;
  display: flex;
  flex-direction: column;
  min-height: 3.2rem;
  padding: .2rem .4rem;
}
/* The cards of a top or bottom hand lie in a row under the name; those of a side hand in a column. */
.review-hand-top, .review-hand-bottom { display: grid; grid-auto-flow: column; justify-content: center; }
.review-hand-top .review-name, .review-hand-bottom .review-name { grid-column: 1 / -1; grid-row: 1; justify-self: center; margin: 0 0 .3rem; }
.review-hand-top .playing-card, .review-hand-bottom .playing-card { grid-row: 2; }
.review-name { flex: 0 0 100%; margin: 0 auto .3rem; text-align: center; width: max-content; }
.review-name {
  background: var(--card-paper);
  border: 2px solid var(--card-ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--card-ink);
  color: var(--card-ink);
  font-weight: 900;
  margin: 0 .4rem;
  padding: .05rem .5rem;
}
.review-hand-left .review-name, .review-hand-right .review-name {
  font-size: .7rem;
  margin: 0 0 .3rem;
  max-width: 3.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-hand .playing-card { height: 3.7rem; width: 2.6rem; }
.review-hand-top .playing-card + .playing-card, .review-hand-bottom .playing-card + .playing-card { margin-left: -1.1rem; }
.review-hand-left .playing-card + .playing-card, .review-hand-right .playing-card + .playing-card { margin-top: -2.4rem; }
.review-winner .review-name { background: var(--gold); }
.review-slot { position: absolute; }
.review-slot .playing-card { height: 3.7rem; width: 2.6rem; }
.review-slot-top { left: calc(50% - 1.3rem); top: 0; }
.review-slot-bottom { bottom: 0; left: calc(50% - 1.3rem); }
.review-slot-left { left: 0; top: calc(50% - 1.85rem); }
.review-slot-right { right: 0; top: calc(50% - 1.85rem); }
.review-status { color: #fff; font-weight: 800; margin: 0; min-height: 1.4em; text-align: center; text-shadow: 1px 1px 0 var(--card-ink); }
.review-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.review-actions .text-link { background: none; border: 0; color: #fff; cursor: pointer; padding: .4rem; }
.review-actions .button[disabled] { cursor: default; opacity: .5; }

/* The end-of-match takeover (US-093): a full-screen page over the table, below the pass-and-play hand-off cover.
   Full fades it in, pops the sticker and raises the podium steps one after the other; Reduced only fades it in;
   Off shows it at once. The confetti pieces are the ones of the celebrations above. */
.match-end {
  align-items: center;
  animation: fade-in .4s both;
  background: linear-gradient(160deg, #2a1d5c, #171333);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  inset: 0;
  justify-content: center;
  overflow: auto;
  padding: 1.25rem;
  position: fixed;
  z-index: 900;
}
.match-end[hidden] { display: none; }
.match-end-confetti { inset: 0; overflow: hidden; pointer-events: none; position: absolute; }
.match-end-confetti i { top: 30%; }
.match-end h2 { font-size: clamp(1.5rem, 5vw, 2.4rem); margin: 0; text-align: center; }
.match-end-rematch { font-weight: 700; margin: 0; text-align: center; }
.match-end-rematch[hidden] { display: none; }
.match-end-goal { font-weight: 700; margin: 0; text-align: center; }
.match-end-goal[hidden], .goal-line[hidden] { display: none; }
.goal-line {
  background: var(--paper);
  border: 3px solid var(--card-ink);
  border-radius: 999px;
  color: var(--card-ink);
  font-weight: 800;
  margin: .6rem 0 0;
  padding: .3rem 1rem;
  width: fit-content;
}
.match-end-offer {
  align-items: center;
  background: var(--paper);
  border: 3px solid var(--card-ink);
  border-radius: 18px;
  color: var(--card-ink);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
  max-width: 24rem;
  padding: .8rem 1rem;
  text-align: center;
}
.match-end-offer p { font-weight: 700; margin: 0; }
.match-end-offer[hidden] { display: none; }
.match-end-offer .text-link { background: none; border: 0; color: var(--card-ink); cursor: pointer; padding: .4rem; }
.match-end-sticker {
  animation: match-end-pop .6s both;
  background: var(--gold);
  border: 4px solid var(--card-ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--card-ink);
  color: var(--card-ink);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: .02em;
  margin: 0;
  padding: .35rem 1.4rem;
  text-transform: uppercase;
  transform: rotate(-4deg);
}
.match-end-scores { text-align: center; }
.match-end-scores .eyebrow { margin: 0 0 .6rem; }
.podium { align-items: flex-end; display: flex; gap: .6rem; justify-content: center; }
.podium-step {
  align-items: center;
  animation: podium-rise .6s cubic-bezier(.2, .9, .3, 1.2) both;
  border: 3px solid var(--card-ink);
  border-radius: 12px 12px 0 0;
  box-shadow: 4px 4px 0 var(--card-ink);
  color: var(--card-ink);
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 7rem;
  padding: .6rem .7rem;
}
.podium-step[data-place="1"] { background: var(--gold); min-height: 9.5rem; }
.podium-step[data-place="2"] { animation-delay: .25s; background: #9fb4c7; min-height: 6.5rem; }
.podium-names { font-size: .8rem; font-weight: 800; }
.podium-score { font-size: 1.7rem; font-weight: 900; line-height: 1; }
.podium-step[data-place="1"] .podium-score { font-size: 2.1rem; }
.match-end-recap {
  background: var(--card-paper);
  border: 3px solid var(--card-ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--card-ink);
  color: var(--card-ink);
  font-size: .9rem;
  max-width: 26rem;
  padding: .8rem 1rem;
  width: 100%;
}
.match-end-recap p { margin: 0 0 .25rem; }
.match-end-recap .recap-heading { font-weight: 900; margin-top: .5rem; }
.match-end-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.match-end-actions .text-link { background: none; border: 0; cursor: pointer; padding: .4rem; }
@keyframes match-end-pop {
  0% { opacity: 0; transform: rotate(-4deg) scale(0); }
  60% { opacity: 1; transform: rotate(-4deg) scale(1.2); }
  100% { opacity: 1; transform: rotate(-4deg) scale(1); }
}
@keyframes podium-rise {
  from { opacity: 0; transform: translateY(40px) scaleY(.6); }
}
body[data-effects="reduced"] .match-end { animation: fade-in var(--effect-fast) both; }
body[data-effects="off"] .match-end { animation: none; }
body[data-effects="reduced"] .match-end .match-end-sticker,
body[data-effects="reduced"] .match-end .podium-step,
body[data-effects="off"] .match-end .match-end-sticker,
body[data-effects="off"] .match-end .podium-step { animation: none; }

body[data-effects="reduced"] .deal-card,
body[data-effects="off"] .deal-card { transform: translate(var(--dx), var(--dy)) rotate(var(--dr)); }

/* Reduced and Off: loops stop and leave a static state (border, glow or colour) that marks the same thing. */
body[data-effects="reduced"] .deal-card,
body[data-effects="off"] .deal-card,
body[data-effects="reduced"] .player-station.deciding,
body[data-effects="off"] .player-station.deciding,
body[data-effects="reduced"] .player-station.call-flash,
body[data-effects="off"] .player-station.call-flash,
body[data-effects="reduced"] .player-thinking i,
body[data-effects="off"] .player-thinking i,
body[data-effects="reduced"] .auction-waiting-view .active-player .player-avatar,
body[data-effects="off"] .auction-waiting-view .active-player .player-avatar,
body[data-effects="reduced"] .trick-winner .winning-card,
body[data-effects="off"] .trick-winner .winning-card {
  animation: none;
}
body[data-effects="reduced"] .trick-winner .winning-card { filter: brightness(1.12); }
body[data-effects="reduced"] .player-thinking i,
body[data-effects="off"] .player-thinking i { opacity: 1; }
body[data-effects="reduced"] .player-station.deciding,
body[data-effects="off"] .player-station.deciding { box-shadow: 0 0 0 4px rgba(255, 209, 102, .3), 0 0 18px var(--gold); }

/* Off: nothing moves, fades or transitions; what an animation would have left behind is set directly. */
body[data-effects="off"] *,
body[data-effects="off"] *::before,
body[data-effects="off"] *::after {
  animation: none !important;
  scroll-behavior: auto !important;
  transition: none !important;
}
/* Pacing is not an effect: cards and controls that wait for their turn to appear keep their delay, then show at once. */
body[data-effects="off"] .current-trick .playing-card.card-arriving,
body[data-effects="off"] .current-trick .trick-player.card-arriving,
body[data-effects="off"] .arriving-late {
  animation: fade-in 0s var(--reveal-delay, 0ms) both !important;
}
body[data-effects="off"] .trick-collecting .trick-slot,
body[data-effects="off"] .trick-collecting::before { opacity: 0; }
body[data-effects="reduced"] *,
body[data-effects="reduced"] *::before,
body[data-effects="reduced"] *::after {
  scroll-behavior: auto !important;
  transition-duration: var(--effect-fast) !important;
}

@media (max-width: 760px) {
  .shell { padding-top: 1rem; }
  .home-view, .destination-view { margin-top: 3.5rem; }
  .mode-grid, .private-options, .rules-grid { grid-template-columns: 1fr; }
  .hero-deal { height: 6.5rem; margin-bottom: .6rem; }
  .home-view { margin-top: 2.5rem; }
  .home-view h1 { font-size: 2.5rem; margin-bottom: .9rem; }
  .home-view .eyebrow, .home-view .welcome-badges { display: none; }
  .home-view .hero-deal { height: 4.5rem; }
  .home-view .deal-stage { height: 4.5rem; }
  .home-view .intro { font-size: 1rem; line-height: 1.45; margin: 1rem 0 0; }
  .play-now { width: 100%; }
  .deal-stage { height: 6.5rem; right: auto; top: 0; transform: scale(.55); transform-origin: 0 0; width: 11rem; }

  .card-table { aspect-ratio: auto; border-radius: 100px; min-height: 640px; }
  .player-station { min-width: 118px; padding: .35rem .55rem .35rem .35rem; }
  .player-avatar { height: 1.8rem; width: 1.8rem; }
  .player-details strong { font-size: .72rem; }
  .player-details small { display: none; }
  .station-left { left: 1%; top: 29%; }
  .station-right { right: 1%; top: 29%; }
  .station-bottom { bottom: 21%; }
  .hidden-hand { height: 84px; transform: translateX(-50%); width: 118px; }
  .station-left .hidden-hand { left: calc(100% + 29px); transform: rotate(90deg) translate(-50%, -50%); }
  .station-right .hidden-hand { left: -34px; transform: rotate(90deg) translate(-50%, -50%); }
  .table-center { top: 49%; width: 55%; }
  .playing-card, .card-back { height: 84px; width: 58px; }
  .card-back::after { font-size: .72rem; height: 1.25rem; line-height: 1.05rem; margin: -.625rem 0 0 -.625rem; width: 1.25rem; }
  .table-hand { bottom: 4%; max-width: 94%; }
  .table-hand .playing-card + .playing-card { margin-left: -14px; }

}

@media (max-width: 430px) {
  h1 { font-size: 3.2rem; }
  .card-table { border-width: 8px; border-radius: 72px; min-height: 590px; }

  .player-station { min-width: auto; }
  .station-left .player-details, .station-right .player-details { display: none; }
  .station-left, .station-right { padding-right: .35rem; }
  .current-trick { flex-wrap: wrap; }
  .trick-diamond { height: 196px; width: 220px; }
  .trick-diamond::before { height: 72px; left: 74px; top: 57px; width: 72px; }
  .trick-slot { height: 84px; width: 58px; }
  .trick-slot-top { left: 81px; }
  .trick-slot-bottom { left: 81px; }
  .trick-slot-left, .trick-slot-right { top: 55px; }

  .text-button { margin-left: 0; }
}

/* Choice buttons: radio groups shown as single buttons (bid amounts, suits, variants, timer, language). */
.choice-field { margin: .5rem 0 .9rem; }
.choice-label { color: var(--muted); display: block; font-size: .72rem; font-weight: 800; margin-bottom: .4rem; }
.choice-group { display: flex; flex-wrap: wrap; gap: .45rem; }
.choice-group .choice { cursor: pointer; display: inline-block; margin: 0; position: relative; }
.choice-group .choice input {
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}
.choice-group .choice span {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--card-ink);
  color: var(--card-ink);
  display: inline-block;
  font-size: .9rem;
  font-weight: 900;
  min-width: 3.2rem;
  padding: .55rem .85rem;
  position: relative;
  text-align: center;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.choice-group .choice:hover input:not(:disabled):not(:checked) + span { background: var(--gold-soft); transform: translateY(-2px); }
.choice-group .choice input:checked + span { background: var(--gold); box-shadow: 4px 5px 0 var(--card-ink); transform: rotate(var(--tilt)) translateY(-2px); }
/* The chosen option carries a black check disc as well as the gold, so colour is never the only signal. */
.choice-group .choice input:checked + span::after {
  align-items: center;
  background: var(--card-ink);
  border-radius: 50%;
  color: var(--gold);
  content: "✓";
  display: flex;
  font-size: .7rem;
  height: 1.2rem;
  justify-content: center;
  position: absolute;
  right: -.5rem;
  top: -.6rem;
  width: 1.2rem;
}
.theme-choice span::before {
  background: linear-gradient(90deg, var(--swatch-a) 50%, var(--swatch-b) 50%);
  border: 2px solid var(--card-ink);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: .9rem;
  margin-right: .45rem;
  vertical-align: -.1rem;
  width: .9rem;
}
/* The swatches of the theme choices: classes, not style attributes, so the CSP can forbid inline styles. */
.swatch-comic { --swatch-a: #1f9d8a; --swatch-b: #5b2b82; }
.swatch-classic-green { --swatch-a: #2f8f4e; --swatch-b: #7a4a22; }
.swatch-midnight { --swatch-a: #1b2a5e; --swatch-b: #4cc9f0; }
.swatch-forest { --swatch-a: #1f6b4a; --swatch-b: #c9e4a1; }
.swatch-ruby { --swatch-a: #8c1d3b; --swatch-b: #f4c3d0; }
.swatch-gilded { --swatch-a: #d4a017; --swatch-b: #2e2306; }
.theme-lock { display: block; font-size: .72rem; font-weight: 700; }
.theme-lock:empty { display: none; }
.theme-choice:has(input:disabled) { cursor: not-allowed; opacity: .75; }
.swatch-sunset { --swatch-a: #e8704a; --swatch-b: #8c2f39; }
.choice-group .choice input:focus-visible + span { outline: 3px solid var(--card-paper); outline-offset: 2px; box-shadow: 0 0 0 3px var(--card-ink), 3px 3px 0 3px var(--card-ink); }
.choice-group .choice input:disabled + span { box-shadow: none; cursor: not-allowed; opacity: .5; }
.choice-group .red-suit input + span { color: var(--card-red); }
.choice-group .red-suit input:checked + span { color: #a01c28; }
.private-form .choice-group .choice { font-size: inherit; margin: 0; }
.setting-choice .choice-group .choice span { display: inline-block; gap: 0; }
.setting-choice { flex-wrap: wrap; justify-content: space-between; }
.setting-choice:has(input[type="checkbox"]) { flex-wrap: nowrap; justify-content: flex-start; }
.timer-settings .choice-label { margin: 0; }

/* Mobile: game screens (game setup, bidding, card play, private table in play) fill the viewport and scroll when it is too short. */
@media (max-width: 760px) {
  .shell:has(:is([data-view="table"]):not([hidden])) {
    --cw: 50px;
    --ch: 72px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: .4rem .6rem calc(.4rem + env(safe-area-inset-bottom));
  }
  .shell:has(:is([data-view="table"]):not([hidden])) > .brand { display: none; }

  .shell > :is([data-view="table"]):not([hidden]) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin-top: 0;
    min-height: 0;
  }

  /* Heading and HUD collapse to a couple of compact rows. */

  /* The table takes whatever height is left. */
  .card-table {
    border-radius: 44px;
    border-width: 6px;
    flex: 1 1 0;
    margin: .35rem 0;
    min-height: 0;
  }

  .card-table::after { font-size: 1.1rem; }
  .playing-card, .card-back { height: var(--ch); width: var(--cw); }
  .player-station { min-width: auto; padding: .25rem .5rem .25rem .25rem; }
  .player-avatar { font-size: .8rem; height: 1.6rem; width: 1.6rem; }
  .player-details strong { font-size: .68rem; }
  .station-top { top: 2%; }
  .station-left, .station-right { top: 32%; }
  .station-bottom { bottom: calc(2% + var(--ch) + 8px); }
  .table-hand { bottom: 2%; max-width: 98%; }
  .table-hand .playing-card + .playing-card { margin-left: calc(var(--cw) * -.3); }
  .hidden-hand { height: 52px; width: 90px; top: calc(100% + 4px); }
  .hidden-hand .card-back { height: 52px; left: calc(var(--card-index) * 6px); width: 36px; }
  .station-left .hidden-hand, .station-right .hidden-hand { bottom: calc(100% + 4px); top: auto; transform: none; }
  .station-left .hidden-hand { left: 0; }
  .station-right .hidden-hand { left: auto; right: 0; }
  .table-center { top: 47%; width: 60%; }
  /* Phone: a bid tag keeps its readable size but wraps inside a narrow width, so it never grows over the played card. */
  .player-call { font-size: .66rem; line-height: 1.2; max-width: 96px; padding: .25rem .4rem; white-space: normal; }
  .playing-card.legal-card { transform: translateY(-4px); }

  .trick-progress { font-size: .58rem; margin-bottom: .3rem; padding: .25rem .5rem; }
  .current-trick { min-height: 0; padding: 0; }
  .trick-diamond { height: 150px; width: 176px; }
  .trick-diamond::before { height: 56px; left: 60px; top: 47px; width: 56px; }
  .trick-slot { height: 66px; width: 46px; }
  .trick-slot .playing-card { height: 66px; width: 46px; }
  .trick-slot-top { left: 65px; }
  .trick-slot-bottom { left: 65px; }
  .trick-slot-left, .trick-slot-right { top: 42px; }
  .trick-player { font-size: .5rem; max-width: 60px; }
  .trick-points { font-size: .58rem; }
  .deal-packet, .deal-packet .card-back { height: 52px; width: 36px; }

  .round-result .button { font-size: .8rem; margin-top: .25rem; padding: .55rem 1rem; }
  .round-result { border-width: 2px; margin: .3rem 0; max-height: 40%; overflow: auto; padding: .6rem .8rem; }
  .round-result h2, .round-result h3 { font-size: 1rem; margin-bottom: .3rem; }
  .round-result p { font-size: .8rem; margin: .2rem 0; }

  /* Bidding: hand caption and action dock sit under the table. */

  .trump-options button { font-size: .8rem; margin: .1rem; padding: .5rem .7rem; }

  .choice-label { font-size: .62rem; margin-bottom: .25rem; }
  .choice-group { gap: .3rem; }
  .choice-group .choice span { border-radius: 10px; font-size: .78rem; min-width: 2.3rem; padding: .45rem .55rem; }

  /* Private table while a game is running: drop the lobby chrome. */

}

@media (max-width: 380px) {
  .shell:has(:is([data-view="table"]):not([hidden])) { --cw: 44px; --ch: 64px; }
}

/* Laptop and desktop: game screens (bidding, card play, private table in play) fill the viewport and scroll when it is too short. */
@media (min-width: 761px) and (min-height: 500px) {
  .shell { --ch: 104px; --cw: 72px; --tch: var(--ch); --tcw: var(--cw); }
  .shell:has(:is([data-view="table"]):not([hidden])) {
    --ch: clamp(76px, 14vh, 104px);
    --cw: calc(var(--ch) * .69);
    --tch: calc(var(--ch) * .8);
    --tcw: calc(var(--cw) * .8);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: .6rem;
    padding-top: .6rem;
  }
  .shell:has(:is([data-view="table"]):not([hidden])) > .brand { display: none; }

  .shell > :is([data-view="table"]):not([hidden]) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin-top: 0;
    min-height: 0;
  }

  /* Heading and HUD shrink to a single compact row each. */

  /* The table takes whatever height is left; cards scale with the viewport height. */
  .card-table {
    aspect-ratio: auto;
    flex: 1 1 0;
    margin: .4rem 0;
    min-height: calc(var(--ch) * 2 + 9rem);
  }
  .playing-card, .card-back { height: var(--ch); width: var(--cw); }
  .table-hand { bottom: 2.5%; }
  .station-top { top: 2.5%; }
  .station-bottom { bottom: calc(2.5% + var(--ch) + 10px); }
  /* Opponents' hidden hands are drawn smaller than the player's own cards. */
  .hidden-hand { height: calc(var(--ch) * .75); width: calc(var(--cw) * .75 + 56px); }
  .hidden-hand .card-back { height: calc(var(--ch) * .75); left: calc(var(--card-index) * 7px); width: calc(var(--cw) * .75); }
  .station-left .hidden-hand { left: calc(100% + var(--ch) * .3); }
  .station-right .hidden-hand { left: calc(var(--ch) * -.32); }
  .station-top .hidden-hand { left: auto; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
  /* Centred in the free space between the top station and the bottom station above the hand. */
  .table-center { top: calc(50% - (var(--ch) + 10px) / 2); }

  /* The trick diamond is laid out from a slightly smaller trick card size. */
  .current-trick { min-height: 0; padding: 0; }
  .trick-diamond { height: calc(var(--tch) * 2.1); width: calc(var(--tcw) * 3.9); }
  .trick-diamond::before { height: calc(var(--tch) * .9); left: calc(50% - var(--tch) * .45); top: calc(50% - var(--tch) * .45); width: calc(var(--tch) * .9); }
  .trick-slot, .trick-slot .playing-card { height: var(--tch); width: var(--tcw); }
  .trick-slot-top, .trick-slot-bottom { left: calc(50% - var(--tcw) / 2); }
  .trick-slot-left, .trick-slot-right { top: calc(50% - var(--tch) / 2); }
  .trick-progress { margin-bottom: .3rem; }

  .round-result .button { margin-top: .4rem; padding: .6rem 1.1rem; }
  /* At the end of a round the result and its buttons stay whole; the table gives up the room. */
  .round-result { flex: none; margin: .4rem auto; padding: .8rem 1.2rem; }
  .destination-view:has(.round-result:not([hidden])) .card-table { min-height: 0; }
  .round-result h2, .round-result h3 { margin-bottom: .3rem; }
  .round-result p { margin: .3rem 0; }

  /* Bidding: the hand caption gives its room to the table; the dock sits under it. */

  /* Contrée auction: contract value, trump suit and actions share one wrapping row. */

  /* Private table while a game is running: drop the lobby chrome. */

}

/* Short laptop screens: trade the heading's size for table height. */
@media (min-width: 761px) and (min-height: 500px) and (max-height: 680px) {
  .shell:has(:is([data-view="table"]):not([hidden])) { --ch: clamp(72px, 13vh, 88px); }

  /* The player's own station moves beside the hand, leaving the middle of the table to the trick. */
  .station-bottom { bottom: calc(2.5% + var(--ch) / 2 - 1.4rem); left: calc(50% + var(--cw) * 4 - 1.5rem); transform: none; }
  .station-bottom.active-player { transform: translateY(-2px); }
  .table-center { top: calc(50% - (var(--ch) - 2.8rem) / 2); }
}

.suit-with-name { white-space: nowrap; }
.suit-inline { height: 1.05em; margin-right: .2em; vertical-align: -.15em; width: 1.05em; }

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (min-width: 600px) {
  .review-hand-left .review-name, .review-hand-right .review-name { font-size: .8rem; max-width: 7rem; }
}

/* The button set's hover and press movement (US-100): Reduced keeps the state change within --effect-fast without the
   lift; Off shows it at once. */
body[data-effects="reduced"] .button:hover:not(:disabled), body[data-effects="reduced"] .button:active:not(:disabled),
body[data-effects="off"] .button:hover:not(:disabled), body[data-effects="off"] .button:active:not(:disabled) { transform: none; }
body[data-effects="reduced"] .button:active:not(:disabled), body[data-effects="off"] .button:active:not(:disabled) { box-shadow: 1px 1px 0 var(--card-ink); }
body[data-effects="off"] .button { transition: none; }

/* Controls (US-100): hover movement follows the effects level; the tilt, the lift and the check are resting states. */
body[data-effects="reduced"] .choice-group .choice:hover input:not(:disabled):not(:checked) + span,
body[data-effects="off"] .choice-group .choice:hover input:not(:disabled):not(:checked) + span,
body[data-effects="off"] .choice-group .choice span,
body[data-effects="off"] .setting-choice input { transition: none; }

/* The sweep (US-100): the remaining menu and game-screen panels and the text left on the felt. These come last so they
   win over the older rules of the same weight. The table itself, its seats and the score bar are not touched. */
.rules-grid section,
.trump-options,
.seat,
.handoff-card {
  --ink: var(--card-ink);
  --muted: #4b4358;
  --gold-soft: #6b4300;
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-hard);
  color: var(--card-ink);
}
.seat { box-shadow: 3px 3px 0 var(--card-ink); }
.empty-seat { background: color-mix(in srgb, var(--card-paper) 80%, var(--gold)); box-shadow: none; }
.rules-grid h2,
.handoff-card h2 { color: var(--card-ink); text-shadow: none; }

.handoff-card { padding: 1.6rem; }

.round-result { background: var(--gold); border: var(--outline-width) solid var(--card-ink); border-radius: var(--radius-panel); box-shadow: var(--shadow-hard); color: var(--card-ink); }
.trump-options button, .reaction-button {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--card-ink);
  color: var(--card-ink);
}
.trump-options button:hover:not(:disabled), .reaction-button:hover, .reaction-button:focus-visible { background: var(--gold); }

/* Text directly on the felt is white with the ink outline; inside paper it is ink (the panels above re-point --muted). */
.hand-label,
.timer-settings label,
.stats-message,
.form-message,
.choice-label,
.rule-note {
  color: #fff;
  text-shadow: var(--text-outline);
}
:is(.private-form, .settings-panel, .your-data-form, .sign-in-panel, .stats-panel, .trump-options, .handoff-card, .rules-grid section, .setting-choice) :is(.choice-label, .form-message, .timer-settings label, .hand-label) {
  color: var(--muted);
  text-shadow: none;
}

/* Running text on the felt (rules, privacy, tutorial) is white and outlined too; paper panels keep their ink. */
.destination-view :is(section, ul, ol) :is(p, li, dt, dd), .privacy-view :is(p, li, dt, dd), .tutorial-view :is(p, li) {
  color: #fff;
  text-shadow: var(--text-outline);
}
:is(.rules-grid section, .stats-panel, .stats-tile, .settings-panel, .private-form, .sign-in-panel, .handoff-card) :is(p, li, dt, dd, small) {
  color: inherit;
  text-shadow: none;
}
/* A panel inside the paper dock is flat: one outline, not two. */

/* Review fixes (US-100). */
.round-result { --ink: var(--card-ink); --muted: #4b4358; }
/* Scoped under .destination-view so it outranks `.destination-view :is(section, ul, ol) :is(p, li, dt, dd)` (white,
   outlined text for the felt): without it the recap on the yellow panel kept the outline and was hard to read. */
.destination-view .round-result :is(p, li, dt, dd, small) { color: inherit; text-shadow: none; }
:is(.sign-in-panel, .private-form, .settings-panel, .stats-panel, .handoff-card, .round-result) .text-link { color: var(--card-ink); text-shadow: none; }
.text-button { color: #fff; text-shadow: var(--text-outline); }
.settings-panel .text-button,
.your-data .text-button,
.handoff-card .text-button,
.tutorial-banner .text-button { color: var(--card-ink); text-shadow: none; }
.private-form input:not([type="radio"]):not([type="checkbox"]):focus-visible, .your-data-form input:focus-visible,
.delete-confirm input:focus-visible, .setup-sheet input:focus-visible {
  box-shadow: 0 0 0 3px var(--card-paper), 0 0 0 6px var(--card-ink);
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.delete-confirm input { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 8px; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .18); color: var(--card-ink); padding: .65rem .75rem; }

/* More room for the hand on phones (US-108). Portrait: rows of larger, non-overlapping cards, each at least 44px to tap;
   with two rows the second covers the lower part of the first, so every rank and suit stays visible. The pill sits
   above the hand and the table is kept tall enough for the trick, the pill and the hand. */
@media (max-width: 600px) and (orientation: portrait) {
  .table-hand {
    --cw: 60px;
    --ch: 86px;
    display: grid;
    gap: 0 4px;
    grid-auto-rows: 46px;
    grid-template-columns: repeat(var(--hand-cols, 4), var(--cw));
    max-width: 98%;
    padding-bottom: calc(var(--ch) - 46px);
    width: auto;
  }
  .table-hand .playing-card { rotate: 0deg; translate: none; }
  .table-hand .playing-card + .playing-card { margin-left: 0; }
  .card-table:has(.table-hand[data-rows="1"]) { min-height: 430px; }
  .card-table:has(.table-hand[data-rows="2"]) { min-height: 480px; }
  .card-table:has(.table-hand[data-rows="1"]) .station-bottom { bottom: calc(2% + 86px + 8px); }
  .card-table:has(.table-hand[data-rows="2"]) .station-bottom { bottom: calc(2% + 132px + 8px); }
  /* The auction has no trick on the felt, only the turned card: it needs less. */

}
/* Landscape phones have width to spare: the fan opens so a 50px card shows at least 44px. */
@media (max-width: 760px) and (orientation: landscape) {
  .table-hand .playing-card + .playing-card { margin-left: calc(var(--cw) * -.1); }
  /* The pill moves to the corner beside the fan, so it never sits on the trick or the cards. */
  .card-table .station-bottom { bottom: 3%; left: 1.5%; transform: none; }
  /* The header's two bars share one row and the heading goes: height is what a landscape phone lacks. */
  .table-header { align-items: flex-start; display: flex; gap: .5rem; }
  .table-header .score-bar { flex: 1 1 58%; min-width: 0; }
  .table-header .table-bar { flex: 1 1 42%; min-width: 0; }

}
/* Sheets (US-116): a <dialog data-sheet> sits at the bottom of a phone and is a centred modal from 1024px. The
   grabber is the handle to drag it down; the drag offset comes from sheet.js. Reduced and Off skip the slide in. */
main.shell:focus { outline: none; }
dialog[data-sheet] { animation: sheet-in .22s ease; background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: var(--radius-panel) var(--radius-panel) 0 0; box-shadow: var(--shadow-hard); color: var(--card-ink); margin: auto 0 0; max-width: none; padding: 0 1.4rem 1.3rem; transform: translateY(var(--sheet-drag, 0)); width: 100%; }
dialog[data-sheet]::backdrop { background: rgba(0, 0, 0, .55); }
.sheet-grabber { cursor: grab; display: block; height: 1.5rem; margin: 0 -1.4rem; touch-action: none; }
.sheet-grabber::before { background: var(--card-ink); border-radius: 99px; content: ""; display: block; height: .3rem; margin: .6rem auto 0; opacity: .35; width: 2.5rem; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (min-width: 1024px) {
  dialog[data-sheet] { border-radius: var(--radius-panel); margin: auto; max-width: 480px; }
  .sheet-grabber { display: none; }
}
body[data-effects="reduced"] dialog[data-sheet], body[data-effects="off"] dialog[data-sheet] { animation: none; }
/* The "Leave this table?" question (US-110). */
.leave-dialog h2 { margin: 0 0 .5rem; text-shadow: none; }
.leave-dialog p { font-weight: 700; margin: 0 0 1.2rem; }
.leave-dialog-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.leave-dialog-actions .button { margin-top: 0; }
/* Clean headings on the felt (US-111). A big 4px drop on every title, with a 0.92 line height, put a ghost copy of a
   wrapped title's first line under its second line: titles are outline only now, and only the large home hero keeps
   the drop. Small text gets the thin outline. */
.home-view h1 { line-height: .98; text-shadow: var(--text-outline), 3px 3px 0 var(--card-ink); }
.eyebrow {
  text-shadow: var(--text-outline-thin);
}

/* A livelier home: an indigo-to-plum backdrop with drifting colour blobs and card suits, a brighter sticker
   palette, a gradient title and staggered arrival. Home only: tables and their themes keep the felt. Full runs the
   motion, Reduced keeps the colour and the arrival fade, Off is static. */
.home-view {
  --coral: #ff7a59;
  --sun: #ffd23f;
  --mint: #5eead4;
  --sky: #6cc4ff;
  --grape: #b39bff;
  --bubble: #ff8fc7;
}
.home-bg {
  background: radial-gradient(var(--felt-dot) 1.4px, transparent 1.6px) 0 0 / 9px 9px,
    linear-gradient(160deg, #2b1468 0%, #4a1d7a 45%, #7a2a73 100%);
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}
.blob { border-radius: 50%; filter: blur(60px); opacity: .55; position: absolute; }
.blob-a { background: var(--coral); height: 28rem; left: -8rem; top: -6rem; width: 28rem; animation: blob-drift 18s ease-in-out infinite alternate; }
.blob-b { background: var(--sky); bottom: -10rem; height: 32rem; right: -8rem; width: 32rem; animation: blob-drift 22s ease-in-out -6s infinite alternate-reverse; }
.blob-c { background: var(--bubble); height: 20rem; left: 45%; top: 35%; width: 20rem; opacity: .35; animation: blob-drift 26s ease-in-out -12s infinite alternate; }
@keyframes blob-drift { to { transform: translate(6rem, 4rem) scale(1.15); } }
.float-suit { animation: suit-rise 16s linear infinite; bottom: -4rem; font-size: 2.6rem; opacity: 0; position: absolute; }
.float-suit.s1 { color: #fff; left: 6%; }
.float-suit.s2 { animation-delay: -3s; animation-duration: 19s; color: var(--coral); left: 22%; }
.float-suit.s3 { animation-delay: -7s; color: var(--sun); left: 40%; }
.float-suit.s4 { animation-delay: -10s; animation-duration: 21s; color: var(--mint); left: 58%; }
.float-suit.s5 { animation-delay: -5s; color: var(--bubble); left: 76%; }
.float-suit.s6 { animation-delay: -13s; animation-duration: 18s; color: var(--sky); left: 90%; }
@keyframes suit-rise {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  10%, 80% { opacity: .35; }
  100% { opacity: 0; transform: translateY(-110vh) rotate(200deg); }
}

.home-view h1 em {
  background: linear-gradient(90deg, var(--sun), var(--coral) 60%, var(--bubble));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* No text-stroke: it is painted over the gradient fill (paint-order is ignored with background-clip: text on
     Android Chrome/WebView) and eats the glyphs. The outline is a ring of drop-shadows behind the fill instead. */
  -webkit-text-stroke: 0;
  text-shadow: none;
  padding: 0 .04em;
  filter: drop-shadow(1.5px 0 0 var(--card-ink)) drop-shadow(-1.5px 0 0 var(--card-ink))
    drop-shadow(0 1.5px 0 var(--card-ink)) drop-shadow(0 -1.5px 0 var(--card-ink))
    drop-shadow(3px 3px 0 var(--card-ink));
}
.home-view .deal-stage { transform: scale(1.25); transform-origin: 50% 0; }
.home-view .play-now {
  background: var(--sun);
  animation: play-pulse 2.4s ease-in-out infinite;
}
@keyframes play-pulse { 50% { transform: scale(1.05); box-shadow: 6px 6px 0 var(--card-ink); } }
.home-view .welcome-badges span { animation: badge-bob 3.2s ease-in-out infinite; }
.home-view .welcome-badges span:nth-child(2) { animation-delay: -1s; background: var(--mint); }
.home-view .welcome-badges span:nth-child(3) { animation-delay: -2s; background: var(--bubble); }
@keyframes badge-bob { 50% { translate: 0 -4px; } }

.home-view .mode-card:nth-child(1) { background: var(--sun); }
.home-view .mode-card:nth-child(2) { background: var(--mint); }
.home-view .mode-card:nth-child(3) { background: var(--coral); }
.home-view .mode-card:nth-child(4) { background: var(--sky); }
.home-view .mode-card:nth-child(5) { background: var(--grape); }
.home-view .mode-card:nth-child(6) { background: var(--bubble); }
.home-view .mode-card .card-icon { color: var(--card-ink); }
.home-view .mode-card:nth-child(3n+1) .card-icon { color: var(--card-red); }
.home-view .mode-card { animation: card-arrive .5s cubic-bezier(.3, 1.4, .5, 1) both; }
.home-view .mode-card:nth-child(2) { animation-delay: .06s; }
.home-view .mode-card:nth-child(3) { animation-delay: .12s; }
.home-view .mode-card:nth-child(4) { animation-delay: .18s; }
.home-view .mode-card:nth-child(5) { animation-delay: .24s; }
.home-view .mode-card:nth-child(6) { animation-delay: .3s; }
@keyframes card-arrive { from { opacity: 0; transform: translateY(24px) rotate(calc(var(--card-tilt) * 3)); } }
.home-view .mode-card:hover, .home-view .mode-card:focus-visible { animation: mode-bounce .45s cubic-bezier(.3, 1.6, .5, 1); }
.home-view .mode-card:active { animation: none; }
/* Hover keeps its bounce: the arrival only plays once, then hover's own animation replaces it. */
.home-view .mode-card:hover .card-icon, .home-view .mode-card:focus-visible .card-icon { animation: icon-wiggle .5s ease; }
@keyframes icon-wiggle { 25% { transform: rotate(-14deg) scale(1.1); } 60% { transform: rotate(12deg) scale(1.1); } }

@media (max-width: 760px) {
  .home-view .deal-stage { transform: scale(.55); transform-origin: 0 0; }
  .float-suit { font-size: 1.9rem; }
}
body[data-effects="reduced"] :is(.blob, .float-suit, .home-view .play-now, .home-view .welcome-badges span) { animation: none; }
body[data-effects="reduced"] .float-suit { opacity: .25; bottom: auto; top: 20%; }
body[data-effects="reduced"] .home-view .mode-card { animation: fade-in var(--effect-fast) both; }
body[data-effects="reduced"] .home-view .mode-card:hover, body[data-effects="reduced"] .home-view .mode-card:focus-visible { animation: none; }
body[data-effects="off"] :is(.blob, .float-suit, .home-view .play-now, .home-view .welcome-badges span, .home-view .mode-card, .home-view .mode-card:hover, .home-view .mode-card:focus-visible, .home-view .mode-card .card-icon) { animation: none; }
body[data-effects="off"] .float-suit { opacity: .25; bottom: auto; top: 20%; }

/* Behind a table the page is a dark plum with a diagonal weave, not the felt: the table's own felt and rim now stand out
   from the page whatever the table theme. Any view with a visible table gets it (bot game, bidding, private table). */
body:has(.destination-view:not([hidden]) .card-table:not([hidden])) {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 14px),
    radial-gradient(ellipse at 50% 30%, #3a2063 0%, #1f1238 60%, #140a28 100%);
  background-attachment: fixed;
}

/* Tab bar (US-117) */
:root { --tab-bar-height: calc(3.9rem + env(safe-area-inset-bottom)); }
/* A paper strip fixed to the bottom of a phone, a row of stickers at the top from 1024px. The page
   keeps room under the bar while it is shown; the bar is hidden during a match. */
.tab-bar {
  background: var(--card-paper);
  border-top: var(--outline-width) solid var(--card-ink);
  bottom: 0;
  display: flex;
  gap: .25rem;
  left: 0;
  padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 50;
}
.tab-bar[hidden] { display: none; }
.shell:has(#tab-bar:not([hidden])) { padding-bottom: calc(var(--tab-bar-height) + 1.6rem); }
html:has(#tab-bar:not([hidden])) { scroll-padding-bottom: calc(var(--tab-bar-height) + .5rem); }
.tab {
  align-items: center;
  border: var(--outline-width) solid transparent;
  border-radius: 999px;
  color: var(--card-ink);
  display: flex;
  flex: 1;
  flex-direction: column;
  font-size: .78rem;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
  padding: .2rem .4rem;
  text-decoration: none;
}
.tab-glyph { font-size: 1.15rem; line-height: 1; }
.tab[aria-current="page"] { background: var(--gold); border-color: var(--card-ink); }
.tab[aria-current="page"] .tab-label { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 3px; }
@media (min-width: 1024px) {
  .tab-bar { background: none; border: 0; float: right; padding: 0; position: static; }
  .shell:has(#tab-bar:not([hidden])) { padding-bottom: 4rem; }
  .tab { background: var(--card-paper); border-color: var(--card-ink); box-shadow: var(--shadow-hard); flex: none; flex-direction: row; font-size: .88rem; gap: .4rem; padding: .45rem 1rem; }
  .tab[aria-current="page"] { background: var(--gold); }
}

/* Setup sheet (US-118): a paper sheet of compact choices. It scrolls inside itself when the viewport is short. */
.setup-sheet { --muted: #4b4358; max-height: calc(100dvh - 1rem); overflow-y: auto; }
.setup-header { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
.setup-header h2 { font-family: var(--font-sans); font-size: 1.25rem; margin: 0; text-shadow: none; }
.sheet-close { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 999px; color: var(--card-ink); cursor: pointer; font-size: 1rem; font-weight: 900; min-height: 44px; min-width: 44px; }
.setup-seats { align-items: center; border: 0; display: grid; gap: .4rem .6rem; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); margin: .4rem 0 .9rem; padding: 0; }
.setup-seats legend { color: var(--muted); font-size: .72rem; font-weight: 800; grid-column: 1 / -1; margin-bottom: .2rem; padding: 0; }
.setup-seats label, .setup-owner label { color: var(--muted); font-size: .72rem; font-weight: 800; }
.setup-owner { margin: .4rem 0 .9rem; }
.setup-seats input, .setup-owner input { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 8px; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .18); color: var(--card-ink); min-height: 44px; padding: .5rem .6rem; width: 100%; }
.setup-owner input { display: block; margin-top: .3rem; }
.more-rules { margin: .2rem 0 .6rem; }
.more-rules summary { align-items: center; cursor: pointer; display: flex; font-weight: 900; min-height: 44px; }
.setup-sheet .setup-help { color: var(--card-ink); margin: .1rem 0 .5rem; text-shadow: none; }
.setup-sheet .form-message { color: #8a1c1c; font-weight: 800; margin: .3rem 0 0; min-height: 0; text-shadow: none; }
.setup-sheet .button { margin-top: .6rem; width: 100%; }
.setup-sheet .choice-label, .setup-sheet .setup-seats legend { color: var(--card-ink); text-shadow: none; }
.more-rules summary::before { content: "▸"; margin-right: .5rem; }
.more-rules[open] summary::before { content: "▾"; }

/* The solo table (US-119): the felt fills the free height; the chip row and the messages (toasts) sit on the felt. */
.table-screen { position: relative; }
.table-menu-game { color: var(--card-ink); font-size: .75rem; font-weight: 800; margin: 0; padding: .45rem .8rem .3rem; }
.table-menu-game:empty { display: none; }
.table-toasts {
  align-items: center;
  bottom: calc(2% + var(--ch, 104px) + 3.3rem);
  display: flex;
  justify-content: center;
  left: 4%;
  pointer-events: none;
  position: absolute;
  right: 4%;
  z-index: 9;
}
.table-toasts:empty { display: none; }
.toast {
  animation: toast-in .22s cubic-bezier(.2, .8, .2, 1) both;
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--card-ink);
  color: var(--card-ink);
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 800;
  max-width: 100%;
  padding: .4rem .8rem;
  text-align: center;
}
.toast.toast-declaration { background: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
body[data-effects="reduced"] .toast, body[data-effects="off"] .toast { animation: none; }
.chip-row { align-items: center; display: flex; gap: .4rem; left: 4%; position: absolute; right: 4%; top: calc(2% + 4rem); z-index: 6; }
.chip-row[hidden] { display: none; }
.chip-list { display: flex; flex: 1 1 auto; gap: .35rem; min-width: 0; overflow-x: auto; padding: 0 .2rem .2rem; scrollbar-width: none; }
.chip {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 999px;
  color: var(--card-ink);
  cursor: pointer;
  flex: 0 0 auto;
  font-family: var(--font-sans);
  font-size: .75rem;
  font-weight: 800;
  min-height: 2.2rem;
  padding: .2rem .8rem;
  white-space: nowrap;
}
.chip[hidden] { display: none; }
.chip-declare { flex: 0 1 auto; max-width: 62%; overflow: hidden; text-overflow: ellipsis; }
.chip-declare[aria-checked="true"] { background: var(--gold); }
.chip.scored { background: var(--gold); }
.table-screen .round-result {
  bottom: 0;
  left: 0;
  margin: 0;
  max-height: 55%;
  overflow: auto;
  position: absolute;
  right: 0;
  text-shadow: none;
  z-index: 20;
}
@media (max-width: 600px) and (orientation: portrait) {
  /* The hand is two rows of cards; the messages sit above both, not on the first row. */
  .card-table:has(.table-hand[data-rows="2"]) .table-toasts { bottom: calc(2% + 132px + 3.3rem); }
}
/* Below 640px of height the felt needs more than the window gives it, so the page scrolls rather than clip the hand. */
@media (max-width: 760px) and (min-height: 640px) {
  .shell:has([data-view="table"]:not([hidden])) { height: 100dvh; overflow: hidden; }
}

/* The auction sheet (US-120): a panel over the lower part of the card table; it carries the player's hand. */
.auction-sheet {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 22px 22px 0 0;
  bottom: 0;
  box-shadow: 0 -4px 0 var(--card-ink);
  color: var(--card-ink);
  display: grid;
  gap: .3rem;
  grid-template-columns: minmax(0, 1fr);
  left: 0;
  max-height: 56dvh;
  overflow-y: auto;
  padding: .3rem .8rem .8rem;
  position: absolute;
  right: 0;
  text-shadow: none;
  z-index: 15;
}
.auction-sheet[hidden] { display: none; }
.auction-sheet .sheet-grabber { background: var(--card-ink); border-radius: 3px; height: 4px; justify-self: center; opacity: .35; width: 2.4rem; }
.auction-head { align-items: center; display: flex; gap: .6rem; justify-content: space-between; }
.auction-sheet h2 { font-size: 1rem; margin: 0; }
.auction-upturned { --cw: 40px; --ch: 58px; margin: 0; min-height: 0; width: auto; }
.auction-history { font-size: .75rem; font-weight: 800; margin: 0; overflow-x: auto; white-space: nowrap; }
/* The hand shows the upper half of its cards, where the rank and the suit are, so they can be big: the cards are as wide as
   eight overlapped cards allow (at most 56 px) and the lower half is clipped. */
.auction-hand { --cw: min(56px, calc((100vw - 4rem) / 5.9)); --ch: calc(var(--cw) * 1.45); display: flex; height: calc(var(--ch) / 2 + .1rem); justify-content: center; overflow: hidden; padding: .1rem 0 0; }
.auction-hand .playing-card { height: var(--ch); width: var(--cw); }
.auction-hand .playing-card + .playing-card { margin-left: calc(var(--cw) * -.3); }
.auction-sheet .choice-field { margin: 0; }
.auction-values .choice-group, .auction-suits .choice-group { flex-wrap: nowrap; overflow-x: auto; padding: .3rem .2rem .45rem; scrollbar-width: none; }
.auction-sheet, .auction-sheet * { text-shadow: none; }
/* The groups are named for screen readers; the sheet has no room for their captions. */
.auction-sheet .choice-label { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.auction-trumps { display: flex; flex-wrap: wrap; gap: .4rem; }
.auction-reason { font-size: .75rem; font-weight: 700; margin: 0; min-height: 1.3em; }
.auction-sheet .auction-history, .auction-sheet .auction-reason, .auction-sheet h2 { color: var(--card-ink); text-shadow: none; }
.auction-sheet .choice-group .choice span { font-size: .88rem; min-width: 0; padding: .35rem .7rem; white-space: nowrap; }
.auction-actions { display: grid; gap: .5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.auction-actions .button { font-size: .9rem; min-width: 0; padding: .6rem .5rem; }
.auction-actions #auction-coinche:not([hidden]) { grid-column: 1 / -1; }
.auction-actions button[hidden] { display: none; }
.auction-waiting-view .auction-sheet button, .auction-waiting-view .auction-sheet input { pointer-events: none; }
/* Once a call is made the sheet gets out of the way, so the table shows how the other players bid next. */
.auction-waiting-view .auction-sheet, .auction-sheet.call-sent { visibility: hidden; }
.auction-sheet.dealing { visibility: hidden; }
.auction-phase .trick-progress { display: none; }
.auction-trumps { display: grid; gap: .4rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.auction-trumps button { font-size: .8rem; min-width: 0; padding: .5rem .2rem; white-space: nowrap; }
.auction-actions { display: flex; flex-wrap: wrap; }
.auction-actions .button { flex: 1 1 40%; }
.auction-actions #auction-coinche { flex-basis: 100%; }
.auction-sheet .auction-trumps { background: none; border: 0; box-shadow: none; margin: 0; padding: 0; }
.auction-trumps button { align-items: center; display: flex; flex-direction: column; gap: .15rem; justify-content: center; line-height: 1.1; }

/* The online table (US-121): the lobby is a sheet over the empty felt, reactions are a tray over the hand. */
.lobby-sheet {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 22px 22px 0 0;
  bottom: 0;
  box-shadow: 0 -4px 0 var(--card-ink);
  color: var(--card-ink);
  display: grid;
  gap: .45rem;
  grid-template-columns: minmax(0, 1fr);
  left: 0;
  max-height: 72dvh;
  overflow-y: auto;
  padding: .3rem .8rem .8rem;
  position: absolute;
  right: 0;
  text-shadow: none;
  z-index: 15;
}
.lobby-sheet[hidden] { display: none; }
.lobby-sheet .sheet-grabber { background: var(--card-ink); border-radius: 3px; height: 4px; justify-self: center; opacity: .35; width: 2.4rem; }
.lobby-sheet h2 { font-size: 1.05rem; margin: 0; }
.lobby-sheet :is(p, span, small, strong, summary, .choice-label) { color: var(--card-ink); text-shadow: none; }
.lobby-sheet p { font-size: .8rem; margin: 0; }
.lobby-code { align-items: center; display: flex; flex-wrap: wrap; gap: .5rem; }
.lobby-code[hidden] { display: none; }
.lobby-code strong { font-family: ui-monospace, monospace; font-size: 1.3rem; letter-spacing: .12em; }
.lobby-seats { display: grid; gap: .35rem .5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lobby-seat { background: rgba(0,0,0,.06); border-radius: var(--radius-sm); display: grid; gap: .05rem; min-width: 0; padding: .35rem .5rem; }
.lobby-seat strong, .lobby-seat span { font-size: .85rem; overflow-wrap: anywhere; }
.lobby-seat small { font-size: .65rem; font-weight: 800; opacity: .7; }
.lobby-seat-you { outline: 2px solid var(--card-ink); }
.lobby-seat-empty strong { opacity: .6; }
.lobby-rules summary { cursor: pointer; font-weight: 800; }
.lobby-rules .timer-settings { margin-top: .4rem; }
.lobby-summary { opacity: .8; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.lobby-actions .button { flex: 1 1 8rem; }
.lobby-actions [hidden] { display: none; }
.reaction-toggle {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--card-ink);
  cursor: pointer;
  font-size: 1.3rem;
  height: 2.6rem;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: .6rem;
  top: .6rem;
  width: 2.6rem;
  z-index: 12;
}
.reaction-toggle[hidden], .reaction-tray[hidden] { display: none; }
.reaction-tray {
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--card-ink);
  display: grid;
  gap: .35rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: .5rem;
  position: absolute;
  right: .6rem;
  top: 3.6rem;
  width: min(18rem, 86%);
  z-index: 13;
}
.reaction-tray .reaction-button { font-size: .8rem; }
.reaction-tray .reaction-button { background: rgba(0,0,0,.06); border-color: var(--card-ink); color: var(--card-ink); text-shadow: none; }
.lobby-sheet :is(h2, .text-button, .lobby-code strong) { color: var(--card-ink); text-shadow: none; -webkit-text-stroke: 0; }
.lobby-sheet .form-message:empty { display: none; }
.lobby-actions .button { padding-block: .55rem; }

/* Home (US-122): the resume card under Play now, the goal line as a link to Progress. */
.resume-card {
  align-items: center;
  background: var(--card-paper);
  border: var(--outline-width) solid var(--card-ink);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-hard);
  color: var(--card-ink);
  display: flex;
  gap: .8rem;
  justify-content: space-between;
  margin: .9rem 0 0;
  max-width: 28rem;
  padding: .6rem 1rem;
  text-decoration: none;
  text-shadow: none;
}
.resume-card[hidden] { display: none; }
.resume-card-done { opacity: .8; }
.daily-board { margin-top: 1.2rem; }
.resume-copy { display: grid; gap: .1rem; }
.resume-copy strong { font-size: 1rem; }
.resume-copy small { font-size: .8rem; font-weight: 700; }
.resume-online { display: grid; gap: 0; max-width: 28rem; }
.resume-online[hidden] { display: none; }
.resume-online-item { align-items: center; display: flex; gap: .4rem; }
.resume-online-item .resume-card { flex: 1; }
.resume-forget {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  margin-top: .9rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
}
a.goal-line { display: block; text-decoration: none; }
a.goal-line:hover, a.goal-line:focus-visible { text-decoration: underline; }

/* The help sheet (US-123): the hint, the card order and the rules, scrolling inside the sheet. */
.help-sheet { max-height: 86dvh; }
.help-body { display: grid; gap: .8rem; padding: 0 1rem 1rem; }
.help-body :is(h3, p, section) { color: var(--card-ink); text-shadow: none; }
.help-body h3 { font-size: 1rem; margin: 0 0 .15rem; }
.help-body p { font-size: .9rem; margin: 0; }
.help-body section { background: rgba(0,0,0,.05); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); }
.help-body .button { justify-self: start; }
.help-body [hidden] { display: none; }
.help-body section { margin: 0; }

/* Progress, Crew and Me (US-124). */
.stats-goal { background: var(--paper); border: 3px solid var(--card-ink); border-radius: 999px; color: var(--card-ink); font-weight: 800; margin: .4rem 0; padding: .3rem 1rem; text-shadow: none; width: fit-content; }
.stats-goal[hidden] { display: none; }
.stats-switcher { margin: .6rem 0; }
.stats-columns { display: block; }
[data-stats-panel][hidden] { display: none; }
.code-boxes { display: flex; gap: .4rem; }
.code-box { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 10px; color: var(--card-ink); font: 900 1.4rem ui-monospace, monospace; height: 3rem; min-width: 0; text-align: center; text-transform: uppercase; width: 100%; }
.crew-open { margin: 1rem 0; }
.crew-open ul { display: grid; gap: .4rem; list-style: none; margin: .4rem 0 0; padding: 0; }
.settings-privacy { margin: 1rem 0; }

/* Desktop table (US-125): from 1024px the reaction tray is a permanent side panel on the felt (opened by the script, the
   toggle is hidden), from the same DOM as the phone's tray; the chip row keeps its place under the top seat. */
@media (min-width: 1024px) {
  .table-screen #tbl-reactions-toggle { display: none; }
  .table-screen #tbl-reaction-tray { grid-template-columns: minmax(0, 1fr); right: 1.2rem; top: 1.2rem; width: 11.5rem; }
  .lobby-sheet { border-radius: var(--radius-panel); bottom: 1.5rem; left: 50%; max-width: 480px; right: auto; transform: translateX(-50%); width: calc(100% - 2rem); }
  .auction-sheet { border-radius: var(--radius-panel); bottom: 1.5rem; left: 50%; max-width: 480px; right: auto; transform: translateX(-50%); width: calc(100% - 2rem); }
}
@media (min-width: 1024px) { .table-screen #tbl-reaction-tray { gap: .2rem; padding: .35rem; top: .8rem; width: 10rem; } .table-screen #tbl-reaction-tray .reaction-button { padding: .2rem .5rem; } }

/* Keyboard use (US-074): a visible focus on every control, and a way past the header. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--gold, #ffd166); outline-offset: 3px; }
.playing-card:focus-visible { outline: 4px solid var(--gold, #ffd166); outline-offset: 3px; z-index: 40; }
.skip-link { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 999px; color: var(--card-ink); font-weight: 900; left: .6rem; padding: .5rem 1rem; position: fixed; top: -4rem; z-index: 100; }
.skip-link:focus { top: .6rem; }

/* Display name (US-072). */
.name-form { display: grid; gap: .4rem; margin-top: .75rem; }
.name-form small { display: block; opacity: .85; }
.name-form-row { display: flex; gap: .5rem; }
.name-form-row input { flex: 1; min-width: 0; }

/* Offline notice (US-073). */
.offline-note { background: var(--card-paper); border-bottom: var(--outline-width) solid var(--card-ink); color: var(--card-ink); font-weight: 800; margin: 0; padding: .5rem 1rem; text-align: center; }
/* The reconnect button of the connection note and the line of missed moves (US-163): in the page's flow, never over the table. */
#connection-reconnect { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: 999px; color: var(--card-ink); cursor: pointer; font: inherit; font-weight: 900; margin-inline-start: .5rem; min-height: 44px; padding: 0 1rem; }
#connection-reconnect:disabled { cursor: progress; opacity: .6; }
.missed-moves { background: var(--card-paper); border-bottom: var(--outline-width) solid var(--card-ink); color: var(--card-ink); font-weight: 800; margin: 0; padding: .5rem 1rem; text-align: center; }
/* Stations keep clear of the trick (US-126): long names are cut with an ellipsis, and the stations shrink (smaller avatar,
   then the name alone) before the trick cards do. app-layout.js picks the level. */
.player-station .player-details { min-width: 0; }
.player-station .player-details strong, .player-station .seat-meta { display: block; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stations-compact .player-station .seat-meta, .stations-minimal .player-station .seat-meta, .stations-low .player-station .seat-meta { display: none; }
.stations-compact .player-station, .stations-minimal .player-station, .stations-low .player-station { min-width: 0; }
.stations-compact .player-station { padding: .25rem .6rem .25rem .3rem; }
.stations-compact .player-station .player-avatar { height: 1.7rem; width: 1.7rem; }
.stations-compact .player-station .player-details strong { font-size: .8rem; max-width: 6rem; }
.stations-minimal .player-station, .stations-low .player-station { padding: .15rem .45rem .15rem .2rem; }
.stations-minimal .player-station .player-avatar, .stations-low .player-station .player-avatar { height: 1.3rem; width: 1.3rem; }
.stations-minimal .player-station .player-details strong, .stations-low .player-station .player-details strong { font-size: .72rem; max-width: 5rem; }
.stations-low .station-bottom { translate: 0 .8rem; }
/* The points of a finished trick sit in the free corner of the trick, never over one of its cards (US-126). */
.trick-points { left: auto; margin-right: .35rem; right: 100%; top: 0; transform: none; }

/* Leaderboard (US-069). */
.board-table .board-mine { font-weight: 900; outline: 3px solid var(--gold, #ffd166); outline-offset: -3px; }

/* Rating history (US-068). */
.rating-history { display: grid; gap: .5rem; margin-top: .75rem; }
.rating-line { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: .6rem; height: 3rem; width: 100%; }
.rating-line polyline { fill: none; stroke: var(--card-ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.stats-note { font-size: .85rem; margin: .6rem 0 0; opacity: .85; }

/* Costly cards in the review (US-067). */
.review-costly { background: var(--card-paper); border: var(--outline-width) solid var(--card-ink); border-radius: .8rem; color: var(--card-ink); font-weight: 800; margin: .4rem 0 0; padding: .4rem .7rem; }
.review-why { display: grid; gap: .15rem; justify-items: center; }
.review-why-button { background: var(--card-paper); border: 2px solid var(--card-ink); border-radius: 999px; color: var(--card-ink); cursor: pointer; font: inherit; font-size: .75rem; font-weight: 800; min-height: 2rem; padding: 0 .6rem; text-shadow: none; }
.review-why-text { background: var(--card-paper); border: 2px solid var(--card-ink); border-radius: 8px; color: var(--card-ink); font-size: .75rem; font-weight: 700; padding: .2rem .4rem; text-shadow: none; }
.review-trick .costly-card, .review-slot .costly-card { outline: 3px solid #e4572e; outline-offset: 2px; }

/* The hand stays in view while the auction sheet scrolls, and short phones get a taller sheet, so the cards are never
   scrolled away behind the bid and coinche buttons. */
.auction-hand { background: var(--card-paper); position: sticky; top: 0; z-index: 2; }
@media (max-height: 760px) {
  .auction-sheet { max-height: 64dvh; }
}
/* Spectators (US-071). */
.table-watchers { font-size: .8rem; font-weight: 800; margin: 0; opacity: .9; }

/* Friends and invitations (US-070). */
.friends-panel { display: grid; gap: .5rem; margin-top: 1rem; }
.friend-link-row { align-items: center; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.friend-link-row input { flex: 1; min-width: 8rem; }
.friend-list { display: grid; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.friend-row { align-items: center; display: flex; gap: .6rem; }
.friend-row > span { flex: 1; font-weight: 800; }
.friend-row small { opacity: .8; }
.invite-banner { align-items: center; background: var(--card-paper); border-bottom: var(--outline-width) solid var(--card-ink); color: var(--card-ink); display: flex; flex-wrap: wrap; font-weight: 800; gap: .6rem; justify-content: center; padding: .5rem 1rem; position: sticky; top: 0; z-index: 90; }
.invite-banner[hidden] { display: none; }
.lobby-friends h3 { font-size: 1rem; margin: .5rem 0 .3rem; }
