/* Snowy River (v6) - woodcut cream paper, ink brown, and the five suit grounds: Escape orange, Climb gum green,
   Descent sky blue, Muster violet, Home night blue (12/11/2026 palette). Mobile first: the base rules are the
   390 px phone layout; wider screens add columns. */
:root {
  --paper: #f8eed6;
  --paper-2: #ecd9ae;
  --card: #fff8e6;
  --ink: #2b1a10;
  --ink-soft: #664a36;
  --line: #d9c395;
  --accent: #b4532f; /* red ochre */
  --accent-dark: #8a3b1f;
  --gold: #d9963a; /* dawn amber */
  --night: #3c5677;
  --night-dark: #26384f;
  --green: #6f9070; /* gum green */
  --green-dark: #46664a;
  --table: #2b1a10;
  --good: #2f7a45;
  /* one colour and one shape per suit, so no suit relies on colour alone */
  --s-escape: #f07f1e;
  --s-climb: #6f9070;
  --s-descent: #6fa8d6;
  --s-muster: #944ddb;
  --s-home: #3c5677;
  --bad: #a8281c;
  --wattle: #d9a62e; /* the Climb cards */
  --teal: #3b7f7a; /* the Brumby cards */
  --font-display: 'Alfa Slab One', Rockwell, 'Rockwell Extra Bold', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: 16px;
  --tw: 56px; /* width of a card in the trick */
  --hw: min(64px, calc((100vw - 2 * var(--gutter) - 24px - 24px) / 6)); /* width of a card in the hand (6 per row on a phone) */
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
  overflow-x: hidden;
}
main { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter) 32px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 8px; }
img { max-width: 100%; }
a { color: var(--night); }
small { font-size: 0.8em; }
.muted { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--night); outline-offset: 2px; }

/* ---------- buttons and form bits ---------- */
.btn, .linkbtn { font: inherit; color: inherit; cursor: pointer; }
.btn { min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--ink); background: var(--card); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--paper-2); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; box-shadow: 0 3px 0 var(--accent-dark); }
.btn--primary:hover { background: var(--accent-dark); }
.btn--big { font-size: 1.1rem; padding: 10px 26px; }
.btn--quiet { border-color: var(--line); font-weight: 600; }
.btn--small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.linkbtn { background: none; border: 0; padding: 8px 6px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; color: var(--night); font-weight: 600; }
select, input[type='text'] { font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 42px; max-width: 100%; width: 100%; }
.field { display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: 0.9rem; margin: 6px 0; }
.field small { font-weight: 400; color: var(--ink-soft); }

