/* Scorekeeper: "the card table".
   Cream card stock and ink in light mode, a dark green-grey table in dark mode,
   one accent (playing-card red). Rounded system type for headings and score
   numerals, system sans for the rest. No webfont is downloaded. */

:root {
  color-scheme: light dark;

  --bg: #f7f2e8;
  --surface: #fffdf8;
  --surface-2: #f1ebdf;
  --surface-3: #e7dfcf;
  --text: #1c1a17;
  --text-soft: #45403a;
  --muted: #6b6359;
  --border: #e0d7c6;
  --border-input: #968a77;

  --accent: #b3261e;
  --accent-strong: #8f1d17;
  --accent-fill: #b3261e;
  --accent-fill-hover: #9a2019;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, var(--surface));

  --shadow-card: 0 1px 2px rgba(28, 26, 23, 0.06), 0 2px 8px rgba(28, 26, 23, 0.04);
  --shadow-lift: 0 2px 4px rgba(28, 26, 23, 0.08), 0 10px 24px rgba(28, 26, 23, 0.08);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-card: 10px;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Nunito, Quicksand,
    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: 16px;
  --maxw: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151b18;
    --surface: #1c2420;
    --surface-2: #232d28;
    --surface-3: #2c3832;
    --text: #ede7db;
    --text-soft: #cfc8ba;
    --muted: #9ea79f;
    --border: #2f3a34;
    --border-input: #6a786f;

    --accent: #ef7a6e;
    --accent-strong: #f59a90;
    --accent-fill: #c43a30;
    --accent-fill-hover: #d24a3f;
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 28px rgba(0, 0, 0, 0.35);
  }
}

/* Base ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--text);
}

a,
button,
input,
label,
select,
textarea,
summary {
  touch-action: manipulation;
}

input,
button {
  accent-color: var(--accent);
  caret-color: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0 0 0.4em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.75rem, 1.35rem + 1.8vw, 2.5rem);
}

h2 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.neg {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 50;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  color: var(--text);
}

.skip-link:focus {
  left: var(--gutter);
}

/* Shell ----------------------------------------------------------------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

main.wrap {
  flex: 1;
  padding-bottom: 48px;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  width: 20px;
  height: 25px;
  flex: none;
}

.brand__mark rect {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 1.6;
}

.brand__mark path {
  fill: var(--accent);
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-soft);
  text-decoration: none;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 max(24px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
}

/* Messages -------------------------------------------------------------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.msg {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-input);
  background: var(--surface);
  font-weight: 500;
  animation: fade-in 0.2s ease-out both;
}

.msg--error {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* Page and game headings ------------------------------------------------ */

.page-head {
  padding: 32px 0 4px;
}

.page-head h1 {
  margin-bottom: 8px;
}

.page-head__lede {
  max-width: 56ch;
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-soft);
}

.game-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0 0;
}

.game-head__text {
  min-width: 0;
}

.game-head h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.game-head__of {
  color: var(--muted);
  font-weight: 600;
}

.game-head__meta {
  max-width: 60ch;
  margin: 6px 0 0;
  color: var(--muted);
}

.game-head + .game-grid {
  margin-top: 20px;
}

.after-form {
  margin-top: 8px;
}

/* The deal: one mark per round, played rounds filled, current round red. */
.deal {
  display: flex;
  gap: 3px;
  margin: 18px 0 20px;
  padding: 0;
  list-style: none;
}

.deal__round {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  place-items: center;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.deal__round.is-done {
  background: var(--surface-3);
  border-color: var(--surface-3);
  color: var(--text-soft);
}

.deal__round.is-current {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
  font-weight: 700;
}

.deal--dense .deal__round {
  font-size: 0;
}

.deal--static {
  margin: 0 0 4px;
}

.deal--static .deal__round {
  max-width: 44px;
}

/* Layout ---------------------------------------------------------------- */

.game-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.game-grid__main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (min-width: 960px) {
  .game-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 20px;
  }

  .game-grid__main {
    gap: 20px;
  }
}

/* Panels: card stock with a thin edge ----------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.panel--hero {
  border-color: color-mix(in srgb, var(--border-input) 55%, var(--border));
  padding: 24px;
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 14px;
}

.panel__title {
  margin: 0;
  font-size: 1.15rem;
}

.panel > .panel__title {
  margin-bottom: 10px;
}

.panel__title--big {
  font-size: 1.4rem;
}

.panel__aside {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.empty {
  margin: 0 0 4px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-input);
  border-radius: var(--radius);
}

/* Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out,
    color 0.15s ease-out, transform 0.1s ease-out;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn:active:not(:disabled) {
  background: var(--surface-3);
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-fill-hover);
  border-color: var(--accent-fill-hover);
  color: var(--accent-ink);
}

.btn--primary:active:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* Disabled reads as "not yet": an empty dashed outline, never a pale fill. */
.btn:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  border-color: var(--border-input);
  color: var(--muted);
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
}

.btn--danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}

