/* Just Cards Mate styles. Mobile first; tokens live in tokens.css. Read CLAUDE.md before editing.
   Breakpoints: phone ≤599 · tablet 600–1023 · laptop 1024–1439 · desktop ≥1440 */

/* ================================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs-base); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.52;
  color: var(--card);
  background-color: var(--felt-deep);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* The felt: one vignette plus a faint fibrous noise. */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; }
body::before { z-index: -2; background: radial-gradient(130% 95% at 38% 18%, var(--felt-hi) 0%, var(--felt) 46%, var(--felt-deep) 100%); }
body::after { z-index: -1; background-image: var(--noise); background-size: 180px; opacity: .08; mix-blend-mode: overlay; }

.wood-top { height: var(--rail-w); background: linear-gradient(180deg, var(--wood-hi), var(--wood)); box-shadow: 0 1px 0 rgb(var(--shadow-rgb) / .5); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.08; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--butter); outline-offset: 2px; }
.paper :focus-visible { outline-color: var(--butter); box-shadow: 0 0 0 4px var(--moss); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--sea-glass); }
.paper .muted { color: var(--muted-ink); }
.sc { font-family: var(--font-sc); font-weight: 700; letter-spacing: .1em; }
.label { font-family: var(--font-sc); font-weight: 700; letter-spacing: .12em; font-size: .82rem; color: var(--sea-glass); }
.paper .label { color: var(--moss); }
.num { font-variant-numeric: tabular-nums; }

/* ================================================================ icons & ornaments */
.ico { width: 22px; height: 22px; flex: none; }
.foldmark { width: 40px; height: 38px; flex: none; }
.brandmark { width: 44px; height: 44px; flex: none; object-fit: contain; filter: drop-shadow(0 2px 2px rgb(var(--shadow-rgb) / .45)); }
.foldmark .fm-card { fill: var(--card); stroke: var(--night); }
.foldmark .fm-gold { fill: var(--gold); stroke: var(--brass); }
.squiggle { position: absolute; left: -2%; right: -2%; bottom: -.18em; width: 104%; height: .32em; color: var(--gold); }
.crown path:first-child { fill: var(--gold); stroke: var(--brass); stroke-width: 1.3; }
.crown path:last-child { stroke: var(--brass); stroke-width: 2; }

/* ================================================================ paper */
.paper {
  position: relative;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--card-edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-paper);
}
.paper::before {
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  border: 1px solid var(--card-edge); border-radius: calc(var(--r-panel) - 5px);
}
.paper > * { position: relative; }

/* ================================================================ tokens (buttons) */
.btn {
  --face: var(--card); --edge: var(--card-shade); --txt: var(--night);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .6rem 1.35rem .7rem;
  border: 0; border-radius: var(--r-token);
  background: var(--face); color: var(--txt);
  font-family: var(--font-sc); font-weight: 700; font-size: 1.02rem; letter-spacing: .09em; line-height: 1;
  box-shadow: 0 4px 0 var(--edge), 0 6px 10px -4px rgb(var(--shadow-rgb) / .55);
  transform: translateY(0);
  transition: transform 90ms ease, box-shadow 90ms ease, opacity 150ms ease;
  user-select: none; -webkit-tap-highlight-color: transparent;
  margin-bottom: 4px; /* room for the edge */
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge), 0 2px 4px -2px rgb(var(--shadow-rgb) / .5); }
.btn:disabled { opacity: .5; }
.btn-primary { --face: var(--gold); --edge: var(--brass); --txt: var(--night); }
.btn-secondary { --face: var(--card); --edge: var(--card-shade); --txt: var(--night); }
.paper .btn-secondary, .btn-emerald { --face: var(--moss); --edge: var(--felt-deep); --txt: var(--card); }
.btn-lg { min-height: 54px; font-size: 1.12rem; padding-inline: 1.6rem; }
.btn-block { width: 100%; }
.btn-ghost {
  background: none; box-shadow: none; color: inherit; padding-inline: .7rem; margin-bottom: 0;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.btn-ghost:active:not(:disabled) { transform: none; box-shadow: none; }
.btn-danger { --face: var(--card); --edge: var(--card-shade); --txt: var(--tomato); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1.5px solid rgb(var(--cream-rgb) / .35); border-radius: 12px;
  background: rgb(var(--shadow-rgb) / .22); color: var(--card); padding: 0;
}
.paper .icon-btn { border-color: var(--card-edge); background: var(--card-hi); color: var(--ink); }
@media (hover: hover) {
  .btn:hover:not(:disabled) { filter: brightness(1.04); }
  .icon-btn:hover { border-color: var(--butter); }
}

/* ================================================================ inputs */
.field { display: grid; gap: .3rem; }
.field > .label { padding-left: .15rem; }
.input {
  width: 100%; min-height: 50px; padding: .65rem .9rem;
  border: 1.5px solid var(--card-shade); border-radius: var(--r-input);
  background: var(--card-hi); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; /* never below 16px */
  box-shadow: inset 0 2px 0 rgb(var(--shadow-rgb) / .06);
}
.input::placeholder { color: var(--muted-ink); opacity: .8; }
.input:focus { outline: 2px solid var(--butter); outline-offset: 1px; border-color: var(--moss); }
.code-input { font-family: var(--font-sc); font-weight: 700; letter-spacing: .4em; text-transform: uppercase; text-align: center; font-size: 1.35rem; padding-left: 1.3rem; }

/* ================================================================ badges & stamps */
.badge {
  display: inline-block; margin-left: .4rem; vertical-align: .1em;
  padding: .08rem .45rem .14rem; border-radius: 6px;
  font-family: var(--font-sc); font-weight: 700; font-size: .72rem; letter-spacing: .1em; line-height: 1.2;
  background: var(--card-edge); color: var(--ink);
}
.badge.gold { background: var(--butter); color: var(--night); }
.stamp {
  display: inline-block; padding: .2rem .55rem .26rem; border: 2px solid currentColor; border-radius: 6px;
  font-family: var(--font-sc); font-weight: 700; letter-spacing: .12em; font-size: .78rem; line-height: 1.1;
  transform: rotate(-4deg); opacity: .9;
}
.sticker {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .85rem .42rem; border-radius: var(--r-token);
  background: var(--butter); color: var(--night);
  font-family: var(--font-sc); font-weight: 700; letter-spacing: .1em; font-size: .9rem;
  box-shadow: 0 2px 0 var(--brass), 0 5px 10px -5px rgb(var(--shadow-rgb) / .6);
  transform: rotate(-2.5deg); width: fit-content;
}

/* ================================================================ top nav */
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--card); text-decoration: none; min-height: 44px; }
.wordmark { font-family: var(--font-display); font-size: 1.55rem; line-height: 1; color: var(--card); white-space: nowrap; }
.wordmark em { position: relative; font-style: normal; color: var(--card); }
.wordmark .wm-swash { bottom: -.24em; height: .28em; color: var(--gold); }
@media (max-width: 380px) { .wordmark { font-size: 1.3rem; } .brandmark { width: 38px; height: 38px; } }
.navlinks { display: none; align-items: center; gap: .25rem; }
.navlinks .btn-ghost { color: var(--card); min-height: 44px; font-family: var(--font-body); font-weight: 500; letter-spacing: 0; font-size: 1rem; text-decoration-color: rgb(var(--cream-rgb) / .35); }
.nav-menu { display: inline-grid; }
@media (min-width: 768px) { .navlinks { display: flex; } .nav-menu { display: none; } }

