/* Spades Night (spades.thelabs.fyi). Same family look as Pitch Night (cream playing cards, slab headings), on a midnight
   blue table with a periwinkle accent. Partners: team 1 spades (blue), team 2 hearts (coral). Cutthroat: four colors.
   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: #0d1630; --surface: #15213f; --surface-2: #1c2a4f; --line: #2a3a63;
  --ink: #f2ecd6; --ink-2: #ccc6ae; --ink-3: #a8a38e;
  --accent: #8ea6ff; --accent-ink: #0b1430; --accent-hover: #a9bbff;
  --card: #f7f0d8; --card-edge: #d9c78c; --card-ink: #13203a; --red: #c8402f;
  --s0: #6cc4ff; --s1: #f08a76; --s2: #7ed492; --s3: #c9a3ff;
  --ok: #63c98d; --bad: #ff8a7a; --gold: #e2b53c; --nil: #c9a3ff;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f1e6; --surface: #fffdf6; --surface-2: #ece7d6; --line: #d9d2bb;
  --ink: #13203a; --ink-2: #3d4a66; --ink-3: #5a6378;
  --accent: #3a4fc4; --accent-ink: #ffffff; --accent-hover: #2d3fa3;
  --card: #fffdf6; --card-edge: #d9c78c; --card-ink: #13203a; --red: #b8382a;
  --s0: #1f6fb2; --s1: #b8382a; --s2: #2c7a3f; --s3: #6b45b0;
  --ok: #1d7a45; --bad: #b8382a; --gold: #9a6b00; --nil: #6b45b0;
  --shadow: 0 16px 34px -20px rgba(19, 32, 58, .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: 10px; padding-bottom: 20px; }
.nobr { white-space: nowrap; }

/* ---- buttons ---- */
button { font: inherit; cursor: pointer; }
.big { 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) { 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, .big svg, .ghost svg { 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); }
.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)); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; flex: 0 1 auto; }
.brand > span { 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; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--ink-3); font-size: .74rem; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-btns { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
/* phones: Rules / Games / Install become icon buttons so the title always fits */
@media (max-width: 480px) { .top-btns .ghost { font-size: 0; gap: 0; padding: 0; width: 40px; height: 40px; justify-content: center; } .top-btns .ghost svg { display: block; width: 20px; height: 20px; } .top-btns { gap: 6px; } }
@media (max-width: 360px) { .top { gap: 6px; padding-left: 10px; padding-right: 10px; } .brand b { font-size: 1rem; } .brand-card { width: 22px; height: 28px; } .top-btns .ghost, .icon-btn { width: 36px; height: 36px; } }
/* larger text (phone text size setting): fitHeader() in app.js turns the buttons into icons, then shrinks the title */
.top.tight .top-btns .ghost { font-size: 0; gap: 0; padding: 0; width: 40px; height: 40px; justify-content: center; }
.top.tight .top-btns .ghost svg { display: block; width: 20px; height: 20px; }
.top.tight .top-btns { gap: 6px; }
.top.tighter .brand b { font-size: 1rem; }
.top.tighter .brand small { font-size: .66rem; }
.top.tightest .brand-card { display: none; }
.top.tightest .brand b { font-size: .9rem; }

/* ---- 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: 14px 0 4px; }
input { font: inherit; color: var(--ink); }
.name-in { display: grid; gap: 5px; }
.name-in span, .lab { font-weight: 700; font-size: .95rem; margin: 0; }
.name-in input { width: 100%; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 1.05rem; }
.name-in input:focus, .stepper input:focus, .join-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.hint { color: var(--ink-3); font-size: .86rem; margin: 6px 0 0; }
.row-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.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 { background: var(--surface-2); }
.stepper input { width: 3.4em; text-align: center; border: 0; background: transparent; font: 400 1.3rem "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; min-width: 0; }
.rule legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.rule label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink-2); font-size: .92rem; }
.rule label b { color: var(--ink); }
.rule label:has(input:checked) { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.rule input, .vcard input { accent-color: var(--accent); width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
#setup .big[type="submit"] { margin-top: 16px; }
.err { margin: 12px 0 0; color: var(--bad); font-weight: 600; }
.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 .98rem/1.15 "Alfa Slab One", Georgia, serif; color: var(--ink); }
.modes small { font-size: .74rem; 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[data-mode="cpu"] [data-only]:not([data-only~="cpu"]), #setup[data-mode="family"] [data-only]:not([data-only~="family"]) { display: none !important; }
.join-box { margin-top: 14px; }
.join-box .lab { margin-top: 10px; }
.join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 6px; }
.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-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); }

/* the versions: a card each */
.versions { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.versions legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.vlist { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vcard { display: flex; gap: 9px; align-items: flex-start; padding: 10px 11px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--bg); min-width: 0; }
.vcard span { display: grid; gap: 2px; min-width: 0; }
.vcard b { font: 400 1rem/1.15 "Alfa Slab One", Georgia, serif; }
.vcard small { color: var(--ink-3); font-size: .78rem; line-height: 1.3; }
.vcard:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.vcard:has(input:checked) small { color: var(--ink-2); }
@media (max-width: 400px) { .vlist { grid-template-columns: 1fr; } }
.more-rules { margin-top: 16px; 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: .78rem; order: 3; flex-basis: 100%; }
.more-rules .rule:first-child { margin-top: 2px; }
.quick h2, .past h2 { font: 400 1.1rem/1.2 "Alfa Slab One", Georgia, serif; }
.qlist { margin: 10px 0 12px; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); font-size: .94rem; }
.qlist b { color: var(--ink); }
.resume { display: flex; align-items: center; gap: 12px; justify-content: space-between; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.resume-tx { display: grid; min-width: 0; }
.resume-tx small { color: var(--accent); font-weight: 750; text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; }
.resume-tx b { font: 400 1.05rem/1.2 "Alfa Slab One", Georgia, serif; overflow-wrap: anywhere; }
.resume-tx span { color: var(--ink-3); font-size: .86rem; }
.past-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.past-list li { display: grid; padding: 8px 0; border-top: 1px solid var(--line); }
.past-list li:first-child { border-top: 0; }
.past-list b { font-size: .95rem; } .past-list span { color: var(--ink-2); font-size: .88rem; } .past-list small { color: var(--ink-3); font-size: .78rem; }

/* ---- scoreboard while playing ---- */
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scores.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sc { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--sc); border-radius: 12px; padding: 6px 9px 7px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; align-items: center; }
.sc.s0 { --sc: var(--s0); } .sc.s1 { --sc: var(--s1); } .sc.s2 { --sc: var(--s2); } .sc.s3 { --sc: var(--s3); }
.sc.mine { background: color-mix(in srgb, var(--sc) 9%, var(--surface)); }
.sc.won { box-shadow: 0 0 0 2px var(--gold); }
.sc-name { margin: 0; display: flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; color: var(--ink-2); min-width: 0; }
.sc-name span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.15; overflow-wrap: anywhere; } /* long team names take two lines instead of being cut short */
.side-ic { width: 12px; height: 12px; flex: none; fill: currentColor; }
.sc .side-ic, .seat .side-ic, .ts-name .side-ic, .sheet-t th .side-ic { fill: var(--sc); }
.sc-pts { grid-row: 1 / 3; grid-column: 2; font: 400 1.75rem/1 "Alfa Slab One", Georgia, serif; font-variant-numeric: tabular-nums; }
.sc-row { margin: 3px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.bags { display: inline-flex; align-items: center; gap: 2px; color: var(--ink-3); font-size: .72rem; font-weight: 700; }
.bags i { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.bags i.on { background: var(--gold); }
.bags svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.sc-hand { font-size: .72rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.scores.n4 .sc { grid-template-columns: minmax(0, 1fr); padding: 5px 6px 6px; }
.scores.n4 .sc-pts { grid-row: auto; grid-column: auto; font-size: 1.25rem; margin-top: 2px; }
.scores.n4 .sc-name { font-size: .72rem; }
.scores.n4 .bags i { width: 4px; height: 4px; }
.scores.n4 .sc-hand { font-size: .66rem; }

/* ---- the table ---- */
.table { --cw: 54px; margin-top: 10px; display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; 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.s0 { --sc: var(--s0); } .seat.s1 { --sc: var(--s1); } .seat.s2 { --sc: var(--s2); } .seat.s3 { --sc: var(--s3); }
.seat.top { grid-area: top; min-height: 112px; }
.seat.left { grid-area: left; align-self: stretch; align-content: center; }
.seat.right { grid-area: right; align-self: stretch; align-content: center; }
.seat.me { grid-area: me; min-height: 120px; grid-template-columns: minmax(0, 1fr); } /* the hand never makes the column (and the page) wider than the screen */
.seat-name { margin: 0; display: flex; align-items: center; gap: 4px; font-weight: 750; font-size: .84rem; max-width: 100%; min-height: 24px; flex-wrap: wrap; justify-content: center; row-gap: 2px; }
.seat-name > span:not(.chip-d):not(.bubble):not(.took) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.seat.turn .seat-name > span:first-of-type { color: var(--accent); }
.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); }
.bubble, .took { 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.nil { border-color: var(--nil); color: var(--nil); }
.bubble.empty, .took.empty { visibility: hidden; }
.took { background: transparent; }
.took.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.took.nil { color: var(--nil); border-color: color-mix(in srgb, var(--nil) 50%, var(--line)); }
.took.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.bubble.mine, .took.mine { margin-left: 2px; }
.seat.left .bubble, .seat.right .bubble, .seat.left .took, .seat.right .took { white-space: normal; text-align: center; max-width: 100%; line-height: 1.15; border-radius: 10px; }
.seat.away .seat-name span { opacity: .6; }
.sit-bot { font-size: .7rem; padding: 3px 7px; }
.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)); } }

