/* Waltzing Matilda - cream paper, red ochre, wattle yellow, billabong teal. Mobile first: the base rules are the phone layout. */
:root {
  --paper: #fbf1d9;
  --paper-2: #f1e0b3;
  --card: #fff9e8;
  --ink: #3a2210;
  --ink-soft: #6d4d38;
  --line: #dbc597;
  --red: #b9482a;
  --red-dark: #8f3318;
  --gold: #e3b13e;
  --teal: #1d4340;
  --teal-dark: #112e2c;
  --teal-light: #2f6a65;
  --good: #2f7a45;
  --s-yellow: #e3b13e;
  --s-green: #8db096;
  --s-red: #c8673f;
  --s-blue: #7f9fc0;
  --s-jumbuck: #e3a3ae;
  --s-trooper: #8f969d;
  --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 */
  --mw: 28px; /* width of a card in a tucker bag */
  --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(--teal-light); }
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(--teal-light); 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; }
.btn:hover { background: var(--paper-2); }
.btn--primary { background: var(--red); border-color: var(--red-dark); color: #fff; box-shadow: 0 3px 0 var(--red-dark); }
.btn--primary:hover { background: var(--red-dark); }
.btn--big { font-size: 1.1rem; padding: 10px 26px; }
.btn--quiet { border-color: var(--line); font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 8px 6px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; color: var(--teal-light); 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 ---------- */
.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(--red-dark); }
.hero { margin-bottom: 14px; }
.hero__art { border-radius: 14px; overflow: hidden; border: 3px solid var(--ink); background: var(--paper-2); }
.hero__art img, .hero__art picture { display: block; width: 100%; height: auto; }
.hero__text { padding: 14px 2px 0; }
.hero__hook { font-size: 1.2rem; font-weight: 600; margin-bottom: 6px; }
.hero__strap { font-family: var(--font-display); font-size: 1.6rem; color: var(--red-dark); margin: 4px 0 8px; }
.hero__sub { color: var(--ink-soft); }
.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-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(--teal); border-color: var(--teal-dark); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--teal-light); 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-weight: 400; 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(--teal-light); }
.check span { display: flex; flex-direction: column; gap: 2px; }
.check small { color: var(--ink-soft); font-size: 0.85rem; }
.form-msg { color: var(--red-dark); font-weight: 700; min-height: 1.2em; }
.rules { border: 2px dashed var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; background: var(--paper); }
.rules summary { cursor: pointer; font-weight: 700; padding: 6px 0; min-height: 40px; }
.rules summary small { font-weight: 400; color: var(--ink-soft); margin-left: 6px; }
.rules__intro { color: var(--ink-soft); }
.rule { padding: 8px 0; border-top: 1px solid var(--line); }
.rule label { font-weight: 700; display: block; margin-bottom: 4px; }
.rule__id { display: inline-block; font-size: 0.72rem; background: var(--ink); color: #fff; border-radius: 4px; padding: 0 5px; margin-right: 4px; vertical-align: 1px; }
.rule__desc { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 0; }
.rules-note, .rules-flag { background: #fff0c9; border: 2px solid var(--gold); border-radius: 10px; padding: 8px 12px; font-weight: 600; margin: 8px 0; }
.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(--red); 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(--red-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; }

.table {
  display: grid; gap: 8px; padding: 10px; border-radius: 16px; border: 3px solid var(--teal-dark);
  background: var(--teal) url(assets/table-texture.webp) 0 0 / 512px 512px;
  grid-template-columns: 1fr 1fr;
}
.table[data-n='2'] { grid-template-columns: 1fr; grid-template-areas: 'r1' 'centre' 'me'; }
.table[data-n='3'] { grid-template-areas: 'r1 r2' 'centre centre' 'me me'; }
.table[data-n='4'] { grid-template-areas: 'r1 r2' 'r3 r3' 'centre centre' 'me me'; }
.table[data-n='5'] { grid-template-areas: 'r1 r2' 'r3 r4' 'centre centre' 'me me'; }
.table[data-n='5'] { --tw: 50px; }
.area-r1 { grid-area: r1; } .area-r2 { grid-area: r2; } .area-r3 { grid-area: r3; } .area-r4 { grid-area: r4; }
.area-me { grid-area: me; } .area-centre { grid-area: centre; }

/* 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; }
.seat.is-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 177, 62, 0.75); }
.seat.is-winning { border-color: var(--good); }
/* avatar | name | cards in hand (the big number); the Dealer / turn tags drop to a row of their own */
.seat__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; min-width: 0; }
.seat__head .seat__tags { grid-column: 1 / -1; grid-row: 2; }
.seat__head .seat__tags:empty { display: none; }
.seat__cards { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; align-items: center; line-height: 1; width: 3.3rem; }
.seat__cardsnum { font-family: var(--font-display); font-weight: 400; font-size: 2.1rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.seat__cards small { font-size: 0.56rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); text-align: center; line-height: 1.1; margin-top: 2px; }
/* A narrow seat (5 players, phones) drops its avatar so the name is never cut: the name matters more. */
.seat { container-type: inline-size; }
@container (max-width: 215px) {
  .seat__head { grid-template-columns: minmax(0, 1fr) auto; }
  .seat__head .seat__avatar { display: none; }
  .seat__cards { grid-column: 2; }
}
.seat__avatar, .pad__avatar, .rank__avatar, .cover__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), 0 0 12px 2px rgba(227, 177, 62, 0.9); }
.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(--teal-light); color: #fff; }
.tag { 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); }

