/* Skull King. Palette from the Board & Card Games hub. */
:root {
  --bg: #0f1117; --bg-soft: #161923; --card: #1a1e2b; --card-hover: #212636; --line: #2a3042;
  --text: #e8eaf0; --muted: #969db4; --accent: #6ea8fe; --gold: #f0b354;
  --good: #6ee7a8; --bad: #f08c8c; --sea: #10283a; --sea2: #0c1d2b;
  --radius: 12px; --tabh: 58px; --toph: 48px;
  --cw: 52px; --ch: 73px; /* card size in hand */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; }
input, select { font: inherit; font-size: 16px; color: var(--text); }
svg { display: block; }

/* ------------------------------------------------------------------ shell */
.app {
  height: 100dvh; display: grid;
  grid-template-rows: calc(var(--toph) + env(safe-area-inset-top)) 1fr calc(var(--tabh) + env(safe-area-inset-bottom));
  grid-template-areas: "top" "main" "tabs";
}
.top {
  grid-area: top; display: flex; align-items: center; justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 0; border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .01em; font-size: 17px; }
.brand-mark { width: 26px; height: 26px; display: inline-block; }
.brand-mark svg { width: 26px; height: 26px; border-radius: 6px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
main { grid-area: main; position: relative; overflow: hidden; min-height: 0; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; overflow: hidden; padding: 10px 16px 10px; }
.view.on { display: flex; }
.tabs {
  grid-area: tabs; display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); background: #12151d; padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer; transition: color .15s;
}
.tabs button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--gold); }
.tabs button:active { transform: scale(.96); }

@media (min-width: 900px) {
  :root { --cw: 64px; --ch: 90px; }
  .app { grid-template-columns: 210px 1fr; grid-template-rows: 56px 1fr; grid-template-areas: "top top" "tabs main"; }
  .top { padding: 0 24px; align-items: center; }
  .tabs { grid-template-columns: none; grid-auto-rows: 52px; align-content: start; border-top: 0; border-right: 1px solid var(--line); padding: 14px 10px; gap: 4px; background: var(--bg); }
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; border-radius: 10px; font-size: 15px; }
  .tabs button.on { background: var(--card); }
  .tabs button:hover { color: var(--text); }
  .view { padding: 18px 28px; }
}

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 0 16px; height: 44px; cursor: pointer; font-weight: 650;
  transition: background .12s, border-color .12s, transform .06s; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1d1405; }
