
/* Layout: a card table. Charcoal felt ground, the walnut board as the one bold object, quiet panels around it. Single dark look by choice. */
:root {
  color-scheme: dark;
  --felt: #1d1f22;
  --panel: #26292d;
  --panel-2: #2e3237;
  --line: #3a3f45;
  --fg: #ebe6dc;
  --muted: #a49d91;
  --brass: #c9a55c;
  --brass-ink: #1f1608;
  --good: #7fb48a;
  --warn: #d9a54a;
  --bad: #d9705f;
  --walnut-1: #6b4428;
  --walnut-2: #57361f;
  --walnut-3: #4a2e1a;
  --walnut-edge: #36210f;
  --engrave: #2a170a;
  --maple-1: #f0d39c;
  --maple-2: #d9b074;
  --maple-ink: #4a2c14;
  --card: #eef1f3;
  --card-ink: #22272c;
  --card-line: #c7cdd2;
  --display: "Saira Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
}
html, body { min-height: 100%; }
body {
  background-color: var(--felt);
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.02) 0 1px, transparent 1px 24px);
  color: var(--fg);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 48px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { margin: 0; font: 800 30px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.brand span { font: 600 13px/1 var(--display); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.crumb { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chip.live { color: var(--brass); border-color: rgba(201,165,92,.45); }

/* buttons */
.btn { appearance: none; border: 0; border-radius: 6px; padding: 9px 16px; background: var(--brass); color: var(--brass-ink); font-weight: 700; cursor: pointer; transition: filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.linkbtn { appearance: none; background: none; border: 0; padding: 0; color: var(--brass); cursor: pointer; font-weight: 600; }

/* layout */
.game { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .game { grid-template-columns: minmax(0, 1.45fr) minmax(330px, 1fr); align-items: start; } }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.panel h2 { margin: 0 0 10px; font: 700 15px/1.2 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.num { font-variant-numeric: tabular-nums; }

/* status strip */
.status { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 500; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.mine { border-color: rgba(201,165,92,.6); }
.status.mine .dot { background: var(--brass); box-shadow: 0 0 0 4px rgba(201,165,92,.18); }

/* ===== board ===== */
.board {
  position: relative; border-radius: 10px; padding: clamp(10px, 2.4vw, 22px);
  background:
    repeating-linear-gradient(94deg, rgba(0,0,0,.07) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(87deg, rgba(255,214,170,.035) 0 1px, transparent 1px 13px),
    radial-gradient(120% 80% at 30% 20%, rgba(255,200,150,.06), transparent 60%),
    linear-gradient(180deg, var(--walnut-1), var(--walnut-2) 55%, var(--walnut-3));
  box-shadow: 0 9px 0 var(--walnut-edge), 0 18px 30px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,180,.12);
  margin-bottom: 9px;
  display: grid; grid-template-columns: minmax(0,1fr); gap: 12px;
}
@media (min-width: 700px) { .board { grid-template-columns: auto minmax(0,1fr) auto; align-items: stretch; } }
.legend { display: none; }
@media (min-width: 700px) {
  .legend { display: flex; flex-direction: column; justify-content: space-between; padding-block: 2px; }
  .legend .eng { width: 30px; height: 30px; color: var(--engrave); opacity: .82; filter: drop-shadow(0 1px 0 rgba(255,214,170,.16)); }
}
.wordmark { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--engrave); text-shadow: 0 1px 0 rgba(255,214,170,.16); }
.wordmark b { font: 800 clamp(26px, 6vw, 40px)/1 var(--display); letter-spacing: .1em; opacity: .85; }
.wordmark i { font: 700 clamp(11px, 2.4vw, 14px)/1.1 var(--display); letter-spacing: .2em; font-style: normal; opacity: .8; text-align: right; }
@media (min-width: 700px) {
  .wordmark { writing-mode: vertical-rl; flex-direction: row; justify-content: flex-start; gap: 6px; }
  .board .wordmark-top { display: none; }
}
@media (max-width: 699px) { .board .wordmark-side { display: none; } }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(2px, .55vw, 6px); }
.cell {
  position: relative; aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(0,0,0,.22), rgba(0,0,0,.12));
  box-shadow: inset 0 2px 3px rgba(0,0,0,.55), inset 0 -1px 0 rgba(255,220,180,.07);
  font: 700 clamp(7px, 1.45vw, 13px)/1 var(--mono); color: rgba(30,15,5,.78);
  text-shadow: 0 1px 0 rgba(255,214,170,.17); letter-spacing: -.02em; user-select: none;
}
.cell.inhand { box-shadow: inset 0 2px 3px rgba(0,0,0,.55), inset 0 0 0 1.5px rgba(201,165,92,.55); color: rgba(240,211,156,.9); text-shadow: none; cursor: pointer; }
.cell.sel { box-shadow: inset 0 0 0 2px var(--brass), 0 0 0 2px rgba(201,165,92,.35); background: rgba(201,165,92,.22); color: #f6e3b8; }
.tile {
  position: absolute; inset: 0; border-radius: 3px; display: grid; place-items: center;
  background:
    repeating-linear-gradient(97deg, rgba(120,70,20,.08) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, var(--maple-1), var(--maple-2));
  color: var(--maple-ink); text-shadow: 0 1px 0 rgba(255,240,210,.5);
  box-shadow: 0 2px 0 #9b7240, 0 3px 5px rgba(0,0,0,.45);
  transform: translateY(-2px);
}
.tile.chain { background: repeating-linear-gradient(97deg, rgba(255,255,255,.07) 0 1px, transparent 1px 5px), linear-gradient(180deg, var(--c), var(--c-d)); color: var(--c-ink); text-shadow: 0 1px 0 rgba(0,0,0,.25); box-shadow: 0 2px 0 var(--c-e), 0 3px 5px rgba(0,0,0,.45); }
.tile.last::after { content: ""; position: absolute; inset: -3px; border-radius: 5px; border: 2px solid var(--brass); }
.tile.pending::after { content: ""; position: absolute; inset: -3px; border-radius: 5px; border: 2px dashed var(--brass); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tile.pending::after { animation: none; } }

/* chain colors (inlay stains) */
.c-ncaa { --c: #2f4f8a; --c-d: #243d6c; --c-e: #17284a; --c-ink: #f3e6cc; }
.c-sns { --c: #b4473a; --c-d: #91372c; --c-e: #63241c; --c-ink: #f8e8cf; }
.c-anthem { --c: #3d8a72; --c-d: #2e6e5a; --c-e: #1e4a3c; --c-ink: #f0ead6; }
.c-angi { --c: #d2702c; --c-d: #b2591d; --c-e: #78380e; --c-ink: #2a1606; }
.c-cummins { --c: #6c5aa0; --c-d: #554583; --c-e: #382c5a; --c-ink: #f1e9f6; }
.c-lilly { --c: #e6cf4e; --c-d: #cdb232; --c-e: #8a7516; --c-ink: #2a1f06; }
.c-salesforce { --c: #5cc0d6; --c-d: #3fa3ba; --c-e: #246a7c; --c-ink: #0f2430; }
/* small engraved chain glyph on each chain tile, so colour is not the only cue */
.tile .tic { position: absolute; right: 2px; top: 2px; width: 34%; height: 34%; opacity: .7; }
.tile .tic svg { width: 100%; height: 100%; }
@media (max-width: 699px) { .tile .tic { display: none; } }
.badge { width: 28px; height: 28px; flex: none; border-radius: 6px; display: grid; place-items: center; background: linear-gradient(180deg, var(--c), var(--c-d)); color: var(--c-ink); box-shadow: inset 0 -2px 0 var(--c-e); }
.badge svg { width: 19px; height: 19px; }
.badge.sm { width: 20px; height: 20px; border-radius: 4px; }
.badge.sm svg { width: 14px; height: 14px; }
.dotc { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; flex: none; }

/* hand */
.hand { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.htile { appearance: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: stretch; gap: 6px; background: none; min-width: 0; }
.htile .face {
  aspect-ratio: 1; border-radius: 5px; display: grid; place-items: center; font: 700 clamp(15px, 3.6vw, 22px)/1 var(--mono); color: var(--maple-ink);
  background: repeating-linear-gradient(97deg, rgba(120,70,20,.08) 0 1px, transparent 1px 5px), linear-gradient(180deg, var(--maple-1), var(--maple-2));
  box-shadow: 0 3px 0 #9b7240, 0 5px 8px rgba(0,0,0,.45); transition: transform .12s;
}
.htile:hover .face { transform: translateY(-2px); }
.htile[aria-pressed="true"] .face { box-shadow: 0 3px 0 #9b7240, 0 0 0 3px var(--brass), 0 6px 12px rgba(0,0,0,.5); transform: translateY(-3px); }
.htile.off .face { filter: saturate(.3) brightness(.62); }
.htile .why { font-size: 11.5px; line-height: 1.25; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.htile.off .why { color: var(--bad); }
.htile.empty .face { background: rgba(0,0,0,.18); box-shadow: inset 0 2px 4px rgba(0,0,0,.4); }
.htile.empty { cursor: default; }
@media (max-width: 480px) { .hand { grid-template-columns: repeat(3, minmax(0, 1fr)); } .htile .face { aspect-ratio: auto; height: 54px; } .htile .why { overflow-wrap: normal; } }

/* action panel */
.action { border-color: rgba(201,165,92,.5); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choice { appearance: none; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; text-align: left; }
.choice:hover:not(:disabled) { border-color: var(--brass); }
.choice:disabled { opacity: .4; cursor: not-allowed; }
.choice small { display: block; color: var(--muted); font-size: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stepper button { appearance: none; border: 0; background: var(--panel-2); width: 34px; height: 32px; cursor: pointer; font-weight: 700; font-size: 17px; }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.buyrow { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; padding-block: 7px; border-bottom: 1px solid var(--line); }
.buyrow:last-of-type { border-bottom: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 4px; accent-color: var(--brass); }

/* tables */
.scroll { overflow-x: auto; }
table.mkt { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.mkt th { text-align: right; vertical-align: bottom; font: 700 10.5px/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 5px 7px; border-bottom: 1px solid var(--line); }
.mkt th:first-child, .mkt td:first-child { text-align: left; padding-left: 0; }
.mkt td { text-align: right; padding: 7px 5px; border-bottom: 1px solid rgba(58,63,69,.6); white-space: nowrap; }
.mkt tr:last-child td { border-bottom: 0; }
.mkt tr.off td { color: var(--muted); }
.mkt tr.off .badge { opacity: .55; }
.cname { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.pill.safe { background: rgba(127,180,138,.16); color: var(--good); }
.pill.end { background: rgba(217,112,95,.16); color: var(--bad); }

/* players */
.plist { display: flex; flex-direction: column; }
.prow { display: grid; grid-template-columns: 14px minmax(0,1fr) auto; gap: 4px 10px; padding-block: 9px; border-bottom: 1px solid var(--line); align-items: center; }
.prow:last-child { border-bottom: 0; }
.prow .turnmark { width: 8px; height: 8px; border-radius: 50%; }
.prow.now .turnmark { background: var(--brass); box-shadow: 0 0 0 3px rgba(201,165,92,.2); }
.prow.now { background: linear-gradient(90deg, rgba(201,165,92,.14), transparent 70%); margin-inline: -16px; padding-inline: 16px; border-left: 3px solid var(--brass); }
.prow.now .name { color: var(--brass); }
.lastact { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lastact.up { color: var(--brass); font-weight: 600; }
.prow .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .cash { font-weight: 700; font-variant-numeric: tabular-nums; }
.holds { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.holds span { display: inline-flex; align-items: center; gap: 5px; }
.holds b { color: var(--fg); font-weight: 600; }
.holds .badge.sm { width: 18px; height: 18px; }
.holds .badge.sm svg { width: 12px; height: 12px; }

/* price card, like the paper one */
.pcard { background: var(--card); color: var(--card-ink); border-radius: 4px; padding: 12px 12px 10px; box-shadow: 0 6px 16px rgba(0,0,0,.4); transform: rotate(-.6deg); }
.pcard table { border-collapse: collapse; width: 100%; font: 12px/1.3 var(--body); font-variant-numeric: tabular-nums; }
.pcard caption { font-weight: 600; font-size: 12px; padding-bottom: 6px; text-align: left; }
.pcard th { font-weight: 600; font-size: 11px; vertical-align: bottom; padding: 0 5px 5px; border-bottom: 1px solid var(--card-line); text-align: center; }
.pcard td { padding: 2px 5px; text-align: center; border-left: 1px solid var(--card-line); }
.pcard td:first-child { border-left: 0; }
details.fold > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; color: var(--muted); font-weight: 700; }
details.fold[open] > summary::after { content: "\2212"; }
details.fold > summary h2 { margin: 0; }
details.fold[open] > summary { margin-bottom: 12px; }

/* log */
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; max-height: 340px; overflow-y: auto; }
.log li { padding-left: 12px; border-left: 2px solid var(--line); }
.log li:first-child { border-left-color: var(--brass); }

/* lobby */
.tables { display: flex; flex-direction: column; }
.trow { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding-block: 11px; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.trow .t1 { font-weight: 600; }
.trow .t2 { font-size: 13px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input[type=text] { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; color: var(--fg); font: inherit; max-width: 260px; width: 100%; }
.seats { display: flex; flex-direction: column; gap: 6px; }
.seat { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel-2); border-radius: 6px; }
.seat .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--felt); font-size: 12px; font-weight: 700; color: var(--muted); flex: none; }
.empty { padding: 18px 4px; color: var(--muted); }

/* standings */
.standings td.win { color: var(--brass); font-weight: 700; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); max-width: min(520px, calc(100% - 32px)); background: #3b2a24; color: #f6e2dc; border: 1px solid var(--bad); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); font-weight: 500; z-index: 10; }
.busy { position: fixed; right: 16px; top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; color: var(--muted); z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== self-hosted additions ===== */
html { padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; }
a { color: var(--brass); }
.brand a { color: inherit; text-decoration: none; display: flex; align-items: baseline; gap: 10px; }
.chip.warn { color: var(--warn); border-color: rgba(217,165,74,.45); }
.btn.danger { background: var(--bad); color: #210a06; }

/* drop animation for the newest tile */
.tile.drop { animation: drop .5s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes drop { from { transform: translateY(-20px) scale(1.3); opacity: 0; } to { transform: translateY(-2px) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tile.drop { animation: none; } }

/* home */
.hero-note { margin: 0 0 4px; color: var(--muted); }
.codebox { font: 700 20px/1 var(--mono); letter-spacing: .25em; text-transform: uppercase; width: 7.5em !important; }
.mine-list { display: flex; flex-direction: column; gap: 6px; }

/* invite */
.invite { display: flex; flex-direction: column; gap: 10px; }
.bigcode { font: 700 clamp(34px, 9vw, 46px)/1 var(--mono); letter-spacing: .22em; color: var(--maple-1); }
.linkline { font: 500 13px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; user-select: all; }

/* presence */
.prow { grid-template-columns: 14px minmax(0,1fr) auto; }
.presence { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 6px; vertical-align: middle; background: var(--good); }
.presence.away { background: transparent; border: 1.5px solid var(--muted); width: 6px; height: 6px; }
.seat .presence { margin-left: 0; }
.skipline { grid-column: 2 / 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--warn); }

/* phone tray: the hand lives at the bottom of the screen */
.tray { display: none; }
@media (max-width: 699px) {
  body.has-tray .wrap { padding-bottom: 168px; }
  .handpanel { display: none; }
  .tray {
    display: flex; flex-direction: column; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(26,28,31,.97); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.45);
  }
  .tray .hint { font-size: 13.5px; min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .tray .hint .btn { padding: 8px 14px; }
  .tray .hand { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
  .tray .htile .face { aspect-ratio: auto; height: 46px; font-size: 15px; }
  .tray .htile .why { display: none; }
}

/* merger sheet */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(8,9,10,.66); display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 700px) { .backdrop { align-items: center; } }
.sheet { width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; background: var(--panel); border: 1px solid rgba(201,165,92,.5); border-radius: 12px; padding: 18px 18px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.sheet h2 { margin: 0 0 4px; font: 800 24px/1.1 var(--display); letter-spacing: .04em; }
.sheet .sub { color: var(--muted); margin: 0 0 14px; }
.mblock { border-top: 1px solid var(--line); padding-block: 12px; display: flex; flex-direction: column; gap: 8px; }
.mblock .mhead { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.mblock .mhead .muted { font-weight: 500; }
.mline { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.mline span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.survivor { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); margin-bottom: 4px; }
.offline-banner { background: #3a2e1a; border: 1px solid var(--warn); color: #f3e1bd; padding: 10px 14px; border-radius: 8px; font-weight: 500; }

/* phone polish */
.status { flex-wrap: wrap; }
@media (max-width: 520px) {
  .brand h1 { font-size: 24px; }
  .status .num { width: 100%; margin-left: 19px !important; font-size: 13px; }
  table.market th:nth-child(n+6), table.market td:nth-child(n+6) { display: none; }
}

/* ===== desktop table: everything on one screen, the board sized to the window ===== */
.dock { display: contents; }
@media (min-width: 1100px) and (min-height: 640px) {
  /* only the live table pins to the window; home and lobby keep the normal page */
  html:has(body[data-status="play"]), html:has(body[data-status="over"]), body[data-status="play"], body[data-status="over"] { height: 100%; overflow: hidden; }
  body[data-status="play"] .wrap, body[data-status="over"] .wrap { max-width: none; height: 100%; box-sizing: border-box; padding: 10px 18px 12px; display: flex; flex-direction: column; gap: 0; }
  body[data-status="play"] .top, body[data-status="over"] .top { margin-bottom: 6px; flex: none; }
  body[data-status="play"] .brand h1, body[data-status="over"] .brand h1 { font-size: 20px; }
  body[data-status="play"] .brand span, body[data-status="over"] .brand span { font-size: 11px; }
  .game.play .status { padding: 7px 14px; }
  .game.play { flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(0, 1fr) clamp(440px, 30vw, 520px); gap: 16px; align-items: stretch; }
  .game.play .col.left { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  .game.play .status { flex: none; }
  .game.play .boardwrap { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; align-items: center; }
  .game.play .board { height: 100%; max-width: 100%; aspect-ratio: 1.5; margin: 0; box-sizing: border-box; padding: 16px 18px; grid-template-columns: auto minmax(0,1fr) auto; align-content: center; gap: 12px; }
  .game.play .board .grid { align-self: center; }
  .game.play .legend { justify-content: space-evenly; }
  .game.play .dock { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; flex: none; align-items: stretch; max-height: 42%; }
  .game.play .dock > .panel { overflow-y: auto; margin: 0; }
  /* the rack gives way before the board does: tile size follows the window height */
  .game.play .hand { gap: 10px; grid-template-columns: repeat(6, minmax(0, clamp(58px, 10vh, 112px))); justify-content: center; }
  .game.play .htile .face { font-size: clamp(15px, 2.2vh, 22px); }
  .game.play .htile .why { font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .game.play .dock .panel h2 { margin-bottom: 6px; }
  /* market and players first; the log takes what is left and scrolls in place. On a short
     screen the column itself scrolls, log and folds last. */
  .game.play .col.right { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
  .game.play .col.right > .panel { flex: none; }
  .game.play .col.right > #logfold { flex: 1 1 auto; min-height: 170px; display: flex; flex-direction: column; overflow: hidden; }
  .game.play .col.right > #logfold:not([open]) { flex: none; }
  .game.play .col.right > #logfold > summary { flex: none; }
  .game.play .log { max-height: none; flex: 1 1 auto; min-height: 0; }
  .game.play .panel { padding: 11px 16px; }
  .game.play .mkt td { padding: 5px 4px; }
  .game.play .mkt { font-size: 12.5px; }
  .game.play .prow { padding-block: 6px; }
  .game.play .holds, .game.play .lastact { font-size: 12px; }
  .game.play .mkt th { font-size: 10px; }
}

/* computer players and problem reports */
.cpu { display: inline-block; font: 700 9.5px/1 var(--body); letter-spacing: .08em; padding: 3px 5px 2px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.seat .cpu { margin-left: 0; }
.reportbtn { font-size: 13px; margin-right: 6px; }
.reporttext { width: 100%; box-sizing: border-box; background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: 14px/1.4 var(--body); resize: vertical; }
.reporttext.mono { font: 12px/1.35 var(--mono); color: var(--muted); }
.reportpeek { margin-top: 12px; }
.reportpeek summary { cursor: pointer; font-size: 13px; margin-bottom: 6px; }