/* ================================================================ home */
.home { width: min(1240px, 100% - 2rem); margin: 0 auto; padding-bottom: 0; }
.hero { display: grid; gap: 1.6rem; padding: .6rem 0 2.4rem; align-items: center; }
.hero-copy { display: grid; gap: 1rem; align-content: start; }
.hero h1 { font-size: clamp(40px, 4.2vw + 12px, 68px); line-height: 1.06; max-width: 13ch; color: var(--card); }
.hero h1 .u { position: relative; white-space: nowrap; }
.hero .lede { font-size: 1.12rem; max-width: 40ch; color: var(--card); opacity: .92; }
.hero-copy > .ad { margin: .6rem 0 0; justify-items: start; }
.hero-copy > .ad .ad-body { max-width: 100%; }

.actions-stack { display: grid; gap: 1.1rem; }
.action-card { padding: 1.4rem 1.3rem 1.3rem; display: grid; gap: .9rem; }
.action-card h2 { font-size: clamp(1.55rem, 1.2vw + 1.1rem, 2rem); color: var(--ink); }
.action-card p.hint { color: var(--muted-ink); font-size: .96rem; }
.action-card.start { transform: rotate(-1.2deg); }
.action-card.join { transform: rotate(1deg); }
.join-row { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.home .btn-lg { width: 100%; min-height: 54px; }

@media (min-width: 600px) {
  .join-row { grid-template-columns: 1fr auto; align-items: start; }
  .join-row .btn { width: auto; }
}
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.1fr minmax(360px, 440px); gap: 2.5rem; padding: 1.6rem 0 3rem; }
  /* let the left column use its full width so the middle of the page isn't empty */
  .hero h1 { max-width: none; text-wrap: balance; }
  .hero .lede { max-width: 54ch; font-size: 1.2rem; }
  .actions-stack { margin-top: 1rem; }
}
@media (min-width: 1440px) {
  .hero { gap: 4rem; }
}

/* ---- section headings with a drawn underline */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.sec-head h2 { position: relative; font-size: clamp(1.6rem, 1.4vw + 1.1rem, 2.2rem); color: var(--card); }

/* ---- the shelf of game boxes */
.shelf { padding: 1rem 0 2rem; }
.boxes {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 280px); gap: 1rem;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: .6rem .2rem 1.4rem; margin: 0 -.2rem;
  scrollbar-width: none;
}
.boxes::-webkit-scrollbar { display: none; }
.gamebox {
  --box: var(--felt);
  scroll-snap-align: start; position: relative; display: grid; grid-template-rows: auto 1fr;
  border-radius: 10px; overflow: hidden; color: var(--ink);
  background: var(--card); border: 1px solid var(--card-edge); box-shadow: var(--shadow-paper);
  transform: rotate(var(--tilt, 0deg));
}
.gamebox .lid {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: 1rem 1rem .9rem; background: var(--box); color: var(--card);
  border-bottom: 3px solid var(--night);
}
.gamebox .lid h3 { font-size: 1.5rem; color: var(--card); }
.gamebox .lid .foldmark { width: 44px; height: 42px; }
.expansion .lid .brandmark { width: 52px; height: 52px; }
.gamebox .contents { padding: .9rem 1rem 1.1rem; display: grid; gap: .45rem; align-content: start; }
.gamebox .contents p { color: var(--muted-ink); font-size: .96rem; }
.gamebox .meta { font-family: var(--font-sc); font-weight: 700; letter-spacing: .1em; font-size: .8rem; color: var(--moss) !important; }
.gamebox.soon { opacity: .9; }
.gamebox.soon .lid { filter: saturate(.55); }
.gamebox.soon .stamp { position: absolute; right: .8rem; bottom: .8rem; color: var(--tomato); background: var(--card); }
.gamebox.soon .q { font-family: var(--font-display); font-size: 1.6rem; opacity: .7; }
@media (min-width: 900px) {
  .boxes { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); overflow: visible; }
}

/* ---- the scorepad explaining a night */
.night-grid { display: grid; gap: 1.6rem; padding: 1rem 0 3rem; align-items: start; }
@media (min-width: 900px) { .night-grid { grid-template-columns: 1.15fr 1fr; gap: 2.4rem; } }
.scorepad-big {
  --line: 2.1rem;
  position: relative; padding: 1.2rem 1.2rem 1.4rem 3.4rem; transform: rotate(-.8deg);
}
.scorepad-big::before { display: none; }
.scorepad-big::after { content: ""; position: absolute; top: 0; bottom: 0; left: 2.4rem; width: 1.5px; background: var(--tomato); opacity: .5; }
.scorepad-big h2 { font-size: 1.7rem; color: var(--ink); margin-bottom: .9rem; line-height: 1.2; }
.scorepad-big ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.scorepad-big li { counter-increment: step; position: relative; padding: .45rem 0 .4rem; line-height: 1.4; color: var(--ink); border-bottom: 1px solid var(--card-edge); }
.scorepad-big li:first-child { border-top: 1px solid var(--card-edge); }
.scorepad-big li::before {
  content: counter(step); position: absolute; left: -2.6rem; width: 1.8rem; text-align: right;
  font-family: var(--font-display); color: var(--moss);
}
.scorepad-big li b { font-weight: 700; }

/* ---- the expansion box (membership) */
.expansion { padding: 0; overflow: hidden; transform: rotate(.7deg); }
.expansion::before { display: none; }
.expansion .lid {
  padding: 1.1rem 1.3rem 1rem; background: var(--felt-deep); color: var(--card);
  border-bottom: 4px solid var(--gold); display: flex; align-items: center; gap: .8rem;
}
.expansion .lid h2 { font-size: 1.7rem; color: var(--card); }
.expansion .lid .label { color: var(--butter); display: block; }
.expansion .inside { padding: 1.1rem 1.3rem 1.3rem; display: grid; gap: .9rem; }
.expansion .inside > p { color: var(--muted-ink); }
.perk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.perk-list li { display: grid; grid-template-columns: 22px 1fr; gap: .6rem; align-items: start; color: var(--ink); }
.perk-list li::before {
  content: ""; width: 14px; height: 14px; margin-top: .3rem; border: 2px solid var(--moss); border-radius: 3px;
  transform: rotate(-4deg);
}
.perk-list li span { display: block; color: var(--muted-ink); font-size: .94rem; }
.perk-list li span.soon-note { display: inline; font-family: var(--font-sc); font-weight: 700; font-size: .72rem; letter-spacing: .1em; color: var(--tomato); margin-left: .35rem; }

