:root {
  --bg: #f3efe6;
  --card: #fffcf7;
  --ink: #161513;
  --muted: #6f6a62;
  --line: rgba(22, 21, 19, 0.08);
  --star: #c9a227;
  --heart: #c41f3a;
  --club: #1f6b4a;
  --spade: #1a1a1a;
  --diamond: #2b5bd7;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --game-scale: 1;
  --shell: min(680px, 100%);
  --game-shell: min(480px, 100%);
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  z-index: 40;
  pointer-events: none;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
p { color: var(--muted); line-height: 1.5; }
button {
  border: 0;
  background: var(--ink);
  color: #fffaf3;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  min-height: 48px;
}
button:disabled { opacity: 0.45; cursor: wait; }
.quiet {
  background: transparent;
  color: var(--ink);
  border: 0;
  box-shadow: none;
  font-weight: 500;
  letter-spacing: 0;
}
.danger { background: #9d2c2c; color: #fffaf3; }
.panel .quiet,
.form-actions .quiet,
.finish-card .quiet,
dialog .quiet:not(.close),
#homeScreenLink {
  border: 1px solid rgba(22, 21, 19, 0.12);
}

header, main {
  width: var(--shell);
  margin: 0 auto;
}
body.in-game header,
body.in-game main { width: var(--game-shell); }
header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
main {
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
body:not(.in-game) .brand { flex: 1; }
.brand-mark {
  width: 38px;
  height: 32px;
  object-fit: contain;
  flex: none;
}
.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.brand-text small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
body.in-game .brand-text { display: none; }
.mobile-game-heading { display: none; flex: 1; min-width: 0; }
body.in-game .mobile-game-heading { display: block; }
.mobile-game-heading h1 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.03em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-save-state {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { display: flex; gap: 0; flex: none; margin-left: auto; }
header .quiet {
  min-height: 44px;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
}
#retrySave { display: none; flex: none; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
main h1, main h2, dialog h2 {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 560;
  letter-spacing: -0.03em;
  color: var(--ink);
}
main h1 {
  font-size: clamp(36px, 9vw, 52px);
  line-height: 1.08;
  margin: 6px 0 10px;
}
main h2 {
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.15;
  margin: 8px 0;
}
.hero p { margin: 0; max-width: 38em; }
.hero > button { margin-top: 6px; }
.suit-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 2px 0 14px;
}
.suit-row img { width: 20px; height: 20px; object-fit: contain; }
.hero .suit-row { justify-content: flex-start; gap: 16px; padding: 14px 0 18px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 28px 0 12px;
}
.section-head h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}
.count { color: var(--muted); font-size: 13px; font-weight: 400; }
.game-list { display: grid; gap: 12px; }
.game-swipe {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #9d2c2c;
  isolation: isolate;
  box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04), 0 8px 20px rgba(22, 21, 19, 0.05);
}
.game-swipe .game-card {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 16px 56px 16px 16px;
  min-height: 72px;
  transform: translateX(var(--swipe-x, 0px));
  transition: transform .2s ease;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
.game-swipe .game-card > div { min-width: 0; }
.game-swipe.delete-open { --swipe-x: -88px; }
.game-swipe.dragging .game-card { transition: none; }
.game-card strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.game-card p { margin: 4px 0 0; font-size: 13px; }
.roster-line { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.roster-player { display: inline-flex; align-items: center; gap: 4px; }
.roster-player span { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.game-meta { display: flex; align-items: center; gap: 6px; }
.mini-suit, .mini-crown { width: 14px; height: 14px; object-fit: contain; flex: none; }
.badge {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--ink);
}
.badge.finished { background: rgba(201, 162, 39, 0.18); color: #7a5b12; }
.delete-game {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 88px;
  min-height: 44px;
  border-radius: 0;
  padding: 10px 4px;
  visibility: hidden;
  z-index: 0;
  font-size: 15px;
}
.game-swipe.delete-open .delete-game,
.game-swipe.dragging .delete-game { visibility: visible; }
.reveal-delete {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  font-weight: 500;
  border-radius: 10px;
}
.reveal-delete:hover { background: rgba(22, 21, 19, 0.05); }
.game-swipe.delete-open .reveal-delete,
.game-swipe.dragging .reveal-delete { visibility: hidden; }
.game-swipe .game-card:focus-visible { outline-offset: -4px; }
.delete-game:focus-visible { outline-color: #fff; outline-offset: -5px; }

.panel {
  background: var(--card);
  border-radius: 24px;
  padding: 18px 16px 16px;
  box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04), 0 12px 32px rgba(22, 21, 19, 0.06);
}
.empty { text-align: center; padding: 28px 18px 22px; }
.empty-crown { width: 64px; height: 48px; object-fit: contain; margin: 0 auto 8px; }
.empty h2 { margin: 4px 0 8px; }
.empty button { margin-top: 8px; }
.footnote {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 22px 0 4px;
}
.hint { font-size: 13px; color: var(--muted); }
.error { color: #9d2c2c; }
label { display: block; font-size: 12px; font-weight: 600; margin: 14px 0 6px; }
input[type="text"], input:not([type]) {
  font-size: 16px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(22, 21, 19, 0.12);
  background: #fff;
  color: var(--ink);
  min-height: 48px;
}
input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.form-actions button { width: 100%; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
legend { font-size: 12px; font-weight: 600; padding: 0; }
.roster-choice label {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.roster-choice input {
  margin: 0;
  width: 18px;
  min-height: 0;
  height: 18px;
  flex: none;
  accent-color: var(--ink);
}
.roster-names {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  overflow-wrap: break-word;
}
.player-entry {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  transform: translateY(var(--player-offset, 0px));
  transition: transform 150ms ease;
}
.player-entry label { margin: 0; flex: 1; min-width: 0; }
.player-entry .suit { width: 26px; height: 26px; object-fit: contain; flex: none; }
.player-entry .quiet { width: 44px; min-height: 44px; padding: 0; }
#addPlayer { margin-top: 6px; }

.player-handle {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: #8a847a;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.player-handle:active { cursor: grabbing; }
.player-dragging {
  position: relative;
  z-index: 2;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(22, 21, 19, 0.12);
  border-radius: 12px;
  transition: none;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
  gap: 8px;
}
.seat {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border-radius: 16px;
  padding: 8px 4px 10px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04), 0 8px 20px rgba(22, 21, 19, 0.05);
}
.seat.lead {
  box-shadow: 0 0 0 1.5px var(--star), 0 8px 20px rgba(201, 162, 39, 0.18);
}
/* Same crown slot on every seat so names and scores stay aligned. */
.lead-crown {
  display: block;
  width: min(72px, 84%);
  height: 54px;
  object-fit: contain;
  object-position: center bottom;
  margin: 0 auto 4px;
  flex: none;
  visibility: hidden;
}
.seat.lead .lead-crown { visibility: visible; }
.scoreboard[data-players="3"] .lead-crown { width: min(64px, 84%); height: 48px; }
.scoreboard[data-players="4"] .lead-crown { width: min(52px, 86%); height: 40px; }
.scoreboard[data-players="5"] .lead-crown { width: min(40px, 88%); height: 32px; margin-bottom: 2px; }
.total-name, .player-name {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.total-name {
  display: block;
  max-width: 100%;
  font-size: calc(11px * var(--game-scale));
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.total-score {
  display: block;
  margin-top: 2px;
  font-weight: 650;
  font-size: calc(26px * var(--game-scale));
  letter-spacing: -0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.scoreboard[data-players="5"] .total-score { font-size: calc(22px * var(--game-scale)); }

.progress {
  display: flex;
  gap: 5px;
  margin: 16px 0;
  align-items: center;
}
.progress span {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(22, 21, 19, 0.08);
}
.progress .done:nth-child(5n+1) { background: var(--star); }
.progress .done:nth-child(5n+2) { background: var(--heart); }
.progress .done:nth-child(5n+3) { background: var(--club); }
.progress .done:nth-child(5n+4) { background: var(--spade); }
.progress .done:nth-child(5n+5) { background: var(--diamond); }
.progress .current { background: var(--ink); height: 8px; }

.round-card { overflow: visible; }
.round-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  overflow: visible;
}
/* Fraunces figures for 3, 4, 5, 7, 9, and 13 descend past a tight line box.
   Keep the ink inside the border box, and never let 10–13 wrap. */
.round-count {
  margin: 0;
  min-width: min-content;
  flex: none;
  overflow: visible;
  line-height: 1;
}
.round-count-num {
  display: block;
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: calc(64px * var(--game-scale));
  line-height: 1.05;
  letter-spacing: -0.045em;
  padding: 0.08em 0.06em 0.06em;
  overflow: visible;
  white-space: nowrap;
}
.round-count.tens .round-count-num {
  font-size: calc(56px * var(--game-scale));
  letter-spacing: -0.05em;
}
.round-count-unit {
  display: block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.wild {
  width: calc(88px * var(--game-scale));
  height: calc(120px * var(--game-scale));
  flex: none;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid rgba(22, 21, 19, 0.12);
  box-shadow: 0 10px 24px rgba(22, 21, 19, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.wild .rank {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 650;
  font-size: calc(52px * var(--game-scale));
  line-height: 1;
  letter-spacing: -0.04em;
  padding: 0.18em 0.04em 0.2em;
}
.wild.tens .rank {
  font-size: calc(36px * var(--game-scale));
  letter-spacing: -0.05em;
  padding-bottom: 0.2em;
}
.wild .pip {
  width: calc(22px * var(--game-scale));
  height: calc(22px * var(--game-scale));
  object-fit: contain;
  margin-top: -4px;
}
.wild .corner {
  position: absolute;
  top: 7px;
  left: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  color: var(--star);
}
.wild.tens .corner { font-size: 11px; letter-spacing: -0.04em; }

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: calc(52px * var(--game-scale));
  border-top: 1px solid var(--line);
  transform: translateY(var(--player-offset, 0px));
  transition: transform 150ms ease;
}
.score-row .suit { width: 26px; height: 26px; object-fit: contain; flex: none; }
.dealer-slot {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(22, 21, 19, 0.28);
  box-shadow: none;
  font-weight: 500;
  letter-spacing: 0;
}
.dealer-slot.is-dealer {
  color: var(--ink);
  background: rgba(201, 162, 39, 0.18);
}
.deck-icon { width: 24px; height: 24px; display: block; }
.dealer-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--ink); flex: none; }
.history-deck { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; vertical-align: -3px; color: var(--muted); }
.history-deck .deck-icon { width: 16px; height: 16px; }
.player-name {
  flex: 1;
  min-width: 0;
  font-weight: 550;
  font-size: calc(18px * var(--game-scale));
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.score-row input {
  flex: none;
  width: 84px;
  height: 44px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
  font-weight: 650;
  font-size: calc(24px * var(--game-scale));
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.score-row input::placeholder { color: rgba(22, 21, 19, 0.35); }
.round-card > button { width: 100%; margin-top: 12px; }

.finish-card { text-align: center; }
.finish-card h2 { margin: 4px 0 8px; }
.finish-card p { margin: 0 0 16px; }
.finish-card button { width: 100%; }
.finish-card .quiet { margin-top: 10px; background: transparent; }

#history {
  margin-top: 14px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04);
}
#history summary {
  list-style: none;
  cursor: pointer;
  min-height: 52px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 550;
  font-size: 14px;
}
#history summary::-webkit-details-marker { display: none; }
#history summary::marker { content: ""; }
#history summary .count { margin-left: auto; }
#history summary::after {
  content: "›";
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
}
#history[open] summary::after { transform: rotate(90deg); }
.history-scroll { overflow-x: auto; padding: 0 12px 14px; }
.history-scroll table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13px; text-align: center; }
.history-scroll th, .history-scroll td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.history-scroll th { color: var(--muted); font-weight: 500; }
.history-scroll td input {
  width: 68px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 2px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#toast {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fffaf3;
  padding: 12px 16px;
  border-radius: 14px;
  z-index: 50;
  display: none;
  max-width: min(90vw, 420px);
  width: max-content;
  font-size: 14px;
}
dialog {
  border: 0;
  border-radius: 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  padding: 28px 22px 22px;
  text-align: center;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(22, 21, 19, 0.28);
}
dialog[open] { animation: reveal .45s cubic-bezier(.2, .9, .3, 1); }
dialog::backdrop { background: rgba(22, 21, 19, 0.46); backdrop-filter: blur(6px); }
dialog h2 { font-size: 30px; line-height: 1.15; margin: 6px 0 8px; }
dialog p { font-size: 15px; overflow-wrap: break-word; }
.close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 40px;
  min-height: 40px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}
#resultsDone, #dismissHomeScreen, #confirmDelete, #cancelDelete { min-height: 48px; }
#resultsDone, #dismissHomeScreen { width: 100%; margin-top: 18px; }
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.result-row.winner, .result-row.jester {
  position: relative;
  border-radius: 14px;
  margin: 36px 0 8px;
  padding: 12px;
}
.result-row.winner { background: rgba(201, 162, 39, 0.14); border: 1px solid rgba(201, 162, 39, 0.55); }
.result-row.jester { background: #f3eef6; border: 1px solid #d9cbe3; }
.result-name { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.result-name strong { font-weight: 600; overflow-wrap: break-word; }
.result-name small {
  flex-basis: 100%;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.result-score {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.result-marker { position: absolute; left: 0; animation: bob 2s ease-in-out infinite; }
.result-marker.crown { top: -36px; width: 42px; height: 32px; object-fit: contain; }
.result-marker.jester-hat { top: -40px; width: 42px; height: 38px; object-fit: contain; }
#editNames { text-align: left; }
#editNames h2 { font-size: 28px; text-align: left; }
#editNames input { padding: 10px 12px; min-height: 44px; }
.edit-names-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.edit-names-actions button { width: auto; }
.delete-dialog-actions { display: flex; gap: 10px; margin-top: 22px; }
.delete-dialog-actions button { flex: 1; padding: 12px 10px; }
#deleteConfirm, #homeScreenHelp {
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}
#homeScreenHelp .install-crown { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 14px; }
#homeScreenHelp h2 { font-size: 28px; }
.install-steps { text-align: left; padding-left: 22px; font-size: 16px; line-height: 1.4; }
.install-steps li { margin: 12px 0; }
.share-symbol { color: var(--ink); font-size: 22px; font-weight: 700; }
#homeScreenHelp .install-note { font-size: 12px; }
#homeScreenLink {
  display: block;
  margin: 12px auto calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(680px, calc(100% - 32px));
  background: var(--card);
  font-size: 15px;
}
#homeScreenLink[hidden] { display: none !important; }

.loading { color: var(--muted); padding: 12px 0; }
.name-single-line { white-space: nowrap; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes bob {
  50% { transform: translateY(-4px) rotate(-6deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}
@media (max-width: 600px) and (orientation: landscape), (max-height: 520px) {
  .suit-row { display: none; }
  .seat { padding: 6px 3px 6px; }
  .lead-crown, .scoreboard[data-players="3"] .lead-crown, .scoreboard[data-players="4"] .lead-crown, .scoreboard[data-players="5"] .lead-crown {
    width: min(36px, 80%);
    height: 28px;
    margin-bottom: 2px;
  }
  .round-count-num, .round-count.tens .round-count-num { font-size: calc(48px * var(--game-scale)); }
  .wild { width: 72px; height: 96px; }
  .wild .rank { font-size: 40px; }
  .wild.tens .rank { font-size: 28px; }
  .progress { margin: 10px 0; }
  .score-row { min-height: 46px; }
}
@media (min-width: 900px) {
  .hero { padding-top: 12px; }
}

/* Sign-in screens, table controls, invites and requests. */
#trialControls {
  width: var(--shell);
  margin: 0 auto;
  padding: 2px max(16px, env(safe-area-inset-right, 0px)) 4px max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
body.in-game #trialControls { width: var(--game-shell); }
#trialControls strong {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
#trialControls .quiet {
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}
#access { padding-top: 14px; }
#access .panel { max-width: 470px; margin: 0 auto; padding: 22px 18px 20px; }
#access h1 { font-size: clamp(30px, 8vw, 40px); margin: 0 0 6px; }
#access p { margin: 8px 0; }
#access a { color: var(--ink); font-weight: 500; }
#access form { margin: 0; }
#access form button, #enterTable, #inviteDialog form button, #closeInvite,
#returnLink button, #inviteLink button { margin-top: 12px; }
#access .panel > button { width: 100%; margin-top: 8px; }
#access form > button { width: 100%; }
#access .quiet, #access .pin-actions .quiet, #access #tableDirectory .quiet,
#requestsDialog .quiet:not(.close), #inviteDialog .quiet:not(.close) {
  border: 1px solid rgba(22, 21, 19, 0.12);
}
input[type="password"], input[type="url"], input[type="email"] {
  font-size: 16px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(22, 21, 19, 0.12);
  background: #fff;
  color: var(--ink);
  min-height: 48px;
}
.pin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.pin-actions button { flex: 1 1 auto; }
.table-actions { margin-top: 12px; }
#tableDirectory { display: grid; gap: 8px; margin: 16px 0; }
#tableDirectory button {
  display: block;
  width: 100%;
  text-align: left;
  overflow-wrap: anywhere;
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px;
  min-height: 60px;
  box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04), 0 8px 20px rgba(22, 21, 19, 0.05);
  border-color: transparent;
}
#tableDirectory strong { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
#tableDirectory small, .request-item small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: normal;
}
#access details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
#access summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
#access details[open] > summary { padding-bottom: 4px; }
#access details > button { width: 100%; }
.admin-table { border-bottom: 1px solid var(--line); padding: 12px 0; }
.admin-table small { display: block; color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
#adminTables { margin-bottom: 14px; }
#requestsDialog, #inviteDialog { text-align: left; }
#requestsDialog h2, #inviteDialog h2 { font-size: 28px; }
.request-item { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 0; }
.request-item label { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 6px 0; font-weight: 500; }
.request-item input, #inviteDialog input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--ink); }
#closeRequests, #closeInvite { margin-top: 12px; width: 100%; }
#inviteDialog .trial-viewer { display: flex; align-items: center; gap: 8px; font-weight: 500; }
#inviteDialog form > button { width: 100%; }
#inviteLink input { margin-top: 10px; font-size: 14px; }
#inviteLink button { width: 100%; }

body:not(.trial-owner) .game-swipe [data-delete],
body:not(.trial-owner) .game-swipe [data-reveal] { display: none; }
body:not(.trial-owner) .game-swipe .game-card { padding-right: 16px; }
body.trial-viewer .score-row input[readonly] { background: transparent; }