.btn--danger:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn--lg {
  min-height: 52px;
  font-size: 1.05rem;
}

.btn--block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.icon-btn svg,
.stepper__btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn:active:not(:disabled) {
  background: var(--surface-3);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.icon-btn--danger {
  color: var(--accent);
}

.icon-btn--danger:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Forms ----------------------------------------------------------------- */

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.label-opt {
  font-weight: 400;
  color: var(--muted);
}

input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  transition: border-color 0.15s ease-out;
}

input::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input:user-invalid {
  border-color: var(--accent);
}

.field {
  margin-bottom: 16px;
}

.field-grid {
  display: grid;
  gap: 0 16px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.hint {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.inline-form input {
  flex: 1;
  min-width: 0;
}

/* Share ----------------------------------------------------------------- */

.share-menu {
  position: relative;
  flex: none;
}

.share-btn {
  border-color: var(--border);
  padding: 8px 12px;
}

.share-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.share-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: min(340px, calc(100vw - 32px));
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-input);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  animation: fade-in 0.15s ease-out both;
}

.share-pop__title {
  margin-bottom: 8px;
}

.share-pop__row {
  display: flex;
  gap: 8px;
}

.share-pop__row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  color: var(--text-soft);
  text-overflow: ellipsis;
}

.share-pop__hint {
  margin: 10px 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--muted);
}

/* Bidding: the keypad is the hero --------------------------------------- */

.turn {
  margin: 0;
}

.turn__who {
  display: block;
  font-size: clamp(2rem, 1.5rem + 2.4vw, 2.75rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.turn__ask {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-soft);
}

.turn__note {
  margin: 8px 0 20px;
  color: var(--muted);
}

.turn__note strong {
  color: var(--accent);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}

.key {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 76px;
  padding: 6px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border), 0 2px 4px rgba(28, 26, 23, 0.06);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease-out, color 0.15s ease-out,
    background-color 0.15s ease-out, transform 0.1s ease-out;
}

.key:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.key:active:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(1px) scale(0.98);
}

.key:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  border-color: var(--accent);
  box-shadow: none;
  color: var(--accent);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.key__lock {
  position: absolute;
  bottom: 6px;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
}