/* ---- footer */
.foot {
  margin-top: 1rem; background: var(--night); color: var(--sea-glass);
  border-top: var(--rail-w) solid var(--wood);
  padding: 1.6rem 1rem max(1.6rem, env(safe-area-inset-bottom));
}
.foot-inner { width: min(1240px, 100%); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.4rem; }
.foot .brand .wordmark { font-size: 1.3rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
.foot .btn-ghost { color: var(--card); font-family: var(--font-body); letter-spacing: 0; font-weight: 500; font-size: 1rem; min-height: 44px; }

/* ================================================================ ads */
.ad { margin: 1.2rem auto; display: grid; justify-items: center; gap: .3rem; max-width: 100%; }
.ad-label { font-family: var(--font-sc); font-weight: 700; font-size: .72rem; letter-spacing: .14em; color: var(--sea-glass); }
.paper .ad-label, .sheet .ad-label { color: var(--muted-ink); }
.ad-body { display: grid; place-items: center; overflow: hidden; }
.ad-banner .ad-body { width: 320px; max-width: 100%; height: 100px; }
.ad-rect .ad-body { width: 300px; height: 250px; }
@media (min-width: 768px) { .ad-banner .ad-body { width: 728px; height: 90px; } }
.ad-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  border: 1.5px dashed rgb(var(--cream-rgb) / .3); border-radius: 8px;
  color: var(--sea-glass); font-size: .9rem; background: rgb(var(--shadow-rgb) / .15);
}
.sheet .ad-placeholder { border-color: var(--card-shade); color: var(--muted-ink); background: none; }

/* ================================================================ lobby */
.lobby { width: min(1240px, 100% - 2rem); margin: 0 auto; padding-bottom: 7rem; }
.lobby-grid { display: grid; gap: 1.2rem; }
.code-tag { padding: 1.2rem 1.1rem 1.1rem; display: grid; gap: .7rem; justify-items: center; text-align: center; transform: rotate(-1deg); }
.code-tag .pin {
  position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: var(--tomato); box-shadow: inset -3px -3px 0 rgb(var(--shadow-rgb) / .25), 0 2px 3px rgb(var(--shadow-rgb) / .4);
}
.code-tag h2 { font-size: 1.15rem; color: var(--ink); line-height: 1.3; }
.big-code { display: flex; gap: .4rem; }
.big-code span {
  display: grid; place-items: center; width: clamp(50px, 14vw, 64px); height: clamp(60px, 17vw, 76px);
  border: 1.5px solid var(--card-edge); border-radius: 8px; background: var(--card-hi);
  font-family: var(--font-display); font-size: clamp(2rem, 8vw, 2.7rem); color: var(--ink);
}
.big-code span:nth-child(odd) { transform: rotate(-1.5deg); }
.big-code span:nth-child(even) { transform: rotate(1.2deg); }
.code-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.code-tag .hint { color: var(--muted-ink); font-size: .92rem; }

.seat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.seat {
  display: flex; align-items: center; gap: .7rem; min-height: 60px; padding: .55rem .8rem;
  border-radius: 12px; background: rgb(var(--shadow-rgb) / .25); border: 1.5px solid rgb(var(--cream-rgb) / .14);
  color: var(--card); width: 100%; text-align: left;
}
button.seat { cursor: pointer; }
.seat.away { opacity: .6; }
.seat.empty { border-style: dashed; background: none; color: var(--sea-glass); }
.seat .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.seat .status { font-size: .9rem; color: var(--sea-glass); }
.avatar {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  font-family: var(--font-display); font-size: 1.1rem; color: var(--card);
  background: hsl(var(--h) 38% 34%); border: 2px solid var(--card);
  box-shadow: 0 2px 0 rgb(var(--shadow-rgb) / .35);
}
.avatar.sm { width: 30px; height: 30px; font-size: .9rem; border-width: 1.5px; }
.avatar.empty { background: none; border: 2px dashed rgb(var(--cream-rgb) / .35); }

.rules { padding: 1.2rem 1.2rem 1.3rem; display: grid; gap: 1rem; align-content: start; }
.rules h2 { font-size: 1.5rem; color: var(--ink); }
.rules dl { margin: 0; display: grid; gap: .6rem; }
.rules dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-bottom: .55rem; border-bottom: 1px dashed var(--card-edge); }
.rules dt { font-family: var(--font-sc); font-weight: 700; letter-spacing: .1em; font-size: .85rem; color: var(--moss); }
.rules dd { margin: 0; color: var(--ink); text-align: right; }
.felt-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.felt-chip {
  display: grid; justify-items: center; gap: .3rem; padding: .55rem .3rem .5rem; min-height: 72px;
  border-radius: 10px; border: 1.5px solid var(--card-edge); background: var(--card-hi); color: var(--ink);
  font-weight: 700; font-size: .9rem;
}
.felt-chip .swatch { width: 34px; height: 22px; border-radius: 5px; background: var(--sw); border: 2px solid var(--card-edge); box-shadow: inset 0 0 0 1px rgb(var(--shadow-rgb) / .2); }
.felt-chip.on { border-color: var(--moss); box-shadow: 0 0 0 2px var(--butter); }
.felt-chip .lock { font-family: var(--font-sc); font-size: .66rem; letter-spacing: .08em; color: var(--muted-ink); font-weight: 700; line-height: 1; }
.sw-emerald { --sw: #0A3A30; } .sw-midnight { --sw: #1D3566; } .sw-plum { --sw: #3B2440; }
.rules-toggle { display: none; }
.rules .deal { display: grid; gap: .4rem; }
.waiting { color: var(--muted-ink); text-align: center; padding: .6rem 0; }
.lobby .waiting.on-felt { color: var(--sea-glass); }
.dots i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-left: 4px; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }

/* phone + tablet: list layout, collapsible rules, fixed deal bar */
.lobby-oval { display: none; }
.dealbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 1.6rem 1rem max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--felt-deep) 45%);
  display: grid; justify-items: center;
}
.dealbar > * { width: min(520px, 100%); }
.dealbar .waiting { color: var(--card); }
.rules details > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer;
}
.rules details > summary::-webkit-details-marker { display: none; }
.rules details > summary h2::after { content: ""; }
.rules details > summary .chev { transition: transform 160ms ease; transform: rotate(-90deg); }
.rules details[open] > summary .chev { transform: rotate(90deg); }
.rules details > .rules-body { display: grid; gap: 1rem; margin-top: .8rem; }
.rules .deal.in-panel { display: none; }