/* ---------- landing: a sell sheet with a setup form in it ---------- */
.landing { padding-top: 4px; }
.topnav { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.topnav__brand { font-family: var(--font-display); font-size: 1.1rem; color: var(--accent-dark); }
.hero { margin-bottom: 14px; }
.hero__art { border-radius: 14px; overflow: hidden; border: 3px solid var(--ink); background: var(--ink); }
.hero__art img, .hero__art picture { display: block; width: 100%; height: auto; }
.hero__art--plain { padding: 22px 12px; text-align: center; color: #fff; }
.hero__title { font-family: var(--font-display); font-size: 2rem; margin: 0 0 8px; }
.hero__suits { display: flex; justify-content: center; gap: 10px; margin: 0; }
.hero__art .hero__suit { width: 30px; height: 30px; font-size: 1rem; display: inline-grid; }
.hero__text { padding: 14px 2px 0; }
.hero__hook { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.2; margin-bottom: 6px; color: var(--ink); }
.hero__sub { color: var(--ink-soft); }
.hero__links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.stats { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 14px; }
.stats li { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.stats svg { width: 30px; height: 30px; flex: none; }
.stats b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; line-height: 1.1; white-space: nowrap; }
.stats span { font-size: 0.8rem; color: var(--ink-soft); }
.panel { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.setup-panel { border-color: var(--ink); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.segs { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { position: relative; flex: 1; min-width: 78px; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 10px 8px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 700; }
.seg input:checked + span { background: var(--night); border-color: var(--night-dark); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--night); outline-offset: 2px; }
.setup__seats { display: grid; grid-template-columns: 1fr; gap: 8px 14px; margin-top: 10px; }
.seatform { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 8px; }
.seatform legend { font-family: var(--font-display); font-size: 0.95rem; padding: 0 4px; }
.hint { color: var(--ink-soft); margin: 10px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--night); }
.check span { display: flex; flex-direction: column; gap: 2px; }
.check small { color: var(--ink-soft); font-size: 0.85rem; }
.form-msg { color: var(--accent-dark); font-weight: 700; min-height: 1.2em; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; color: var(--ink-soft); font-size: 0.9rem; padding: 10px 0; }

/* how to play */
.how__lead { font-size: 1.05rem; }
.how__steps { padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.how__steps > li { counter-increment: step; position: relative; padding: 0 0 0 44px; }
.how__steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--font-display); }
.how__steps h3 { margin-bottom: 2px; }
.how__suits { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 6px 0 0; }
.how__suits li { display: flex; align-items: center; gap: 5px; font-weight: 600; }
.how__suits small { font-weight: 400; color: var(--ink-soft); }
.how__badge { width: 26px; height: 26px; }
.how__link { margin-top: 10px; }

/* ---------- game screen ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.topbar__title { font-family: var(--font-display); color: var(--accent-dark); font-size: 1.1rem; white-space: nowrap; }
.topbar .linkbtn { white-space: nowrap; padding: 8px 4px; }
.topbar__right { display: flex; gap: 4px; }
.game { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.col--main { min-width: 0; display: grid; gap: 12px; }

/* the table: the dark wooden board everything sits on */
.table {
  display: grid; gap: 10px; padding: 10px; border-radius: 16px; border: 3px solid var(--ink);
  background: var(--table) url(assets/table-texture.webp) center / 256px;
  grid-template-columns: minmax(0, 1fr);
}
.table[data-n='5'] { --tw: 50px; }

/* status: the half banner (direction and trumps) and what to do now */
.status { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
.phasebar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 8px 12px 8px; color: #fff; }
.phasebar--climb { background: var(--green-dark); }
.phasebar--descent { background: var(--night-dark); }
.phasebar--over { background: var(--ink); }
.phasebar__badge { width: 38px; height: 38px; flex: none; }
.phasebar__name { font-family: var(--font-display); font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.1; }
.phasebar__rule { font-weight: 900; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.05em; background: #fff; color: var(--ink); border-radius: 999px; padding: 1px 12px; }
.phasebar__range { flex-basis: 100%; font-size: 0.92rem; font-weight: 700; letter-spacing: 0.01em; line-height: 1.3; }
.phasebar__meta { flex-basis: 100%; font-size: 0.8rem; font-weight: 600; opacity: 0.92; }
.status__prompt { margin: 0; padding: 8px 12px 9px; font-weight: 700; min-height: 3.9em; }
/* the ride: six climb steps, the summit, six descent steps */
.ride { flex-basis: 100%; display: flex; align-items: stretch; gap: 3px; list-style: none; padding: 0; margin: 2px 0 0; }
.ride__step { flex: 1; min-width: 0; text-align: center; font-size: 0.72rem; font-weight: 800; line-height: 1; padding: 5px 0; border-radius: 4px; background: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.8); }
.ride__step.is-done { background: rgba(255, 255, 255, 0.45); color: var(--ink); }
.ride__step.is-now { background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--gold); }
.ride__summit { flex: 0 0 auto; display: flex; align-items: center; gap: 3px; padding: 0 6px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 900; background: var(--gold); color: var(--ink); border-radius: 4px; }
.ride__summit b { font-weight: 900; }
/* opponents */
.opps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opps[data-opp='1'] { grid-template-columns: minmax(0, 1fr); }
.opps[data-opp='3'] .seat:last-child { grid-column: 1 / -1; }

/* seats */
.seat { align-self: start; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 6px 8px; display: flex; flex-direction: column; gap: 5px; min-width: 0; position: relative; container-type: inline-size; }
.seat.is-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 150, 58, 0.85); }
.seat.is-winning { border-color: var(--good); }
/* avatar | name, level and (small, muted) the cards in hand: the tricks won are what matters in this game */
.seat__head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 8px; min-width: 0; }
.seat__hand { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); line-height: 1.2; }
.seat__cardsnum { font-weight: 700; font-variant-numeric: tabular-nums; }
/* A narrow seat (phones) drops its avatar so the name is never cut: the name matters more. */
@container (max-width: 215px) {
  .seat__head { grid-template-columns: minmax(0, 1fr); }
  .seat__head .seat__avatar { display: none; }
}
.seat__avatar, .pad__avatar, .rank__avatar, .cover__avatar, .reck__avatar { border-radius: 50%; object-fit: cover; background: var(--paper-2); flex: none; }
.seat__avatar { width: 34px; height: 34px; }
.seat.is-turn .seat__avatar { box-shadow: 0 0 0 3px var(--gold); }
.avatar-chip { display: inline-grid; place-items: center; color: #fff; font-weight: 800; }
.avatar-chip--1 { background: var(--accent); } .avatar-chip--2 { background: var(--s-home); } .avatar-chip--3 { background: var(--s-climb); }
.avatar-chip--4 { background: var(--s-escape); color: var(--ink); } .avatar-chip--5 { background: var(--ink-soft); }
.seat__id { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.seat__name { font-weight: 800; overflow-wrap: anywhere; }
.seat__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 0.68rem; font-weight: 700; border-radius: 999px; padding: 0 7px; background: var(--paper-2); color: var(--ink-soft); width: fit-content; }
.badge--human { background: var(--night); color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 6px; padding: 1px 6px; }
.tag--dealer { background: var(--ink); color: #fff; }
.tag--turn { background: var(--gold); color: var(--ink); }
.tag__badge { width: 16px; height: 16px; }
/* the hand score so far, then the Climb cards and Brumby cards the seat has taken (fans of small cards, with their sums) */
.seat__score { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; background: var(--paper-2); border-radius: 8px; padding: 2px 8px 4px; }
.hscore { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.hscore__label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); font-weight: 800; }
.hscore__num { font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.hscore__num--pos { color: var(--good); } .hscore__num--neg { color: var(--bad); } .hscore__num--zero { color: var(--ink); }
.seat__score .total { font-size: 0.78rem; color: var(--ink-soft); text-align: right; padding-bottom: 2px; }
.total b { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; color: var(--ink); }
.taken { background: #f3e6c4; border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 2px 6px 4px; min-height: 42px; min-width: 0; }
.taken--climb { border-left-color: var(--wattle); } .taken--brumby { border-left-color: var(--teal); }
.taken__head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.taken__label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); font-weight: 800; }
.taken__sum, .reck__kind b { font-family: var(--font-display); font-weight: 400; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.taken__sum--pos { color: var(--good); } .taken__sum--neg { color: var(--bad); } .taken__sum--zero { color: var(--ink-soft); }
.taken__none { font-size: 0.74rem; color: var(--ink-soft); font-weight: 600; }
.taken__fan { display: flex; align-items: center; padding-left: 15px; min-width: 0; }
.taken__card { display: block; width: 30px; margin-left: -15px; flex: none; }
.taken__card.is-new { animation: slide-in 0.45s ease-out both; }
.taken__img { display: block; width: 100%; height: auto; aspect-ratio: 480 / 336; border-radius: 3px; box-shadow: 0 1px 3px rgba(43, 26, 16, 0.55); }
.badge-suit { display: inline-block; border-radius: 50%; flex: none; vertical-align: middle; }
span.badge-suit { display: inline-grid; place-items: center; color: #fff; font-size: 0.7em; }
.badge-suit--escape { background: var(--s-escape); color: var(--ink); } .badge-suit--climb { background: var(--s-climb); }
.badge-suit--descent { background: var(--s-descent); color: var(--ink); } .badge-suit--muster { background: var(--s-muster); } .badge-suit--home { background: var(--s-home); }

/* card faces: art when there is some, a drawn face (number + suit shape) when there is not */
.cardimg { display: block; width: 100%; height: auto; aspect-ratio: 300 / 428; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 1px 3px rgba(43, 26, 16, 0.55)); }
.asset-chip.cardchip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; background: #fff; border: 2px solid var(--ink); border-radius: 8px; color: var(--ink); font-size: 0.8rem; }
.asset-chip.cardchip b { font-family: var(--font-display); font-weight: 400; font-size: 1.5em; line-height: 1; }
.asset-chip.cardchip i { font-style: normal; font-size: 1.1em; line-height: 1; }
.asset-chip.cardchip--escape { color: #9a4d05; border-color: var(--s-escape); } .asset-chip.cardchip--climb { color: var(--green-dark); border-color: var(--s-climb); }
.asset-chip.cardchip--descent { color: #2f6b99; border-color: var(--s-descent); } .asset-chip.cardchip--muster { color: var(--s-muster); border-color: var(--s-muster); } .asset-chip.cardchip--home { color: var(--s-home); border-color: var(--s-home); }
.asset-chip.cardchip--back { background: repeating-linear-gradient(45deg, var(--s-home), var(--s-home) 6px, var(--night-dark) 6px, var(--night-dark) 12px); border-color: var(--ink); }

/* the stage: the Climb row, the Brumby row and the trick */
.stage { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'climb' 'row' 'trick'; gap: 10px; min-width: 0; }
.stage__climb { grid-area: climb; } .stage__row { grid-area: row; } .stage__trick { grid-area: trick; }
.stage__climb, .stage__trick, .stage__row { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 10px 10px; min-width: 0; }
body[data-busy='1'] .stage { cursor: pointer; }

/* the Climb row (up) and the Brumby row (down): the prize of each trick, face up, with its value under it */
.row__title { font-family: var(--font-display); margin: 2px 0 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap; }
.row__rule { font-family: var(--font-body); font-weight: 800; font-size: 0.78rem; color: var(--ink); border-radius: 999px; padding: 1px 10px; }
.row--climb .row__title { color: #6d5410; } .row--climb .row__rule { background: #f4e3a8; }
.row--brumby .row__title { color: #24615c; } .row--brumby .row__rule { background: #cfe5e1; }
.row__slots, .summit__row { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 6px; }
.row__slots--climb { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 4px; }
.rslot, .summit__row li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.rslot__card { display: block; width: 100%; aspect-ratio: 480 / 336; border-radius: 6px; }
.rslot__img, .summit__brumby { display: block; width: 100%; height: auto; aspect-ratio: 480 / 336; border-radius: 6px; box-shadow: 0 1px 4px rgba(43, 26, 16, 0.5); }
.rslot__n { position: absolute; left: -4px; top: -7px; z-index: 2; width: 19px; height: 19px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 0.7rem; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.rslot__val { font-family: var(--font-display); font-weight: 400; font-size: 1.05rem; line-height: 1; font-variant-numeric: tabular-nums; }
.rslot__val--pos { color: var(--good); } .rslot__val--neg { color: var(--bad); } .rslot__val--zero { color: var(--ink-soft); }
.rslot--down .rslot__img { opacity: 0.85; filter: saturate(0.7); }
.rslot.is-bad:not(.is-taken) .rslot__card { box-shadow: 0 0 0 2px var(--bad); }
.rslot.is-next .rslot__card { outline: 4px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 14px rgba(217, 150, 58, 0.9); z-index: 1; }
.rslot.is-next.is-new .rslot__card { animation: pop 0.6s ease-out; }
.rslot.is-next .rslot__n { background: var(--gold); color: var(--ink); }
.rslot.is-next .rslot__val { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.rslot.is-colt .rslot__img, .summit__row .is-colt .summit__brumby { box-shadow: 0 0 0 2px var(--gold), 0 0 10px rgba(217, 150, 58, 0.9); }
.rslot__gone { display: grid; place-items: center; width: 100%; aspect-ratio: 480 / 336; border: 2px dashed var(--line); border-radius: 6px; }
.rslot__avatar { width: 62%; max-width: 26px; aspect-ratio: 1; height: auto; border-radius: 50%; object-fit: cover; }
.row__line { margin: 8px 0 0; font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); min-height: 2.6em; }
.row--climb .row__line { min-height: 2.6em; }
.row__piles { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; }
.row__pile b, .row__discard summary b { font-family: var(--font-display); font-weight: 400; color: var(--ink); }
.row__discard summary { cursor: pointer; min-height: 24px; }
.row__thumbs { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.row__thumb { width: 38px; display: block; }
.row__thumbimg { display: block; width: 100%; height: auto; border-radius: 3px; }

/* the current trick */
.trick__title { font-family: var(--font-display); margin: 2px 0 6px; font-size: 1rem; }
.led { white-space: nowrap; }
.row__badge { width: 18px; height: 18px; margin-right: 3px; vertical-align: -4px; }
.led__badge { width: 22px; height: 22px; margin-right: 3px; vertical-align: -6px; }
.prize { display: inline-block; font-family: var(--font-body); font-weight: 900; font-size: 0.82rem; border-radius: 999px; padding: 0 9px; margin-left: 4px; vertical-align: 1px; background: var(--paper-2); }
.prize--pos { background: #d6ecd9; color: #1f5a31; } .prize--neg { background: #f4d4cf; color: var(--bad); }
.tplays { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 0; }
.tplay { display: flex; flex-direction: column; align-items: center; gap: 2px; width: var(--tw); }
.tplay__card, .tplay__slot { display: block; width: var(--tw); }
.tplay__slot { aspect-ratio: 300 / 428; border: 2px dashed var(--line); border-radius: 6px; }
.tplay__who { margin-top: 4px; font-size: 0.72rem; font-weight: 700; line-height: 1.1; text-align: center; max-width: calc(var(--tw) + 14px); overflow-wrap: anywhere; }
.tplay__tags { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; min-height: 1.1em; }
.mark { font-style: normal; font-size: 0.6rem; text-transform: uppercase; font-weight: 800; letter-spacing: 0.03em; padding: 0 4px; border-radius: 4px; background: var(--paper-2); }
.mark--wins { background: var(--good); color: #fff; }
.mark--off-suit { background: var(--accent); color: #fff; }
.mark--trump, .mark--trumps { background: var(--gold); color: var(--ink); }
.tplay.is-offsuit .tplay__card .cardimg { opacity: 0.88; }
.tplay.is-winner .tplay__card .cardimg { box-shadow: 0 0 0 4px var(--good), 0 0 16px rgba(47, 122, 69, 0.7); border-radius: 6%; animation: pop 0.5s ease-out; }
.tplay.is-lost { opacity: 0.6; }
.trick__msg { margin: 6px 0 0; text-align: center; min-height: 1.5em; font-size: 0.9rem; color: var(--ink-soft); }
.trick__msg.is-banner { font-weight: 800; color: var(--ink); }

/* the hand */
.handbox { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px 10px; }
.handbox.is-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 150, 58, 0.8); }
.handbox__title { font-family: var(--font-display); margin: 0 0 6px; }
.handbox__title span { font-family: var(--font-body); font-size: 0.8rem; color: var(--ink-soft); margin-left: 6px; }
.hand .card.is-trump .cardimg { box-shadow: none; }
.handbox__back { width: 50px; }
.hand { display: grid; grid-template-columns: repeat(6, var(--hw)); gap: 8px 4px; justify-content: center; padding-top: 8px; }
.card { padding: 0; border: 0; background: none; position: relative; width: var(--hw); cursor: pointer; font: inherit; border-radius: 6px; transition: transform 0.12s ease; -webkit-tap-highlight-color: transparent; }
.card.is-legal:hover, .card.is-legal:focus-visible, .card.is-selected { transform: translateY(-8px); }
.card.is-selected .cardimg, .card.is-legal:hover .cardimg { filter: drop-shadow(0 0 3px var(--night)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }
.card.is-trump::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: -5px; height: 3px; border-radius: 2px; background: var(--gold); }
.card.is-blocked { cursor: not-allowed; }
.card.is-blocked .cardimg { filter: grayscale(0.9) brightness(0.62); opacity: 0.7; }
.card.is-wait { cursor: default; }
.card__hint { position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 900; line-height: 1; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.card__hint.is-win { background: var(--good); color: #fff; }
.card__hint.is-lose { background: #6b6b6b; color: #fff; }
.legend { font-size: 0.82rem; color: var(--ink-soft); margin: 8px 0 2px; }
.hint-dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 0.7rem; font-weight: 900; color: #fff; vertical-align: 1px; }
.hint-dot.is-win { background: var(--good); }
.hint-dot.is-lose { background: #6b6b6b; margin-left: 8px; }
/* The hint line always has room for its longest sentence, so hovering a card never changes the page height (on a narrow
   window the page would jump under the pointer and the hint would flicker on and off). */
.preview { min-height: 7.6em; margin: 4px 0 0; font-weight: 600; color: var(--ink-soft); }
@media (min-width: 560px) { .preview { min-height: 4.8em; } }
@media (min-width: 1000px) { .preview { min-height: 3.3em; } }
.preview--on { color: var(--ink); }
.note { margin: 0; color: var(--accent-dark); font-weight: 700; min-height: 1.3em; }

/* score pad and log */
.side .panel { padding: 6px 12px 10px; margin-bottom: 10px; }
.side summary { font-family: var(--font-display); cursor: pointer; padding: 6px 0; min-height: 36px; }
.pad { border-collapse: collapse; width: 100%; font-size: 0.9rem; table-layout: fixed; }
.pad th, .pad td { padding: 3px 2px; text-align: center; border-bottom: 1px solid var(--line); }
.pad thead th { vertical-align: bottom; }
.pad tbody th, .pad tfoot th { text-align: left; font-weight: 600; width: 26%; }
.pad__avatar { width: 24px; height: 24px; display: block; margin: 0 auto 1px; font-size: 0.7rem; }
.pad__name { display: block; font-size: 0.7rem; line-height: 1.1; overflow-wrap: anywhere; }
.pad tr.is-now td, .pad tr.is-now th { background: #f7e2b8; }
.pad tr.is-todo td { color: var(--line); }
.pad tfoot th, .pad tfoot td { font-family: var(--font-display); font-weight: 400; border-bottom: 0; border-top: 2px solid var(--ink); }
.log__list { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow-y: auto; font-size: 0.88rem; }
.log__item { padding: 5px 0; border-bottom: 1px solid var(--line); }
.log__item--hand { font-weight: 700; color: var(--night); }
.log__item--event { color: var(--accent-dark); }

/* overlays: the summit beat, the reckoning, the end */
.overlay { position: fixed; inset: 0; background: rgba(43, 26, 16, 0.66); display: flex; align-items: center; justify-content: center; padding: var(--gutter); z-index: 20; }
.end, .dialog { background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 18px; width: 100%; max-width: 680px; max-height: calc(100vh - 2 * var(--gutter)); overflow: auto; position: relative; }
.end__kicker { font-family: var(--font-display); color: var(--accent-dark); margin: 0; }
.end__note { color: var(--ink-soft); font-size: 0.85rem; }
.end__note--lead { color: var(--ink); font-size: 0.98rem; font-weight: 600; }
.end__buttons, .dialog__buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.end__rules, .end__tiebreak { margin: 8px 0; }
.end__tiebreak { background: #f7e2b8; border: 2px solid var(--gold); border-radius: 10px; padding: 8px 12px; font-weight: 600; }
.dialog__close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 1.8rem; line-height: 1; cursor: pointer; width: 44px; height: 44px; }
.dialog--wide { max-width: 760px; }
.table-wrap { overflow-x: auto; }

/* the summit: a beat that shows the switch (the Climb row is empty, lowest wins, Home is trumps, the Brumby row is dealt) */
.end--summit { max-width: 600px; text-align: center; }
.end--summit h2 { font-size: 1.45rem; }
.end--summit .end__buttons { justify-content: center; }
.summit__swap { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 8px 0 10px; }
.summit__side { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 150px; padding: 8px 6px; border-radius: 12px; border: 3px solid var(--ink); line-height: 1.15; }
.summit__side b { font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; }
.summit__side small { font-size: 0.78rem; font-weight: 700; }
.summit__side--was { background: #f6dcc0; opacity: 0.8; }
.summit__side--now { background: #d5e1ef; animation: pop 0.8s ease-out 0.3s both; }
.summit__badge { width: 46px; height: 46px; }
.summit__arrow { font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.summit__label { font-weight: 800; font-size: 0.85rem; letter-spacing: 0.02em; color: var(--ink-soft); margin: 10px 0 8px; }
.summit__colt { font-weight: 800; background: #f7e2b8; border: 2px solid var(--gold); border-radius: 10px; padding: 4px 10px; margin: 8px 0 0; }
.summit__note { color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; margin: 10px 0 0; }

/* the reckoning: one row per seat, with the Climb cards, the Brumby cards and the sums */
.reck { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.reck__row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: 'av who score' 'av what what' 'av total total'; align-items: center; gap: 4px 8px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px 6px 8px; }
.reck__avatar { grid-area: av; width: 40px; height: 40px; }
.reck__who { grid-area: who; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; overflow-wrap: anywhere; }
.reck__who small { color: var(--ink-soft); }
.reck__what { grid-area: what; display: grid; gap: 4px; min-width: 0; }
.reck__kind { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; }
.reck__kind i { font-style: normal; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); font-weight: 800; width: 84px; }
.reck__cards { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.reck__card { width: 38px; display: block; }
.reck__img { display: block; width: 100%; height: auto; aspect-ratio: 480 / 336; border-radius: 3px; box-shadow: 0 1px 2px rgba(43, 26, 16, 0.5); }
.reck__none { color: var(--ink-soft); }
.reck__score { grid-area: score; font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; text-align: right; line-height: 1; }
.reck__score--pos { color: var(--good); } .reck__score--neg { color: var(--bad); }
.reck__total { grid-area: total; font-size: 0.82rem; color: var(--ink-soft); text-align: right; }
.reck__total b { color: var(--ink); }
.summary { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

/* the end of the game */
.ranking { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.rank { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.rank.is-winner { border-color: var(--gold); background: #fbe9c3; }
.rank__pos { font-family: var(--font-display); width: 26px; text-align: center; font-size: 1.2rem; }
.rank__avatar { width: 44px; height: 44px; }
.rank__who { display: flex; flex-direction: column; flex: 1; min-width: 100px; line-height: 1.2; }
.crown { font-style: normal; font-size: 0.72rem; font-weight: 800; background: var(--gold); border-radius: 6px; padding: 0 6px; width: fit-content; margin-top: 2px; }
.rank__total { font-size: 0.9rem; }
.rank__total b { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; }
.rank__total small { display: inline-flex; align-items: center; gap: 3px; }
.pad--end { width: 100%; }
.endbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fbe9c3; border: 2px solid var(--gold); border-radius: 12px; padding: 8px 12px; grid-column: 1 / -1; }
.endbar > span { flex: 1; min-width: 160px; }
.cover { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: var(--gutter); background: var(--night-dark); }
.cover__card { background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 22px 18px; text-align: center; max-width: 440px; width: 100%; }
.cover__avatar { width: 90px; height: 90px; margin: 0 auto 6px; display: grid; font-size: 2rem; }
.cover__kicker { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); margin: 0; }
.cover h2 { font-size: 1.8rem; overflow-wrap: anywhere; }
.cover__msg { color: var(--ink-soft); }
.asset-chip { display: inline-block; background: var(--paper-2); border: 1px dashed var(--ink-soft); border-radius: 6px; padding: 1px 6px; font-size: 0.8rem; color: var(--ink-soft); }

/* ---------- animation (all of it off under reduced motion) ---------- */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes bump { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes slide-in { 0% { transform: translateX(-14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.fx-bump { animation: bump 0.55s ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .row__slots, .summit__row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .setup__seats { grid-template-columns: repeat(2, 1fr); }
  .reck__row { grid-template-columns: 40px minmax(0, 0.8fr) minmax(0, 2.2fr) auto 76px; grid-template-areas: 'av who what score total'; padding: 6px 12px 6px 8px; gap: 2px 10px; }
  .opps[data-opp='3'] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opps[data-opp='3'] .seat:last-child { grid-column: auto; }
}
@media (min-width: 700px) {
  :root { --tw: 66px; --hw: clamp(56px, calc((100vw - 2 * var(--gutter) - 24px - 40px) / 9), 92px); }
  .hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 4px; }
  .card.is-first:not(:first-child) { margin-left: 8px; }
  .table { padding: 14px; gap: 12px; }
  .opps { grid-template-columns: repeat(var(--opp, 2), minmax(0, 1fr)); gap: 10px; }
  .opps[data-opp='1'] { --opp: 1; max-width: 420px; justify-self: center; width: 100%; }
  .opps[data-opp='2'] { --opp: 2; } .opps[data-opp='3'] { --opp: 3; } .opps[data-opp='4'] { --opp: 4; }
  .stage { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-areas: 'climb trick' 'row trick'; grid-template-rows: auto 1fr; gap: 12px; align-items: start; }
  .table[data-n='5'] { --tw: 48px; } .table[data-n='4'] { --tw: 58px; }
  .table[data-n='4'] .tplays, .table[data-n='5'] .tplays { gap: 6px; }
  .seat__avatar { width: 44px; height: 44px; }
  .seat { padding: 8px 10px; gap: 6px; }
  .area-me { max-width: 460px; width: 100%; justify-self: center; }
}
@media (min-width: 1000px) {
  .game { grid-template-columns: minmax(0, 1fr) 320px; }
  :root { --hw: clamp(56px, calc((min(100vw, 1240px) - 2 * var(--gutter) - 334px - 24px - 40px) / 8), 96px); --tw: 70px; }
  .table[data-n='4'] { --tw: 60px; } .table[data-n='5'] { --tw: 50px; }
  .side { position: sticky; top: 8px; }
  .stats { max-width: 760px; }
}
@media (min-width: 1100px) {
  .landing { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 0 28px; align-items: start; }
  .landing .topnav, .landing .footer, .landing .hero { grid-column: 1 / -1; }
  .landing .stats { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 380px) {
  :root { --gutter: 12px; }
}
@media (max-width: 480px) {
  .topbar__title { display: none; }
  .stats li { padding: 8px 6px; gap: 5px; }
  .stats svg { width: 22px; height: 22px; }
  .stats b { font-size: 1.05rem; }
  .hero__hook { font-size: 1.25rem; }
  .phasebar__name { font-size: 1.15rem; }
  .phasebar__rule { font-size: 0.95rem; }
}

/* stats screen, bug reporter */
.st h3 { margin: 16px 0 4px; font-size: 1.05rem; }
.st__lead { font-size: 1.1rem; }
.st__empty { padding: 24px 0; text-align: center; color: var(--ink-soft); }
.st__muted { color: var(--ink-soft); font-size: 0.9rem; margin: 2px 0 4px; }
.st__small { color: var(--accent-dark); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.st__scroll { overflow-x: auto; }
.st__table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.st__table th, .st__table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.st__table thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.st__table td { font-variant-numeric: tabular-nums; }
.st__filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; margin: 8px 0; }
.st__filter select { font: inherit; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 8px; background: var(--card); max-width: 100%; width: auto; }
.bug-button { position: fixed; right: 10px; bottom: 10px; z-index: 40; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card); font-size: 1rem; line-height: 1; cursor: pointer; opacity: 0.55; padding: 0; }
.bug-button:hover, .bug-button:focus-visible { opacity: 1; }
body[data-covered='1'] .bug-button { display: none; }
body[data-screen='game'] { padding-bottom: 52px; }
.bug .field { display: block; margin: 8px 0; }
.bug .field span { display: block; font-weight: 700; font-size: 0.9rem; }
.bug input, .bug textarea { width: 100%; font: inherit; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 8px; background: var(--card); }
.bug__lead { color: var(--ink-soft); }
.bug__past { margin-top: 12px; font-size: 0.9rem; }
.bug__past ul { list-style: none; padding: 0; margin: 4px 0 0; }
.bug__past li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.bug__past .linkbtn { min-height: 32px; }
.reck__who .mark { align-self: flex-start; }