.bids {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.bids__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.bids__row:last-child {
  border-bottom: 0;
}

.bids__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.bids__row.is-speaking .bids__name,
.bids__row.is-speaking .bids__wait {
  color: var(--accent);
}

.bids__value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.bids__wait {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Standings ------------------------------------------------------------- */

.standings {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.standings:last-child {
  margin-bottom: 0;
}

.standing {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.standing:last-child {
  border-bottom: 0;
}

.standing__rank {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}

.standing--top .standing__rank {
  color: var(--accent);
}

.standing__who {
  min-width: 0;
}

.standing__name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standing__meta {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
}

.standing__points {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

/* Set by app.js on totals and rows that changed since the previous page. */
.standing.is-updated,
tr.is-new > * {
  animation: score-flash 0.8s ease-out;
}

.standing.is-updated .standing__points {
  transform-origin: right center;
  animation: score-bump 0.24s ease-out;
}

@keyframes score-flash {
  from {
    background-color: var(--accent-soft);
  }
}

@keyframes score-bump {
  from {
    transform: scale(1.12);
  }
}

/* Score entry ----------------------------------------------------------- */

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.entry:first-child {
  padding-top: 0;
}

.entry__body {
  flex: 1;
  min-width: 0;
}

.entry__label {
  margin: 0;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry__meta {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.stepper input {
  width: 76px;
  min-height: 52px;
  padding: 6px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.stepper__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out,
    color 0.15s ease-out;
}

.stepper__btn[hidden] {
  display: none;
}

.stepper__btn:hover {
  background: var(--surface-3);
}

.stepper__btn:active {
  transform: translateY(1px);
}

.stepper__sign {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.stepper__sign[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.entries + .hint {
  margin: 12px 0 0;
}

.entries + .hint + .btn,
.tally + .btn {
  margin-top: 16px;
}

.tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--border-input);
  border-radius: var(--radius);
  font-weight: 600;
  transition: border-color 0.2s ease-out, color 0.2s ease-out;
}

.tally__hint {
  font-weight: 400;
  color: var(--muted);
}

.tally__count {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.tally__count strong {
  display: inline-block;
  font-size: 1.5rem;
}

.tally__count strong.is-bumped {
  animation: score-bump 0.2s ease-out;
}

.tally[data-state="ok"] {
  border-style: solid;
  border-color: var(--text);
}

.tally[data-state="off"] {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
}

.tally[data-state="off"] .tally__hint {
  color: var(--accent);
}

/* Score sheet: a ruled score pad ---------------------------------------- */

.table-scroll {
  overflow-x: auto;
  margin: 0 -20px 16px;
  padding: 0 20px;
}

.sheet {
  width: 100%;
  border-collapse: collapse;
}

.sheet th,
.sheet td {
  padding: 9px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.sheet th + th,
.sheet td,
.sheet th + td {
  border-left: 1px solid var(--border);
}

.sheet th:first-child {
  position: sticky;
  left: 0;
  text-align: left;
  background: var(--surface);
}

.sheet thead th {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-soft);
  border-bottom: 2px solid var(--text);
}

.sheet tbody th {
  font-weight: 500;
  color: var(--muted);
}

.sheet tbody td {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.sheet tbody tr:last-child > * {
  border-bottom: 0;
}

.sheet tfoot th,
.sheet tfoot td {
  border-top: 3px double var(--text);
  border-bottom: 0;
}

.sheet tfoot th {
  font-weight: 700;
  color: var(--text);
}

.sheet tfoot td {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

/* Setup: seats ---------------------------------------------------------- */

.seats {
  margin: 0;
  padding: 0;
  list-style: none;
}

.seat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.seat__number {
  flex: none;
  width: 1.75rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--muted);
}

.seat__name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat__actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.panel--start .btn {
  margin-top: 4px;
}

/* Results: the podium as three standing cards --------------------------- */

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  max-width: 640px;
  margin: 24px auto 28px;
  padding: 0;
  list-style: none;
}

.podium--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 440px;
}

.podium--solo {
  grid-template-columns: minmax(0, 220px);
  justify-content: center;
}

.podium__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 36px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  text-align: center;
}

.podium__card--1 {
  min-height: 270px;
  border-color: var(--accent);
}

.podium__card--2 {
  min-height: 228px;
}

.podium__card--3 {
  min-height: 200px;
}

@media (prefers-reduced-motion: no-preference) {
  .podium__card {
    animation: fade-in 0.4s ease-out both;
  }
}

.podium__index {
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.podium__card--1 .podium__index {
  color: var(--accent);
}

.podium__name {
  max-width: 100%;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.podium__points {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.podium__unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* Home ------------------------------------------------------------------ */

.resume {
  margin-top: 20px;
}

.resume__link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease-out;
}

.resume__link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.resume__text {
  flex: 1;
  min-width: 0;
}

.resume__label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.resume__name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume__go {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent);
}

.resume__go svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.choices {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

@media (min-width: 760px) {
  .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

.choice {
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.choice--main {
  border-color: color-mix(in srgb, var(--border-input) 55%, var(--border));
}

.choice__title {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.choice__text {
  color: var(--text-soft);
  margin-bottom: 12px;
}

.choice__rule {
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

.choice form {
  margin-top: auto;
}

.recent-panel {
  margin-top: 24px;
}

.recent {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent li {
  border-bottom: 1px solid var(--border);
}

.recent li:last-child {
  border-bottom: 0;
}

.recent__item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-height: 48px;
  padding: 12px 0;
  color: var(--text);
  text-decoration: none;
}

.recent__item:hover {
  color: var(--accent);
}

.recent__name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent__meta {
  flex: none;
  font-size: 0.86rem;
  color: var(--muted);
}

/* Rules page ------------------------------------------------------------ */

.rules {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  margin-top: 24px;
}

.rule-steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 65ch;
}

.rule-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.25rem;
  color: var(--text-soft);
}

.rule-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1em;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.rule-steps strong {
  color: var(--text);
}

.scale {
  margin: 0 0 12px;
}

.scale__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.scale__row:last-child {
  border-bottom: 0;
}

.scale dt {
  font-weight: 600;
}

.scale dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
}

/* Phone ----------------------------------------------------------------- */

@media (max-width: 640px) {
  .panel {
    padding: 16px;
  }

  .panel--hero,
  .choice {
    padding: 18px 16px;
  }

  .table-scroll {
    margin: 0 -16px 16px;
    padding: 0 16px;
  }

  .sheet th,
  .sheet td {
    padding: 9px 8px;
  }

  .game-head {
    padding-top: 20px;
  }

  .page-head {
    padding-top: 24px;
  }

  .keypad {
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 8px;
  }

  .key {
    min-height: 68px;
    font-size: 1.75rem;
  }

  .btn-row > form {
    flex: 1 1 auto;
  }

  .btn-row > form > .btn {
    width: 100%;
  }

  .deal {
    gap: 2px;
  }

  .deal__round {
    height: 26px;
    font-size: 0.72rem;
  }

  .podium {
    gap: 8px;
  }

  .podium__card {
    padding: 30px 6px;
  }

  .podium__card--1 {
    min-height: 210px;
  }

  .podium__card--2 {
    min-height: 180px;
  }

  .podium__card--3 {
    min-height: 160px;
  }

  .podium__index {
    top: 8px;
    left: 8px;
    font-size: 1.15rem;
  }

  .podium__name {
    font-size: 1.05rem;
  }

  .podium__points {
    font-size: 1.5rem;
  }
}

@media (max-width: 380px) {
  .share-btn [data-share-label] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .share-btn {
    width: 44px;
    padding: 0;
  }

  .stepper input {
    width: 64px;
  }
}

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