.btn.blue { background: var(--accent); border-color: var(--accent); color: #0d1424; }
.btn.ghost { background: transparent; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn.wide { width: 100%; }
@media (hover: hover) { .btn:hover:not(:disabled) { border-color: #3a4258; } .btn.primary:hover:not(:disabled) { background: #f5c06c; } }

.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 7px; height: 32px; padding: 0 10px; font-size: 13.5px; font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card-hover); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.seg .note { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); line-height: 1.1; }

.step { display: inline-flex; align-items: center; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; height: 40px; }
.step button { width: 38px; height: 38px; border: 0; background: none; font-size: 21px; font-weight: 600; cursor: pointer; color: var(--text); border-radius: 9px; }
.step button:active { background: var(--card-hover); }
.step button:disabled { opacity: .25; }
.step .val { min-width: 28px; text-align: center; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.step.sm { height: 40px; } .step.sm button { width: 34px; height: 38px; font-size: 19px; } .step.sm .val { min-width: 22px; font-size: 16.5px; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #39405a; border-radius: 15px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }

.q { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #4a5270; color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; background: none; padding: 0; flex: none; vertical-align: middle; }
.q:active { background: var(--card-hover); }
.muted { color: var(--muted); }
.lbl { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 750; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; scrollbar-width: thin; scrollbar-color: #2f3650 transparent; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 14px; }
input[type=text] { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; height: 44px; padding: 0 12px; width: 100%; }
input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
select { -webkit-appearance: none; appearance: none; background: var(--bg-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23969db4' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; border: 1px solid var(--line); border-radius: 10px; height: 40px; padding: 0 32px 0 12px; color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; text-overflow: ellipsis; }
select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ------------------------------------------------------------------ cards */
.cardf { width: var(--cw); height: var(--ch); border-radius: 7px; flex: none; position: relative; user-select: none; -webkit-user-select: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.45); transition: transform .16s ease, box-shadow .16s, opacity .16s; }
.cardf svg { width: 100%; height: 100%; border-radius: 7px; }
.cardf.sm { width: 38px; height: 53px; border-radius: 5px; }
.cardf.xs { width: 30px; height: 42px; border-radius: 4px; }
.cardf.fallback { background: #f4efe2; color: #111; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; text-align: center; }
.cardf.dim { opacity: .38; }
.cardf.can { cursor: pointer; }
.cardf.sel { transform: translateY(-10px); box-shadow: 0 0 0 2px var(--gold), 0 10px 18px rgba(0,0,0,.5); }
.cardf.best { box-shadow: 0 0 0 2px var(--good), 0 6px 14px rgba(0,0,0,.5); }
.cardf .badge { position: absolute; left: 50%; bottom: -15px; transform: translateX(-50%); font-size: 10.5px; font-weight: 800; padding: 0 4px; border-radius: 6px; background: #0b0d13; border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
@keyframes dealIn { from { transform: translateY(24px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dropIn { from { transform: translateY(var(--from, 40px)) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.cardf.deal { animation: dealIn .28s ease-out both; }
.cardf.drop { animation: dropIn .26s ease-out both; }
@media (prefers-reduced-motion: reduce) { .cardf.deal, .cardf.drop { animation: none; } }

/* ------------------------------------------------------------------ sheets */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(4,6,10,.62); display: flex; align-items: flex-end; justify-content: center; }
.sheet-back[hidden] { display: none; }
.sheet { width: 100%; max-height: 86dvh; background: var(--card); border-top-left-radius: 18px; border-top-right-radius: 18px; border: 1px solid var(--line);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0; font-size: 17px; }
.sheet .acts { display: flex; gap: 10px; justify-content: space-between; }
.sheet .acts .btn { flex: 1; }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { width: 460px; border-radius: 16px; } }
.pop { position: fixed; z-index: 60; max-width: 290px; background: #232838; border: 1px solid #3a4258; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.pop[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; background: #232838; border: 1px solid #3a4258; border-radius: 10px; padding: 9px 14px; font-size: 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.toast button { background: none; border: 0; color: var(--gold); font-weight: 750; cursor: pointer; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ------------------------------------------------------------------ score */
.sc { display: grid; gap: 14px; min-height: 0; flex: 1; grid-template-rows: auto 1fr auto; }
.sc-head { display: flex; align-items: center; gap: 8px; }
.sc-round { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.sc-round .r { font-weight: 800; font-size: 17px; white-space: nowrap; }
.sc-round .c { color: var(--muted); font-size: 13px; white-space: nowrap; }
.navb { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-soft); cursor: pointer; font-size: 18px; font-weight: 700; }
.navb { width: 40px; height: 40px; }
.navb:disabled { opacity: .35; }
.sc-rows { display: flex; flex-direction: column; gap: 6px; }
.sc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 50px 50px; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 0 10px; height: 50px; flex: none; }
.sc-row.tr { grid-template-columns: minmax(0, 1fr) auto 46px 46px 50px; }
.sc-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-name small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.sc-pts { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
.sc-tot { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.sc-tot.lead { color: var(--gold); }
.bonus-chip { height: 40px; border-radius: 8px; border: 1px dashed #4a5270; background: none; color: var(--muted); font-weight: 750; font-size: 13px; cursor: pointer; padding: 0; }
.bonus-chip.has { border-style: solid; border-color: var(--gold); color: var(--gold); }
.sc-foot { display: flex; align-items: center; gap: 12px; }
.sc-foot .info { flex: 1; font-size: 13.5px; color: var(--muted); min-width: 0; }
.sc-foot .info b { color: var(--text); }
.sc-foot .info b.neg { color: var(--bad); }
.sc-cols { display: grid; gap: 22px; min-height: 0; flex: 1; }
.sc-hdr { display: grid; grid-template-columns: minmax(0, 1fr) auto 50px 50px; gap: 8px; padding: 0 10px; font-size: 10.5px; }
.sc-hdr.tr { grid-template-columns: minmax(0, 1fr) auto 46px 46px 50px; }
.sc-hdr span { text-align: right; } .sc-hdr span:first-child { text-align: left; }
.sc-hdr .c2 { text-align: center; width: 104px; }
@media (min-width: 900px) { .sc-cols { grid-template-columns: minmax(380px, 520px) 1fr; } }
/* very narrow phones (320 px): the name gets its own line so it never shrinks to "…" */
@media (max-width: 360px) {
  .sc-row, .sc-row.tr { grid-template-columns: 104px minmax(0, 1fr) 50px; height: auto; padding: 5px 10px 6px; row-gap: 3px; }
  .sc-row.tr { grid-template-columns: 104px 46px minmax(0, 1fr) 50px; }
  .sc-row .sc-name { grid-column: 1 / -1; }
  .sc-row .sc-name small { display: inline; margin-left: 6px; }
  .sc-hdr, .sc-hdr.tr { grid-template-columns: 104px minmax(0, 1fr) 50px; }
  .sc-hdr.tr { grid-template-columns: 104px 46px minmax(0, 1fr) 50px; }
  .sc-hdr span:first-child { display: none; }
  .sc-hdr .c2 { text-align: center; }
  /* keep the whole sheet inside the screen: Total column and the Bids/Tricks switch were cut off */
  .sc-cols { grid-template-columns: minmax(0, 1fr); }
  .sc-head .seg { width: 124px !important; }
  .sc-round { flex-wrap: wrap; row-gap: 0; }
}
.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.grid-table th, .grid-table td { padding: 6px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid-table th:first-child, .grid-table td:first-child { text-align: left; color: var(--muted); }
.grid-table thead th { position: sticky; top: 0; background: var(--bg); font-size: 12px; color: var(--muted); font-weight: 700; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.grid-table tfoot td { font-weight: 800; color: var(--text); border-top: 2px solid var(--line); }
.grid-table td.cur { background: rgba(240,179,84,.08); }
.grid-table .bt { color: var(--muted); font-size: 11px; margin-right: 4px; }
.rt-wrap { overflow-x: auto; max-width: 100%; }
/* 6+ players: bid/won sits above the points in each cell so every column fits without scrolling */
.rt-wrap.many .grid-table, .grid-table.stack { font-size: 12px; }
.rt-wrap.many .grid-table th, .rt-wrap.many .grid-table td, .grid-table.stack th, .grid-table.stack td { padding: 3px 2px; }
.rt-wrap.many .grid-table td .bt, .grid-table.stack td .bt { display: block; margin: 0; font-size: 11.5px; line-height: 1.2; }
.grid-table.stack td:first-child .bt { display: none; }
@media (max-width: 360px) { .grid-table.stack { font-size: 11.5px; } .grid-table.stack thead th { font-size: 11px; max-width: 32px; } .grid-table.stack th, .grid-table.stack td { padding: 3px 1px; } }
.setup-list { display: flex; flex-direction: column; gap: 8px; }
.setup-row { display: flex; gap: 8px; align-items: center; }
.setup-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.xbtn { width: 40px; height: 44px; border: 1px solid var(--line); background: var(--bg-soft); border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 18px; flex: none; }
.banner { background: linear-gradient(135deg, rgba(240,179,84,.18), rgba(110,168,254,.12)); border: 1px solid var(--gold); border-radius: var(--radius); padding: 14px; text-align: center; }
.banner h2 { margin: 0 0 2px; font-size: 21px; }
.banner p { margin: 0; color: var(--muted); font-size: 13.5px; }
.bonus-list { display: flex; flex-direction: column; gap: 8px; }
.bonus-row { display: flex; align-items: center; gap: 10px; }
.bonus-row .t { flex: 1; font-size: 14px; }
.bonus-row .t small { color: var(--muted); display: block; font-size: 11.5px; }

/* --------------------------------------------------------------- advisor */
.adv { display: grid; gap: 10px; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; }
.adv-ctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.adv-ctl .cell { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.adv-ctl .cell .lbl { font-size: 10px; min-height: 18px; display: flex; align-items: center; gap: 4px; }
.adv-hand-row { display: flex; gap: 8px; align-items: center; min-width: 0; min-height: 53px; }
.adv-hand-row .btn { flex: none; }
/* up to 13 cards in one row, more wrap to a second row; cards shrink to fit */
.adv-hand { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 30px)); gap: 4px; align-content: center; }
.adv-hand.two { grid-template-columns: repeat(13, minmax(0, 30px)); }
.adv-hand .slot, .adv-hand .cardf { width: 100%; height: auto; aspect-ratio: 30 / 42; }
.adv-hand .slot { border-radius: 4px; border: 1px dashed #3a4258; }
.adv-hand .cardf { cursor: pointer; }
.picker { display: flex; flex-direction: column; gap: 6px; }
.pk-grid { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; }
.pk-sp { display: flex; flex-wrap: wrap; gap: 5px; }
.pk-sp .pk { flex: 1 1 auto; padding: 0 8px; }
.pk { height: 36px; border-radius: 5px; border: 1px solid transparent; font-size: 12.5px; font-weight: 800; cursor: pointer; padding: 0; position: relative; font-variant-numeric: tabular-nums; }
.pk.on { outline: 2px solid var(--gold); outline-offset: 1px; }
.pk:disabled { opacity: .3; cursor: default; }
.pk-special { font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 4px; background: #2a3042; color: var(--text); white-space: nowrap; }
.pk .cnt { position: absolute; top: -6px; right: -4px; background: var(--gold); color: #1d1405; border-radius: 8px; font-size: 10px; padding: 0 4px; line-height: 14px; }
.chart { display: flex; flex-direction: column; min-height: 0; }
.bars { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; overflow-x: auto; gap: 4px; align-items: end; min-height: 90px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; cursor: default; }
.bar .pct { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar .fill { width: 100%; max-width: 40px; border-radius: 5px 5px 2px 2px; background: #33405e; transition: height .3s ease; min-height: 2px; }
.bar.best .fill { background: var(--gold); }
.bar .b { font-size: 13px; font-weight: 800; }
.bar .ev { font-size: 10.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
.verdict { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.verdict .big { font-size: 22px; font-weight: 850; color: var(--gold); }
@media (min-width: 900px) {
  .adv { grid-template-columns: minmax(420px, 1fr) minmax(360px, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 28px; align-content: start; }
  .adv-ctl, .adv-hand-row, .picker { grid-column: 1; }
  .chart { grid-column: 2; grid-row: 2 / -1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; max-height: 560px; }
  .odds-table { max-width: 820px; }
  .pk { height: 38px; font-size: 14px; }
  .adv-hand-row { min-height: 70px; } .adv-hand { grid-template-columns: repeat(10, minmax(0, 46px)); } .adv-hand.two { grid-template-columns: repeat(13, minmax(0, 46px)); }
}
.odds-table { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.odds-table th, .odds-table td { padding: 4px 3px; text-align: center; }
.odds-table th:first-child, .odds-table td:first-child { text-align: left; white-space: nowrap; }
.odds-table td.h { border-radius: 4px; font-weight: 750; color: #0b0d13; }

/* ------------------------------------------------------------------ play: the table from your seat
   Surfaces, card backs, decks, seats and tokens come from css/table.css (shared kit). */
#v-play { padding: 8px 8px 6px; }
.pl { display: grid; gap: 8px; flex: 1; min-height: 0; grid-template-rows: 1fr; grid-template-columns: minmax(0, 1fr); --tw: 60px; --hw: 76px; --msgh: 42px; --bw: 22px; --mw: 12px; }
.table { display: grid; grid-template-rows: auto 1fr auto auto; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; border-radius: 18px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.55), inset 0 0 0 3px rgba(255,214,150,.07), inset 0 0 40px rgba(0,0,0,.45), 0 4px 18px rgba(0,0,0,.5); }
.table .tbl-back.sk-back { background: var(--skback) center / 100% 100% no-repeat; border: 0; border-radius: calc(var(--card-w) * .08);
  box-shadow: var(--tbl-stack, 0 1px 1px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.3)); }
.table .tbl-back.sk-back::after { border-radius: inherit; }
/* our SVG faces already draw the card edge: the kit adds the paper sheen and shadow */
.table .cardf.tbl-card { --ratio: 5 / 7; width: var(--card-w); height: auto; opacity: 1; background: none; border: 0; border-radius: calc(var(--card-w) * .08); }
.table .cardf.tbl-card svg { border-radius: inherit; }

/* opponents round the far side */
.opps.tbl-seats { gap: 4px; padding: 6px 6px 0; align-items: flex-start; }
.table .tbl-plate { display: flex; align-items: center; gap: 4px; padding: 2px 7px; font-size: 12px; line-height: 17px; min-width: 0; max-width: 100%; }
.tbl-plate .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.tbl-plate .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tbl-plate .num { font-variant-numeric: tabular-nums; color: #f3d48a; margin-left: 2px; }
.mine.is-turn .tbl-plate { border-color: #f0c35a; box-shadow: 0 0 0 2px rgba(240,195,90,.45), 0 2px 4px rgba(0,0,0,.4); }
.seatbox.ghost .tbl-plate { opacity: .75; }
.held { width: 100%; min-width: 0; display: flex; justify-content: center; min-height: 6px; }
.ofan { --card-w: var(--bw); width: min(100%, calc(var(--bw) * 4.2)); }
.gpile { --card-w: calc(var(--bw) + 4px); margin: 4px 0 2px; }
.lay { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 22px; }
.won { display: inline-flex; align-items: center; padding: 0 2px; position: relative; }
.won > .tbl-card { --card-w: var(--mw); flex: none; rotate: -4deg; }
.won > .tbl-card + .tbl-card { margin-left: calc(var(--mw) * -.86); }
.won > .tbl-card:nth-of-type(even) { rotate: 3deg; translate: 0 1px; }
/* the count is written on the face-down pile itself (not a token, so it never reads as part of the bid) */
.won .wn { position: absolute; inset: 0 0 0 2px; z-index: 1; display: grid; place-items: center; font: 800 12px/1 system-ui, sans-serif; color: #fff;
  text-shadow: 0 0 2px #000, 0 0 3px #000, 0 1px 1px #000; font-variant-numeric: tabular-nums; pointer-events: none; }
.won[data-won="0"] { display: none; }
.bidtok { --tok-size: 24px; position: relative; font-size: calc(var(--tok-size) * .5); }
.bidtok.nobid { color: transparent; opacity: .55; }
.bidtok .cb { position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #777, #111 70%); box-shadow: 0 1px 2px rgba(0,0,0,.6); }
.table.many .opps .tbl-plate { flex-direction: column; gap: 0; padding: 1px 4px; font-size: 10.5px; line-height: 13px; }
.table.many .opps .tbl-plate { align-items: stretch; text-align: center; }
.table.many .opps .tbl-plate .dot { display: none; }
.table.many .opps .tbl-plate .num { margin: 0; }
.table.many { --bw: 14px; --mw: 13px; --tw: 44px; }
.table.many .opps .bidtok { --tok-size: 24px; }
.table.many .opps .lay { gap: 6px; }

/* the middle: the trick, each card in front of whoever played it */
.mid { position: relative; min-height: 0; }
.mid .msg { position: absolute; left: 50px; right: 50px; top: 4px; z-index: 3; text-align: center; font-size: 14px; font-weight: 750; line-height: 1.2; color: #f6ecd6; text-shadow: 0 1px 2px rgba(0,0,0,.7); pointer-events: none; }
.mid .msg small { display: block; font-weight: 500; font-size: 12.5px; color: #e2cfa6; margin-top: 1px; }
.mid.bidding .msg { top: 50%; transform: translateY(-50%); font-size: 17px; }
.mid.bidding .msg small { font-size: 13.5px; }
.trick { position: absolute; inset: 0; z-index: 2; pointer-events: none; } /* trick cards aren't tapped; the score pad under this layer must stay tappable */
.tcard { position: absolute; left: var(--ax); top: calc(var(--msgh) + (100% - var(--msgh)) * var(--ay) / 100); width: var(--tw); --card-w: var(--tw);
  transform: translate(-50%, -50%) translate(var(--jx, 0), var(--jy, 0)) rotate(var(--r, 0deg)); }
.tcard .cardf { width: 100%; }
.tcard.win .cardf { box-shadow: 0 0 0 2px #f0c35a, 0 0 18px rgba(240,195,90,.6), 0 8px 14px rgba(0,0,0,.45); transform: translateY(-4px) scale(1.04); }
.tcard .as { position: absolute; left: 50%; bottom: -15px; transform: translateX(-50%); font-size: 10px; font-weight: 750; padding: 0 5px; border-radius: 6px; background: rgba(20,12,4,.8); color: #f3e6c8; white-space: nowrap; }
.deckspot { position: absolute; left: 12px; bottom: 12px; z-index: 1; --card-w: 34px; }
.pad { position: absolute; right: 10px; bottom: 8px; z-index: 1; width: 40px; height: 50px; padding: 0; border: 0; border-radius: 3px; cursor: pointer;
  background: repeating-linear-gradient(#f4ecd8 0 7px, #9fb6c9 7px 8px) 0 12px / 100% calc(100% - 12px) no-repeat, #f4ecd8;
  box-shadow: inset 0 9px 0 #7a2a22, inset 0 10px 0 rgba(0,0,0,.25), 1px 2px 0 #d8cfb9, 2px 4px 0 #c2b89f, 3px 6px 8px rgba(0,0,0,.45); }
.pad i { position: absolute; left: 7px; right: 7px; top: 16px; bottom: 7px; background: linear-gradient(90deg, transparent 45%, rgba(122,42,34,.55) 45% 50%, transparent 50%); }
.pad:active { scale: .96; }

/* actions and your place */
.actions-wrap { position: relative; z-index: 3; padding: 0 8px 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 44px; align-items: center; }
.actions .muted { color: #e2cfa6; }
.bidpad { display: grid; grid-template-columns: repeat(var(--bn, 6), minmax(0, 60px)); justify-content: center; gap: 6px; width: 100%; }
.bidpad .btn { padding: 0; height: 44px; font-size: 18px; font-weight: 800; }
.bidpad .btn.hint { box-shadow: 0 0 0 2px var(--good); border-color: var(--good); }
.mine { position: relative; z-index: 2; padding: 0 6px 8px; }
.mine > .lay { gap: 8px; min-height: 26px; }
.hand { --card-w: var(--hw); margin: 2px 0 0; }
.hand.badges { margin-top: 16px; }
/* big hand on a narrow screen: two overlapping fans, the back row shows its top 46px */
.hand.two { display: flex; flex-direction: column; }
.hand.two .hrow.front { margin-top: calc(26px - var(--hw) * 1.4); }
.hand.two .hrow.front .cardf .badge { top: auto; bottom: 3px; }
.hand .cardf { cursor: default; }
.hand .cardf.can { cursor: pointer; }
.hand .cardf.dim { filter: saturate(.35) brightness(.62); }
.hand .cardf.best { box-shadow: 0 0 0 2px var(--good), 0 8px 16px rgba(0,0,0,.5); }
.hand .cardf.sel { box-shadow: 0 0 0 2px #f0c35a, 0 12px 22px rgba(0,0,0,.5); }
@media (hover: hover) { .hand .cardf.can:hover:not(.is-up) { --up: 9px; } }
.hand .cardf .badge { position: absolute; left: 1px; top: -17px; bottom: auto; transform: none; font-size: 10.5px; font-weight: 800; padding: 0 4px; border-radius: 6px; background: rgba(12,8,4,.88); border: 1px solid rgba(255,220,160,.25); white-space: nowrap; font-variant-numeric: tabular-nums; }
.study { font-size: 13px; color: #e2cfa6; text-align: center; min-height: 18px; }
.study b { color: #fff6e2; }
.pl-side { display: none; }
.padsheet { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; max-height: 64dvh; }

/* physical motion: dealt from the deck and turned over; opponents' cards turn face up as they land */
@keyframes dealFly { 0% { translate: var(--dx, 0) var(--dy, 60px); scale: .55 .55; } 48% { scale: .03 .8; } 100% { translate: 0 0; scale: 1 1; } }
@keyframes backOff { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes turnUp { 0% { scale: 1 1; } 48% { scale: .03 1; } 100% { scale: 1 1; } }
.hand .cardf.deal { animation: dealFly .52s cubic-bezier(.3,.7,.3,1) both; }
.hand .cardf.deal::before, .tcard.turnin .cardf::before { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; background: var(--skback) center / 100% 100% no-repeat; animation: backOff .52s linear both; animation-delay: inherit; pointer-events: none; }
.tcard.turnin .cardf { animation: turnUp .36s ease-in-out both; }
.tcard.turnin .cardf::before { animation-duration: .36s; }
.tcard.turnin .cardf.drop { animation: dropIn .26s ease-out both, turnUp .36s ease-in-out both; }

@media (min-width: 900px) {
  #v-play { padding: 14px 20px; }
  .pl { grid-template-columns: minmax(0, 1fr) 290px; column-gap: 18px; --msgh: 56px; --tw: 92px; --hw: 100px; --bw: 34px; --mw: 16px; }
  .table.many { --bw: 20px; --mw: 13px; --tw: 70px; }
  .table { grid-column: 1; border-radius: 26px; }
  .pl-side { display: flex; flex-direction: column; gap: 12px; grid-column: 2; min-height: 0; }
  .opps.tbl-seats { padding: 12px 18px 0; }
  .opps .tbl-seat { margin-top: calc(var(--d2, 0) * 64px); }
  .table .tbl-plate { font-size: 13.5px; line-height: 19px; padding: 2px 9px; }
  .table.many .opps .tbl-plate { font-size: 12px; line-height: 15px; }
  .bidtok { --tok-size: 28px; }
  .table.many .opps .bidtok { --tok-size: 24px; }
  .mid .msg { font-size: 17px; top: 8px; } .mid .msg small { font-size: 14px; }
  .mid.bidding .msg { font-size: 21px; } .mid.bidding .msg small { font-size: 15px; }
  .deckspot { --card-w: 50px; left: 22px; bottom: 18px; }
  .pad { display: none; }
  .bidpad { grid-template-columns: repeat(var(--bn, 11), minmax(0, 56px)); }
  .tcard .as { font-size: 11.5px; bottom: -18px; }
  .mine { padding: 0 18px 12px; }
}
/* short screens (phone on its side, small phones) */
@media (max-height: 600px) and (max-width: 899px) {
  .pl { --tw: 44px; --hw: 54px; --bw: 13px; --mw: 12px; }
  .bidtok, .table.many .opps .bidtok { --tok-size: 22px; }
  .mid .msg { font-size: 13px; } .mid .msg small { font-size: 11.5px; }
  .deckspot { --card-w: 26px; }
  .pad { width: 32px; height: 40px; }
}
/* phone upright: deck and pad sit up beside the message, so the trick can use the whole felt width */
@media (max-width: 899px) and (orientation: portrait) {
  .deckspot { bottom: auto; top: 4px; left: 8px; }
  .pad { bottom: auto; top: 4px; right: 8px; }
}
@media (max-height: 460px) and (max-width: 899px) {
  .pl { --tw: 36px; --hw: 46px; }
  .held { min-height: 0; }
  .opps.tbl-seats { padding-top: 4px; }
  .lay { min-height: 20px; }
  .mine > .lay { min-height: 22px; }
  /* phone on its side: the actions move to the right edge so the trick keeps the middle */
  .table { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto; }
  /* the seats stay over the felt so each played card can sit right under its player */
  .opps.tbl-seats { grid-column: 1; }
  .mid { grid-column: 1; grid-row: 2; }
  .mine { grid-column: 1; grid-row: 3; }
  .actions-wrap { grid-column: 2; grid-row: 1 / 4; align-self: center; padding: 0 10px 0 0; }
  .actions { flex-direction: column; flex-wrap: nowrap; }
  .bidpad { grid-template-columns: repeat(4, 40px); gap: 5px; }
  .bidpad .btn { height: 36px; font-size: 16px; }
  .pad { right: 6px; }
  .pl { --msgh: 18px; }
  /* your name plate, bid and tricks sit under the actions on the right, so the trick gets that row */
  /* each opponent's bid and won pile sit beside their held cards, not under them: one row less, a bigger trick */
  .opps .tbl-seat { display: grid; grid-template-columns: minmax(0, 1fr) auto; justify-items: center; align-items: center; column-gap: 3px; row-gap: 2px; }
  .opps .tbl-seat > .tbl-plate { grid-column: 1 / -1; }
  .opps .tbl-seat > .lay { gap: 3px; }
  .mine { position: static; min-height: 46px; } /* keeps room for the message when the hand is empty */
  .mine > .lay { position: absolute; right: 8px; bottom: 6px; z-index: 4; min-height: 0; }
  .mid:not(.bidding) .msg { top: 100%; left: 4px; right: auto; width: 27%; text-align: left; font-size: 12.5px; }
}
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.log li { color: var(--muted); }
.log li b { color: var(--text); font-weight: 650; }
.res-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.res-table th, .res-table td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.res-table th:first-child, .res-table td:first-child { text-align: left; }
.res-table th { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.reveal { display: flex; flex-direction: column; gap: 6px; }
.reveal .rh { display: flex; align-items: center; gap: 6px; }
.reveal .rh .nm { width: 64px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
.reveal .rh .cs { display: flex; gap: 2px; flex-wrap: wrap; }
.seat-list { display: flex; flex-direction: column; gap: 8px; }
.seat { display: flex; align-items: center; gap: 8px; }
.seat .nm { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.net-in.code { width: 92px; flex: 0 0 92px; text-align: center; letter-spacing: .12em; text-transform: uppercase; }
.lobby { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 520px; width: 100%; margin: 0 auto; min-height: 0; flex: 1; }
.room-code { font-size: 44px; font-weight: 850; letter-spacing: .14em; color: var(--gold); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- settings */
.set { display: grid; gap: 14px; align-content: start; }
.set-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.set-group h3 { margin: 0; padding: 12px 14px 4px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.set-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; min-height: 50px; border-top: 1px solid var(--line); }
.set-group h3 + .set-row { border-top: 0; }
.set-row .t { flex: 1; min-width: 0; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.set-row .t small { color: var(--muted); font-weight: 500; }
@media (min-width: 900px) { .set { grid-template-columns: repeat(2, minmax(0, 480px)); align-items: start; } }
.rules-body { font-size: 14px; color: var(--muted); padding: 0 14px 12px; }
.rules-body h4 { color: var(--text); margin: 12px 0 4px; font-size: 14px; }
.rules-body ul { margin: 4px 0; padding-left: 18px; }
details.rules summary { cursor: pointer; padding: 12px 14px; font-weight: 650; list-style: none; }
details.rules summary::-webkit-details-marker { display: none; }
a { color: var(--accent); }

/* Sound & effects rows (js/fx.js) in this page's own settings look */
.set .fx-set .fx-row { padding: 9px 14px; min-height: 50px; }
.set .fx-set .fx-lab { font-weight: 600; gap: 6px; }
.set .fx-set .switch { width: 50px; height: 30px; }
.set .fx-set .switch span { background: #39405a; border-radius: 15px; }
.set .fx-set .switch span::after { width: 24px; height: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .18s; }
.set .fx-set .switch input:checked + span { background: var(--good); }
.set .fx-set .switch input:checked + span::after { transform: translateX(20px); }
.set .fx-set .seg { width: 160px; }
.set .fx-set .seg button { flex: 1; height: 32px; padding: 0 10px; cursor: pointer; }
.set .fx-set .seg button[aria-pressed="true"] { background: var(--card-hover); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.set .fx-set .fx-vol { flex: 0 1 160px; }
.set .fx-set .fx-test { height: 32px; padding: 0 12px; cursor: pointer; }
.set .fx-set .fx-why { padding: 0 14px 8px; }
/* Animations off: the card deal and drop are instant too */
.fx-still .cardf.deal, .fx-still .cardf.drop, .fx-still .tcard.turnin .cardf { animation: none; }
.fx-still .cardf.deal::before, .fx-still .tcard.turnin .cardf::before { display: none; }
@media (prefers-reduced-motion: reduce) { .hand .cardf.deal, .tcard.turnin .cardf { animation: none; } .hand .cardf.deal::before, .tcard.turnin .cardf::before { display: none; } }