/* 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.back { background: repeating-linear-gradient(45deg, #2c4a8f 0 4px, #243e78 4px 8px); border-color: #e9dfbd; box-shadow: inset 0 0 0 2px #182a55, 0 1px 3px rgba(0, 0, 0, .3); }
.card.mini { --cw: 26px; border-radius: 4px; border-width: 1px; }
.backs { display: flex; justify-content: center; min-height: 32px; align-items: center; }
.backs .card { --cw: 22px; border-radius: 3px; border-width: 1px; }
.backs .card + .card { margin-left: -16px; }
.seat.left .backs .card + .card, .seat.right .backs .card + .card { margin-left: -18px; }
.deal-in { animation: dealIn .32s calc(var(--i, 0) * 40ms) 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: 220px; border-radius: 22px; background: radial-gradient(circle at 50% 40%, #27508f, #172f5c 72%); border: 3px solid #0f1f42; box-shadow: inset 0 0 30px rgba(0, 0, 0, .35); overflow: hidden;
  --s0: #7dccff; --s1: #ff9c88; --s2: #8fe0a2; --s3: #d4b3ff; }
:root[data-theme="light"] .felt { background: radial-gradient(circle at 50% 40%, #3563ad, #234886 72%); border-color: #1a3566; }
.felt-top { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 6px; z-index: 5; } /* narrow table: the trick count goes under, never clipped */
.broken { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .28); color: #b9c6e6; padding: 3px 8px 3px 6px; border-radius: 999px; font-size: .68rem; font-weight: 750; }
.broken svg { width: 13px; height: 13px; fill: #6d7ea6; }
.broken.on { color: #fff6d8; } .broken.on svg { fill: #fff6d8; }
.felt-bid { font-size: .7rem; font-weight: 700; color: #e6ecfa; background: rgba(0, 0, 0, .28); padding: 3px 8px; border-radius: 999px; margin-left: auto; white-space: nowrap; }
.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.s0 { --tc: var(--s0); } .trick .card.s1 { --tc: var(--s1); } .trick .card.s2 { --tc: var(--s2); } .trick .card.s3 { --tc: var(--s3); }
.trick .card.caught, .trick .card.winner { box-shadow: 0 0 0 3px var(--tc, var(--gold)), 0 4px 12px rgba(0, 0, 0, .4); z-index: 1; }
.trick .took-msg { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: .72rem; font-weight: 800; color: #fff6d8; background: rgba(0, 0, 0, .4); padding: 2px 8px; border-radius: 10px; max-width: calc(100% - 92px); text-align: center; line-height: 1.2; z-index: 2; border: 1.5px solid var(--tc, transparent); }
.trick .took-msg.s0 { --tc: var(--s0); } .trick .took-msg.s1 { --tc: var(--s1); } .trick .took-msg.s2 { --tc: var(--s2); } .trick .took-msg.s3 { --tc: var(--s3); }
.trick .caught-msg { font-weight: 700; }
.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; }
.snd-btn { position: absolute; right: 8px; bottom: 8px; z-index: 3; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .3); color: #e6ecfa; cursor: pointer; }
.snd-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.snd-btn[aria-pressed="false"] { color: #94a3c6; }
.snd-btn:hover { background: rgba(0, 0, 0, .45); }
.snd-btn.rk-btn { right: auto; left: 8px; }

/* your hand: 13 cards overlap with the rank and suit in the corner, like holding them */
.myhand { display: flex; justify-content: center; width: 100%; padding: 12px 0 2px; --cw: 56px; min-height: calc(var(--cw) * 1.42 + 14px); align-items: flex-end; }
.myhand .card { flex: none; cursor: default; transition: transform .15s, opacity .15s, box-shadow .15s; }
.myhand .card + .card { margin-left: var(--gap, 5px); } /* --gap: fitHand() in game/table.js overlaps the cards when they don't fit */
.myhand.stacked .card:not(.back) { place-items: start; justify-items: start; align-content: start; padding: 5px 0 0 3px; gap: 2px; }
.myhand.stacked .card b, .myhand.stacked .card i { font-size: calc(var(--cw) * .31); }
.myhand.stacked .card b { letter-spacing: -.06em; }
.myhand.stacked .card.joker i { font-size: calc(var(--cw) * .15); writing-mode: vertical-rl; letter-spacing: .06em; }
.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:disabled { opacity: 1; filter: brightness(.6) saturate(.6); }
.myhand .card:disabled { opacity: 1; }
.card.hint, .bidbtn.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; min-height: 132px; align-content: center; }
.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; }
.tsay.hint-why, .tsay.ready-say { margin: 0; color: var(--ink-2); font-size: .88rem; }
.bidrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.bidbtn { min-width: 0; height: 46px; padding: 0; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 400 1.15rem "Alfa Slab One", Georgia, serif; touch-action: manipulation; }
.bidbtn:hover { border-color: var(--accent); }
.bidbtn.nilbtn { grid-column: span 2; font: 800 1rem "Inter", sans-serif; color: var(--nil); border-color: color-mix(in srgb, var(--nil) 55%, var(--line)); }
.bidbtn.sent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.blind-btn { background: var(--nil); color: #1c0f33; box-shadow: none; }
.blind-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--nil) 85%, #fff); }
.blind-btn.sent { opacity: .7; }
.look-btn { display: inline-flex; align-items: center; gap: 7px; }
.auto-pick { padding: 8px 14px; }
.deal-now { justify-self: center; }
#table button { touch-action: manipulation; }
.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); }
.tsum { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tsum li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--bg); border-left: 3px solid var(--sc); }
.tsum li.s0 { --sc: var(--s0); } .tsum li.s1 { --sc: var(--s1); } .tsum li.s2 { --sc: var(--s2); } .tsum li.s3 { --sc: var(--s3); }
.ts-name { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: .9rem; min-width: 0; }
.ts-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-how { grid-column: 1; color: var(--ink-3); font-size: .8rem; }
.ts-pts { grid-row: 1 / 3; grid-column: 2; align-self: center; font: 400 1.25rem "Alfa Slab One", Georgia, serif; color: var(--ok); }
.ts-pts.neg { color: var(--bad); }
@media (max-width: 380px) { .table { --cw: 50px; grid-template-columns: 60px minmax(0, 1fr) 60px; } .myhand { --cw: 48px; } .bidrow { grid-template-columns: repeat(5, minmax(0, 1fr)); } .bidbtn.nilbtn { grid-column: span 2; } }
@media (prefers-reduced-motion: reduce) { .deal-in, .trick .card, .seat.turn:not(.me) .backs { animation: none !important; transition: none; } }