@media (min-width: 600px) and (max-width: 899px) {
  .lobby-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .lobby-grid > .code-tag { grid-column: 1 / -1; justify-self: center; width: min(520px, 100%); }
}
@media (min-width: 900px) {
  .lobby { padding-bottom: .5rem; }
  .lobby .ad { margin: .2rem auto 0; }
  .lobby-grid { grid-template-columns: 1fr minmax(300px, 340px); align-items: start; gap: 1.6rem; }
  .lobby-grid > .code-tag, .lobby-grid > .seat-wrap { display: none; }
  .lobby-oval { display: block; position: relative; aspect-ratio: 16 / 10; width: min(100%, calc((100dvh - 130px) * 1.6)); margin: 0 auto; }
  .lobby-left.has-ad .lobby-oval { width: min(100%, calc((100dvh - 275px) * 1.6)); }
  .lobby .lobby-left > .ad { margin: 1.3rem auto 0; }
  .lobby-left .ad-banner .ad-body { max-width: 100%; }
  .oval {
    position: absolute; inset: 11% 12%; border-radius: 50%;
    background: var(--felt); border: 12px solid var(--wood);
    box-shadow: inset 0 0 0 2px var(--wood-hi), inset 0 10px 30px rgb(var(--shadow-rgb) / .45), 0 10px 22px -10px rgb(var(--shadow-rgb) / .8);
    overflow: hidden;
  }
  .oval::after { content: ""; position: absolute; inset: 0; background-image: var(--noise); background-size: 180px; opacity: .09; mix-blend-mode: overlay; }
  .lobby-oval .code-tag { position: absolute; left: 50%; top: 50%; width: min(360px, 44%); padding: .9rem .9rem .8rem; gap: .5rem; transform: translate(-50%, -50%) rotate(-1.5deg); z-index: 2; }
  .lobby-oval .code-tag h2 { font-size: 1rem; }
  .lobby-oval .big-code span { width: 50px; height: 58px; font-size: 2.1rem; }
  .lobby-oval .code-actions { flex-wrap: nowrap; gap: .5rem; }
  .lobby-oval .code-actions .btn { min-height: 44px; padding-inline: .9rem; font-size: .92rem; }
  .lobby-oval .code-tag .hint { font-size: .85rem; }
  .lobby-oval .seat {
    position: absolute; z-index: 3; width: auto; min-width: 128px; max-width: 170px;
    left: var(--x); top: var(--y); transform: translate(-50%, -50%) rotate(var(--r, 0deg));
    flex-direction: column; gap: .25rem; padding: .55rem .7rem .6rem; text-align: center;
    background: var(--card); color: var(--ink); border: 1px solid var(--card-edge); box-shadow: var(--shadow-paper);
  }
  .lobby-oval .seat .pname { white-space: nowrap; max-width: 140px; }
  .lobby-oval .seat .status { color: var(--muted-ink); font-size: .85rem; line-height: 1.1; }
  .lobby-oval .seat.empty { background: rgb(var(--shadow-rgb) / .25); border: 1.5px dashed rgb(var(--cream-rgb) / .35); color: var(--sea-glass); box-shadow: none; min-height: 60px; justify-content: center; }
  .lobby-oval .seat.empty .status { color: var(--sea-glass); }
  .rules details > summary { pointer-events: none; }
  .rules details > summary .chev { display: none; }
  .rules .deal.in-panel { display: grid; }
  .dealbar { display: none; }
}
@media (min-width: 900px) and (max-height: 820px) {
  .rules { padding: 1rem 1.1rem 1.1rem; gap: .75rem; }
  .lobby .topnav { padding: .5rem 0; }
}

/* ================================================================ cards */
.card {
  --suit: var(--ink); --rank-c: var(--ink);
  position: relative; flex: none; display: block;
  width: var(--cw); height: calc(var(--cw) * 1.4);
  border-radius: clamp(4px, calc(var(--cw) * .085), 10px);
  background: var(--card); color: var(--rank-c);
  border: 1px solid var(--card-edge); padding: 0; text-align: left;
  box-shadow: var(--shadow-card);
  font-family: var(--font-display); user-select: none; -webkit-tap-highlight-color: transparent;
  transform: translateY(var(--arc, 0px)) rotate(var(--rot, 0deg));
  transition: transform var(--t-card) var(--ease-card), box-shadow var(--t-card) ease;
}
/* the printed inner frame */
.card::before {
  content: ""; position: absolute; inset: calc(var(--cw) * .05); pointer-events: none;
  border: 1px solid var(--card-edge); border-radius: clamp(2px, calc(var(--cw) * .05), 6px);
}
button.card { cursor: pointer; }
.suit-stars { --suit: var(--stars); --rank-c: var(--stars-ink); }
.suit-moons { --suit: var(--moons); --rank-c: var(--moons); }
.suit-ferns { --suit: var(--ferns); --rank-c: var(--ferns); }
.suit-shells { --suit: var(--shells); --rank-c: var(--shells); }
.suit-drops { --suit: var(--drops); --rank-c: var(--drops); }
.card .glyph { display: block; color: var(--suit); overflow: visible; }
.card .glyph .edge { stroke: var(--stars-ink); stroke-width: 1.2; stroke-linejoin: round; }
.card .glyph .vein { stroke: var(--card); }
.corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; gap: calc(var(--cw) * .025); width: calc(var(--cw) * .28); }
.corner.tl { top: calc(var(--cw) * .08); left: calc(var(--cw) * .07); }
.corner.br { bottom: calc(var(--cw) * .08); right: calc(var(--cw) * .07); transform: rotate(180deg); }
.card .rank { font-size: calc(var(--cw) * .27); font-weight: 400; color: var(--rank-c); }
.card .corner-glyph { width: calc(var(--cw) * .2); height: calc(var(--cw) * .2); }
.card .pip { position: absolute; left: 50%; top: 50%; width: 44%; height: auto; transform: translate(-50%, -50%); }

/* wild: crown on a butter-tinted face */
.card.wild { background: var(--wild-face); }
.card.wild .wild-mark { position: absolute; right: calc(var(--cw) * .09); top: calc(var(--cw) * .1); width: calc(var(--cw) * .22); color: var(--gold); }
.card .crown-glyph { color: var(--gold); }
.card .crown-glyph .edge { stroke: var(--brass); stroke-width: 1.3; }
.card.joker { --rank-c: var(--stars-ink); }
.card.joker .pip { width: 54%; top: 44%; }
.joker-text { position: absolute; left: 0; right: 0; bottom: 19%; text-align: center; font-family: var(--font-sc); font-weight: 700; font-size: calc(var(--cw) * .13); letter-spacing: .14em; color: var(--stars-ink); }
.card.joker .corner .rank { display: none; }

/* states */
.card.selected { transform: translateY(calc(var(--cw) * -.2)) rotate(0deg); box-shadow: 0 0 0 2px var(--butter), var(--shadow-lift); z-index: 5; }
.card.out-hint { box-shadow: 0 0 0 2px var(--butter), var(--shadow-card); }
.card.out-hint.selected { box-shadow: 0 0 0 3px var(--butter), var(--shadow-lift); }
.card.new { animation: deal-in 260ms var(--ease-card); }
.card.empty { background: rgb(var(--shadow-rgb) / .2); border: 2px dashed rgb(var(--cream-rgb) / .3); box-shadow: none; }
.card.empty::before { display: none; }
@media (hover: hover) {
  button.card:not(:disabled):hover { transform: translateY(calc(var(--arc, 0px) - 6px)) rotate(0deg); box-shadow: var(--shadow-lift); }
  button.card.selected:hover { transform: translateY(calc(var(--cw) * -.2 - 2px)) rotate(0deg); box-shadow: 0 0 0 2px var(--butter), var(--shadow-lift); }
}
.card:focus-visible { outline: 2px solid var(--butter); outline-offset: 3px; z-index: 6; }