.seat__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.schip { display: inline-flex; align-items: center; gap: 3px; background: var(--paper-2); border-radius: 8px; padding: 1px 6px 1px 3px; min-height: 26px; white-space: nowrap; }
.schip__icon { width: 20px; height: 20px; flex: none; object-fit: contain; }
.schip__icon--bag { border-radius: 50%; }
.schip b { font-family: var(--font-display); font-weight: 400; font-size: 1rem; }
.schip i { font-style: normal; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); font-weight: 700; }
.schip--bag.has-sheep { background: #f9d9de; box-shadow: inset 0 0 0 2px var(--s-jumbuck); }
.seat__bagcards { min-width: 0; }
.mini { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.mini__card { width: var(--mw); }
.mini__card .cardimg { filter: drop-shadow(0 1px 2px rgba(58, 34, 16, 0.5)); }
.seat__score { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; font-size: 0.82rem; color: var(--ink-soft); }
.seat__score b { color: var(--ink); }
.total b { font-family: var(--font-display); font-weight: 400; font-size: 1rem; }
.plus { color: var(--good); font-weight: 700; }
.glyph { display: inline-block; border-radius: 50%; flex: none; }
.badge-suit { display: inline-block; border-radius: 50%; flex: none; vertical-align: middle; }

.cardimg { display: block; width: 100%; height: auto; aspect-ratio: 300 / 429; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 1px 3px rgba(58, 34, 16, 0.5)); }

/* centre: status, Billabong, trooper line, trick */
.area-centre { background: rgba(255, 249, 232, 0.95); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.status__line { font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; margin: 0; }
.status__prompt { font-weight: 700; margin: 2px 0 0; min-height: 2.9em; }
.scene { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: start; }
.billabong { min-width: 0; max-width: 300px; margin: 0 auto; width: 100%; }
.billabong__scene { position: relative; border-radius: 12px; overflow: hidden; background: #6ba8a2; box-shadow: 0 0 0 2px var(--ink); }
.billabong__img { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 699; }
.billabong__pile { position: absolute; left: 24%; top: 34%; width: 22%; }
.billabong__pile .cardimg { transform: rotate(-4deg); }
.billabong__pile.is-empty { border: 2px dashed rgba(255, 249, 232, 0.8); border-radius: 6px; aspect-ratio: 300 / 429; }
.billabong__count { position: absolute; right: -6px; bottom: -6px; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 0.8rem; border: 2px solid var(--card); }
.billabong__drinking { list-style: none; margin: 0; padding: 0; position: absolute; left: 51%; top: 30%; width: 46%; display: flex; gap: 4%; }
.drink { width: 47.8%; flex: none; }
.drink:only-child { width: 47.8%; }
.drink .cardimg { transform: rotate(3deg); box-shadow: 0 0 0 2px var(--s-jumbuck); border-radius: 5% / 3.6%; }
.troopers { min-width: 0; text-align: center; }
.troopers__title { font-family: var(--font-display); margin: 0 0 4px; font-size: 1rem; }
.tline { list-style: none; display: flex; justify-content: center; gap: 8px; padding: 0; margin: 0 0 4px; }
.tslot { position: relative; width: 44px; height: 44px; border-radius: 10px; border: 2px dashed var(--line); background: var(--paper); display: grid; place-items: center; }
.tslot__icon { width: 28px; height: 28px; opacity: 0.22; }
.tslot__n { position: absolute; right: 2px; bottom: 0; font-size: 0.65rem; font-weight: 800; color: var(--ink-soft); }
.tslot.is-filled { border: 2px solid var(--ink); background: var(--s-trooper); box-shadow: 0 2px 0 var(--ink); }
.tslot.is-filled .tslot__icon { opacity: 1; }
.tslot--yellow.is-filled { background: var(--s-yellow); }
.tslot--green.is-filled { background: var(--s-green); }
.tslot--red.is-filled { background: var(--s-red); }
.tslot--blue.is-filled { background: var(--s-blue); }
.tslot--extra.is-filled { border-color: var(--red-dark); box-shadow: 0 2px 0 var(--red-dark), 0 0 0 2px var(--red); }
.tslot.is-filled .tslot__n { color: var(--ink); background: var(--paper); border-radius: 6px; padding: 0 3px; right: 1px; bottom: 1px; }
.troopers__price { margin: 2px 0 0; font-size: 0.9rem; }
.troopers__price small { display: block; color: var(--ink-soft); }
.troopers__note { margin: 2px 0 0; font-size: 0.78rem; color: var(--ink-soft); font-style: italic; }
.trick__title { font-family: var(--font-display); margin: 4px 0; font-size: 1rem; }
.led { white-space: nowrap; }
.led__badge { width: 20px; height: 20px; margin-right: 3px; vertical-align: -5px; }
.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 / 429; 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--trump { background: var(--s-jumbuck); }
.mark--trooper { background: var(--s-trooper); color: #fff; }
.mark--wins { background: var(--good); color: #fff; }
.tplay.is-trump .tplay__card .cardimg { box-shadow: 0 0 0 3px var(--s-jumbuck); border-radius: 6%; }
.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); }
body[data-busy='1'] .area-centre { cursor: pointer; }

/* 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(227, 177, 62, 0.65); }
.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; }
.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(--teal-light)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }
.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; }
.preview { min-height: 2.9em; margin: 4px 0 0; font-weight: 600; color: var(--ink-soft); }
.preview--on { color: var(--ink); }
.note { margin: 0; color: var(--red-dark); font-weight: 700; min-height: 1.3em; }

/* the grab step */
.grab { background: #fff0c9; border: 2px solid var(--gold); border-radius: 12px; padding: 8px 10px 10px; margin-bottom: 10px; }
.grab__title { font-family: var(--font-display); margin: 0 0 6px; font-size: 1.1rem; }
.grab__warn { background: var(--red); color: #fff; border-radius: 8px; padding: 6px 10px; font-weight: 800; margin: 0 0 8px; }
.gopts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gopt { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.gopt__card { flex: none; width: 56px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.gopt__card--none { cursor: default; }
.gopt__card:hover .cardimg { filter: drop-shadow(0 0 3px var(--teal-light)) drop-shadow(0 5px 6px rgba(0, 0, 0, 0.35)); }
.gopt__card--peek { cursor: default; }
.gopt__body { min-width: 0; flex: 1; }
.gopt__text { margin: 4px 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.grab__risk { margin: 8px 0 0; font-size: 0.85rem; color: var(--ink-soft); }

/* 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; }
.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: #fff0c9; }
.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); }
.pad tfoot tr.pad__left th, .pad tfoot tr.pad__left td { font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); border-top: 0; }
.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(--teal-light); }
.log__item--trooper { color: var(--red-dark); font-weight: 600; }
.log__item--grab { color: #7a3a52; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(58, 34, 16, 0.62); 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(--red-dark); margin: 0; }
.end__lead { color: var(--ink-soft); }
.quote { font-style: italic; font-weight: 600; text-align: center; margin: 6px 0 10px; }
.end__note { color: var(--ink-soft); font-size: 0.85rem; }
.end__buttons, .dialog__buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.end__rules, .end__tiebreak { margin: 8px 0; }
.end__tiebreak { background: #fff0c9; 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; }
.table-wrap { overflow-x: auto; }
.summary { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.summary th, .summary td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.summary thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.summary th[scope='row'] { font-weight: 700; }
.summary .who { display: flex; align-items: center; gap: 6px; }
.summary .num { text-align: center; }
.summary tr.is-caught td, .summary tr.is-caught th { background: #fbe3e5; }
.summary .cost { display: block; color: var(--red-dark); font-weight: 700; margin-top: 2px; }
.summary .clean { color: var(--good); font-weight: 700; }
.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: #fff3d0; }
.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__cols { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); }
.rank__bag { width: 22px; height: 22px; border-radius: 50%; }
.rank__total { font-size: 0.9rem; }
.rank__total b { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; }
.pad--end { width: 100%; }
.endbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff3d0; 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(--teal) url(assets/table-texture.webp) 0 0 / 512px 512px; }
.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: block; }
.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.3); } }
@keyframes arrive { 0% { transform: translateY(-26px) scale(1.4) rotate(-12deg); opacity: 0; } 55% { transform: translateY(2px) scale(1.05); opacity: 1; } 100% { transform: none; opacity: 1; } }
.fx-bump { animation: bump 0.55s ease-out; }
.fx-arrive { animation: arrive 0.6s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
.fx-ghost { border-radius: 5% / 3.6%; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45); }
.card { transition: transform 0.12s ease; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx-ghost { display: none; }
}

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .setup__seats { grid-template-columns: repeat(2, 1fr); }
  .hero__strap { font-size: 2rem; }
}
@media (min-width: 700px) {
  :root { --tw: 66px; --mw: 30px; --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: 10px; }
  .table[data-n='2'] { grid-template-columns: 1fr; }
  .table[data-n='3'] { grid-template-columns: 1fr 2fr 1fr; grid-template-areas: 'r1 centre r2' '. me .'; }
  .table[data-n='4'] { grid-template-columns: 1fr 2.1fr 1fr; grid-template-areas: '. r2 .' 'r1 centre r3' '. me .'; }
  .table[data-n='5'] { grid-template-columns: 1fr 1.2fr 1.2fr 1fr; grid-template-areas: '. r2 r3 .' 'r1 centre centre r4' '. me me .'; }
  .table[data-n='5'] { --tw: 46px; }
  .table[data-n='4'] { --tw: 56px; }
  .table[data-n='2'] { --tw: 84px; }
  .seat__avatar { width: 44px; height: 44px; }
  .seat { padding: 8px 10px; gap: 6px; }
  .game--ended .col--main { margin-top: 0; }
  .table[data-n='2'] .scene, .table[data-n='5'] .scene { grid-template-columns: 1fr 1fr; align-items: center; }
  .table[data-n='3'] .scene { grid-template-columns: 1fr; }
  .table[data-n='4'] .scene { grid-template-columns: 1fr; }
}
@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: 68px; }
  .table[data-n='4'] { --tw: 58px; }
  .table[data-n='5'] { --tw: 48px; }
  .side { position: sticky; top: 8px; }
  .stats { max-width: 760px; }
  .table[data-n='3'] .scene, .table[data-n='4'] .scene { grid-template-columns: 1fr 1fr; align-items: center; }
}
@media (min-width: 1280px) {
  :root { --tw: 76px; --mw: 34px; }
  .table[data-n='4'] { --tw: 62px; }
  .table[data-n='5'] { --tw: 62px; }
  .table[data-n='2'] { --tw: 92px; }
}
@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 .hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: center; }
  .landing .hero__text { padding: 0; }
  .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; }
  .gopt__card { width: 48px; }
}
@media (max-width: 699px) {
  .seat__chips .schip i { display: none; }
  .seat__chips .schip { padding-right: 5px; }
}

/* stats screen, bug reporter (added with the stats work) */
.btn--small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.dialog--wide { max-width: 760px; }
.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(--red-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%; }
.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; }