/* the winner and the score sheet */
.winner { margin-top: 12px; padding: 16px; border-radius: 16px; background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1.5px solid var(--gold); text-align: center; display: grid; gap: 10px; justify-items: center; }
.winner.lost { background: var(--surface); border-color: var(--line); }
.win-ic { width: 40px; height: 40px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.win-line { margin: 0; font: 400 1.15rem/1.3 "Alfa Slab One", Georgia, serif; }
.win-btns { display: grid; grid-template-columns: 1fr auto; gap: 8px; width: 100%; }
.sheet summary { cursor: pointer; font-weight: 750; list-style: none; display: flex; align-items: baseline; gap: 8px; }
.sheet summary::-webkit-details-marker { display: none; }
.sheet summary::after { content: "+"; margin-left: auto; color: var(--ink-3); font-size: 1.2rem; }
.sheet[open] summary::after { content: "−"; }
.sheet summary small { color: var(--ink-3); font-weight: 600; font-size: .8rem; }
.sheet-wrap { margin-top: 10px; overflow-x: auto; }
.sheet .empty { color: var(--ink-3); margin: 0; font-size: .9rem; }
.sheet-t { width: 100%; border-collapse: collapse; font-size: .84rem; }
.sheet-t th, .sheet-t td { padding: 7px 6px; border-top: 1px solid var(--line); vertical-align: top; text-align: left; }
.sheet-t thead th { border-top: 0; color: var(--ink-2); font-size: .78rem; }
.sheet-t thead th span { margin-left: 4px; }
.sheet-t thead th.s0 { --sc: var(--s0); } .sheet-t thead th.s1 { --sc: var(--s1); } .sheet-t thead th.s2 { --sc: var(--s2); } .sheet-t thead th.s3 { --sc: var(--s3); }
.sheet-t tbody th { color: var(--ink-3); font-weight: 700; width: 1.6em; }
.sheet-t td span { display: block; }
.sh-bid { color: var(--ink-2); }
.sh-note { color: var(--ink-3); font-size: .76rem; }
.sh-note.bad { color: var(--bad); }
.sh-pts b { font-weight: 800; }
.sh-pts span { display: inline !important; color: var(--ink-3); }
.play-foot { text-align: center; margin-top: 12px; }

/* card order sheet */
.ranks { border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(94vw, 460px); max-height: min(88vh, 820px); background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7); overflow: auto; }
.ranks::backdrop { background: rgba(6, 12, 28, .62); backdrop-filter: blur(3px); }
.rk-body { padding: 18px 16px 6px; }
.rk-body h2 { font: 400 1.3rem/1.2 "Alfa Slab One", Georgia, serif; margin: 0 0 4px; }
.rk-body p { margin: 0 0 10px; color: var(--ink-2); font-size: .92rem; }
.rk-order { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.rk-o { display: grid; justify-items: center; gap: 2px; }
.rk-o .card.mini { --cw: 34px; border-radius: 5px; }
.rk-o small { font-size: .68rem; color: var(--ink-3); font-weight: 700; }
.rk-close { display: block; width: calc(100% - 32px); margin: 12px 16px 16px; position: sticky; bottom: 12px; }

/* ---- friends & family ---- */
.code-panel { text-align: center; display: grid; gap: 8px; justify-items: center; }
.code-panel .hint { margin: 0; }
.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; }