/* back: deep green, woven gold lattice, cream border */
.card.back {
  background-color: var(--back);
  background-image:
    repeating-linear-gradient(45deg, rgb(var(--gold-rgb) / .42) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgb(var(--gold-rgb) / .42) 0 1px, transparent 1px 7px);
  border: clamp(2px, calc(var(--cw) * .05), 5px) solid var(--card);
}
.card.back::before { inset: calc(var(--cw) * .04); border-color: rgb(var(--gold-rgb) / .55); }

/* mini cards (results, rules) */
.card.mini { --cw: 38px; }
.card.mini::before { display: none; }
.card.mini .pip, .card.mini .corner.br, .card.mini .joker-text, .card.mini .wild-mark { display: none; }
.card.mini .corner.tl { position: static; width: 100%; height: 100%; justify-content: center; gap: 2px; }
.card.mini .rank { font-size: 15px; }
.card.mini .corner-glyph { width: 15px; height: 15px; }
.card.mini.joker .corner-glyph { width: 20px; height: 20px; }
.card.mini.back { --cw: 22px; border-width: 2px; background-size: auto; }
.meld .card.mini + .card.mini { margin-left: -9px; }

/* ================================================================ table (in game) */
.table-screen {
  --cw: 80px; --pcw: 88px;
  height: calc(100dvh - var(--rail-w)); display: grid;
  grid-template-rows: auto 1fr auto; gap: .45rem;
  padding: max(.35rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right)) 0 max(.5rem, env(safe-area-inset-left));
  overflow: hidden;
}
@media (min-width: 600px) { .table-screen { --cw: clamp(72px, min(12vw, 12vh), 110px); --pcw: calc(var(--cw) * .86); } }
@media (min-width: 1024px) { .table-screen { --cw: clamp(72px, min(8.5vw, 15vh), 120px); } }

.tbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 48px; }
.tbar-group { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.round-tag {
  display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem .45rem; border-radius: 8px;
  background: var(--card); color: var(--ink); border: 1px solid var(--card-edge); box-shadow: var(--shadow-card);
  font-family: var(--font-sc); font-weight: 700; letter-spacing: .08em; font-size: .92rem; white-space: nowrap;
  transform: rotate(-1deg);
}
.round-tag .crown { width: 18px; height: 18px; }
.room-chip {
  display: none; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .8rem;
  border-radius: 10px; border: 1.5px solid rgb(var(--cream-rgb) / .3); background: rgb(var(--shadow-rgb) / .22);
  color: var(--card); font-family: var(--font-sc); font-weight: 700; letter-spacing: .12em; font-size: .9rem;
}
.score-btn { display: inline-flex; align-items: center; gap: .4rem; width: auto; padding: 0 .75rem; font-family: var(--font-sc); font-weight: 700; letter-spacing: .08em; font-size: .9rem; }
@media (min-width: 600px) { .room-chip { display: inline-flex; } }

.table-mid { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; }
.table-mid.has-ad { grid-template-columns: auto minmax(0, 1fr); }
.table-mid > .ad { margin: 0; align-self: center; }
.ad-sky .ad-body { width: 160px; height: 600px; }

.board {
  position: relative; min-height: 0; display: grid;
  grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr);
  border: var(--rail-w) solid var(--wood); border-radius: 18px;
  background: var(--felt); overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--wood-hi), inset 0 6px 18px rgb(var(--shadow-rgb) / .45), 0 6px 14px -6px rgb(var(--shadow-rgb) / .7);
}
.board::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 40%, var(--felt-hi), var(--felt) 50%, var(--felt-deep) 100%); }
.board::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: var(--noise); background-size: 180px; opacity: .09; mix-blend-mode: overlay; }
.board > * { position: relative; z-index: 1; }

