/* Widow Pitch score keeper (pitch.thelabs.fyi). TheLabs family look: navy table, cream playing cards, teal actions.
   Team 1 plays spades (navy ink), team 2 hearts (red). Dark by default, light on request. */

@font-face { font-family: "Alfa Slab One"; src: url(/fonts/alfa-slab-one-latin.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/fonts/inter-latin.woff2) format("woff2"); font-weight: 300 800; font-display: swap; }

:root {
  --bg: #0b1f28; --surface: #11303c; --surface-2: #163a48; --line: #22495a;
  --ink: #f2e9c9; --ink-2: #cdc4a4; --ink-3: #aca489;
  --accent: #39b8bf; --accent-ink: #082229; --accent-hover: #5fcbd1;
  --card: #f7f0d8; --card-edge: #d9c78c; --card-ink: #10262f; --red: #c8402f;
  --t0: #39b8bf; --t1: #f08a76;
  --ok: #63c98d; --bad: #ff8a7a; --self: #f2b84b; --self-card: #a35c00; --widow: #b9c96b; --widow-card: #56661a;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f2e4; --surface: #fffdf6; --surface-2: #efe9d4; --line: #ddd5bb;
  --ink: #10262f; --ink-2: #3c5560; --ink-3: #576b73;
  --accent: #12707a; --accent-ink: #ffffff; --accent-hover: #0c5960;
  --card: #fffdf6; --card-edge: #d9c78c; --card-ink: #10262f; --red: #b8382a;
  --t0: #12707a; --t1: #b8382a;
  --ok: #1d7a45; --bad: #b8382a; --self: #94560a; --self-card: #a35c00; --widow: #556316; --widow-card: #56661a;
  --shadow: 0 16px 34px -20px rgba(16, 38, 47, .45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 "Inter", system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2 { margin: 0; line-height: 1.1; }
h1 { font: 400 1.9rem/1.1 "Alfa Slab One", Georgia, serif; }
h2 { font-size: 1.05rem; font-weight: 750; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
main.wrap { flex: 1; padding-top: 14px; padding-bottom: 20px; }

/* ---- buttons ---- */
button { font: inherit; cursor: pointer; }
.big, .set-btns button[type="submit"] { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-weight: 750; font-size: 1.08rem; padding: 14px 20px; width: 100%; box-shadow: 0 8px 20px -12px var(--accent); }
.big:hover:not(:disabled), .set-btns button[type="submit"]:hover { background: var(--accent-hover); }
.big:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.big.slim { width: auto; padding: 10px 16px; font-size: 1rem; }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.ghost:hover:not(:disabled) { background: var(--surface-2); }
.ghost:disabled { opacity: .45; cursor: not-allowed; }
.ghost.small { padding: 6px 11px; font-size: .9rem; }
.ic { display: inline-flex; align-items: center; gap: 7px; }
.ic svg, .bi { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#install { border-color: var(--accent); color: var(--accent); }
@media (max-width: 440px) { .top-btns .ghost svg { display: none; } .top-btns .ghost { padding: 8px 10px; } .top-btns { gap: 6px; } }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--ink-2); border-radius: 10px; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .sun { display: none; }
:root[data-theme="light"] .icon-btn .sun { display: inline; }
:root[data-theme="light"] .icon-btn .moon { display: none; }

/* ---- header ---- */
.top { display: flex; align-items: center; gap: 10px; max-width: 640px; width: 100%; margin: 0 auto; padding: 12px max(14px, env(safe-area-inset-right, 0px)) 6px max(14px, env(safe-area-inset-left, 0px)); padding-top: max(12px, env(safe-area-inset-top, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-card { width: 30px; height: 38px; flex: none; transform: rotate(-8deg); }
.brand-card rect { fill: var(--card); stroke: var(--card-edge); stroke-width: 1.5; }
.brand-card text { font: 400 10px "Alfa Slab One", serif; fill: var(--card-ink); }
.brand-card use { fill: var(--card-ink); }
.brand b { display: block; font: 400 1.3rem/1 "Alfa Slab One", Georgia, serif; letter-spacing: .01em; }
.brand small { display: block; color: var(--ink-3); font-size: .78rem; font-weight: 600; margin-top: 3px; }
.top-btns { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---- panels and fields ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 12px; box-shadow: var(--shadow); }
.screen > h1 { margin: 6px 0 4px; }
input { font: inherit; color: var(--ink); }
.teams-in { display: grid; gap: 10px; }
.team-in { display: grid; gap: 5px; }
.team-in span { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .95rem; }
.team-in svg { width: 16px; height: 16px; }
.team-in.t0 svg { fill: var(--t0); }
.team-in.t1 svg { fill: var(--t1); }
.team-in input { width: 100%; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 1.05rem; }
.team-in input:focus, .stepper input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.row-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.row-in label { font-weight: 700; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.stepper button { width: 46px; height: 46px; border: 0; background: transparent; color: var(--ink); font-size: 1.4rem; font-weight: 600; }
.stepper button:hover:not(:disabled) { background: var(--surface-2); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper input, .stepper output { width: 3.2em; text-align: center; border: 0; background: transparent; font: 400 1.35rem "Alfa Slab One", Georgia, serif; -moz-appearance: textfield; padding: 0; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.rule { border: 0; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.rule legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.rule label, .check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink-2); }
.rule label:has(input:checked) { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.rule input, .check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.check { margin-top: 12px; }
#setup-form .big { margin-top: 16px; }
.err { margin: 12px 0 0; color: var(--bad); font-weight: 600; }
.note { color: var(--ink-3); font-size: .9rem; margin: 12px 4px 0; }

/* ---- scoreboard: one playing card per team ---- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pcard { position: relative; background: var(--card); color: var(--card-ink); border: 1px solid var(--card-edge); border-radius: 16px; padding: 12px 12px 34px; min-width: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, var(--shadow); transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.pcard.t1 { --suit: var(--red); }
.pcard.t0 { --suit: var(--card-ink); }
.pcard.lead { transform: translateY(-3px) rotate(-1deg); }
.pcard.t1.lead { transform: translateY(-3px) rotate(1deg); }
.pcard .corner { position: absolute; display: grid; justify-items: center; line-height: 1; color: var(--suit); }
.pcard .corner b { font: 400 .95rem "Alfa Slab One", Georgia, serif; }
.pcard .corner svg { width: 13px; height: 13px; fill: var(--suit); margin-top: 2px; }
.pcard .c1 { top: 10px; left: 10px; }
.pcard .c2 { bottom: 10px; right: 10px; transform: rotate(180deg); }
.pcard .name { margin: 0 22px; text-align: center; font-weight: 750; font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; min-height: 2.4em; display: grid; place-items: center; }
.pcard .score { text-align: center; font: 400 clamp(3.4rem, 17vw, 5rem)/1 "Alfa Slab One", Georgia, serif; color: var(--suit); margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.pcard .score.neg { color: var(--red); }
.pcard .togo { text-align: center; font-size: .82rem; font-weight: 600; color: #576b73; margin: 0 14px; }
.meter { height: 6px; border-radius: 3px; background: rgba(16, 38, 47, .12); margin: 8px 14px 0; overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--p, 0%); border-radius: 3px; background: var(--suit); transition: width .5s cubic-bezier(.2, .7, .2, 1); }
.pcard.won { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.bump { animation: bump .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes bump { 40% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .bump { animation: none; } .pcard, .meter i { transition: none; } }

/* ---- poked: a red rubber stamp with a poking finger ---- */
.stamp { display: inline-flex; align-items: center; gap: 4px; border: 2px solid currentColor; border-radius: 6px; font: 400 .78rem/1 "Alfa Slab One", Georgia, serif; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.stamp svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stamp.tag { color: var(--bad); padding: 2px 6px 2px 4px; transform: rotate(-4deg); vertical-align: 1px; }
.minis { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 10px 8px 0; }
.stamp.mini { color: var(--red); padding: 2px 5px 2px 3px; transform: rotate(-6deg); font-size: .72rem; }
.stamp.mini.self { color: var(--self-card); transform: rotate(4deg); }
.stamp.tag.self { color: var(--self); transform: rotate(3deg); }
.stamp.mini.widow { color: var(--widow-card); transform: rotate(-2deg); }
.stamp.tag.widow { color: var(--widow); transform: rotate(-2deg); }
.stamp.slam.widow { color: var(--widow-card); box-shadow: 0 0 0 2px color-mix(in srgb, var(--widow-card) 25%, transparent) inset; }
.stamp.slam.self { color: var(--self-card); box-shadow: 0 0 0 2px color-mix(in srgb, var(--self-card) 25%, transparent) inset; }
.stamp.slam { position: absolute; left: 50%; top: 46%; color: var(--red); background: color-mix(in srgb, var(--card) 82%, transparent); padding: 6px 12px 6px 8px; border-width: 4px; border-radius: 10px;
  font-size: clamp(1.3rem, 7vw, 1.9rem); box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 25%, transparent) inset; pointer-events: none; z-index: 2;
  transform: translate(-50%, -50%) rotate(-14deg); animation: slam 2.2s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes slam {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-24deg) scale(2.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(.94); }
  22% { transform: translate(-50%, -50%) rotate(-14deg) scale(1.04); }
  30%, 78% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
}
.pcard:has(.slam) { animation: jolt .4s .25s; }
@keyframes jolt { 30% { translate: 0 4px; } 60% { translate: 0 -1px; } }
@media (prefers-reduced-motion: reduce) { .stamp.slam { animation: fadeout 2.2s forwards; } .pcard:has(.slam) { animation: none; } }
@keyframes fadeout { 0%, 78% { opacity: 1; } 100% { opacity: 0; } }
.pokes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.poke-btn { width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; text-align: center; padding: 10px 5px 9px; border: 1.5px dashed var(--line); border-radius: 10px; background: transparent; color: var(--ink-2); }
.poke-btn svg { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.poke-btn b { display: block; font: 400 .92rem/1.1 "Alfa Slab One", Georgia, serif; color: var(--ink); }
.poke-btn small { display: block; font-size: .76rem; line-height: 1.3; margin-top: 3px; text-wrap: balance; }
.poke-btn:hover { border-color: var(--ink-3); }
.poke-btn[aria-pressed="true"] { border: 2px solid var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.poke-btn[aria-pressed="true"] b { color: var(--bad); }
.poke-btn[aria-pressed="true"] svg { transform: translateX(4px) rotate(-8deg); }
.poke-btn.widow[aria-pressed="true"] { border-color: var(--widow); color: var(--widow); background: color-mix(in srgb, var(--widow) 12%, transparent); }
.poke-btn.widow[aria-pressed="true"] b { color: var(--widow); }
.poke-btn.widow[aria-pressed="true"] svg { transform: translateY(-2px) rotate(6deg); }
.poke-btn.self[aria-pressed="true"] { border-color: var(--self); color: var(--self); background: color-mix(in srgb, var(--self) 10%, transparent); }
.poke-btn.self[aria-pressed="true"] b { color: var(--self); }
.poke-btn.self[aria-pressed="true"] svg { transform: translateY(-2px) rotate(-8deg); }
.chips button:disabled { opacity: .3; cursor: not-allowed; }

/* ---- winner ---- */
.winner { margin-top: 12px; padding: 16px; border-radius: 16px; text-align: center; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1.5px solid var(--accent); }
.win-line { margin: 0 0 12px; font: 400 1.35rem/1.25 "Alfa Slab One", Georgia, serif; }
.win-btns { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

/* ---- hand entry ---- */
.hand h2 { display: flex; justify-content: space-between; align-items: baseline; }
.hand h2 span { color: var(--ink-3); font-weight: 600; font-size: .9rem; }
.step { margin-top: 14px; }
.lab { margin: 0 0 7px; font-weight: 700; font-size: .95rem; }
.seg { display: grid; gap: 8px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg button, .chips button { border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; font-weight: 700; }
.seg button { padding: 12px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.seg button svg { width: 16px; height: 16px; flex: none; }
.seg button.t0 svg { fill: var(--t0); }
.seg button.t1 svg { fill: var(--t1); }
.chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.chips.nine { grid-template-columns: repeat(var(--n, 9), minmax(0, 1fr)); }
.chips.many { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chips button { height: 46px; padding: 0; font: 400 1.1rem "Alfa Slab One", Georgia, serif; }
.seg button:hover, .chips button:hover { border-color: var(--ink-3); }
.seg button[aria-pressed="true"], .chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.other { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.other .lab { margin: 0; }
.other .hint { grid-column: 1 / -1; margin: 6px 0 0; color: var(--ink-3); font-size: .85rem; }
.preview { margin: 14px 0 10px; min-height: 1.5em; font-weight: 650; color: var(--ink-2); }
.preview .up { color: var(--ok); }
.preview .down { color: var(--bad); }

/* ---- hand log ---- */
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hands { list-style: none; margin: 10px 0 0; padding: 0; }
.hands li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.hands .no { color: var(--ink-3); font-weight: 700; font-size: .9rem; }
.hands .what { min-width: 0; font-size: .93rem; color: var(--ink-2); }
.hands .what b { color: var(--ink); }
.hands .set { color: var(--bad); font-weight: 700; }
.hands .made { color: var(--ok); font-weight: 700; }
.hands .pts { display: flex; gap: 6px; font-variant-numeric: tabular-nums; }
.hands .pts span:first-child { border-top: 2px solid var(--t0); }
.hands .pts span:last-child { border-top: 2px solid var(--t1); }
.hands .pts span { min-width: 3.4em; text-align: center; padding: 3px 6px; border-radius: 8px; background: var(--bg); font-weight: 700; font-size: .92rem; }
.hands .pts small { display: block; color: var(--ink-3); font-weight: 600; font-size: .72rem; }
.hands li.out { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.empty { color: var(--ink-3); margin: 10px 0 0; }

/* ---- settings ---- */
.settings summary { cursor: pointer; font-weight: 700; }
.settings form { margin-top: 12px; }
.set-btns { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 14px; }

/* ---- games list ---- */
.games-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.tally ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.tally li { display: flex; justify-content: space-between; gap: 12px; }
.tally li b { font: 400 1.1rem "Alfa Slab One", Georgia, serif; }
.game-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.game-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.game-list .gl-score { font-weight: 650; overflow-wrap: anywhere; }
.game-list .gl-score b { font: 400 1.05rem "Alfa Slab One", Georgia, serif; }
.game-list .gl-meta { grid-column: 1; color: var(--ink-3); font-size: .85rem; }
.game-list .gl-btns { grid-column: 2; grid-row: 1 / 3; display: flex; gap: 6px; }
.game-list .win { color: var(--ok); font-weight: 700; }
.game-list .live { color: var(--accent); font-weight: 700; }

.foot { padding-top: 10px; padding-bottom: 18px; color: var(--ink-3); font-size: .85rem; text-align: center; }
.foot p { margin: 0; }

@media (max-width: 380px) {
  .chips.nine { gap: 4px; }
  .chips button { height: 42px; font-size: 1rem; }
  .pcard .name { font-size: .92rem; }
}
@media (min-width: 560px) { .teams-in { grid-template-columns: 1fr 1fr; } }
.stamp.slam.self, .stamp.slam.widow { font-size: clamp(1.2rem, 6.4vw, 1.7rem); line-height: 1.05; padding: 6px 12px 6px 8px; }
.stamp.slam.self span, .stamp.slam.widow span { width: min-content; white-space: normal; text-align: center; }
.seg button[aria-pressed="true"] svg { fill: currentColor; }

/* ---- 1.1: steps, preview, hand list, rules page ---- */
.lab { display: flex; align-items: center; gap: 8px; }
.lab .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font: 750 .78rem/1 "Inter", system-ui, sans-serif; border: 1px solid var(--line); }
.lab small { color: var(--ink-3); font-weight: 600; font-size: .78rem; margin-left: auto; }
.other { padding-left: 30px; }
.preview { margin: 16px 0 12px; min-height: 0; color: var(--ink-2); font-weight: 600; }
.preview p { margin: 0; }
.preview.ready { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); display: grid; gap: 4px; }
.pv-head { font-weight: 750; color: var(--ink); }
.pv-head.made { color: var(--ok); }
.pv-head.set { color: var(--bad); }
.pv-row { display: flex; align-items: center; gap: 8px; }
.pv-row svg { width: 14px; height: 14px; flex: none; }
.pv-row.t0 svg { fill: var(--t0); }
.pv-row.t1 svg { fill: var(--t1); }
.pv-row span { min-width: 0; overflow-wrap: anywhere; }
.pv-row b { margin-left: auto; font: 400 1.1rem "Alfa Slab One", Georgia, serif; color: var(--ink-2); }
.pv-row b.up { color: var(--ok); }
.pv-row b.down { color: var(--bad); }
.pv-next { color: var(--ink-3); }
.poke-btn.poked[aria-pressed="true"] svg { transform: translateX(3px) rotate(-6deg); }

.hands .what { display: grid; gap: 3px; }
.hands .who { font-size: .98rem; overflow-wrap: anywhere; }
.hands .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .86rem; }
.hands .res { font-size: .72rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.hands .res.made { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.hands .res.set { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.hands .stamp.tag { font-size: .68rem; border-width: 1.5px; padding: 2px 6px 2px 4px; }
.stamp.tag.poked { color: var(--bad); }

.quick h2, .howto h2, .whatsnew h2 { font: 400 1.15rem/1.2 "Alfa Slab One", Georgia, serif; margin-bottom: 8px; }
.qlist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; color: var(--ink-2); }
.qlist li { padding-left: 14px; border-left: 3px solid var(--line); }
.qlist b { color: var(--ink); }
.qlist b.ok, .ok { color: var(--ok); }
.qlist b.bad, .bad { color: var(--bad); }
.howto .qlist { margin: 0; }
.quick .ghost { width: 100%; justify-content: center; }

.rules .back { margin: 4px 0 10px; }
.rules h1 { font-size: 1.7rem; }
.lede { font-size: 1.05rem; margin: 10px 0 8px; }
.aside { color: var(--ink-3); font-size: .9rem; margin: 8px 0 0; }
.howto { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: step; }
.howto > li { counter-increment: step; position: relative; padding-left: 52px; }
.howto > li::before { content: counter(step); position: absolute; left: 14px; top: 15px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--card); color: var(--card-ink); border: 1px solid var(--card-edge); font: 400 .9rem/1 "Alfa Slab One", Georgia, serif; transform: rotate(-6deg); }
.howto p { margin: 0 0 8px; color: var(--ink-2); }
.howto p:last-child { margin-bottom: 0; }
.howto b { color: var(--ink); }
.rank { font: 400 .95rem "Alfa Slab One", Georgia, serif; color: var(--ink); letter-spacing: .06em; white-space: nowrap; }
.callout { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 10%, transparent); border: 1.5px solid color-mix(in srgb, var(--bad) 45%, transparent); }
.callout svg, .marks-help svg { width: 28px; height: 28px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.callout.poked svg { color: var(--bad); }
.points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.points li { background: var(--card); color: #3c5560; border: 1px solid var(--card-edge); border-radius: 10px; padding: 8px 10px; font-size: .84rem; line-height: 1.35; }
.points li b { display: block; color: var(--card-ink); font: 400 1rem/1.2 "Alfa Slab One", Georgia, serif; margin-bottom: 2px; }
.marks-help { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.marks-help li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1.5px dashed var(--line); border-radius: 10px; color: var(--ink-2); font-size: .92rem; }
.marks-help li b { display: block; font: 400 1rem/1.2 "Alfa Slab One", Georgia, serif; }
.marks-help .poked svg, .marks-help .poked b { color: var(--bad); }
.marks-help .self svg, .marks-help .self b { color: var(--self); }
.marks-help .widow svg, .marks-help .widow b { color: var(--widow); }
.whatsnew p { margin: 0 0 8px; color: var(--ink-2); font-size: .92rem; }
.whatsnew .when { color: var(--ink-3); font-size: .82rem; margin-right: 4px; }
.rules > .big { margin-top: 14px; }
.foot p + p { margin-top: 4px; }
.foot .ver { white-space: nowrap; }
.brand b, .brand small { white-space: nowrap; }
@media (max-width: 400px) { .brand small { display: none; } .brand b { font-size: 1.08rem; } .top { gap: 8px; } .brand-card { width: 26px; height: 33px; } }
.game-list .gl-score { display: grid; gap: 2px; }
.gl-team { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.gl-team svg { width: 13px; height: 13px; flex: none; }
.gl-team.t0 svg { fill: var(--t0); }
.gl-team.t1 svg { fill: var(--t1); }
.gl-team span { min-width: 0; overflow-wrap: anywhere; }
.gl-team b { margin-left: auto; padding-left: 8px; color: var(--ink-2); }
.gl-team.won, .gl-team.won b { color: var(--ink); }
.game-list .gl-meta { margin-top: 4px; }
.game-list .gl-btns { flex-direction: column; }
.game-list .gl-btns button { min-width: 5.8em; }
.game-list .win, .game-list .live { display: block; }

/* ---- 1.2: game types, Game counter, hand tracker, stats ---- */
.brand b { font-size: 1.45rem; }
.sel { font: inherit; font-weight: 650; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 34px 10px 12px; min-width: 0; max-width: 62%;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.vdesc { margin: 8px 0 0; color: var(--ink-3); font-size: .88rem; }
.custom { margin-top: 4px; padding: 2px 12px 12px; border: 1.5px dashed var(--line); border-radius: 12px; }
.custom .row-in { margin-top: 10px; }
.custom .stepper button { width: 40px; height: 40px; }
.custom .stepper input { width: 2.6em; font-size: 1.15rem; }

.counter { margin-top: 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; }
.counter[open] { padding-bottom: 12px; }
.counter summary { cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 11px 0; font-weight: 700; color: var(--ink-2); list-style: none; }
.counter summary::-webkit-details-marker { display: none; }
.counter summary::after { content: "+"; margin-left: auto; font-size: 1.2rem; color: var(--ink-3); }
.counter[open] summary::after { content: "−"; }
.counter summary svg, .track-btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.counter .hint { margin: 0 0 10px; color: var(--ink-3); font-size: .85rem; }
.count-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 10px; align-items: center; }
.count-grid .ch { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--ink-2); max-width: 7.5em; text-align: center; line-height: 1.15; }
.count-grid .ch svg { width: 12px; height: 12px; flex: none; }
.count-grid .ch.t0 svg { fill: var(--t0); } .count-grid .ch.t1 svg { fill: var(--t1); }
.count-grid .cl b { font: 400 1.1rem "Alfa Slab One", Georgia, serif; margin-right: 6px; }
.count-grid .cl small { color: var(--ink-3); font-size: .78rem; }
.cs { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.cs button { width: 34px; height: 36px; border: 0; background: transparent; color: var(--ink); font-size: 1.15rem; }
.cs button:disabled { opacity: .3; cursor: not-allowed; }
.cs output { min-width: 1.6em; text-align: center; font: 400 1.05rem "Alfa Slab One", Georgia, serif; }
.count-grid .tot { font-weight: 750; padding-top: 6px; border-top: 1px solid var(--line); }
.ctot { text-align: center; font: 400 1.25rem "Alfa Slab One", Georgia, serif; padding-top: 6px; border-top: 1px solid var(--line); }
.count-result { margin: 10px 0 0; font-weight: 700; color: var(--ok); min-height: 0; }
.count-result:empty { display: none; }

.track-btn { margin-top: 10px; width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 11px 12px; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--accent); }
.track-btn:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.track-btn svg { width: 26px; height: 26px; }
.track-btn b { display: block; color: var(--ink); font-weight: 750; }
.track-btn small { display: block; color: var(--ink-3); font-size: .82rem; margin-top: 1px; }

#track .panel { margin-top: 10px; }
#track .lab { margin-top: 4px; }
#track .lab + .seg, #track .lab + .suits { margin-bottom: 14px; }
.suits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.suits button { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; height: 58px; font-size: 1.6rem; line-height: 1; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--card-ink); }
.suits button small { font-size: .7rem; font-weight: 700; color: #576b73; }
.suits .s-h, .suits .s-d { color: var(--red); }
.suits button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
.deck-h { margin: 14px 0 6px; font-weight: 700; font-size: .85rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.deck-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.pc { position: relative; height: 62px; border-radius: 8px; border: 1.5px solid var(--card-edge); background: var(--card); color: var(--card-ink); display: grid; place-items: center; align-content: center; gap: 0; padding: 0; line-height: 1; }
.pc b { font: 400 1.1rem "Alfa Slab One", Georgia, serif; }
.pc small { font-size: 1rem; }
.pc.s-h, .pc.s-d { color: var(--red); }
.pc.joker b { font: 700 1.1rem system-ui, sans-serif; color: #7a4fd0; }
.pc.joker small { font-size: .62rem; font-weight: 750; text-transform: uppercase; }
.pc .gv { position: absolute; top: 2px; right: 3px; font: 700 .58rem/1 "Inter", system-ui, sans-serif; font-style: normal; color: #576b73; }
.pc.on { transform: translateY(-2px); }
.pc.on.t0 { box-shadow: 0 0 0 3px var(--t0); }
.pc.on.t1 { box-shadow: 0 0 0 3px var(--t1); }
.pc.on::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; border-radius: 2px; }
.pc.on.t0::after { background: var(--t0); } .pc.on.t1::after { background: var(--t1); }
.tsum h2 { margin-bottom: 8px; }
.trows { display: grid; gap: 2px; }
.trow { display: flex; justify-content: space-between; gap: 10px; padding: 6px 2px; border-top: 1px solid var(--line); font-size: .93rem; }
.trow .tn { font-weight: 700; }
.trow .tw { color: var(--ink-3); text-align: right; overflow-wrap: anywhere; }
.trow.t0 .tw { color: var(--t0); font-weight: 700; } .trow.t1 .tw { color: var(--t1); font-weight: 700; }
.tgame { margin: 10px 0 0; color: var(--ink-3); font-size: .88rem; }
.trackbar { position: sticky; bottom: 0; margin: 12px calc(-1 * max(14px, env(safe-area-inset-left, 0px))) 0; padding: 10px max(14px, env(safe-area-inset-left, 0px)) calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; z-index: 3; }
.tb-tots { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tb { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 650; color: var(--ink-2); }
.tb svg { width: 13px; height: 13px; flex: none; } .tb.t0 svg { fill: var(--t0); } .tb.t1 svg { fill: var(--t1); }
.tb-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb b { margin-left: auto; font: 400 1.35rem "Alfa Slab One", Georgia, serif; color: var(--ink); }
.trackbar .big { padding: 12px 16px; }

.stats { list-style: none; margin: 10px 0 2px; padding: 0; display: grid; gap: 4px; font-size: .84rem; color: var(--ink-3); }
.stats li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stats svg { width: 12px; height: 12px; } .stats .t0 svg { fill: var(--t0); } .stats .t1 svg { fill: var(--t1); }
.stats b { color: var(--ink-2); }

.rules-for { margin: 10px 0 2px; }
.rules-for .sel { max-width: 70%; }
.points em { display: inline-block; margin-top: 4px; font-style: normal; font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: #12707a; }
.points li span { display: block; }
.gamecount { margin-top: 14px; }
.gamecount h3 { margin: 0 0 4px; font: 400 1rem "Alfa Slab One", Georgia, serif; }
.cvals { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cvals li { background: var(--card); border: 1px solid var(--card-edge); border-radius: 8px; text-align: center; padding: 6px 2px; color: #576b73; font-size: .72rem; font-weight: 700; }
.cvals b { display: block; color: var(--card-ink); font: 400 1.15rem "Alfa Slab One", Georgia, serif; }
@media (max-width: 400px) { .brand b { font-size: 1.25rem; } }

/* ---- dealer, moon, bragging rights, pop-ups ---- */
:root { --moon: #8f7cf0; --gold: #e2b53c; }
:root[data-theme="light"] { --moon: #5b46c9; --gold: #9a6b00; }
.team-box { display: grid; gap: 6px; }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.players input { width: 100%; min-width: 0; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: .95rem; }
.players input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.players-hint { margin: 8px 0 0; color: var(--ink-3); font-size: .84rem; }
.dealer-pick { display: flex; gap: 6px; align-items: center; min-width: 0; }
.dealer-pick .sel { max-width: 9.5em; }
.dealer-pick .ghost { white-space: nowrap; }
.more-rules { margin-top: 14px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; }
.more-rules[open] { padding-bottom: 12px; }
.more-rules summary { cursor: pointer; padding: 11px 0; font-weight: 700; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.more-rules summary::-webkit-details-marker { display: none; }
.more-rules summary::after { content: "+"; margin-left: auto; color: var(--ink-3); font-size: 1.2rem; }
.more-rules[open] summary::after { content: "−"; }
.more-rules summary small { color: var(--ink-3); font-weight: 600; font-size: .8rem; order: 3; flex-basis: 100%; }
.more-rules .rule { margin-top: 4px; }
.more-rules .rule + .rule { margin-top: 14px; }

.dealer { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.d-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--card); color: var(--card-ink); }
.d-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.d-who { display: grid; min-width: 0; }
.d-who small { color: var(--ink-3); font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.d-who b { display: flex; align-items: center; gap: 5px; font-size: 1.02rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-who b svg { width: 11px; height: 11px; flex: none; order: -1; }
.d-who:nth-child(2) b svg, .d-who b svg { fill: var(--ink-3); }
.dealer.t0 .d-who:nth-child(2) b svg { fill: var(--t0); } .dealer.t1 .d-who:nth-child(2) b svg { fill: var(--t1); }
.dealer.t0 .d-who:nth-child(3) b svg { fill: var(--t1); } .dealer.t1 .d-who:nth-child(3) b svg { fill: var(--t0); }
.hands .dealt { color: var(--ink-3); font-size: .78rem; }

.moon-chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; grid-column: span 2; font: 700 .95rem "Inter", system-ui, sans-serif !important; color: var(--moon) !important; border-color: color-mix(in srgb, var(--moon) 55%, var(--line)) !important; }
.moon-chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chips .moon-chip[aria-pressed="true"] { background: var(--moon); border-color: var(--moon) !important; color: #fff !important; }
.stamp.moon { color: var(--moon); }
.stamp.moon.missed { color: var(--bad); }
.stamp.slam.moon { color: #5b46c9; box-shadow: 0 0 0 2px color-mix(in srgb, #5b46c9 25%, transparent) inset; font-size: clamp(1.1rem, 6vw, 1.6rem); }
.stamp.slam.moon span { width: min-content; white-space: normal; text-align: center; line-height: 1.05; }
.stamp.slam.moon.missed { color: var(--red); }
.callout.moon { margin-top: 8px; background: color-mix(in srgb, var(--moon) 10%, transparent); border-color: color-mix(in srgb, var(--moon) 45%, transparent); }
.callout.moon svg { color: var(--moon); }

.brag h2 { font: 400 1.2rem/1.2 "Alfa Slab One", Georgia, serif; }
.awards { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.award { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--card); color: var(--card-ink); border: 1px solid var(--card-edge); min-width: 0; }
.aw-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 22%, transparent); color: #8a5d00; }
.aw-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.aw-tx { display: grid; min-width: 0; line-height: 1.25; }
.aw-tx small { font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: #8a5d00; }
.aw-tx b { font: 400 .98rem/1.2 "Alfa Slab One", Georgia, serif; overflow-wrap: anywhere; margin: 2px 0; }
.aw-tx span { font-size: .8rem; color: #576b73; }
.board-wrap { margin-top: 14px; overflow-x: auto; }
.lb { width: 100%; border-collapse: collapse; font-size: .9rem; }
.lb th, .lb td { padding: 8px 6px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.lb thead th { border-top: 0; color: var(--ink-3); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lb th:first-child { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.lb tbody th { font-weight: 700; }
.lb td { font-variant-numeric: tabular-nums; color: var(--ink-2); }

.dlg { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(92vw, 400px); background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7); }
.dlg::backdrop { background: rgba(6, 16, 21, .62); backdrop-filter: blur(3px); }
.dlg[open] { animation: dlg-in .22s cubic-bezier(.2, .7, .2, 1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.dlg form { padding: 22px 20px 18px; display: grid; justify-items: center; text-align: center; }
.dlg-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); margin-bottom: 10px; transform: rotate(-6deg); }
.dlg.danger .dlg-ic { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.dlg-ic svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dlg h2 { font: 400 1.3rem/1.2 "Alfa Slab One", Georgia, serif; margin: 0 0 6px; }
.dlg p { margin: 0 0 4px; color: var(--ink-2); }
.dlg-list { width: 100%; display: grid; gap: 6px; margin-top: 12px; }
.dlg-pick { padding: 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font-weight: 700; font-size: 1.02rem; }
.dlg-pick:hover { border-color: var(--ink-3); }
.dlg-pick.cur { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.dlg-btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.dlg-btns:has(> [hidden]) { grid-template-columns: 1fr; }
.dlg-btns .big { width: 100%; padding: 12px; box-shadow: none; }
.dlg.danger .dlg-btns .big { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .dlg.danger .dlg-btns .big { color: #2a0d08; }
.dlg.danger .dlg-btns .big:hover { filter: brightness(1.08); }
.draw { display: grid; gap: 8px; }
.draw-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.draw-cell { display: grid; justify-items: center; gap: 6px; min-width: 0; }
.draw .pc.mini { width: 52px; height: 72px; animation: flip .45s calc(var(--i, 0) * .18s) both cubic-bezier(.2, .7, .2, 1); cursor: default; }
.draw .pc.mini b { font-size: 1.25rem; }
.draw-cell.win .pc.mini { box-shadow: 0 0 0 3px var(--gold); transform: translateY(-4px); }
.draw-name { font-size: .82rem; font-weight: 650; color: var(--ink-2); overflow-wrap: anywhere; line-height: 1.2; }
.draw-cell.win .draw-name { color: var(--ink); font-weight: 800; }
.draw-tie { margin: 6px 0 0; font-weight: 700; color: var(--self); font-size: .9rem; }
@keyframes flip { from { opacity: 0; transform: rotateY(90deg) translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .dlg[open], .draw .pc.mini { animation: none; } }
@media (max-width: 400px) { .dealer { grid-template-columns: auto minmax(0, 1fr) auto; } .dealer .d-who:nth-of-type(3) { grid-column: 2; grid-row: 2; } .dealer > button { grid-row: 1 / 3; grid-column: 3; } .award { flex-direction: column; gap: 6px; padding: 9px; } .aw-ic { width: 28px; height: 28px; } .aw-ic svg { width: 17px; height: 17px; } }

/* ---- play the computer: mode switch ---- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.modes button { display: grid; justify-items: center; gap: 2px; padding: 12px 8px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink-2); text-align: center; }
.modes svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; }
.modes b { font: 400 1rem/1.15 "Alfa Slab One", Georgia, serif; color: var(--ink); }
.modes small { font-size: .76rem; line-height: 1.25; }
.modes button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); color: var(--accent); }
#setup-form[data-mode="score"] [data-only]:not([data-only~="score"]), #setup-form[data-mode="play"] [data-only]:not([data-only~="play"]), #setup-form[data-mode="family"] [data-only]:not([data-only~="family"]) { display: none !important; }
.play-in { display: grid; gap: 6px; }
.play-in .hint { margin: 2px 0 0; color: var(--ink-3); font-size: .85rem; }

/* compact scoreboard while playing */
.cards.compact { gap: 8px; }
.cards.compact .pcard { padding: 8px 10px 10px; border-radius: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; transform: none; }
.cards.compact .corner { display: none; }
.cards.compact .pcard .name { margin: 0; min-height: 0; text-align: left; display: block; font-size: .86rem; }
.cards.compact .pcard .score { grid-row: 1 / 3; grid-column: 2; font-size: 2.1rem; margin: 0; }
.cards.compact .pcard .togo { margin: 0; text-align: left; font-size: .74rem; }
.cards.compact .meter { grid-column: 1 / -1; margin: 6px 0 0; height: 4px; }
.cards.compact .minis { grid-column: 1 / -1; justify-content: flex-start; margin: 6px 0 0; }
.cards.compact .stamp.slam { font-size: 1.1rem; }

/* ---- the table ---- */
.table { --cw: 54px; margin-top: 10px; display: grid; grid-template-columns: 66px minmax(0, 1fr) 66px; grid-template-areas: "top top top" "left felt right" "me me me" "act act act"; gap: 8px; }
.seat { position: relative; display: grid; justify-items: center; align-content: start; gap: 3px; min-width: 0; }
.seat.top { grid-area: top; }
.seat.left { grid-area: left; align-self: center; }
.seat.right { grid-area: right; align-self: center; }
.seat.me { grid-area: me; }
.seat-name { margin: 0; display: flex; align-items: center; gap: 4px; font-weight: 750; font-size: .84rem; max-width: 100%; }
.seat-name span:not(.chip-d):not(.bubble) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name svg { width: 11px; height: 11px; flex: none; }
.seat.t0 .seat-name svg { fill: var(--t0); } .seat.t1 .seat-name svg { fill: var(--t1); }
.chip-d { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--card-ink); font: 800 .66rem/1 "Inter", sans-serif; box-shadow: 0 0 0 1.5px var(--card-edge); }
.seat.turn .seat-name { color: var(--accent); }
.thinking { position: absolute; top: -4px; right: 2px; color: var(--accent); font-weight: 900; letter-spacing: 1px; animation: blink 1s infinite; }
.seat.me .thinking { display: none; }
@keyframes blink { 50% { opacity: .25; } }
.count { font-size: .68rem; color: var(--ink-3); }
.bubble { font-size: .72rem; font-weight: 750; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.bubble.bidder { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bubble.mine { margin-left: 4px; }

/* cards */
.card { position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: 7px; background: var(--card); border: 1.5px solid var(--card-edge); color: var(--card-ink);
  display: grid; place-items: center; align-content: center; gap: 0; padding: 0; line-height: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); font-family: inherit; }
.card b { font: 400 calc(var(--cw) * .36) "Alfa Slab One", Georgia, serif; }
.card i { font-style: normal; font-size: calc(var(--cw) * .36); }
.card.s-h, .card.s-d { color: var(--red); }
.card.joker b { color: #7a4fd0; font-family: system-ui, sans-serif; font-weight: 800; }
.card.joker i { font-size: calc(var(--cw) * .15); font-weight: 800; letter-spacing: .04em; color: #7a4fd0; }
.card.trump-badge { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0, 0, 0, .25); }
.card.back { background: repeating-linear-gradient(45deg, #1d6b73 0 4px, #175a61 4px 8px); border-color: #e9dfbd; box-shadow: inset 0 0 0 2px #0f4a50, 0 1px 3px rgba(0, 0, 0, .3); }
.card.mini { --cw: 26px; border-radius: 4px; border-width: 1px; }
.backs { display: flex; justify-content: center; }
.backs .card { --cw: 22px; border-radius: 3px; border-width: 1px; }
.backs .card + .card { margin-left: -14px; }
.seat.top .backs .card + .card { margin-left: -12px; }
.exposed { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: center; }
.exposed small { font-size: .62rem; color: var(--ink-3); margin-right: 2px; }
.deal-in { animation: dealIn .32s calc(var(--i, 0) * 50ms) both cubic-bezier(.2, .7, .2, 1); }
@keyframes dealIn { from { opacity: 0; transform: translateY(-40px) rotate(-8deg) scale(.8); } }

/* the felt and the trick */
.felt { grid-area: felt; position: relative; min-height: 210px; border-radius: 22px; background: radial-gradient(circle at 50% 40%, #1f6f62, #134a43 70%); border: 3px solid #0d332e;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .35); overflow: hidden; }
:root[data-theme="light"] .felt { background: radial-gradient(circle at 50% 40%, #2c8a78, #1c6355 70%); border-color: #164d43; }
.felt-top { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; z-index: 2; }
.trump-badge { display: grid; justify-items: center; background: var(--card); color: var(--card-ink); border-radius: 8px; padding: 2px 7px 3px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); line-height: 1; }
.trump-badge small { font-size: .55rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #576b73; }
.trump-badge b { font-size: 1.3rem; }
.trump-badge.s-h b, .trump-badge.s-d b { color: var(--red); }
.felt-bid { font-size: .7rem; font-weight: 700; color: #e9f5ef; background: rgba(0, 0, 0, .28); padding: 3px 8px; border-radius: 999px; text-align: right; max-width: 70%; }
.widow-pile, .stock-pile { position: absolute; display: flex; align-items: center; }
.widow-pile { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.widow-pile .card, .stock-pile .card { --cw: 30px; border-radius: 4px; }
.widow-pile .card + .card { margin-left: -18px; }
.widow-pile small, .stock-pile small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-size: .66rem; font-weight: 700; color: #cfe8df; white-space: nowrap; }
.stock-pile { left: 10px; bottom: 22px; }
.trick { position: absolute; inset: 0; }
.trick .card { position: absolute; left: 50%; top: 50%; --cw: 48px; transition: transform .35s, opacity .35s; }
.trick .at-me { transform: translate(-50%, -6%); }
.trick .at-top { transform: translate(-50%, -94%); }
.trick .at-left { transform: translate(-128%, -50%) rotate(-6deg); }
.trick .at-right { transform: translate(28%, -50%) rotate(6deg); }
.trick .from-me { animation: fromMe .3s both; } .trick .from-top { animation: fromTop .3s both; }
.trick .from-left { animation: fromLeft .3s both; } .trick .from-right { animation: fromRight .3s both; }
@keyframes fromMe { from { opacity: 0; translate: 0 90px; } } @keyframes fromTop { from { opacity: 0; translate: 0 -90px; } }
@keyframes fromLeft { from { opacity: 0; translate: -90px 0; } } @keyframes fromRight { from { opacity: 0; translate: 90px 0; } }
.trick .card.winner { box-shadow: 0 0 0 3px var(--gold), 0 4px 12px rgba(0, 0, 0, .4); z-index: 1; }
.trick .took-msg { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); font-size: .72rem; font-weight: 800; color: #fff6d8; background: rgba(0, 0, 0, .35); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.trick.sweep .card { opacity: 0; }
.trick.sweep.to-me .card { translate: 0 120px; } .trick.sweep.to-top .card { translate: 0 -120px; }
.trick.sweep.to-left .card { translate: -140px 0; } .trick.sweep.to-right .card { translate: 140px 0; }
.trick.sweep .took-msg { opacity: 0; transition: opacity .2s; }

/* your hand */
.myhand { display: flex; justify-content: center; width: 100%; padding: 10px 0 2px; --cw: 56px; }
.myhand .card { flex: none; cursor: default; transition: transform .15s, opacity .15s, box-shadow .15s; }
.myhand .card + .card { margin-left: min(5px, calc((100% - var(--n) * var(--cw)) / (var(--n) - 1))); }
.myhand .card.can { cursor: pointer; transform: translateY(-8px); box-shadow: 0 0 0 2px var(--accent), 0 6px 12px rgba(0, 0, 0, .3); }
.myhand .card.can:hover { transform: translateY(-14px); }
.myhand .card.cant { opacity: .45; }
.myhand .card:disabled { opacity: 1; }
.myhand .card.cant:disabled { opacity: .45; }
.myhand .card.keep, .myhand .card.throw { cursor: pointer; }
.myhand .card.throw { transform: translateY(10px); opacity: .45; }
.myhand .card.throw::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; color: var(--bad); font-weight: 900; }
.myhand .card.new { box-shadow: 0 0 0 2px var(--self), 0 2px 6px rgba(0, 0, 0, .25); }
.myhand .card.new::before { content: "new"; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font: 800 .55rem/1 "Inter", sans-serif; text-transform: uppercase; background: var(--self); color: #241600; padding: 2px 4px; border-radius: 4px; }
.card.hint, .bidbtn.hint, .suitbtn.hint { animation: hintPulse 1s 3; box-shadow: 0 0 0 3px var(--gold) !important; }
@keyframes hintPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 40%, transparent); } }

/* what you do next */
.tact { grid-area: act; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 10px; justify-items: stretch; }
.tsay { margin: 0; color: var(--ink-2); text-align: center; }
.tsay.strong { color: var(--ink); font-weight: 700; }
.tsay.err { color: var(--bad); font-weight: 700; }
.bidrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bidbtn { min-width: 44px; height: 46px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 400 1.15rem "Alfa Slab One", Georgia, serif; }
.bidbtn:hover { border-color: var(--accent); }
.bidbtn.pass { font: 700 1rem "Inter", sans-serif; color: var(--ink-2); padding: 0 16px; }
.bidbtn.moon { font: 700 1rem "Inter", sans-serif; color: var(--moon); border-color: color-mix(in srgb, var(--moon) 55%, var(--line)); }
.suitrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.suitbtn { display: grid; justify-items: center; gap: 1px; padding: 8px 2px; border-radius: 10px; border: 1.5px solid var(--card-edge); background: var(--card); color: var(--card-ink); line-height: 1.1; }
.suitbtn b { font-size: 1.6rem; } .suitbtn.s-h b, .suitbtn.s-d b { color: var(--red); }
.suitbtn small { font-size: .7rem; font-weight: 700; color: #3c5560; }
.suitbtn i { font-style: normal; font-size: .68rem; color: #576b73; }
.hint-btn { justify-self: center; }
.tsum-head { margin: 0; font-weight: 800; text-align: center; font-size: 1.05rem; }
.tsum-head.made { color: var(--ok); } .tsum-head.set { color: var(--bad); }
.tpoints { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.tpoints li { display: flex; justify-content: space-between; gap: 6px; font-size: .86rem; padding: 4px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.tp-k { font-weight: 700; }
.tp-w { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpoints .t0 .tp-w { color: var(--t0); font-weight: 700; } .tpoints .t1 .tp-w { color: var(--t1); font-weight: 700; }
.tgame { margin: 0; text-align: center; color: var(--ink-3); font-size: .84rem; }
@media (max-width: 380px) { .table { --cw: 50px; grid-template-columns: 58px minmax(0, 1fr) 58px; } .myhand { --cw: 50px; } }
@media (prefers-reduced-motion: reduce) { .deal-in, .trick .card { animation: none !important; transition: none; } }
.stock-pile small { top: 50%; left: 100%; transform: translateY(-50%); margin: 0 0 0 6px; }
.thinking { display: none; }
.seat.turn:not(.me) .backs { filter: drop-shadow(0 0 5px var(--accent)); animation: turnGlow 1.2s infinite; }
@keyframes turnGlow { 50% { filter: drop-shadow(0 0 1px var(--accent)); } }
@media (prefers-reduced-motion: reduce) { .seat.turn:not(.me) .backs { animation: none; } }
/* running score while playing, and what was left in the deck */
.table { grid-template-areas: "top top top" "left felt right" "live live live" "me me me" "act act act"; }
.live { grid-area: live; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.live-team { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; min-width: 0; }
.live-team.t0 { border-top: 3px solid var(--t0); } .live-team.t1 { border-top: 3px solid var(--t1); }
.live-head { margin: 0; display: flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; min-width: 0; }
.live-head svg { width: 11px; height: 11px; flex: none; } .live-team.t0 .live-head svg { fill: var(--t0); } .live-team.t1 .live-head svg { fill: var(--t1); }
.live-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.live-pts { margin-left: auto; font: 400 1rem "Alfa Slab One", Georgia, serif; white-space: nowrap; }
.live-tags { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 3px; }
.live .tag { font-size: .66rem; font-weight: 750; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.live-team.t0 .tag:not(.gm) { background: color-mix(in srgb, var(--t0) 22%, transparent); color: var(--ink); }
.live-team.t1 .tag:not(.gm) { background: color-mix(in srgb, var(--t1) 22%, transparent); color: var(--ink); }
.live .tag.gm.lead { outline: 1.5px solid var(--gold); }
.live-note { grid-column: 1 / -1; margin: 0; text-align: center; font-size: .7rem; color: var(--ink-3); }
.leftover { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 6px; justify-items: center; }
.lo-head { margin: 0; font-size: .82rem; color: var(--ink-3); text-align: center; }
.lo-cards { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.lo-cards .card.mini { --cw: 30px; }
.lo-cards .card.trump { box-shadow: 0 0 0 2px var(--gold); }
@media (max-width: 400px) { .brand small { display: block; font-size: .7rem; margin-top: 2px; } .brand small .sub-type { display: none; } }
/* hold every part of the table at a steady height so nothing jumps as cards come and go */
.seat.top { height: 104px; align-content: start; }
.seat .backs { min-height: 32px; align-items: center; }
.bubble.empty { visibility: hidden; }
.seat.left, .seat.right { align-self: stretch; align-content: center; }
.felt { min-height: 214px; }
.live-team { min-height: 66px; }
.live-tags { max-height: 40px; overflow: hidden; }
.live-note { min-height: 1.2em; }
.seat.me { min-height: 128px; align-content: start; }
.myhand { min-height: calc(var(--cw) * 1.42 + 12px); align-items: flex-end; }
.tact { min-height: 132px; align-content: center; }
@media (max-width: 440px) { .tpoints { grid-template-columns: minmax(0, 1fr); } }
.seat-name { min-height: 24px; }
.seat.me .seat-name { height: 24px; }
.seat.me .exposed { position: absolute; top: 0; right: 0; }
.live-team { height: 80px; min-height: 0; overflow: hidden; }
.live-tags { max-height: 42px; }
.cards.compact .minis { display: none; }
.cards.compact .pcard { height: 78px; }
.live .tag.gm.won { background: color-mix(in srgb, var(--gold) 25%, transparent); color: var(--ink); }
.foot .coffee { margin-bottom: 8px; }
.foot .coffee a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: .86rem; }
.foot .coffee a:hover { border-color: #f5c84c; color: var(--ink); }
.foot .coffee b { color: var(--ink); }
.foot .coffee svg { width: 18px; height: 18px; flex: none; fill: none; stroke: #e0a92e; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.foot .coffee b { white-space: nowrap; }

/* ---- friends & family ---- */
.modes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.modes button { padding: 10px 4px; }
.modes b { font-size: .88rem; }
.modes small { font-size: .7rem; }
.join-box { margin-top: 14px; }
.join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.join-row input { min-width: 0; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 400 1.5rem/1 "Alfa Slab One", Georgia, serif; letter-spacing: .25em; text-transform: uppercase; text-align: center; }
.join-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.join-box .or { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; color: var(--ink-3); font-size: .82rem; }
.join-box .or::before, .join-box .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.code-panel { text-align: center; display: grid; gap: 8px; justify-items: center; }
.code-panel .hint { margin: 0; color: var(--ink-3); font-size: .86rem; }
.code-lab { margin: 0; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.big-code { margin: 0; font: 400 3.2rem/1 "Alfa Slab One", Georgia, serif; letter-spacing: .18em; padding-left: .18em; color: var(--ink); }
.code-panel .big { width: auto; padding: 12px 26px; }
.lobby-rules { margin: 2px 0 0; font-size: .8rem; color: var(--ink-3); }
.lobby-seats { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "top top" "left right" "me me"; gap: 8px; }
.lseat { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; justify-items: center; text-align: center; min-width: 0; }
.lseat.top { grid-area: top; } .lseat.left { grid-area: left; } .lseat.right { grid-area: right; } .lseat.me { grid-area: me; }
.lseat small { color: var(--ink-3); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.lseat b { font: 400 1.15rem/1.2 "Alfa Slab One", Georgia, serif; overflow-wrap: anywhere; }
.lseat .lstate { font-size: .8rem; color: var(--ink-3); }
.lseat.open { border-style: dashed; }
.lseat.open b { color: var(--ink-3); font-family: inherit; font-weight: 700; font-size: 1rem; }
.lseat.taken .lstate { color: var(--ok); }
.lseat.bot .lstate { color: var(--accent); }
.lseat.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.lbtns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.lobby-msg { text-align: center; color: var(--ink-2); margin: 14px 4px 0; font-weight: 600; }
.lobby-btns { display: grid; gap: 8px; margin-top: 12px; }
.lobby-btns .ghost { justify-self: center; }
.seat.away .seat-name span { opacity: .6; }
.sit-bot { font-size: .7rem; padding: 3px 7px; }
@media (max-width: 400px) { .brand b { font-size: 1.12rem; } }
.brand { flex: none; }
.top-btns { flex: none; }
@media (max-width: 380px) { .brand b { font-size: 1rem; } .brand-card { width: 22px; height: 28px; } .top-btns .ghost { padding: 7px 8px; font-size: .9rem; } .icon-btn { width: 36px; height: 36px; } .top { gap: 6px; } }