/* ---- rules page ---- */
.rules-text h2 { font: 400 1.15rem/1.2 "Alfa Slab One", Georgia, serif; margin: 18px 0 6px; }
.rules-text h2:first-child { margin-top: 0; }
.rules-text p, .rules-text li { color: var(--ink-2); }
.rules-text p { margin: 0 0 8px; }
.rules-text ul { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 5px; }
.rules-text .small { font-size: .82rem; color: var(--ink-3); margin-top: 14px; }
.back-btn { margin-top: 12px; }

/* ---- pop-ups ---- */
.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, 12, 28, .62); backdrop-filter: blur(3px); }
.dlg[open], .ranks[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-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: #2a0d08; }
:root[data-theme="light"] .dlg.danger .dlg-btns .big { color: #fff; }
@media (prefers-reduced-motion: reduce) { .dlg[open], .ranks[open] { animation: none; } }

/* ---- footer ---- */
.foot { padding-top: 6px; padding-bottom: 22px; text-align: center; color: var(--ink-3); font-size: .82rem; }
.foot p { margin: 4px 0; }
.foot .more-games { font-weight: 650; color: var(--ink-2); margin-bottom: 10px; }
.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); white-space: nowrap; }
.foot .coffee svg { width: 18px; height: 18px; flex: none; fill: none; stroke: #e0a92e; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* hand over: no empty space where the cards were */
.table.phase-done .seat.me { min-height: 0; }
.table.phase-done .myhand { min-height: 0; padding: 0; }
.table.phase-done .seat.top { min-height: 0; }
.table.phase-done .backs { min-height: 0; }

/* hint text in empty boxes (2026-10-19): the box's own text color, faded and italic, so it never looks filled in */
::placeholder { color: currentColor; opacity: .5; font-style: italic; font-weight: 400; letter-spacing: normal; text-transform: none; }

/* "Version 1.0.1" stays on one line */
.ver { white-space: nowrap; }

/* link to the KEG Press daily word search after a game (2026-11-20) */
.kp-link { margin: 16px 0 0; text-align: center; font-size: .95rem; }
.kp-link a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