/* opponents: compact chips on phones */
.opps { display: flex; gap: .45rem; padding: .5rem .5rem .2rem; overflow-x: auto; scrollbar-width: none; }
.opps::-webkit-scrollbar { display: none; }
.opp {
  position: relative; flex: 1 0 auto; min-width: 104px; max-width: 200px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 .45rem;
  padding: .35rem .55rem .35rem .4rem; border-radius: 10px;
  background: var(--card); color: var(--ink); border: 1px solid var(--card-edge); box-shadow: var(--shadow-card);
}
.opp .avatar { width: 32px; height: 32px; font-size: .95rem; border-color: var(--card-edge); }
.opp-name { font-weight: 700; font-size: .95rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-sub { font-size: .85rem; color: var(--muted-ink); line-height: 1.2; white-space: nowrap; }
.opp-hand { display: none; }
.opp { grid-template-columns: auto minmax(0, 1fr) auto; }
@media (max-width: 599px) {
  .opp { flex: 1 1 0; min-width: 0; max-width: none; gap: 0 .3rem; padding: .3rem .4rem .3rem .3rem; }
  .opp .avatar { width: 26px; height: 26px; font-size: .8rem; }
  .opp-name { font-size: .88rem; }
  .opp-sub { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
  .opp-score { padding-left: .25rem; font-size: 1.02rem; }
  .opps:has(.opp:nth-child(4)) .opp { flex: 0 0 31%; }
}
.opp-score {
  display: grid; justify-items: center; line-height: 1; padding-left: .35rem; margin-left: .1rem;
  border-left: 1px dashed var(--card-edge);
  font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums;
}
.opp-score small { font-family: var(--font-sc); font-weight: 700; font-size: .62rem; letter-spacing: .1em; color: var(--muted-ink); margin-top: .1rem; }

/* laid-down cards, face up in the middle of the table */
.laid { display: grid; justify-items: center; gap: .35rem; }
.laid-melds { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem .7rem; max-width: 100%; }
.laid .meld { background: rgb(var(--shadow-rgb) / .3); box-shadow: inset 0 0 0 1px rgb(var(--gold-rgb) / .35); padding: 4px 5px; }
.laid .card.mini { --cw: 32px; }
.laid .card.mini .rank { font-size: 13px; }
.laid .card.mini .corner-glyph { width: 12px; height: 12px; }
@media (min-width: 600px) {
  .laid .card.mini { --cw: 40px; }
  .laid .card.mini .rank { font-size: 16px; }
  .laid .card.mini .corner-glyph { width: 15px; height: 15px; }
}
@media (min-width: 1024px) and (min-height: 700px) {
  .laid .card.mini { --cw: 50px; }
  .laid .card.mini .rank { font-size: 20px; }
  .laid .card.mini .corner-glyph { width: 18px; height: 18px; }
  .laid .meld .card.mini + .card.mini { margin-left: -6px; }
}
.opp.turn { box-shadow: 0 0 0 2px var(--butter), var(--shadow-card); }
.opp.turn .opp-sub { color: var(--moss); font-weight: 700; }
.opp.away { opacity: .7; } .opp.gone { opacity: .45; }
.out-flag { display: none; position: absolute; top: -12px; right: -6px; }
@media (min-width: 600px) { .out-flag { display: block; } }
.out-flag .stamp { background: var(--card); color: var(--tomato); font-size: .66rem; padding: .05rem .35rem .1rem; }
.backs { display: inline-flex; }
.backs .card + .card { margin-left: -14px; }
.backs .card:nth-child(1) { transform: rotate(-8deg); } .backs .card:nth-child(2) { transform: rotate(-3deg); }
.backs .card:nth-child(3) { transform: rotate(3deg); } .backs .card:nth-child(4) { transform: rotate(8deg); }

/* centre: piles + prompt strip */
.center { display: grid; align-content: center; justify-items: center; gap: .6rem; padding: .4rem .5rem; min-height: 0; }
.piles { display: flex; gap: clamp(1.4rem, 6vw, 3.4rem); align-items: flex-start; }
.pile { --cw: var(--pcw); background: none; border: 0; padding: 0; display: grid; justify-items: center; gap: .4rem; border-radius: 10px; color: var(--card); }
.pile:disabled { opacity: 1; cursor: default; }
.pile-label { font-family: var(--font-sc); font-weight: 700; letter-spacing: .12em; font-size: .82rem; color: var(--sea-glass); }
.pile .stack { position: relative; display: block; width: var(--cw); height: calc(var(--cw) * 1.4); }
.pile .stack .card { position: absolute; inset: 0; }
.pile .stack .card:nth-child(1) { transform: translate(-3px, 3px) rotate(-2deg); }
.pile .stack .card:nth-child(2) { transform: translate(-1px, 1px) rotate(1deg); }
.pile .stack .card:nth-child(3) { transform: rotate(-.5deg); }
.pile.discard > .card { transform: rotate(2deg); }
.pile.can { cursor: pointer; }
.pile.can .stack .card:last-child, .pile.can > .card { box-shadow: 0 0 0 2px var(--butter), var(--shadow-card); }
.pile.can .pile-label { color: var(--butter); }
@media (hover: hover) {
  .pile.can:hover .stack .card:last-child, .pile.can:hover > .card { transform: translateY(-6px) rotate(0deg); }
}
.prompt-strip {
  max-width: min(46ch, 100%); padding: .45rem 1rem .5rem; border-radius: 6px; text-align: center;
  background: var(--card); color: var(--ink); border: 1px solid var(--card-edge); box-shadow: var(--shadow-card);
  font-weight: 500; line-height: 1.3; transform: rotate(-.6deg);
}
.my-turn .prompt-strip { background: var(--butter); border-color: var(--brass); }
.prompt-strip b { font-family: var(--font-display); font-weight: 400; font-size: 1.12em; }
.ticker { font-size: .9rem; color: var(--sea-glass); text-align: center; min-height: 1.3em; max-width: 46ch; line-height: 1.3; }
.final-banner { padding: .3rem .8rem .36rem; border-radius: 6px; background: var(--tomato); color: var(--card); font-family: var(--font-sc); font-weight: 700; letter-spacing: .08em; font-size: .9rem; transform: rotate(-1.5deg); }

/* your hand */
.me { display: grid; gap: .25rem; padding: 0 .35rem .35rem; min-width: 0; }
.me-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .3rem; }
.me-name { font-weight: 700; color: var(--card); }
.me-score { color: var(--sea-glass); font-variant-numeric: tabular-nums; }
.hand { display: flex; justify-content: safe center; align-items: flex-end; padding: calc(var(--cw) * .26) 6px 4px; overflow-x: auto; overflow-y: visible; scrollbar-width: none; }
.hand::-webkit-scrollbar { display: none; }
.hand-group { display: flex; }
.hand-group + .hand-group { margin-left: 14px; }
.hand-group.meld { padding: 4px 6px 3px; border-radius: 10px; background: rgb(var(--gold-rgb) / .12); box-shadow: inset 0 0 0 1.5px rgb(var(--gold-rgb) / .45); }
.hand .card + .card { margin-left: calc(var(--overlap, 0px) * -1); }
.hand .card.selected { z-index: 5; }
/* drag to reorder: the held card follows the pointer, its mates slide aside */
.hand, .hand .card { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; }
.hand .card.dragging { transition: none; z-index: 20; box-shadow: var(--shadow-lift); cursor: grabbing; }
.dragging-card, .dragging-card * { cursor: grabbing !important; }
.dragging-card .hand { overflow: visible; }

/* tools + action bar */
.tools { display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .85rem;
  border-radius: var(--r-token); border: 1.5px solid rgb(var(--cream-rgb) / .3); background: rgb(var(--shadow-rgb) / .22);
  color: var(--card); font-family: var(--font-sc); font-weight: 700; letter-spacing: .08em; font-size: .88rem;
}
.chip .ico { width: 18px; height: 18px; }
.chip.on { background: var(--butter); color: var(--night); border-color: var(--brass); }
.assist-info { width: 100%; text-align: center; color: var(--butter); font-size: .92rem; line-height: 1.3; }
.react-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.react-btn { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid rgb(var(--cream-rgb) / .25); background: rgb(var(--shadow-rgb) / .25); font-size: 1.35rem; padding: 0; }
.actionbar {
  display: grid; gap: .45rem;
  padding: .35rem 0 max(12px, env(safe-area-inset-bottom));
}
.action-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.actionbar .spacer { display: none; }
@media (min-width: 600px) { .actionbar .spacer { display: block; } }
.action-btns .btn { width: 100%; min-height: 52px; }
.btn.can-out { box-shadow: 0 0 0 2px var(--butter), 0 4px 0 var(--card-shade), 0 6px 10px -4px rgb(var(--shadow-rgb) / .55); }

/* scorepad (pinned on laptop/desktop) */
.scorepad { display: none; }
.scorepad h3 { font-size: 1.15rem; color: var(--ink); margin-bottom: .35rem; }
.standings { list-style: none; margin: 0; padding: 0; display: grid; }
.standings li { display: flex; align-items: center; gap: .5rem; padding: .32rem .1rem; border-bottom: 1px solid var(--card-edge); color: var(--ink); }
.standings li:last-child { border-bottom: 0; }
.standings li.turn .sname { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.standings li.gone { opacity: .45; }
.sname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.standings li.me .sname { font-weight: 700; }
.sscore { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---- short phones (375 × 667 and similar): pull everything tighter */
@media (max-width: 599px) and (max-height: 740px) {
  .table-screen { --cw: 64px; --pcw: 70px; gap: .35rem; }
  .ticker { display: none; }
  .me-head { font-size: .9rem; line-height: 1.1; }
  .laid .final-banner { display: none; }
  .laid .card.mini { --cw: 28px; }
  .laid .card.mini .rank { font-size: 12px; }
  .center { gap: .45rem; padding-block: .2rem; }
  .actionbar { gap: .35rem; padding-top: .2rem; }
  .action-btns .btn { min-height: 48px; }
}

/* ---- tablet and up: seats with fanned backs, actions under the hand */
@media (min-width: 600px) {
  .table-screen { padding-left: max(.8rem, env(safe-area-inset-left)); padding-right: max(.8rem, env(safe-area-inset-right)); }
  .opps { flex-wrap: wrap; justify-content: center; gap: .7rem; overflow: visible; padding: .7rem .7rem .2rem; }
  .opp { flex: 0 1 auto; min-width: 170px; max-width: 260px; grid-template-columns: auto minmax(0, 1fr) auto auto; padding: .45rem .7rem .45rem .5rem; }
  .opp .avatar { width: 36px; height: 36px; }
  .opp-hand { display: flex; align-items: center; gap: .35rem; padding-left: .3rem; }
  .opp-hand .count { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
  .opp:nth-child(odd) { transform: rotate(-1deg); } .opp:nth-child(even) { transform: rotate(1deg); }
  .actionbar { grid-template-columns: 1fr auto 1fr; align-items: center; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .actionbar .tools { justify-content: flex-start; }
  .action-btns { grid-template-columns: auto auto; }
  .action-btns .btn { min-width: 150px; }
  .actionbar .react-tray, .actionbar .assist-info { grid-column: 1 / -1; }
}
@media (min-width: 600px) and (max-width: 1023px) {
  .actionbar { grid-template-columns: auto 1fr; }
  .actionbar .spacer { display: none; }
  .action-btns { justify-content: end; }
}

/* ---- laptop and desktop: scorepad pinned top-right */
@media (min-width: 1024px) {
  /* piles sit dead centre on the felt; the scorepad is pinned over the top-right corner */
  .opps { padding-left: calc(var(--pad-w, 210px) + 1.6rem); padding-right: calc(var(--pad-w, 210px) + 1.6rem); }
  .scorepad {
    display: block; width: var(--pad-w, 210px);
    padding: .9rem .9rem .7rem; transform: rotate(1.5deg); z-index: 2;
  }
  .board > .scorepad { position: absolute; top: .8rem; right: .8rem; }
  .scorepad .pin { position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--tomato); box-shadow: inset -2px -2px 0 rgb(var(--shadow-rgb) / .25), 0 2px 3px rgb(var(--shadow-rgb) / .4); }
  .score-btn { display: none; }
}
@media (min-width: 1440px) { .board { --pad-w: 250px; } }

/* ---- phone landscape: piles left, opponents right, hand along the bottom */
@media (orientation: landscape) and (max-height: 520px) {
  .table-screen { --cw: clamp(52px, 16vh, 76px); --pcw: clamp(44px, 12vh, 64px); gap: .3rem; }
  .piles { gap: 1.2rem; }
  .pile { gap: .2rem; }
  .pile-label { font-size: .74rem; }
  .final-banner { font-size: .78rem; padding: .15rem .6rem .2rem; }
  .tbar { min-height: 44px; }
  .board { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .center { grid-column: 1; grid-row: 1; padding: .3rem .6rem; gap: .35rem; }
  .opps { grid-column: 2; grid-row: 1; flex-wrap: wrap; align-content: center; justify-content: center; overflow-y: auto; }
  .opp { transform: none !important; }
  .me { grid-column: 1 / -1; grid-row: 2; }
  .me-head, .ticker { display: none; }
  .scorepad { display: none !important; }
  .score-btn { display: inline-flex !important; }
  .prompt-strip { font-size: .82rem; padding: .2rem .6rem; }
  .center { align-content: start; gap: .3rem; }
  .actionbar { grid-template-columns: 1fr auto; }
  .actionbar .tools { grid-row: 1; }
  .action-btns .btn { min-height: 46px; min-width: 120px; }
}

/* ================================================================ overlays, sheets & modals */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center;
  background: rgb(var(--shadow-rgb) / .72); overflow-y: auto;
  padding: .6rem .6rem 0; animation: fade 200ms ease;
}
.sheet {
  width: min(720px, 100%); max-height: calc(100dvh - 1.2rem); overflow-y: auto;
  padding: 1.4rem 1.2rem max(1.2rem, env(safe-area-inset-bottom)); display: grid; gap: .9rem;
  border-radius: var(--r-panel) var(--r-panel) 0 0; animation: rise 260ms var(--ease-card);
}
.sheet { overflow-x: hidden; }
.sheet::before { display: none; }
.sheet .ad-banner .ad-body { width: 320px; height: 100px; }
.sheet h2 { font-size: clamp(1.7rem, 3vw + 1rem, 2.4rem); color: var(--ink); }
.sheet .label { color: var(--moss); }
.results { display: grid; gap: .55rem; }
.res-row { display: grid; gap: .5rem; padding: .7rem .75rem; border-radius: 10px; background: var(--card-hi); border: 1px solid var(--card-edge); }
.res-row.me { border-color: var(--moss); }
.res-row.out { background: var(--wild-face); }
.res-head { display: flex; align-items: center; gap: .5rem; }
.res-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.res-pts { font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); min-width: 2.4ch; text-align: right; font-variant-numeric: tabular-nums; }
.res-total { font-size: .88rem; color: var(--muted-ink); min-width: 7ch; text-align: right; font-variant-numeric: tabular-nums; }
.res-cards { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.meld { display: inline-flex; padding: 3px 4px; border-radius: 7px; background: rgb(var(--shadow-rgb) / .06); }
.meld.loose { background: rgb(210 85 58 / .1); box-shadow: inset 0 0 0 1px rgb(210 85 58 / .4); }
.sheet-actions { display: grid; gap: .5rem; justify-items: center; }
.sheet-actions .btn-lg { width: 100%; }
.final { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.final li { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px; background: var(--card-hi); border: 1px solid var(--card-edge); }
.final li.winner { background: var(--wild-face); box-shadow: 0 0 0 2px var(--butter); }
.final li .crown { width: 20px; height: 20px; }
.rankno { font-family: var(--font-display); width: 1.6ch; color: var(--muted-ink); }
.last-round summary { cursor: pointer; color: var(--moss); min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.last-round .results { margin-top: .4rem; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center;
  background: rgb(var(--shadow-rgb) / .72); animation: fade 150ms ease;
}
.modal {
  width: 100%; max-height: calc(100dvh - 2.5rem); display: grid; grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--r-panel) var(--r-panel) 0 0; animation: rise 240ms var(--ease-card);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1rem .3rem 1.2rem; }
.modal-head h2 { font-size: 1.55rem; color: var(--ink); }
.modal-body { padding: .4rem 1.2rem max(1.3rem, env(safe-area-inset-bottom)); overflow-y: auto; color: var(--ink); }
@media (min-width: 600px) {
  .overlay { place-items: center; padding: 1rem; }
  .sheet { border-radius: var(--r-panel); max-height: calc(100dvh - 2rem); padding: 1.6rem 1.6rem 1.4rem; }
  .modal-backdrop { place-items: center; padding: 1rem; }
  .modal { width: min(480px, 100%); max-height: calc(100dvh - 2rem); border-radius: var(--r-panel); }
  .modal.wide { width: min(660px, 100%); }
}

.prose { display: grid; gap: .7rem; font-size: 1rem; }
.prose h3 { font-size: 1.2rem; margin-top: .5rem; color: var(--ink); }
.prose ul, .prose ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.prose ul.cols { display: block; columns: 2; } .prose ul.cols li { break-inside: avoid; margin-bottom: .25rem; }
.demo-row { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.preview-box { display: grid; gap: .6rem; padding: .8rem; border: 1.5px dashed var(--card-shade); border-radius: 10px; }
.menu { display: grid; gap: .9rem; } .menu h3 { font-size: 1.15rem; color: var(--ink); }
.menu-list { display: grid; gap: .6rem; margin-top: .3rem; }
.menu-list .btn { width: 100%; }
.score-wrap { overflow-x: auto; }
.score-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.score-table th, .score-table td { padding: .45rem .6rem; text-align: center; border-bottom: 1px solid var(--card-edge); white-space: nowrap; }
.score-table th:first-child { text-align: left; color: var(--muted-ink); font-weight: 500; }
.score-table .me { color: var(--moss); font-weight: 700; }
.score-table tfoot th, .score-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); font-size: 1.05rem; }

/* ================================================================ toasts, banner, floaters, confetti */
#conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 90; padding: .5rem 1rem; text-align: center; background: var(--butter); color: var(--night); font-weight: 700; border-bottom: 2px solid var(--brass); }
#toasts { position: fixed; left: 0; right: 0; bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 5rem)); z-index: 80; display: grid; justify-items: center; gap: .4rem; padding: 0 1rem; pointer-events: none; }
.toast {
  max-width: 480px; padding: .6rem 1rem .65rem; border-radius: 8px;
  background: var(--card); color: var(--ink); border: 1px solid var(--card-edge); box-shadow: var(--shadow-paper);
  font-weight: 500; animation: rise 200ms ease; transform: rotate(-.6deg);
}
.toast.out { opacity: 0; transition: opacity 400ms ease; }
#float-layer { position: fixed; inset: 0; z-index: 70; overflow: hidden; pointer-events: none; }
.float-react { position: absolute; bottom: 22%; display: grid; justify-items: center; animation: floatup 2.4s ease-out forwards; }
.float-react .emo { font-size: 2.5rem; }
.float-react .who { padding: .05rem .5rem .1rem; border-radius: 6px; background: var(--card); color: var(--ink); font-size: .82rem; font-weight: 700; box-shadow: var(--shadow-card); }
.confetti { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: confetti 1s cubic-bezier(.25, .6, .4, 1) forwards; }

/* ================================================================ motion */
@keyframes deal-in { from { transform: translateY(-24px) rotate(-6deg); opacity: 0; } to { transform: translateY(var(--arc, 0px)) rotate(var(--rot, 0deg)); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; } }
@keyframes dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes floatup { 0% { opacity: 0; transform: translateY(30px); } 15% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-200px); } }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); opacity: 0; } }
/* ================================================================ lobby: game picker + bots */
.game-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; }
.game-chip { min-height: 48px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .35rem .5rem; }
.game-chip .chip-mark { width: 26px; height: 24px; }
.game-chip:disabled { opacity: .5; cursor: default; }
.game-chip.on:disabled { opacity: 1; }
.rules .field .hint { color: var(--muted-ink); font-size: .88rem; padding-left: .15rem; }
.rules details > summary .summary-game { margin-left: auto; margin-right: .5rem; color: var(--moss); font-family: var(--font-sc); font-weight: 700; letter-spacing: .1em; font-size: .85rem; }
.seat.add-bot { cursor: pointer; }
.seat.add-bot .avatar { color: var(--sea-glass); font-family: var(--font-body); font-size: 1.4rem; line-height: 1; }
@media (hover: hover) { .seat.add-bot:hover { border-color: var(--butter); color: var(--butter); } .seat.add-bot:hover .status { color: var(--butter); } }
.seat.add-bot:focus-visible { outline: 2px solid var(--butter); outline-offset: 2px; }
.rules-tabs { max-width: 320px; margin-bottom: .4rem; }

/* ================================================================ scum table */
.scum-pile { position: relative; display: grid; justify-items: center; gap: .4rem; }
.scum-pile .play { position: relative; z-index: 1; display: flex; align-items: flex-start; }
.scum-pile .play .card + .card { margin-left: calc(var(--cw) * -.55); }
.scum-pile .play .card:nth-child(odd) { transform: rotate(-2deg); }
.scum-pile .play .card:nth-child(even) { transform: rotate(2.5deg) translateY(2px); }
.scum-pile .play.prev { position: absolute; z-index: 0; top: 0; left: 50%; transform: translate(-62%, -6px) rotate(-7deg); opacity: .55; pointer-events: none; }
.scum-pile.run .play:not(.prev) .card { box-shadow: 0 0 0 2px var(--butter), var(--shadow-card); }
.scum-pile .pile-label { position: relative; z-index: 1; }
.run-banner { background: var(--moss); }
.badge.role { display: inline-flex; align-items: center; gap: .2rem; margin: 0 .35rem 0 0; }
.me-name .badge.role, .res-head .badge.role { margin-left: .4rem; }
.badge.role .crown { width: 12px; height: 12px; }
.badge.role-scum { background: var(--tomato); color: var(--card); }
.badge.role-viceScum { background: var(--card-edge); color: var(--tomato); }
.badge.role-vice { background: var(--card-edge); color: var(--moss); }
.opp.done .avatar { opacity: .7; }
.scum-table .opp-sub { overflow: hidden; text-overflow: ellipsis; }
.scum-table .opp-sub .badge.role { vertical-align: .05em; }
@media (min-width: 600px) { .scum-table .opp { min-width: 210px; max-width: 300px; } }
.action-btns.one { grid-template-columns: 1fr; }
.action-btns.three { grid-template-columns: 1fr 1fr 1fr; }
.action-btns.three .btn { min-width: 0; padding-left: .6rem; padding-right: .6rem; }
@media (min-width: 600px) { .action-btns.three .btn { min-width: 130px; } }
.act-lock { animation: pop-in 200ms var(--ease-card); box-shadow: 0 0 0 2px var(--butter), 0 4px 0 var(--edge); }
@keyframes pop-in { from { transform: translateY(6px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.out-note { color: var(--sea-glass); padding: 1rem 0; }
/* phones: a big hand sits on two overlapping rows, low cards behind */
.hand.two-rows { flex-direction: column; align-items: center; }
.hand.two-rows .hand-group + .hand-group { margin-left: 0; margin-top: calc(var(--cw) * -.86); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .toast, .overlay, .modal-backdrop { animation: fade 200ms ease !important; }
  .confetti { display: none; }
}
