/* Art Auction: gallery tokens and the shell, landing and lobby screens. */

:root {
  --wall: #1b1917;
  --wall-2: #26221f;
  --spot: rgba(255, 220, 170, .16);
  --floor: #c9a77c;
  --floor-2: #a8865c;
  --brass: #c8a254;
  --brass-2: #e7cd8a;
  --ink: #f3ede4;
  --muted: #a69e93;
  /* Supporting text that must still read on the wall (about 9:1 on --wall). */
  --ink-2: #cfc7bb;
  --danger: #b23a3a;
  --ok: #5b9c6b;

  --display: 'Cormorant Garamond', serif;
  --ui: 'Manrope', system-ui, sans-serif;

  --radius-sm: 6px;
  --radius-lg: 12px;

  /* Frames: a thin brass moulding, a dark mat line, and a cast shadow on the wall. */
  --frame-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 0 3px var(--brass), 0 0 0 4px rgba(0, 0, 0, .45), 0 18px 30px -12px rgba(0, 0, 0, .75);
  --frame-shadow-lift: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 0 3px var(--brass-2), 0 0 0 4px rgba(0, 0, 0, .45), 0 26px 44px -14px rgba(0, 0, 0, .8);
  --plaque-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .25), 0 3px 8px rgba(0, 0, 0, .45);

  --gutter: clamp(16px, 4vw, 48px);
  --floor-h: clamp(56px, 9vh, 96px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--wall);
  background-image:
    radial-gradient(ellipse 60% 55% at 50% 38%, var(--spot), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, var(--wall-2), var(--wall) 75%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

main { position: relative; }

:focus-visible { outline: 2px solid var(--brass-2); outline-offset: 3px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-pad: 12px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: var(--btn-pad);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--ink);
  font: 500 15px/1 var(--ui);
  letter-spacing: .01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .42; }

.btn-primary {
  border-color: var(--brass);
  color: var(--brass-2);
  background: linear-gradient(180deg, rgba(200, 162, 84, .14), rgba(200, 162, 84, .04));
  box-shadow: inset 0 1px 0 rgba(231, 205, 138, .18);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(200, 162, 84, .26), rgba(200, 162, 84, .1));
  border-color: var(--brass-2);
  color: var(--ink);
}

.btn-ghost {
  border-color: rgba(243, 237, 228, .18);
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled) { border-color: rgba(243, 237, 228, .42); background: rgba(243, 237, 228, .05); }

.btn-link {
  min-height: 44px;
  padding: 8px 4px;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: rgba(166, 158, 147, .4);
  text-underline-offset: 4px;
}
.btn-link:hover { color: var(--ink); text-decoration-color: var(--brass); }

.btn-lg { --btn-pad: 16px 30px; font-size: 16px; min-height: 52px; }
.btn-sm { --btn-pad: 8px 14px; font-size: 14px; min-height: 36px; }

/* ---------------------------------------------------------------- inputs */

.text-input, .code-input, .link-field {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(243, 237, 228, .16);
  background: rgba(10, 9, 8, .55);
  color: var(--ink);
  font: 500 16px/1.2 var(--ui);
  transition: border-color .18s ease, background-color .18s ease;
}
.text-input::placeholder, .code-input::placeholder { color: rgba(166, 158, 147, .7); }
.text-input:hover, .code-input:hover { border-color: rgba(243, 237, 228, .3); }
.text-input:focus, .code-input:focus { outline: none; border-color: var(--brass); background: rgba(10, 9, 8, .75); }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
}
.wordmark {
  font: italic 500 24px/1 var(--display);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .01em;
}
.wordmark:hover { color: var(--brass-2); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 237, 228, .12);
  background: rgba(10, 9, 8, .4);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill[data-status="online"]::before { background: var(--ok); box-shadow: 0 0 8px rgba(91, 156, 107, .8); }
.status-pill[data-status="offline"]::before { background: var(--danger); }
.status-pill[data-status="connecting"]::before { background: var(--brass); animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: .3; } }

/* ---------------------------------------------------------------- floor */

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--floor-h);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 14px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 179px, rgba(60, 40, 20, .22) 179px 181px),
    linear-gradient(180deg, var(--floor), var(--floor-2));
  border-top: 6px solid #2c2622; /* skirting board */
  pointer-events: none;
}

/* ---------------------------------------------------------------- landing */

[data-screen="landing"] {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 48px var(--gutter) calc(var(--floor-h) + 40px);
}

.wall {
  position: absolute;
  inset: 0 0 var(--floor-h) 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4vh 0 3vh;
  pointer-events: none;
  opacity: .62;
  /* Paintings hang above and below the title band, never behind the controls. */
  -webkit-mask-image: linear-gradient(180deg, #000 0 26%, transparent 38% 64%, #000 76%);
  mask-image: linear-gradient(180deg, #000 0 26%, transparent 38% 64%, #000 76%);
}
.wall-row {
  overflow: visible;
  /* Frames fade out at the screen edges, so a sliver of one reads as a painting going round the corner. */
  -webkit-mask-image: linear-gradient(90deg, transparent 0 1%, #000 8%, #000 92%, transparent 99%);
  mask-image: linear-gradient(90deg, transparent 0 1%, #000 8%, #000 92%, transparent 99%);
}
.wall-track {
  display: flex;
  align-items: flex-start;
  gap: 72px;
  width: max-content;
  padding-left: 36px;
  animation: drift-left 90s linear infinite;
  will-change: transform;
}
.wall-row--right .wall-track { animation-name: drift-right; }

@keyframes drift-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes drift-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

.wall-frame {
  margin: 0;
  flex: none;
  line-height: 0;
  padding: 7px;
  background: #0f0d0c;
  box-shadow: var(--frame-shadow);
}
.wall-frame canvas { display: block; filter: brightness(1.08) saturate(1.05); }

/* A pool of darkness behind the title, then the spotlight on it. */
.spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 44% 42% at 50% 47%, rgba(27, 25, 23, .96) 0%, rgba(27, 25, 23, .82) 55%, rgba(27, 25, 23, 0) 100%),
    radial-gradient(ellipse 30% 46% at 50% 0%, rgba(255, 220, 170, .14), transparent 70%);
}

.landing-hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(64px, 11.5vw, 168px);
  line-height: .9;
  letter-spacing: -.025em;
  color: var(--ink);
  text-shadow: 0 2px 40px rgba(0, 0, 0, .7);
  white-space: nowrap;
}

.tagline {
  margin: 14px 0 0;
  font: italic 500 clamp(24px, 2.6vw, 34px)/1.2 var(--display);
  color: var(--ink);
  opacity: .78;
}

.landing-actions {
  margin-top: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 20px;
}
.landing-or { font: italic 500 20px/1 var(--display); color: var(--muted); }

.join-code { display: flex; gap: 8px; }
.code-input {
  width: 150px;
  background: rgba(243, 237, 228, .06);
  border-color: rgba(200, 162, 84, .55);
  min-height: 52px;
  text-align: center;
  font: 600 22px/1 var(--display);
  letter-spacing: .32em;
  padding-left: calc(14px + .32em);
  text-transform: uppercase;
  font-feature-settings: 'lnum' 1;
}
.code-input::placeholder { font: 500 16px/1 var(--ui); letter-spacing: .02em; text-transform: none; color: rgba(243, 237, 228, .72); }
.code-input:hover { border-color: var(--brass); }
.join-code .btn { min-width: 84px; border-color: rgba(200, 162, 84, .55); color: var(--brass-2); }
/* Disabled until a full code is typed: still a button (muted outline, dimmed label), not loose text. */
.join-code .btn:disabled { opacity: 1; border-color: rgba(243, 237, 228, .16); background: rgba(243, 237, 228, .025); color: rgba(166, 158, 147, .75); }
.join-code .btn { min-height: 52px; }

.landing-meta {
  margin: 40px 0 0;
  font-size: 15px;
  color: var(--ink-2);
  text-shadow: 0 1px 12px rgba(0, 0, 0, .8);
}
/* "How to play" runs on from the description as a brass link, same dialog as the lobby's. */
.landing-howto {
  display: inline;
  min-height: 0;
  padding: 0 2px;
  font: inherit;
  color: var(--brass-2);
  text-decoration-color: rgba(200, 162, 84, .5);
  white-space: nowrap;
}
.landing-howto:hover, .landing-howto:focus-visible { color: var(--ink); text-decoration-color: var(--brass-2); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- lobby */

[data-screen="lobby"] {
  position: relative;
  min-height: calc(100vh - 72px);
  min-height: calc(100dvh - 72px);
  padding: 8px var(--gutter) calc(var(--floor-h) + 40px);
  overflow-x: clip;
}

.lobby {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lobby-head { display: flex; flex-direction: column; align-items: center; }
.lobby-kicker { margin: 0; font: 600 11px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.room-code {
  display: flex;
  gap: .08em;
  margin: 4px 0 12px;
  font: 600 40px/1 var(--display);
  letter-spacing: .16em;
  padding-left: .16em;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(0, 0, 0, .5);
  font-variant-numeric: lining-nums;
  font-feature-settings: 'lnum' 1;
}
.lobby-share { display: flex; align-items: center; gap: 16px; }
.link-field { margin-top: 12px; width: min(100%, 360px); font-size: 14px; }

.seats {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}

.seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; }
/* A picture light washing the wall above each occupied frame. */
.seat::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -120px;
  width: 300px;
  height: 420px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 42% 46% at 50% 42%, rgba(255, 220, 170, .17), rgba(255, 220, 170, .05) 60%, transparent 100%);
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.seat[data-filled="true"]::before { opacity: 1; }
.seat > * { position: relative; }

.seat-frame {
  position: relative;
  width: 100%;
  max-width: 156px;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border-radius: 2px;
  /* An open seat: an empty stretched canvas in a hairline brass frame, waiting to be hung. */
  border: 1px solid rgba(200, 162, 84, .5);
  background:
    repeating-linear-gradient(45deg, rgba(243, 237, 228, .035) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-45deg, rgba(243, 237, 228, .028) 0 1px, transparent 1px 5px),
    linear-gradient(160deg, rgba(243, 237, 228, .075), rgba(243, 237, 228, .02));
  box-shadow: inset 0 0 0 6px rgba(15, 13, 12, .32), inset 0 0 0 7px rgba(200, 162, 84, .35), 0 14px 24px -14px rgba(0, 0, 0, .7);
  transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.seat-initial {
  font: italic 500 clamp(44px, 6vw, 72px)/1 var(--display);
  color: var(--brass-2);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
}

.seat[data-filled="true"] .seat-frame {
  border: 10px solid #0f0d0c;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(255, 220, 170, .12), transparent 70%),
    linear-gradient(160deg, #332d28, #221e1b);
  box-shadow: var(--frame-shadow);
}
.seat[data-filled="true"] .seat-initial { opacity: 1; transform: none; }
.seat[data-you="true"] .seat-frame { box-shadow: var(--frame-shadow-lift), 0 0 60px -10px rgba(255, 220, 170, .25); }

/* A small cast-brass museum label under each frame. */
.seat-plaque {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 2px;
  color: var(--ink-2);
  font: italic 500 16px/1.2 var(--display);
  letter-spacing: .02em;
}
.seat[data-filled="false"] .seat-plaque { min-height: 0; padding: 0 4px; color: var(--ink-2); font-size: 16px; cursor: default; }
.seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-dot { display: none; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }

.seat[data-filled="true"] .seat-plaque {
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #a8823e);
  color: #2a2016;
  box-shadow: var(--plaque-shadow);
  font: 600 16px/1.2 var(--display);
  letter-spacing: .02em;
}
.seat[data-filled="true"] .seat-dot { display: block; background: #3f6b48; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.seat[data-connected="false"] .seat-dot { background: var(--danger); }
.seat[data-connected="false"] .seat-frame { opacity: .6; }

/* Computer players: a small muted tag beside the name, and a remove control in the lobby. */
.bot-tag {
  flex: none;
  font: 700 10px/1 var(--ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 3px 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
}
.bot-tag[hidden], .bot-remove[hidden] { display: none; }
.seat[data-filled="true"] .seat-plaque .bot-tag { color: #5a4524; }
.bot-remove {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .16);
  color: #2a2016;
  font: 700 16px/1 var(--ui);
  cursor: pointer;
}
/* Visual size stays 22px; the pseudo-element stretches the hit area to 44px. */
.bot-remove { position: relative; }
.bot-remove::before { content: ''; position: absolute; inset: -11px; }
.bot-remove:hover { background: rgba(0, 0, 0, .3); }
.bot-remove:focus-visible { outline: 2px solid #2a2016; outline-offset: 1px; }

.lobby-controls {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.join-form { display: flex; gap: 10px; width: min(100%, 420px); }
.join-form .text-input { flex: 1; min-width: 0; min-height: 52px; font-size: 17px; }
.join-form .btn { min-height: 52px; }
.seated-controls { display: flex; gap: 12px; align-items: center; }
.lobby-controls .btn-primary {
  min-width: 168px;
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 60%, #a8823e);
  border-color: #e9d29a;
  color: #231a10;
  font-weight: 700;
  box-shadow: var(--plaque-shadow), 0 14px 30px -14px rgba(231, 205, 138, .45);
}
.lobby-controls .btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f1dba2, var(--brass-2) 60%, var(--brass)); color: #1a130b; }
.lobby-controls .btn-primary:disabled { opacity: .45; box-shadow: var(--plaque-shadow); }
.lobby-hint { margin: 0; font-size: 14px; color: var(--muted); min-height: 21px; }

/* Table styles: see the table section below the small-screen rules. */

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--floor-h) + 20px);
  z-index: 50;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(200, 162, 84, .45);
  background: rgba(20, 18, 16, .94);
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

.displaced {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 9, 8, .78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.displaced-card {
  max-width: 420px;
  padding: 32px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(200, 162, 84, .4);
  background: var(--wall-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  text-align: center;
}
.displaced-card h2 { margin: 0; font: 600 30px/1.1 var(--display); text-wrap: balance; }
.displaced-card p { margin: 12px 0 24px; color: var(--muted); font-size: 15px; }
.status-pill[data-status="displaced"]::before { background: var(--brass); }

dialog.overlay {
  border: 1px solid rgba(200, 162, 84, .35);
  border-radius: var(--radius-lg);
  background: var(--wall-2);
  color: var(--ink);
}
dialog.overlay::backdrop { background: rgba(10, 9, 8, .7); }
/* (Overlay layouts live at the end of this file.) */

/* ---------------------------------------------------------------- small screens */

@media (max-width: 720px) {
  /* One group: Create, a small "or" rule, then the code row. */
  .landing-actions { flex-direction: column; gap: 12px; margin-top: 36px; }
  .landing-or { display: flex; align-items: center; gap: 10px; width: min(240px, 100%); font: 500 12px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .landing-or::before, .landing-or::after { content: ''; flex: 1; height: 1px; background: rgba(200, 162, 84, .3); }
  .wall-row { zoom: .62; -webkit-mask-image: linear-gradient(90deg, transparent 0 7%, #000 24%, #000 76%, transparent 93%); mask-image: linear-gradient(90deg, transparent 0 7%, #000 24%, #000 76%, transparent 93%); }
  .wall { -webkit-mask-image: linear-gradient(180deg, #000 0 14%, transparent 26% 70%, #000 82%); mask-image: linear-gradient(180deg, #000 0 14%, transparent 26% 70%, #000 82%); }
  .seat::before { width: 160px; }
  /* Three across, and a short last row centred under them. */
  .seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px 16px; margin-top: 40px; }
  .seats > .seat { flex: 0 0 calc((100% - 32px) / 3); }
  .seat-frame { max-width: 96px; aspect-ratio: 4 / 5; }
  .seat { gap: 12px; }
  .seat[data-filled="true"] .seat-frame { border-width: 7px; }
  .seat[data-filled="true"] .seat-plaque { font-size: 14px; padding: 4px 8px; }
  .seat[data-filled="false"] .seat-plaque { font-size: 14px; }
  .wall-track { gap: 40px; }
  .room-code { font-size: 34px; }
}

@media (max-width: 420px) {
  .title { font-size: 64px; }
  .seated-controls { flex-direction: column; width: 100%; }
  .seated-controls .btn { width: 100%; }
}

/* ---------------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .wall-track { animation: none; }
  .status-pill[data-status="connecting"]::before { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ================================================================ table */

[data-screen="table"] { position: relative; }
body[data-view="table"] .topbar { padding-top: 10px; padding-bottom: 10px; }

.table {
  --side: 248px;
  --log-w: 248px;
  position: relative;
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr) var(--log-w);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "board   board log"
    "players stage log"
    "hand    hand  bal";
  column-gap: 24px;
  row-gap: 12px;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  padding: 0 var(--gutter);
  overflow-x: clip;
}
.table[data-log="closed"] { --log-w: 44px; }

#board { grid-area: board; }
#seats { grid-area: players; }
#stage { grid-area: stage; }
#hand { grid-area: hand; }
#balance { grid-area: bal; }
#log-drawer { grid-area: log; }

/* The oak floor runs under the whole bottom row. */
.floor-band {
  grid-row: 3;
  grid-column: 1 / -1;
  margin: 0 calc(-1 * var(--gutter));
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0) 16px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 179px, rgba(60, 40, 20, .22) 179px 181px),
    linear-gradient(180deg, var(--floor), var(--floor-2));
  border-top: 6px solid #2c2622;
  pointer-events: none;
}

#fx-layer { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }

/* ---------------------------------------------------------------- card component */

.card {
  position: relative;
  flex: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
}
/* The frame is painted the artist's colour, so a glance at any card (hand,
   easel, a bought pile, the game-over wall) says whose it is. */
.card-frame {
  --frame-paint: linear-gradient(135deg, color-mix(in srgb, var(--artist) 78%, #fff6e0), var(--artist) 42%, color-mix(in srgb, var(--artist) 68%, #000));
  display: block;
  line-height: 0;
  padding: 5px;
  background: var(--frame-paint);
  box-shadow: var(--frame-shadow);
}
.card-art { display: block; outline: 1px solid rgba(0, 0, 0, .55); }
/* Long-press magnifies (magnify.js): no text selection or iOS callout on cards. */
.card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.card-plaque {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 0 8px 0 0;
  min-height: 20px;
  overflow: hidden;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #a8823e);
  color: #2a2016;
  box-shadow: var(--plaque-shadow);
  font: 700 13px/1 var(--display);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}
.plaque-bar { align-self: stretch; width: 7px; background: var(--artist); box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); }
.plaque-icon { width: 14px; height: 14px; stroke-width: 2; }

.card[data-size="mini"] .card-frame {
  padding: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 6px 10px -4px rgba(0, 0, 0, .8);
}
.card[data-size="mini"] .card-plaque { display: none; }

.card[data-size="easel"] .card-frame {
  padding: 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 0 0 4px var(--brass), 0 0 0 5px rgba(0, 0, 0, .5), 0 34px 50px -18px rgba(0, 0, 0, .85);
}
.card[data-size="easel"] .card-plaque { margin-top: 14px; min-height: 28px; gap: 8px; padding-right: 12px; font-size: 16px; }
.card[data-size="easel"] .plaque-bar { width: 10px; }
.card[data-size="easel"] .plaque-icon { width: 18px; height: 18px; }
.plaque-name { font-weight: 600; }

/* ---------------------------------------------------------------- board */

#board {
  display: grid;
  grid-template-columns: auto repeat(5, minmax(0, 1fr));
  /* name and value, the played bar, then a row per round */
  grid-template-rows: auto auto repeat(4, 20px);
  column-gap: 12px;
  row-gap: 3px;
  padding-top: 4px;
}
/* Every panel shares the board's rows, so a round reads straight across. */
#board > .artist, .round-key { grid-row: 1 / -1; display: grid; grid-template-rows: subgrid; }
.round-key { margin-right: -4px; }
.round-key span { align-self: center; font: 700 10px/1 var(--ui); letter-spacing: .08em; color: var(--muted); }
.artist {
  position: relative;
  isolation: isolate; /* the round rules sit behind the coins, above the panel */
  gap: 3px;
  /* One column no wider than the panel, so a long name ellipsises instead of
     pushing the value out over the next artist. */
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  padding: 7px 12px 8px 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(243, 237, 228, .055), rgba(243, 237, 228, .02));
  box-shadow: inset 0 0 0 1px rgba(243, 237, 228, .07);
}
.artist::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  border-radius: 3px 0 0 3px;
  background: var(--artist);
}
.artist-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.artist-body, .tiles { display: contents; }
.artist-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 15px/1.1 var(--display); color: var(--muted); }
.artist-last { font-weight: 600; font-size: 20px; color: var(--ink); }
/* Paintings played this round: five steps, the fifth ends the round. */
.pips { display: flex; align-self: center; gap: 3px; padding: 3px 0 5px; }
.pips i { flex: 1; height: 5px; border-radius: 1px; background: rgba(243, 237, 228, .12); }
.pips i.on { background: var(--artist); }
.artist[data-near="true"] .pips i:last-child { background: transparent; box-shadow: inset 0 0 0 1px var(--danger); }

/* A row per round: the coin the artist earned (30 / 20 / 10), a dash for a
   round that paid nothing, a faint rule for one still to come. */
.tiles li {
  position: relative;
  display: grid;
  place-items: center;
  list-style: none;
  font: 700 11px/1 var(--ui);
  font-variant-numeric: tabular-nums;
  color: #2a2016;
}
.tiles li::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; z-index: -1; border-top: 1px solid rgba(243, 237, 228, .07); }
.tiles li[data-current="true"]::after { border-top-color: rgba(200, 162, 84, .4); }
.tiles li[data-tile="0"][data-past="true"]::after { left: 42%; right: 42%; border-top-color: rgba(243, 237, 228, .25); }
.tiles li:not([data-tile="0"]):not(:empty) {
  justify-self: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  background: radial-gradient(circle at 35% 30%, #f6e3a8, var(--brass-2) 40%, var(--brass) 75%, #9a7535);
  box-shadow: inset 0 0 0 1.5px rgba(122, 92, 40, .55), 0 2px 5px rgba(0, 0, 0, .5);
}
.tiles li:not([data-tile="0"]):not(:empty)::after { content: none; }
.board-key { display: none; }
.value-wrap { flex: none; line-height: 1; }
.value { font: 600 24px/1 var(--display); color: var(--brass-2); font-variant-numeric: lining-nums tabular-nums; }

/* ---------------------------------------------------------------- seats */

/* Shared by the desktop sidebar and the phone strip. */
.seat-slot { min-width: 0; }
.table .seat { position: relative; min-width: 0; transition: background-color .3s ease, box-shadow .3s ease; }
.table .seat::before { content: none; }
.seat-head { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.table .seat-plaque { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.table .seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .seat .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #3f6b48; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.table .seat[data-connected="false"] .dot { background: var(--danger); }
.table .seat[data-connected="false"] .bought { opacity: .6; }
.hammer {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2b241d;
  color: var(--brass-2);
  box-shadow: 0 0 0 1px rgba(200, 162, 84, .6);
}
.hammer .glyph { width: 18px; height: 18px; }
.seat-meta { display: flex; align-items: center; gap: 10px; min-height: 24px; font-size: 13px; color: var(--muted); }
.hand-count { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hand-count .glyph { width: 16px; height: 16px; }
.status { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.status-more { margin-left: -5px; white-space: pre; }
.status:empty { display: none; }
.status[data-kind="turn"] { color: var(--brass-2); }
.status[data-kind="turn"]::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brass-2); animation: pulse 1.4s ease-in-out infinite; }
.status[data-kind="high"] { padding: 2px 9px; border-radius: 999px; background: rgba(200, 162, 84, .2); color: var(--brass-2); font-weight: 700; }
.status[data-kind="passed"] { font-style: italic; opacity: .75; }
.status[data-kind="sealed"] { padding: 2px 9px 2px 6px; border-radius: 999px; background: #e9dcc2; color: #3a2c1c; font-weight: 700; }
.status[data-kind="away"] { color: #e6a5a5; }
.status[data-kind="paid"] { color: var(--brass-2); font-weight: 700; }
.status-icon { width: 15px; height: 15px; color: #8e2e2e; }

.bought { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; max-width: 100%; }
.bought-group { display: inline-flex; align-items: flex-end; padding-bottom: 4px; border-bottom: 2px solid var(--artist); }
.bought-group .card + .card { margin-left: -24px; }

.skip { margin-top: 2px; border-color: rgba(178, 58, 58, .6); color: #f0c0c0; }

/* ---- Desktop and tablet: every player in one sidebar, in turn order from
   you (clockwise), each a row with name, hand, status and this round's buys. */
@media (min-width: 721px) {
  #seats {
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(200, 162, 84, .3) transparent;
  }
  #seats::before {
    content: 'Players';
    order: -2;
    padding: 2px 2px 4px;
    font: 700 11px/1 var(--ui);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
  }
  /* The slots are a phone concern: here the seats are one list, you first. */
  .seat-slot { display: contents; }
  .table .seat[data-you="true"] { order: -1; }
  /* One line per player (name, hand, status), with this round's buys under it.
     A long name keeps its room: hand and status wrap to a line of their own. */
  .table .seat {
    display: flex;
    flex-direction: row; /* (the lobby's .seat is a column) */
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 12px 8px 14px;
    border-radius: 6px;
    background: rgba(243, 237, 228, .035);
    box-shadow: inset 0 0 0 1px rgba(243, 237, 228, .06);
  }
  .table .seat[data-you="true"] { background: rgba(200, 162, 84, .07); box-shadow: inset 0 0 0 1px rgba(200, 162, 84, .22); }
  /* Whoever the game waits on: a brass edge and a warm wash. */
  .table .seat[data-waiting="true"] {
    background: linear-gradient(90deg, rgba(255, 220, 170, .12), rgba(255, 220, 170, .03));
    box-shadow: inset 3px 0 0 var(--brass-2), inset 0 0 0 1px rgba(200, 162, 84, .35);
  }
  .seat-head { flex: 1 0 auto; max-width: 100%; min-height: 26px; gap: 6px; }
  .table .seat-plaque { font: 600 19px/1.15 var(--display); color: var(--ink); }
  .hammer { flex: none; width: 24px; height: 24px; }
  .hammer .glyph { width: 14px; height: 14px; }
  .seat-meta { margin-left: auto; min-height: 20px; gap: 8px; font-size: 12.5px; }
  .status-more { display: none; }
  /* Mini cards at about two thirds, grouped by artist; nothing bought, nothing shown. */
  .bought { flex-basis: 100%; zoom: .62; gap: 8px 14px; }
  .bought[data-empty="true"] { display: none; }
  .skip { flex-basis: 100%; }
}

/* ---- Phones: opponents in a row above the stage, you under it. */
@media (max-width: 720px) {
  .table .seat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: var(--radius-lg);
  }
  .table .seat[data-waiting="true"] {
    background: radial-gradient(ellipse 70% 80% at 50% 30%, rgba(255, 220, 170, .14), transparent 75%);
    box-shadow: inset 0 0 0 1px rgba(200, 162, 84, .35);
  }
  .table .seat-plaque {
    padding: 5px 12px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #a8823e);
    color: #2a2016;
    box-shadow: var(--plaque-shadow);
    font: 600 18px/1.1 var(--display);
  }
  .bought { justify-content: center; min-height: 64px; }
  .bought[data-empty="true"]::before {
    content: 'No paintings yet';
    align-self: center;
    font: 500 13px/1.2 var(--ui);
    color: rgba(243, 237, 228, .8);
    white-space: nowrap;
  }
  .seat-slot[data-pos="you"] { align-self: center; display: flex; justify-content: center; position: relative; z-index: 2; }
  .table .seat[data-you="true"] {
    width: 100%;
    padding: 10px 10px 8px;
    background: rgba(24, 19, 15, .82);
    box-shadow: inset 0 0 0 1px rgba(200, 162, 84, .25), 0 10px 24px -8px rgba(0, 0, 0, .6);
  }
  .table .seat[data-you="true"] .seat-plaque { font-size: 16px; padding: 3px 10px; }
}

/* ---------------------------------------------------------------- stage */

#stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  padding: 4px 0 8px;
}
#stage::before {
  /* the picture light over the easel */
  content: '';
  position: absolute;
  inset: -40px 0 0;
  background: radial-gradient(ellipse 46% 58% at 34% 40%, rgba(255, 220, 170, .13), transparent 72%);
  pointer-events: none;
}
#stage > * { position: relative; }

#auction-banner { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.banner-plaque {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 0 0;
  min-height: 38px;
  overflow: hidden;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #a8823e);
  color: #2a2016;
  box-shadow: var(--plaque-shadow);
}
.banner-plaque::before { content: ''; align-self: stretch; width: 12px; background: var(--artist, var(--brass)); }
#auction-banner[data-type=""] .banner-plaque::before { background: #8a6a33; }
.banner-icon { width: 22px; height: 22px; stroke-width: 2; }
.banner-title { margin: 0; font: 600 24px/1 var(--display); letter-spacing: .01em; }
.banner-rule { margin: 0; max-width: 46ch; font-size: 13px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }

.stage-body { display: flex; align-items: flex-start; justify-content: center; gap: 28px; width: 100%; }

#easel { position: relative; display: flex; justify-content: center; align-items: flex-start; gap: 18px; padding-bottom: 26px; flex: none; }
.easel-legs {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 150px;
  height: 40px;
  transform: translateX(-50%);
  z-index: -1;
  background:
    linear-gradient(72deg, transparent 45%, #6e5638 45% 55%, transparent 55%) left / 50% 100% no-repeat,
    linear-gradient(-72deg, transparent 45%, #6e5638 45% 55%, transparent 55%) right / 50% 100% no-repeat;
}
.easel-empty {
  display: grid;
  place-items: center;
  width: 228px;
  height: 296px;
  padding: 20px;
  border: 1px dashed rgba(200, 162, 84, .45);
  background: rgba(0, 0, 0, .16);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, .1), inset 0 0 0 7px rgba(200, 162, 84, .12);
  font: italic 500 20px/1.2 var(--display);
  color: var(--ink-2);
  text-align: center;
}
/* On your choice the hand is the focus; the empty easel steps back (but stays a visible frame). */
.easel-empty[data-yours="true"] { border-color: rgba(200, 162, 84, .38); background: rgba(0, 0, 0, .1); color: var(--muted); font-size: 17px; }
/* A double leans as a pair: the second canvas overlaps the first. */
#easel[data-count="2"] { gap: 0; }
#easel[data-count="2"] .card[data-size="easel"] .card-art { width: 156px !important; height: 208px !important; }
#easel[data-count="2"] .card[data-size="easel"] .card-frame { padding: 9px; }
#easel[data-count="2"] .card:first-of-type { rotate: -2.5deg; align-items: flex-start; }
#easel[data-count="2"] .card + .card { margin-left: -22px; margin-top: 30px; rotate: 3deg; align-items: flex-end; }
/* Each caption sits under the outer half of its own canvas, clear of the overlap; the banner names the artist. */
#easel[data-count="2"] .card[data-size="easel"] .plaque-name { display: none; }
#easel[data-count="2"] .card[data-size="easel"] .card-plaque { margin-top: 12px; }
#stage[data-phase="roundEnd"] #easel, #stage[data-phase="gameOver"] #easel { display: none; }

.auction-side { display: flex; flex-direction: column; gap: 14px; flex: 0 1 320px; min-width: 264px; padding-top: 2px; }
#stage[data-phase="roundEnd"] .auction-side, #stage[data-phase="gameOver"] .auction-side { flex-basis: 520px; }

#auction-info { display: flex; flex-direction: column; gap: 14px; }
.info-auctioneer { display: flex; align-items: center; gap: 12px; }
.gavel-medal { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: #221d19; color: var(--brass-2); box-shadow: inset 0 0 0 1.5px rgba(200, 162, 84, .4); }
.ring-gavel { width: 22px; height: 22px; }
/* The open-auction clock: a large brass numeral inside a draining ring, beside the high bid. */
.ring-wrap { position: relative; grid-column: 3; grid-row: 1 / span 2; align-self: center; display: grid; place-items: center; width: 74px; height: 74px; flex: none; color: var(--brass-2); }
.ring-wrap:not([data-live="true"]) { display: none; }
.ring-wrap > * { grid-area: 1 / 1; }
#countdown { width: 74px; height: 74px; }
.ring-track { fill: #1d1915; stroke: rgba(200, 162, 84, .22); stroke-width: 2.5; }
.ring-fill { fill: none; stroke: var(--brass-2); stroke-width: 2.5; stroke-linecap: round; opacity: 0; transition: stroke-dashoffset .1s linear; }
.ring-wrap[data-live="true"] .ring-fill { opacity: 1; }
.ring-wrap[data-live="true"][data-urgent="true"] .ring-fill { stroke: #e07b6a; }
.clock-face { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.countdown-secs { font: 600 32px/.9 var(--display); color: var(--brass-2); font-variant-numeric: lining-nums tabular-nums; }
.clock-unit { margin-top: 1px; font: 700 9px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ring-wrap[data-urgent="true"] .countdown-secs { color: #f0a090; }
.ring-wrap[data-urgent="true"] .clock-face { animation: clock-pulse 1s ease-in-out infinite; }
@keyframes clock-pulse { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.16); } }
.info-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.info-label { font-size: 12px; color: var(--muted); }
.auctioneer-name { font: 600 20px/1.15 var(--display); }
.info-high { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: 12px; padding: 12px 0; border-block: 1px solid rgba(243, 237, 228, .08); }
.info-high .info-label { grid-column: 1 / 3; grid-row: 1; }
.info-high .high-amount { grid-column: 1; grid-row: 2; }
.info-high .high-name { grid-column: 2; grid-row: 2; }
.high-amount { font: 600 46px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.info-high[data-empty="true"] .high-amount { font-size: 28px; font-style: italic; color: var(--muted); }
/* The auctioneer is still naming the price: a live, readable pending state, not a disabled one. */
.info-high[data-pending="true"] .high-amount { font-size: 26px; font-style: italic; font-weight: 500; color: var(--ink); }
.high-name { font-size: 15px; color: var(--brass-2); font-weight: 500; }
.info-waiting { margin: 0; font: 500 15px/1.4 var(--ui); color: var(--ink); }

#controls { display: flex; flex-direction: column; gap: 10px; }
#controls:empty { display: none; }
.controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.controls-hint { margin: 0; font-size: 14px; color: var(--ink); opacity: .85; }
.controls-offline { margin: 0; font-size: 14px; font-style: italic; color: var(--muted); }
.controls-meta { font-size: 12px; color: var(--muted); }
#controls .btn { --btn-pad: 12px 18px; min-height: 50px; font-size: 16px; }
#controls .btn-primary {
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 60%, #a8823e);
  border-color: #e9d29a;
  color: #231a10;
  font-weight: 700;
  box-shadow: var(--plaque-shadow);
}
#controls .btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f1dba2, var(--brass-2) 60%, var(--brass)); color: #1a130b; }
.amount-field {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding-left: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(243, 237, 228, .2);
  background: rgba(10, 9, 8, .6);
  cursor: text;
}
.amount-field:focus-within { border-color: var(--brass-2); }
.amount-sign { font: 600 24px/1 var(--display); color: var(--muted); }
.amount-input {
  width: 68px;
  padding: 8px 10px 8px 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 26px/1 var(--display);
  font-variant-numeric: lining-nums tabular-nums;
  -moz-appearance: textfield;
}
.amount-input:focus { outline: none; }
.amount-input::-webkit-outer-spin-button, .amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Hidden bid: a paper envelope; sealed, it gets a wax seal. */
.envelope {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 12px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brass);
  background: linear-gradient(180deg, #e8dbbd, #d6c39d);
  color: #3a2c1c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 22px -12px rgba(0, 0, 0, .7);
  overflow: hidden;
}
.envelope-flap { position: absolute; inset: 0 0 auto; height: 18px; background: linear-gradient(170deg, transparent 49%, rgba(0, 0, 0, .12) 50%) left / 50% 100% no-repeat, linear-gradient(-170deg, transparent 49%, rgba(0, 0, 0, .12) 50%) right / 50% 100% no-repeat; }
.envelope-label { font: 600 17px/1.2 var(--display); }
.envelope .controls-meta { color: #6b5a44; }
.envelope .amount-field { background: rgba(255, 255, 255, .55); border-color: rgba(58, 44, 28, .3); }
.envelope .amount-sign { color: #6b5a44; }
.envelope .amount-input { color: #2a2016; }
.envelope[data-sealed="true"] { flex-direction: row; align-items: center; gap: 12px; padding: 22px 12px 12px; }
.envelope-seal { width: 34px; height: 34px; color: #8e2e2e; }


/* ---------------------------------------------------------------- hand */

#hand {
  container-type: inline-size;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-width: 0;
  min-height: 176px;
  padding: 16px 0 8px;
}
#hand[data-empty="true"]::before { content: 'No cards in hand'; align-self: center; font: italic 500 18px/1 var(--display); color: rgba(42, 32, 22, .7); }
#hand .card {
  --w: 98px;
  margin-left: clamp(-58px, calc((100cqw - var(--n) * var(--w)) / max(1, var(--n) - 1)), 8px);
  transform-origin: 50% 120%;
  rotate: calc((var(--i) - (var(--n) - 1) / 2) * 1.4deg);
  transition: translate .16s ease, scale .16s ease, filter .2s ease;
  cursor: default;
}
#hand .card:first-child { margin-left: 0; }
#hand .card:disabled { opacity: 1; }
#hand .card[aria-disabled="true"] { cursor: default; }
#hand .card-plaque { margin-top: 6px; font-size: 12px; }
#hand .card.is-playable { cursor: pointer; translate: 0 -18px; }
#hand .card.is-playable .card-frame { box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 0 3px #f6e2a8, 0 0 0 4px rgba(0, 0, 0, .45), 0 0 34px 8px rgba(255, 214, 140, .72), 0 18px 30px -12px rgba(0, 0, 0, .75); }
/* Your move: a warm wash of light on the floor under the hand. */
#hand[data-turn="true"]::after {
  content: '';
  position: absolute;
  inset: 0 6% 0;
  z-index: -1;
  background: radial-gradient(ellipse 50% 70% at 50% 60%, rgba(255, 236, 190, .55), transparent 75%);
  pointer-events: none;
}
#hand .card.is-playable:hover, #hand .card.is-playable:focus-visible { translate: 0 -22px; scale: 1.08; z-index: 3; }
/* Any card in your hand lifts on hover, so it can be inspected outside your turn. */
#hand .card:not(.is-playable):hover { translate: 0 -10px; scale: 1.05; z-index: 3; }
#hand[data-turn="true"] .card:not(.is-playable) { filter: brightness(.5) saturate(.6); }

/* Phone only: the hand tray's "+N" edge pills and the action bar's clock copy. */
.hand-more, .bar-clock, .controls-row-quiet { display: none; }

/* Your turn to choose: a brass call-out at the top edge of the floor, over the hand. */
.turn-note { display: none; margin: 0; }
.turn-note[data-kind="turn"] {
  grid-area: hand;
  align-self: start;
  justify-self: center;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: -22px;
  padding: 7px 16px 7px 12px;
  border-radius: 999px;
  background: #231a10;
  color: var(--brass-2);
  box-shadow: 0 0 0 1px var(--brass), 0 10px 22px -8px rgba(0, 0, 0, .8), 0 0 24px rgba(255, 214, 140, .25);
  font: 600 18px/1.1 var(--display);
  letter-spacing: .01em;
  white-space: nowrap;
  pointer-events: none;
}
.turn-note[data-kind="turn"]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--brass-2); box-shadow: 0 0 8px rgba(231, 205, 138, .9); animation: pulse 1.4s ease-in-out infinite; }
.card-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  translate: -50% 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: #231a10;
  color: var(--brass-2);
  box-shadow: 0 0 0 1px var(--brass);
  font: 700 11px/1.2 var(--ui);
  white-space: nowrap;
}

#balance {
  align-self: center;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  position: relative;
  z-index: 2;
  padding: 10px 18px 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #a8823e);
  color: #2a2016;
  box-shadow: var(--plaque-shadow), 0 12px 24px -10px rgba(0, 0, 0, .6);
}
.balance-label { font-size: 12px; font-weight: 700; opacity: .8; }
.balance-amount { font: 600 48px/.9 var(--display); font-variant-numeric: lining-nums tabular-nums; }

/* ---------------------------------------------------------------- log drawer */

#log-drawer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100dvh - 260px);
  margin-top: 4px;
  border-left: 1px solid rgba(200, 162, 84, .22);
  padding-left: 14px;
}
.log-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 18px/1 var(--display);
  cursor: pointer;
}
.log-toggle::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); rotate: -45deg; }
.table[data-log="closed"] .log-toggle { writing-mode: vertical-rl; }
.table[data-log="closed"] .log-toggle::after { rotate: 135deg; }
.table[data-log="closed"] #log { display: none; }
.table[data-log="closed"] #log-drawer { padding-left: 8px; }
#log {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 162, 84, .3) transparent;
  /* An older entry scrolled half out of view melts away instead of being cut. */
  padding-top: 14px;
  -webkit-mask-image: linear-gradient(180deg, transparent 2px, #000 16px);
  mask-image: linear-gradient(180deg, transparent 2px, #000 16px);
}
#log:empty::before { content: 'Every bid, sale and payout will be listed here.'; display: block; padding-top: 6px; font-style: italic; }
#log li { padding: 5px 0; border-bottom: 1px solid rgba(243, 237, 228, .05); }
#log li:last-child { color: var(--ink); }
#log li[data-type="sold"], #log li[data-type="free"], #log li[data-type="scored"], #log li[data-type="gameOver"] { color: var(--ink); }
#log li[data-type="roundStarted"], #log li[data-type="roundEnded"], #log li[data-type="fifthPainting"] { padding-top: 10px; font: 600 15px/1.3 var(--display); color: var(--brass-2); }

/* Chat lines sit in the log, set apart by a speaker in brass; yours read "You". */
#log li[data-type="chat"] { display: flex; gap: 6px; align-items: baseline; color: var(--ink); overflow-wrap: anywhere; }
#log li[data-type="chat"] .chat-name { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--brass-2); }
#log li[data-type="chat"][data-you="true"] .chat-name { color: var(--ink-2); }
#log li[data-type="chat"] .chat-text { min-width: 0; }
.chat-form { display: flex; gap: 6px; flex: none; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(200, 162, 84, .22); }
.chat-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 3px;
  border: 1px solid rgba(243, 237, 228, .14);
  background: rgba(10, 9, 8, .45);
  color: var(--ink);
  font: 500 14px/1 var(--ui);
}
.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { outline: 2px solid rgba(200, 162, 84, .55); outline-offset: 1px; border-color: rgba(200, 162, 84, .6); }
.chat-send {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid rgba(200, 162, 84, .45);
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #a8823e);
  color: #2a2016;
  cursor: pointer;
}
.chat-send svg { width: 18px; height: 18px; }
.chat-send:hover { filter: brightness(1.06); }
.chat-send:focus-visible { outline: 2px solid var(--brass-2); outline-offset: 2px; }
.table[data-log="closed"] .chat-form { display: none; }
/* A new line from someone else while the log is put away: a brass dot on the toggle. */
.table .log-toggle, .topbar-log { position: relative; }
.table[data-unread="true"] .log-toggle::before, .topbar-log[data-unread="true"]::before {
  content: '';
  position: absolute;
  top: 6px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass-2);
  box-shadow: 0 0 0 2px var(--wall-2, #1b1917), 0 0 10px rgba(255, 214, 140, .6);
}
.table[data-log="closed"][data-unread="true"] .log-toggle::before { top: -2px; right: 10px; }
.topbar-log[data-unread="true"]::before { top: -1px; right: -1px; }

/* ---------------------------------------------------------------- table: tablet (721–1180px)
   The desktop grid at half-screen widths: the fixed side columns shrink, the
   auction panel drops under the easel when it has to, and the board's artists
   lose their first names, so nothing is forced over its neighbour. */

@media (min-width: 721px) and (max-width: 1180px) {
  .table { --side: 196px; --log-w: 212px; column-gap: 16px; }
  #board { gap: 8px; }
  .artist { padding: 6px 9px 7px 13px; }
  .artist-first { display: none; }
  .artist-last { font-size: 18px; }
  .value { font-size: 20px; }
  .stage-body { flex-wrap: wrap; gap: 18px 24px; }
  .auction-side { flex: 1 1 240px; min-width: 0; }
  .banner-rule { max-width: none; }
}
/* Up to 900px the log is a sheet (below), so its grid column only has to hold
   the money chip; whether the log is open or closed changes nothing here. */
@media (min-width: 721px) and (max-width: 900px) {
  .table, .table[data-log] { --log-w: 116px; --side: 168px; }
  #board { grid-column: 1 / -1; }
  #board { column-gap: 8px; }
  .table .seat-plaque { font-size: 16px; }
  /* A smaller easel: the painting still reads, and the panel fits beside or under it. */
  .card[data-size="easel"] .card-art { width: 156px !important; height: 208px !important; }
  .card[data-size="easel"] .card-frame { padding: 9px; }
  #easel[data-count="2"] .card[data-size="easel"] .card-art { width: 120px !important; height: 160px !important; }
  #easel[data-count="2"] .card[data-size="easel"] .card-frame { padding: 7px; }
  .easel-empty { width: 180px; height: 232px; font-size: 18px; }
  .easel-legs { width: 120px; height: 34px; }
}
@media (min-width: 721px) and (max-width: 1180px) {
  .table .seat { padding: 8px 10px 8px 12px; }
  .table .seat-plaque { gap: 6px; }
  .bought { zoom: .55; }
  .bought-group .card + .card { margin-left: -28px; }
  #log-drawer { padding-left: 10px; }
  #log { font-size: 12.5px; }
}

/* With the sidebar and the log beside it, a panel only has room for the surname. */
@media (max-width: 1399px) { .artist-first { display: none; } }

/* ---------------------------------------------------------------- table: short screens
   Laptops and landscape tablets: the board's round rows cost height, so the
   easel and the rows shrink to keep the hand on screen; below 720px of height
   the rows fold into each panel's coin strip, as on phones. */

@media (min-width: 721px) and (max-height: 860px) {
  #board { grid-template-rows: auto auto repeat(4, 17px); row-gap: 2px; }
  .tiles li:not([data-tile="0"]):not(:empty) { width: 17px; height: 17px; font-size: 9px; }
  #hand { min-height: 160px; padding-top: 12px; }
}
/* (721–900px already has a smaller easel.) */
@media (min-width: 901px) and (max-height: 860px) {
  .card[data-size="easel"] .card-art { width: 168px !important; height: 224px !important; }
  .card[data-size="easel"] .card-frame { padding: 9px; }
  #easel[data-count="2"] .card[data-size="easel"] .card-art { width: 126px !important; height: 168px !important; }
  .easel-empty { width: 186px; height: 242px; }
}
@media (min-width: 721px) and (max-height: 720px) {
  #board { grid-template-rows: none; }
  .round-key { display: none; }
  #board > .artist { grid-row: auto; grid-template-rows: none; }
  .artist-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .pips { flex: 1 1 auto; min-width: 30px; }
  .tiles { display: flex; flex: none; gap: 2px; margin: 0; padding: 0; }
  .tiles li[data-tile="0"], .tiles li:empty { display: none; }
}

/* ---------------------------------------------------------------- table: phone */

@media (max-width: 720px) {
  body[data-view="table"] .topbar { padding: 8px 16px; }
  .table {
    --opp: 3;
    grid-template-columns: repeat(var(--opp), minmax(0, 1fr));
    grid-template-areas: none;
    grid-template-rows: none;
    column-gap: 8px;
    row-gap: 8px;
    min-height: 0;
    padding: 0 16px 16px;
  }
  .table[data-opponents="2"] { --opp: 2; grid-template-areas: none; }
  .table[data-opponents="4"] { --opp: 4; }
  /* Named areas are gone here, so every region needs its area reset (ids outrank .table > *). */
  #board, #stage, #hand, #balance, #log-drawer, .floor-band, .seat-slot[data-pos] { grid-area: auto; grid-column: 1 / -1; }
  #board { grid-row: 1; }
  #seats { display: contents; }
  #turn-note { grid-area: auto; }
  .seat-slot[data-pos="left"], .seat-slot[data-pos="top"], .seat-slot[data-pos="right"],
  .table[data-opponents="2"] .seat-slot[data-pos="top"] { display: contents; }
  .table .seat[data-pos="left"], .table .seat[data-pos="top"], .table .seat[data-pos="right"] { grid-row: 2; }
  #stage { grid-row: 3; }
  .seat-slot[data-pos="you"] { grid-row: 4; }
  #log-drawer { grid-row: auto; }

  /* The board: three artist panels over two (centred), and one caption under
     the grid as the key. Each panel: surname and value on top; this round's
     count and the four round tiles below, as legible chips. */
  /* Phones keep each panel to two lines: the round rows fold into a strip of
     the coins earned so far, beside the played bar. */
  #board { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: none; gap: 4px 5px; padding-top: 0; }
  .round-key { display: none; }
  #board > .artist { grid-row: auto; grid-template-rows: none; grid-column: span 2; }
  #board > .artist:nth-child(5) { grid-column: 2 / span 2; }
  #board > .artist:nth-child(6) { grid-column: 4 / span 2; }
  .artist-body { display: flex; align-items: center; justify-content: space-between; }
  .tiles { display: flex; flex: none; gap: 2px; margin: 0; padding: 0; }
  .tiles li[data-tile="0"], .tiles li:empty { display: none; }
  .artist { padding: 4px 5px 5px 9px; gap: 3px; }
  .artist::before { width: 4px; }
  .artist-first { display: none; }
  .artist-last { font-size: 16px; }
  .artist-head { align-items: baseline; gap: 4px; }
  .artist-name { color: var(--ink); }
  .artist-body { gap: 4px; min-height: 18px; }
  .pips { flex: 1 1 auto; min-width: 30px; gap: 2px; padding: 0; }
  .pips i { height: 4px; }
  .tiles li:not([data-tile="0"]):not(:empty) { width: 18px; height: 18px; font-size: 10px; }
  .value { font-size: 19px; }
  .board-key {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0;
    color: var(--ink-2);
    font: 500 12px/1.1 var(--ui);
    white-space: nowrap;
  }
  .board-key .key-item { display: inline-flex; align-items: center; gap: 5px; }
  .key-sep { color: var(--muted); }
  .key-bar { width: 18px; height: 4px; border-radius: 1px; background: linear-gradient(90deg, var(--ink-2) 0 60%, rgba(243, 237, 228, .2) 60%); }
  .key-chip { display: inline-grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f6e3a8, var(--brass-2) 40%, var(--brass) 75%); }

  .table .seat { padding: 5px 2px 6px; gap: 3px; }
  .table .seat[data-pos="top"] { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; }
  .table .seat[data-pos="top"] .bought { justify-content: center; }
  .table .seat-plaque { font-size: 14px; padding: 3px 7px; gap: 5px; }
  .hammer { width: 22px; height: 22px; }
  .hammer .glyph { width: 13px; height: 13px; }
  .seat-meta { gap: 6px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; justify-content: center; }
  .status-more { display: none; }
  .bought { min-height: 36px; gap: 4px 6px; zoom: .62; }
  /* .bought is zoomed to .62 here: 13px / .62 keeps the caption at a real 13px. */
  .bought[data-empty="true"]::before { content: 'None yet'; font-size: calc(13px / .62); }
  .table .seat[data-you="true"] { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 8px; }
  .table .seat[data-you="true"] .bought { min-height: 0; zoom: .8; }

  /* Stage: the banner across the top, then the easel beside the auction panel,
     so the painting and the high bid are on screen together. */
  #stage { padding: 0 0 6px; }
  .stage-body { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "banner banner" "easel info"; align-items: start; column-gap: 14px; row-gap: 8px; }
  .auction-side { display: contents; }
  #auction-banner { grid-area: banner; }
  #easel { grid-area: easel; padding-bottom: 16px; }
  #auction-banner { gap: 5px; }
  #auction-info { grid-area: info; gap: 10px; padding-top: 4px; }
  #stage[data-phase="choose"] #easel { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  #stage[data-phase="choose"] #auction-info { display: none; }
  .banner-title { font-size: 20px; }
  .banner-rule { font-size: 13px; }
  .card[data-size="easel"] .card-art { width: 111px !important; height: 148px !important; }
  /* A double stays beside the auction panel: a smaller overlapping pair. */
  #easel[data-count="2"] .card[data-size="easel"] .card-art { width: 80px !important; height: 107px !important; }
  #easel[data-count="2"] .card[data-size="easel"] .card-frame { padding: 6px; }
  #easel[data-count="2"] .card + .card { margin-left: -26px; margin-top: 24px; }
  .card[data-size="easel"] .card-frame { padding: 7px; }
  .card[data-size="easel"] .card-plaque { margin-top: 10px; min-height: 24px; font-size: 13px; gap: 5px; padding-right: 8px; }
  .card[data-size="easel"] .plaque-icon { width: 14px; height: 14px; }
  .card[data-size="easel"] .plaque-bar { width: 7px; }
  .easel-legs { width: 110px; height: 30px; }
  .easel-empty { width: 132px; height: 170px; padding: 14px; font-size: 16px; }
  /* Choosing: the hand is the focus, so the empty easel is small and quiet. */
  #stage[data-phase="choose"] .easel-empty { width: 80px; height: 102px; padding: 8px; border-color: rgba(200, 162, 84, .45); background: rgba(0, 0, 0, .12); font-size: 14px; color: var(--ink-2); }
  #stage[data-phase="choose"] .easel-legs { width: 70px; height: 20px; }
  #stage[data-phase="choose"] #easel { padding-bottom: 14px; }
  /* The stage reaches down to the dock (table.js sets --stage-min), so the
     seat below it starts under the tray: fully covered, never a sliver. */
  #stage { justify-content: flex-start; min-height: var(--stage-min, 0px); }
  /* Choosing: the small placeholder sits in the middle of the free space. */
  #stage[data-phase="choose"] .stage-body { flex: 1; grid-template-rows: auto minmax(0, 1fr); }
  #stage[data-phase="choose"] #easel { align-self: center; }
  .info-auctioneer { gap: 9px; }
  .gavel-medal { width: 36px; height: 36px; }
  .ring-gavel { width: 18px; height: 18px; }
  .auctioneer-name { font-size: 18px; }
  .info-high { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 0; row-gap: 2px; }
  .info-high .info-label { grid-column: 1; }
  .info-high .high-amount { grid-column: 1; grid-row: 2; }
  .info-high .high-name { grid-column: 1 / -1; grid-row: 3; }
  .info-high .ring-wrap { grid-column: 2; grid-row: 1 / span 2; width: 58px; height: 58px; }
  #countdown { width: 58px; height: 58px; }
  .countdown-secs { font-size: 25px; }
  .clock-unit { font-size: 8px; }
  .high-amount { font-size: 38px; }
  .info-high[data-empty="true"] .high-amount { font-size: 24px; }
  .info-high[data-pending="true"] .high-amount { font-size: 22px; }

  /* ---- The dock: a hand tray on the oak floor over an action bar, fixed to the viewport. */
  .table { padding-bottom: calc(var(--bar-h) + var(--tray-h) + 20px); }
  .floor-band {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: calc(var(--bar-h) + var(--tray-h));
    margin: 0;
    border-top: 4px solid #2c2622;
    background:
      linear-gradient(180deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0) 12px) 0 0 / 100% var(--tray-h) no-repeat,
      repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 119px, rgba(60, 40, 20, .22) 119px 121px) 0 0 / 100% var(--tray-h) no-repeat,
      linear-gradient(180deg, var(--floor), var(--floor-2)) 0 0 / 100% var(--tray-h) no-repeat,
      linear-gradient(180deg, #8a6a32, var(--brass-2) 50%, #8a6a32) 0 var(--tray-h) / 100% 2px no-repeat,
      linear-gradient(180deg, #1f1b18, #141210);
    box-shadow: 0 -14px 28px rgba(0, 0, 0, .5);
    /* No transitions, ever (reduced motion shortens every transition to
       .01ms): table.js reads this band's top as the dock edge. */
    transition-property: none;
  }
  #hand {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--bar-h);
    z-index: 21;
    height: var(--tray-h);
    min-height: 0;
    justify-content: flex-start;
    align-items: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* The trailing pad clears the edge fade, so the last card scrolls fully into view;
       every snap rests a card whole at the left (or the last one whole at the right). */
    padding: 0 calc(16px + var(--hand-fade)) 6px 16px;
    scroll-padding: 0 calc(16px + var(--hand-fade)) 0 16px;
    scroll-snap-type: x mandatory;
    /* Edge fades (table.js sets data-more-*): the tray melts into the floor on
       whichever side still has cards off screen, and is crisp when all fit. */
    --fade-l: 0px;
    --fade-r: 0px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  }
  /* Narrow fades: a card half under one keeps a readable plaque. */
  #hand[data-more-left="true"] { --fade-l: var(--hand-fade); }
  #hand[data-more-right="true"] { --fade-r: var(--hand-fade); }
  #hand .card:last-child { scroll-snap-align: end; }
  /* "+N ›": how many cards sit past that edge. Over the art, never in the way of a tap. */
  .hand-more[hidden] { display: none; } /* the explicit display below must not defeat `hidden` */
  .hand-more {
    position: fixed;
    bottom: calc(var(--bar-h) + 60px);
    z-index: 23;
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(35, 26, 16, .94);
    color: var(--brass-2);
    box-shadow: 0 0 0 1px var(--brass), 0 4px 12px rgba(0, 0, 0, .6);
    font: 700 12px/1 var(--ui);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
  }
  .hand-more[data-side="left"] { left: 6px; }
  .hand-more[data-side="right"] { right: 6px; }
  #hand::-webkit-scrollbar { display: none; }
  /* Still a fanned hand: each card tucks a little under the next. */
  #hand .card { --w: 66px; margin-left: -9px; rotate: 0deg; scroll-snap-align: start; }
  #hand .card:first-child { margin-left: 0; }
  #hand .card-art { width: 56px !important; height: 75px !important; }
  #hand .card-frame { padding: 4px; }
  #hand .card-plaque { margin-top: 5px; min-height: 18px; font-size: 12px; gap: 3px; padding-right: 6px; }
  #hand .plaque-bar { width: 5px; }
  #hand .plaque-icon { width: 12px; height: 12px; }
  #hand .card.is-playable { translate: 0 -10px; z-index: 2; }
  #hand .card.is-playable .card-frame { box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 0 2px #f6e2a8, 0 0 0 3px rgba(0, 0, 0, .45), 0 0 18px 4px rgba(255, 214, 140, .75), 0 12px 18px -10px rgba(0, 0, 0, .75); }
  #hand .card.is-playable:hover, #hand .card.is-playable:focus-visible { translate: 0 -10px; scale: 1; }
  #hand .card:not(.is-playable):hover { translate: none; scale: 1; }
  #hand .card-tag { top: 3px; padding: 2px 6px; font-size: 10px; }
  #hand[data-turn="true"]::after { inset: 0; background: radial-gradient(ellipse 60% 80% at 50% 70%, rgba(255, 236, 190, .5), transparent 75%); }
  #hand[data-empty="true"]::before { font-size: 16px; }

  #balance {
    position: fixed;
    left: 12px;
    bottom: calc(var(--bar-pad) + env(safe-area-inset-bottom, 0px));
    z-index: 22;
    width: var(--chip-w);
    align-self: auto;
    justify-self: auto;
    align-items: flex-start;
    gap: 1px;
    padding: 6px 9px 7px;
  }
  .balance-label { font-size: 10px; letter-spacing: .02em; }
  .balance-amount { font-size: 30px; }

  /* Everything you can press sits right of the money chip. */
  #controls, .table[data-controls="none"] #turn-note:not([data-kind=""]) {
    position: fixed;
    left: calc(12px + var(--chip-w) + 10px);
    right: 12px;
    bottom: calc(var(--bar-pad) + env(safe-area-inset-bottom, 0px));
    z-index: 22;
  }
  #controls { gap: 6px; }
  #controls .controls-row { flex-wrap: nowrap; gap: 6px; }
  #controls .btn { --btn-pad: 10px 12px; min-height: 46px; font-size: 15px; }
  #controls .btn-primary { flex: 1 1 auto; }
  #controls .amount-field { min-height: 46px; padding-left: 9px; flex: none; }
  #controls .amount-sign { font-size: 20px; }
  #controls .amount-input { width: 46px; padding: 6px 6px 6px 3px; font-size: 22px; }
  /* The prompt gets its own line at the top of the bar, in the brass hint colour. */
  #controls .controls-hint { padding-top: 2px; font-size: 13px; line-height: 1.4; color: var(--brass-2); opacity: 1; text-wrap: pretty; }
  /* The open-auction clock, mirrored beside Bid (table.js keeps it in step with #countdown). */
  #controls .bar-clock {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1d1915;
    box-shadow: inset 0 0 0 2px var(--brass-2);
    color: var(--brass-2);
    font: 700 13px/1 var(--ui);
    font-variant-numeric: tabular-nums;
  }
  #controls .bar-clock:empty { display: none; }
  /* The no-action form of the bar during an open auction: clock + one line. */
  #controls .controls-row-quiet { display: flex; align-items: center; gap: 10px; min-height: 46px; }
  #controls .controls-row-quiet .controls-hint { margin: 0; }
  #controls .bar-clock[data-urgent="true"] { color: #f0a090; box-shadow: inset 0 0 0 2px #e07b6a; animation: clock-pulse 1s ease-in-out infinite; }
  /* Double: the offer hint and Skip share one row, keeping the bar (and so the tray) low. */
  .table[data-stage="doubleAdd"] #controls { flex-direction: row; align-items: center; gap: 10px; }
  .table[data-stage="doubleAdd"] #controls .controls-hint { flex: 1; min-width: 0; font-size: 12.5px; }
  #controls .controls-meta { font-size: 11px; color: var(--ink-2); opacity: .75; }
  /* The envelope keeps to two rows: label and limit, then amount and Seal. */
  #controls .envelope { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label meta" "row row"; align-items: baseline; padding: 16px 8px 8px; gap: 5px 8px; }
  #controls .envelope .envelope-label { grid-area: label; }
  #controls .envelope .controls-meta { grid-area: meta; }
  #controls .envelope .controls-row { grid-area: row; }
  #controls .envelope[data-sealed="true"] { display: flex; }
  #controls .envelope-label { font-size: 15px; }
  #controls .envelope .controls-meta { color: #6b5a44; opacity: 1; }
  #controls .envelope[data-sealed="true"] { padding: 14px 12px 10px; }
  #controls .controls-offline { font-size: 13px; }
  #turn-note { display: none; }
  .table[data-controls="none"] #turn-note:not([data-kind=""]) {
    display: flex;
    align-items: center;
    min-height: 54px;
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--ink-2);
    font: italic 500 18px/1.2 var(--display);
    white-space: normal;
    text-wrap: balance;
  }
  .table[data-controls="none"] #turn-note[data-kind="turn"] { color: var(--brass-2); font-style: normal; font-weight: 600; gap: 10px; }
  /* A brass pointer up at the hand tray, where the choice is made. */
  .table[data-controls="none"] #turn-note[data-kind="turn"]::before {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background:
      linear-gradient(var(--brass-2), var(--brass-2)) 50% 62% / 2px 10px no-repeat,
      conic-gradient(from 135deg at 50% 34%, var(--brass-2) 0 90deg, transparent 0) 50% 28% / 12px 8px no-repeat,
      #231a10;
    box-shadow: 0 0 0 1px var(--brass), 0 0 12px rgba(255, 214, 140, .3);
    animation: point-up 1.6s ease-in-out infinite;
  }
  @keyframes point-up { 50% { translate: 0 -3px; } }
  .table[data-controls="none"] .info-waiting { display: none; }
}

/* ---- The log: a sheet over the table, opened from the top bar. Phones and
   narrow tablets (portrait iPads, half-screen windows): a side column would
   leave the stage no room, so the drawer leaves the grid. table.js's sheetMq
   matches this width. */
@media (max-width: 900px) {
  body[data-view="table"] .topbar-log { display: inline-grid; }
  #log-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    max-height: min(72dvh, 560px);
    margin: 0;
    padding: 6px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid rgba(200, 162, 84, .5);
    border-radius: 14px 14px 0 0;
    background: linear-gradient(180deg, #2a2521, var(--wall-2) 40%);
    box-shadow: 0 0 0 100vmax rgba(10, 9, 8, .62), 0 -20px 40px rgba(0, 0, 0, .6);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s;
  }
  .table[data-logsheet="open"] #log-drawer { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
  .table[data-log] #log-drawer { padding-left: 16px; }
  .table[data-log] .log-toggle { writing-mode: horizontal-tb; align-self: stretch; justify-content: space-between; min-height: 44px; font-size: 22px; }
  .table[data-log] .log-toggle::after { rotate: 45deg; width: 9px; height: 9px; }
  .table[data-log] #log { display: block; max-height: none; font-size: 14px; }
  .table[data-log] .chat-form { display: flex; }
  .chat-input { height: 42px; font-size: 16px; } /* 16px: iOS does not zoom the page on focus */
  .chat-send { width: 42px; height: 42px; }
}

@media (max-width: 720px) {
  :root {
    --chip-w: 80px;
    --bar-pad: 10px;
    --tray-h: 128px;
    --hand-card: 64px; /* a hand card's framed width */
    --hand-fade: 24px; /* the tray's edge fade */
    --bar-h: calc(var(--bar-in, 54px) + 2 * var(--bar-pad) + env(safe-area-inset-bottom, 0px));
  }
  body[data-view="table"] .toast { bottom: calc(var(--bar-h) + var(--tray-h) + 12px); }
}
/* Narrow phones (320–360px): the money chip shrinks and the action row may
   wrap, so amount + Bid + Pass never run past the viewport edge. The hand tray
   follows the bar's measured height, so a wrapped row simply lifts it. */
@media (max-width: 360px) {
  :root { --chip-w: 68px; }
  /* Top bar: wordmark and round pill shrink, icon buttons tighten, and the
     status pill drops its label (title/aria-label keep the meaning). */
  body[data-view="table"] .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  body[data-view="table"] .topbar .wordmark { font-size: 17px; }
  body[data-view="table"] .topbar-game { margin-left: 0; gap: 6px; }
  body[data-view="table"] .topbar-end { gap: 4px; }
  body[data-view="table"] .topbar .icon-btn { width: 28px; height: 28px; min-width: 28px; }
  body[data-view="table"] .status-pill { height: 28px; padding: 0 8px; gap: 0; }
  body[data-view="table"] .status-pill::after { content: none; }
  #balance { padding: 5px 7px 6px; }
  .balance-amount { font-size: 24px; }
  #controls .controls-row { flex-wrap: wrap; }
  #controls .btn { --btn-pad: 9px 10px; min-height: 42px; font-size: 14px; }
  #controls .amount-input { width: 40px; font-size: 20px; }
  /* The board becomes a strip that scrolls sideways rather than shrinking its
     tiles below a legible size; a fade at the right edge says there is more. */
  #board { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity; margin-right: -10px; padding-right: 24px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  #board::-webkit-scrollbar { display: none; }
  #board > .artist { flex: 0 0 116px; scroll-snap-align: start; }
  #board > .board-key { flex: 0 0 auto; flex-direction: column; align-items: flex-start; gap: 5px; padding: 0 4px 0 6px; }
  #board .key-sep { display: none; }
}
@media (max-width: 560px) {
  body[data-view="table"] .topbar { gap: 8px; }
  body[data-view="table"] .topbar-game { margin-left: 4px; }
  body[data-view="table"] .topbar-end { gap: 6px; }
  body[data-view="table"] .icon-btn { width: 32px; height: 32px; }
  body[data-view="table"] .round-pill { padding: 6px 10px; }
  body[data-view="table"] .topbar .wordmark { font-size: 20px; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .status[data-kind="turn"]::before { animation: none; }
  .ring-wrap[data-urgent="true"] .clock-face, .turn-note[data-kind="turn"]::before, #turn-note[data-kind="turn"]::before, #controls .bar-clock { animation: none !important; }
  #log-drawer { transition: none !important; }
}

/* ================================================================ motion (present.js) */

/* Real elements a flight will deliver stay invisible until their sprite lands. */
[data-inflight] { visibility: hidden !important; }

.fx-sprite { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform, opacity; }
.fx-card { display: inline-flex; }
.fx-card .fx-face { pointer-events: none; }
.fx-stack .fx-face .card-frame { box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 0 0 2px rgba(200, 162, 84, .75), 3px 3px 0 0 #1a1613, 3px 3px 0 1px rgba(200, 162, 84, .6), 6px 6px 0 0 #1a1613, 6px 6px 0 1px rgba(200, 162, 84, .45); }

.fx-back {
  width: 60px;
  height: 84px;
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .06), transparent 40%),
    repeating-linear-gradient(45deg, #3a1f1f 0 6px, #331b1b 6px 12px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), inset 0 0 0 4px #1b1917, inset 0 0 0 5px var(--brass), 0 8px 14px -6px rgba(0, 0, 0, .8);
}

.fx-hammer {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 60%, #a8823e);
  color: #2a2016;
  box-shadow: var(--plaque-shadow), 0 10px 18px -8px rgba(0, 0, 0, .8);
}
.fx-hammer-glyph { width: 26px; height: 26px; stroke-width: 2.2; }

.fx-gavel { z-index: 3; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .6)); transform-origin: 50% 93.75%; }
.fx-gavel svg { display: block; width: 100%; height: 100%; }
.fx-impact { border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 190, .0) 30%, rgba(255, 236, 190, .65) 48%, rgba(255, 236, 190, 0) 62%); }

.fx-coin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--brass-2) 35%, var(--brass) 70%, #8a6a2c);
  box-shadow: 0 0 0 1px rgba(60, 40, 10, .55), 0 3px 6px rgba(0, 0, 0, .55), 0 0 10px rgba(255, 214, 140, .35);
}

.fx-ribbon {
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #c44646, var(--danger) 55%, #8e2a2a);
  color: #fbf3e4;
  font: 600 34px/1 var(--display);
  letter-spacing: .32em;
  text-transform: uppercase;
  text-indent: .32em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 -2px 0 rgba(0, 0, 0, .25), 0 18px 30px -12px rgba(0, 0, 0, .8);
  border-top: 2px solid var(--brass);
  border-bottom: 2px solid var(--brass);
}

.fx-tile {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e3a8, var(--brass-2) 40%, var(--brass) 75%, #9a7535);
  color: #2a2016;
  font: 700 10px/1 var(--ui);
  box-shadow: 0 0 0 2px var(--artist, var(--brass)), 0 10px 16px -6px rgba(0, 0, 0, .8);
}

.fx-chip {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #1b1612;
  color: var(--brass-2);
  font: 700 15px/1 var(--ui);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1px var(--brass), 0 8px 14px -6px rgba(0, 0, 0, .8);
}

.fx-envelope { z-index: 2; }
.fx-env-front, .fx-env-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 3px;
}
.fx-env-front { background: linear-gradient(180deg, #efe4cc, #d8c8a6); color: var(--danger); box-shadow: 0 8px 14px -6px rgba(0, 0, 0, .8); }
.fx-env-glyph { width: 30px; height: 30px; }
.fx-env-back { transform: scaleX(0); background: #1b1612; color: var(--brass-2); font: 700 17px/1 var(--ui); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 1px var(--brass), 0 8px 14px -6px rgba(0, 0, 0, .8); }

/* Mute toggle in the top bar. */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(243, 237, 228, .12);
  background: rgba(10, 9, 8, .4);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: rgba(243, 237, 228, .3); }
.topbar-log { display: none; }
.topbar-log[aria-expanded="true"] { color: var(--brass-2); border-color: rgba(200, 162, 84, .6); }
.icon-btn svg { width: 18px; height: 18px; }
.fx-pile { box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), inset 0 0 0 4px #1b1917, inset 0 0 0 5px var(--brass), 2px 2px 0 0 #2a1717, 2px 2px 0 1px rgba(200, 162, 84, .55), 4px 4px 0 0 #2a1717, 4px 4px 0 1px rgba(200, 162, 84, .4), 0 12px 18px -6px rgba(0, 0, 0, .8); }
.fx-float {
  display: grid;
  place-items: center;
  color: var(--brass-2);
  font: 700 18px/1 var(--ui);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .8), 0 0 12px rgba(0, 0, 0, .6);
}

/* ================================================================ top bar: game info */

.topbar-end { display: flex; align-items: center; gap: 8px; }
.topbar-game { display: flex; align-items: center; gap: 12px; margin: 0 auto 0 24px; min-width: 0; }
.topbar-room { color: var(--ink); font: 700 14px/1 var(--ui); letter-spacing: .14em; white-space: nowrap; }
.topbar-room-label { color: var(--muted); font-weight: 500; letter-spacing: .01em; }
.round-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(200, 162, 84, .42);
  background: rgba(200, 162, 84, .08);
  color: var(--brass-2);
  font: 600 13px/1 var(--ui);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .topbar-game { margin-left: 12px; }
  .topbar-room { display: none; }
  .round-of { display: none; }
  /* Short label beside the dot, never the dot alone. */
  .status-pill { height: 32px; padding: 0 10px 0 9px; gap: 6px; font-size: 0; }
  .status-pill::after { content: attr(data-short); font-size: 12px; font-weight: 600; }
  .status-pill[data-status="online"]::after { color: #9fcaa9; }
  .status-pill[data-status="offline"]::after { color: #e6a5a5; }
  .topbar .wordmark { font-size: 21px; }
}

/* ================================================================ overlays: shared */

:root {
  --ov-ease: cubic-bezier(.2, .8, .2, 1);
  --ov-night: #12100e;
}

dialog.overlay-full {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background-color: var(--ov-night);
  background-image:
    radial-gradient(ellipse 62% 42% at 50% 0%, rgba(255, 222, 176, .16), transparent 72%),
    radial-gradient(ellipse 120% 90% at 50% 25%, #25211e, var(--ov-night) 78%);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.overlay-full::backdrop { background: rgba(10, 9, 8, .92); }
dialog.overlay-full[open][data-animate="true"] { animation: ov-fade .45s var(--ov-ease) both; }

.ov-sheet {
  position: relative;
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) var(--gutter) clamp(28px, 5vh, 48px);
}
.ov-title { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.005em; text-wrap: balance; }
/* Titles take focus from script so screen readers start there; they are not
   controls, so no ring (Safari counts that focus as focus-visible). */
.ov-title:focus, .ov-title:focus-visible { outline: none; }
.ov-kicker { margin: 0 0 10px; color: var(--muted); font: 500 15px/1.2 var(--ui); letter-spacing: .02em; }
.ov-section {
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(200, 162, 84, .32);
  color: var(--brass-2);
  font: italic 500 22px/1.1 var(--display);
}

/* A brass rule with a lozenge at its centre, under each overlay heading. */
.ov-head::after, .go-head::after {
  content: '';
  display: block;
  width: min(440px, 72%);
  height: 10px;
  margin: 24px auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 440 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5H204M236 5H440' stroke='%23c8a254' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30% 70%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 30% 70%, transparent);
}
.ov-head::before, .go-head::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--brass-2);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(231, 205, 138, .5);
}

/* Brass tiles, as on the value board. */
.ov-tile {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 60%, #a8823e);
  color: #2a2016;
  box-shadow: var(--plaque-shadow);
  font: 700 13px/1 var(--ui);
  font-variant-numeric: tabular-nums;
}
.ov-tile.is-empty { background: none; box-shadow: none; border: 1px dashed rgba(243, 237, 228, .12); }

.ov-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 36px; }
.ov-continue.btn { min-width: 300px; }
.ov-continue.btn-primary {
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 60%, #a8823e);
  border-color: #e9d29a;
  color: #231a10;
  font-weight: 700;
  box-shadow: var(--plaque-shadow), 0 14px 30px -14px rgba(231, 205, 138, .45);
}
.ov-continue.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f1dba2, var(--brass-2) 60%, var(--brass)); color: #1a130b; }
.ov-continue.btn:disabled { opacity: .5; box-shadow: var(--plaque-shadow); }
.ov-note { min-height: 1.5em; margin: 0; color: var(--muted); font-size: 14px; }

@keyframes ov-fade { from { opacity: 0; } }
@keyframes ov-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes ov-slide { from { opacity: 0; transform: translateX(-22px); } }
@keyframes ov-drop { 0% { opacity: 0; transform: translateY(-26px); } 70% { opacity: 1; transform: translateY(2px); } 100% { transform: none; } }
@keyframes ov-pop { 0% { opacity: 0; transform: translateY(-16px) scale(.86); } 65% { opacity: 1; transform: translateY(1px) scale(1.03); } 100% { transform: none; } }
@keyframes ov-punch { 40% { transform: scale(1.12); } }

/* ================================================================ round scoring */

.sc-sheet { display: flex; flex-direction: column; max-width: 1160px; }
.ov-head { position: relative; text-align: center; }
.sc-sheet .ov-title { font-size: clamp(44px, 5.6vw, 76px); line-height: 1; }
.ov-lede { max-width: 56ch; margin: 14px auto 0; color: var(--muted); font-size: 16px; text-wrap: balance; }
.ov-lede-short { display: none; }

.sc-body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 32px 64px;
  align-items: start;
  margin-top: clamp(24px, 4.5vh, 44px);
}
.rank-list, .payout-list, .standings-list { list-style: none; margin: 0; padding: 0; }

.rank-row {
  display: grid;
  grid-template-columns: 26px 6px minmax(0, 1fr) auto 64px 104px;
  grid-template-areas: 'n sw name tile count value';
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(243, 237, 228, .07);
}
.rank-n { grid-area: n; color: var(--muted); font: 600 24px/1 var(--display); font-variant-numeric: lining-nums; text-align: center; }
.rank-swatch { grid-area: sw; align-self: stretch; min-height: 30px; background: var(--artist); border-radius: 1px; box-shadow: 0 0 14px -2px var(--artist); }
.rank-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 26px/1.05 var(--display); }
.rank-tiles { grid-area: tile; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.ov-tile.is-past { width: 22px; height: 22px; font-size: 11px; opacity: .55; filter: saturate(.6); box-shadow: none; }
.rank-row[data-tile="0"] .ov-tile.is-past { opacity: .32; }
.rank-count { grid-area: count; color: var(--muted); font-size: 14px; white-space: nowrap; }
.rank-value { grid-area: value; text-align: right; color: var(--brass-2); font: 700 17px/1 var(--ui); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-row:not([data-tile="0"]) .rank-n { color: var(--brass-2); }
.rank-row[data-tile="0"] .rank-name { color: rgba(243, 237, 228, .74); }
.rank-row[data-tile="0"] .rank-swatch { opacity: .45; box-shadow: none; }
.rank-row[data-tile="0"] .rank-value { color: var(--ink-2); font-weight: 500; font-size: 15px; }
.rank-row[data-tile="0"] .rank-n { color: var(--ink-2); }
.rank-row[data-tile="0"] .rank-count { color: var(--ink-2); }

.payout-row {
  display: grid;
  grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) auto;
  grid-template-areas: 'name cards total';
  align-items: center;
  gap: 18px;
  min-height: 92px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(243, 237, 228, .07);
}
.payout-name { grid-area: name; min-width: 0; overflow-wrap: anywhere; font: 600 23px/1.1 var(--display); }
.payout-cards { grid-area: cards; display: flex; flex-wrap: wrap; gap: 10px 10px; }
.payout-none { grid-area: cards; color: var(--muted); font: italic 500 18px/1.2 var(--display); }
.payout-total { grid-area: total; min-width: 4.2ch; text-align: right; font: 600 36px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.payout-total.is-landed { animation: ov-punch .3s var(--ov-ease); }
.payout-row.is-you { margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: linear-gradient(90deg, rgba(200, 162, 84, .1), transparent 70%); box-shadow: inset 3px 0 0 var(--brass); }
.payout-row.is-you .payout-name, .payout-row.is-you .payout-total { color: var(--brass-2); }
.payout-row[data-zero="true"] .payout-total { color: var(--muted); }

.pay-card { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; }
.pay-card figcaption { color: var(--brass-2); font: 700 12px/1 var(--ui); font-variant-numeric: tabular-nums; }
.pay-card[data-worth="false"] .card { filter: grayscale(.85) brightness(.7); opacity: .6; }
.pay-card[data-worth="false"] figcaption { color: var(--muted); font-weight: 500; }

[data-animate="true"] .ov-head > * { animation: ov-rise .55s var(--ov-ease) both; }
[data-animate="true"] .ov-head > .ov-title { animation-delay: 70ms; }
[data-animate="true"] .ov-head > .ov-lede { animation-delay: 140ms; }
[data-animate="true"] .ov-head::after { animation: ov-fade .6s ease-out .2s both; }
[data-animate="true"] .sc-ranking .ov-section { animation: ov-fade .4s ease-out .15s both; }
[data-animate="true"] .rank-row { animation: ov-slide .45s var(--ov-ease) both; animation-delay: var(--d); }
[data-animate="true"] .rank-row .ov-tile:not(.is-empty):not(.is-past) { animation: ov-drop .45s cubic-bezier(.5, 0, .75, 0) both; animation-delay: calc(var(--d) + 220ms); }
[data-animate="true"] .sc-sales .ov-section { animation: ov-fade .4s ease-out both; animation-delay: var(--d); }
[data-animate="true"] .payout-row { animation: ov-rise .45s var(--ov-ease) both; animation-delay: var(--d); }
[data-animate="true"] .pay-card { animation: ov-pop .42s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: var(--d); }
[data-animate="true"] .ov-foot { animation: ov-fade .4s ease-out .3s both; }

/* ================================================================ game over */

.go-sheet {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: 40px 64px;
  align-items: center;
  max-width: 1280px;
}
.go-stage { text-align: center; min-width: 0; }
.go-head { position: relative; }
.go-crown { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 1.6vw, 20px); }
.go-title { font-size: clamp(46px, 6vw, 92px); line-height: .98; color: var(--ink); text-shadow: 0 2px 30px rgba(255, 214, 150, .18); }
.go-laurel-wrap { flex: none; width: clamp(34px, 3.8vw, 54px); color: var(--brass); }
.go-laurel-wrap[data-side="right"] { transform: scaleX(-1); }
.go-laurel { display: block; width: 100%; height: auto; }
.go-sub { margin: 12px 0 0; color: var(--brass-2); font: italic 500 clamp(22px, 2.2vw, 30px)/1.1 var(--display); font-variant-numeric: lining-nums; }

.go-wall {
  position: relative;
  margin-top: clamp(24px, 4vh, 40px);
  padding: 58px 28px 34px;
  min-height: 300px;
  overflow: hidden;
  border-radius: 3px;
  background:
    radial-gradient(ellipse 50% 70% at 50% 0%, rgba(255, 226, 182, .2), transparent 72%),
    linear-gradient(180deg, #24201c, #1a1714 75%, #15120f);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(200, 162, 84, .14);
  transition: filter .9s ease-out;
}
/* The picture rail the paintings hang from. */
.go-wall::before {
  content: '';
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(180deg, var(--brass-2), #8a6a32);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .6);
}
.go-cone {
  position: absolute;
  inset: 0 12% 0;
  pointer-events: none;
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 232, 196, .16), rgba(255, 232, 196, .04) 70%, transparent);
  transition: opacity .9s ease-out;
}
.go-hangs { position: relative; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 26px 30px; }
.go-hang { display: flex; flex-direction: column; align-items: center; margin: 0; transform: rotate(var(--tilt, 0deg)); transform-origin: 50% -36px; }
.go-wire {
  position: relative;
  width: 58px;
  height: 34px;
  margin-top: -36px;
  background:
    linear-gradient(to top right, transparent calc(50% - .8px), rgba(231, 205, 138, .55) 50%, transparent calc(50% + .8px)) left / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - .8px), rgba(231, 205, 138, .55) 50%, transparent calc(50% + .8px)) right / 50% 100% no-repeat;
}
.go-hang .card { margin-top: -2px; }
.go-hang .card-frame { box-shadow: var(--frame-shadow-lift); }
.go-hang .card-plaque { display: none; }
.go-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding: 6px 10px 7px;
  border-radius: 1px;
  background: #ece4d4;
  color: #2a2016;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .7);
  text-align: left;
}
.go-label-name { font: 600 15px/1 var(--display); }
.go-label-meta { font: 500 11px/1.1 var(--ui); color: #6b5a44; white-space: nowrap; }
.go-bare { position: relative; max-width: 30ch; margin: 64px auto; color: var(--muted); font: italic 500 20px/1.3 var(--display); }
.go-caption { margin: 12px 0 0; color: var(--ink-2); font: italic 500 18px/1.3 var(--display); }

.go-ledger { min-width: 0; }
.standing-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(243, 237, 228, .08);
}
.standing-rank { color: var(--muted); font: 600 28px/1 var(--display); font-variant-numeric: lining-nums; text-align: center; }
.standing-name { min-width: 0; overflow-wrap: anywhere; font: 600 26px/1.1 var(--display); }
.standing-purse { position: relative; display: inline-block; min-width: 4.4ch; padding: 4px 2px; text-align: right; }
.standing-money { font: 600 38px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.standing-money.is-landed { animation: ov-punch .32s var(--ov-ease); }
/* The museum screen: pleated felt over each player's money until it lifts. */
.standing-screen {
  position: absolute;
  inset: -2px -8px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #2e2622 0 5px, #241e1a 5px 10px);
  border-bottom: 2px solid var(--brass);
  box-shadow: 0 6px 12px -6px rgba(0, 0, 0, .8);
  clip-path: inset(0 0 0 0);
  transition: clip-path .6s cubic-bezier(.7, 0, .3, 1);
}
.standing-row.is-lifted .standing-screen { clip-path: inset(0 0 100% 0); }
.standing-row.is-you .standing-name { color: var(--brass-2); }
[data-revealed="true"] .standing-row[data-rank="1"] { margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: linear-gradient(90deg, rgba(200, 162, 84, .14), transparent 80%); box-shadow: inset 3px 0 0 var(--brass); }
[data-revealed="true"] .standing-row[data-rank="1"] .standing-money,
[data-revealed="true"] .standing-row[data-rank="1"] .standing-rank { color: var(--brass-2); }
.go-ledger .ov-foot { align-items: stretch; }
.go-ledger .ov-continue.btn { min-width: 0; width: 100%; }

/* The curtain: the museum's screens over the whole room, lifting on open. */
.go-curtain {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .35), transparent 30%, transparent 85%, rgba(0, 0, 0, .3)),
    repeating-linear-gradient(90deg, #29221e 0 26px, #1f1a17 26px 52px);
  border-bottom: 6px solid var(--brass);
  box-shadow: 0 2px 0 #7d5f2c, 0 18px 40px rgba(0, 0, 0, .7);
  transform: translateY(-110%);
}
.go-curtain-label { color: rgba(231, 205, 138, .5); font: italic 500 clamp(32px, 5vw, 56px)/1 var(--display); }
@keyframes go-lift { from { transform: none; } to { transform: translateY(-110%); } }
[data-animate="true"] .go-curtain { animation: go-lift 1.05s cubic-bezier(.65, 0, .35, 1) .25s both; }
@keyframes go-hang-in { 0% { opacity: 0; transform: translateY(-40px) rotate(-7deg); } 60% { opacity: 1; transform: translateY(3px) rotate(calc(var(--tilt, 0deg) + 2deg)); } 100% { transform: rotate(var(--tilt, 0deg)); } }

/* Until the winner is revealed, the gallery is dark and the title unwritten. */
[data-animate="true"][data-revealed="false"] .go-laurel-wrap,
[data-animate="true"][data-revealed="false"] .go-sub { opacity: 0; }
[data-animate="true"][data-revealed="false"] .go-title { color: rgba(243, 237, 228, .5); font-style: italic; font-weight: 500; font-size: clamp(34px, 4.2vw, 62px); }
[data-animate="true"][data-revealed="false"] .go-head { animation: ov-fade .8s ease-out 1s both; }
[data-animate="true"][data-revealed="false"] .go-wall { filter: brightness(.6) saturate(.5); }
[data-animate="true"][data-revealed="false"] .go-cone { opacity: 0; }
[data-animate="true"][data-revealed="false"] .go-hang,
[data-animate="true"][data-revealed="false"] .go-caption,
[data-animate="true"][data-revealed="false"] .go-bare { opacity: 0; }
[data-animate="true"][data-revealed="true"] .go-title { animation: ov-rise .7s var(--ov-ease) both; }
[data-animate="true"][data-revealed="true"] .go-sub { animation: ov-rise .7s var(--ov-ease) .25s both; }
[data-animate="true"][data-revealed="true"] .go-laurel-wrap { animation: go-laurel .9s var(--ov-ease) .1s both; }
@keyframes go-laurel { from { opacity: 0; translate: 0 10px; scale: .85; } }
[data-animate="true"][data-revealed="true"] .go-hang { animation: go-hang-in .8s cubic-bezier(.3, 1.2, .5, 1) both; animation-delay: calc(var(--d) + 350ms); }
[data-animate="true"][data-revealed="true"] .go-caption,
[data-animate="true"][data-revealed="true"] .go-bare { animation: ov-fade .6s ease-out .8s both; }
[data-animate="false"] .standing-screen { transition: none; }
[data-animate="false"] .go-wall { transition: none; }

/* ================================================================ how to play */

dialog.overlay-howto {
  width: min(760px, calc(100% - 32px));
  max-width: none;
  /* An explicit height, not just a cap: iOS Safari resolves the sheet's
     flex-basis 0% against a content-sized dialog and collapses it to nothing. */
  height: min(880px, calc(100dvh - 48px));
  max-height: min(880px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #2a2521, var(--wall-2) 30%, #201c19);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9);
}
dialog.overlay-howto[open] { display: flex; flex-direction: column; }
dialog.overlay-howto::backdrop { background: rgba(10, 9, 8, .72); backdrop-filter: blur(3px); }
.ht-sheet { position: relative; display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
/* Scroll cue: a 36px gutter below the scroll area (the body stops above it,
   so no paragraph runs under the cue) holding a brass chevron, with only a
   short feather over the body's last few pixels. Hidden at the end. */
.ht-sheet { --ht-gutter: 36px; --ht-feather: 14px; }
.ht-more {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--ht-gutter) + var(--ht-feather));
  display: grid;
  place-items: end center;
  padding-bottom: 6px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(32, 28, 25, 0), #201c19 var(--ht-feather));
  color: var(--brass-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: opacity .25s ease;
}
.ht-more svg { width: 22px; height: 22px; animation: ht-nudge 1.8s ease-in-out infinite; }
@keyframes ht-nudge { 50% { transform: translateY(3px); } }
.ht-sheet[data-at-end="true"] .ht-more { opacity: 0; }
.ht-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 28px 16px; border-bottom: 1px solid rgba(200, 162, 84, .3); }
.ht-title { font-size: 38px; line-height: 1; }
.ht-close { flex: none; width: 40px; height: 40px; }
.ht-body { overflow-y: auto; overscroll-behavior: contain; margin-bottom: var(--ht-gutter); padding: 18px 28px 20px; }
.ht-body > p { max-width: 64ch; margin: 0 0 14px; color: rgba(243, 237, 228, .86); font-size: 15.5px; line-height: 1.6; }
.ht-body > .ht-lede { color: var(--ink); font: 500 21px/1.4 var(--display); }
.ht-body > .ov-section { margin-top: 26px; }
.ht-types { list-style: none; margin: 0; padding: 0; }
.ht-type { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 22px; align-items: start; padding: 16px 0; border-bottom: 1px solid rgba(243, 237, 228, .07); }
.ht-card { padding-top: 4px; }
.ht-card .card { zoom: .7; }
/* Illustrations only: the art in its frame, no plaque too small to read. */
.ht-card .card-plaque { display: none; }
.ht-name { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font: 600 23px/1.1 var(--display); }
.ht-glyph { flex: none; width: 22px; height: 22px; color: var(--brass-2); }
.ht-text p { margin: 0; color: rgba(243, 237, 228, .86); font-size: 15px; line-height: 1.6; }
.ht-scoring { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.ht-scoring p { margin: 0; color: rgba(243, 237, 228, .86); font-size: 15.5px; line-height: 1.6; }
.ht-tiles { display: flex; flex: none; gap: 6px; }
.ht-deck { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 14px; padding: 0; }
.ht-artist { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 1px solid rgba(243, 237, 228, .12); border-radius: 999px; font-size: 15px; }
.ht-swatch { width: 14px; height: 14px; border-radius: 3px; background: var(--artist); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.ht-artist-name { color: rgba(243, 237, 228, .86); }
.ht-artist-count { color: var(--brass-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.ht-deal { border-collapse: collapse; margin: 0 0 14px; font-size: 15px; font-variant-numeric: tabular-nums; }
.ht-deal th, .ht-deal td { padding: 6px 14px; text-align: center; border-bottom: 1px solid rgba(243, 237, 228, .07); }
.ht-deal thead th { color: rgba(243, 237, 228, .6); font-weight: 500; font-size: 13px; }
.ht-deal tbody th { color: var(--ink); font-weight: 600; text-align: left; }
.ht-deal td { color: rgba(243, 237, 228, .86); }

/* ================================================================ overlays: narrow screens */

@media (max-width: 900px) {
  .go-sheet { grid-template-columns: minmax(0, 1fr); }
  .sc-body { grid-template-columns: minmax(0, 1fr); gap: 36px; }
}

@media (max-width: 720px) {
  .ov-sheet { padding: 28px 16px 24px; }
  /* Scoring on a phone: a tight header and compact rows, so the ranking and
     the first sale are on screen at once. */
  /* A real top inset (notch included), so the kicker never meets the screen edge. */
  .sc-sheet { padding-top: calc(24px + env(safe-area-inset-top, 0px)); }
  .sc-sheet .ov-kicker { margin-bottom: 4px; font-size: 13px; }
  .sc-sheet .ov-title { font-size: 34px; }
  .sc-sheet .ov-head::after { margin-top: 14px; }
  .ov-lede { margin-top: 8px; font-size: 14px; }
  .ov-lede-long { display: none; }
  .ov-lede-short { display: inline; }
  .sc-body { margin-top: 16px; gap: 24px; }
  .sc-sheet .ov-section { font-size: 19px; padding-bottom: 6px; margin-bottom: 2px; }
  .rank-row {
    grid-template-columns: 18px 4px minmax(0, 1fr) auto;
    grid-template-areas: 'n sw name tile' 'n sw count value';
    column-gap: 10px;
    row-gap: 1px;
    padding: 6px 0;
  }
  .rank-n { font-size: 21px; }
  .rank-swatch { min-height: 24px; }
  .rank-name { font-size: 21px; line-height: 1.05; }
  .rank-count { font-size: 12.5px; }
  .rank-row .ov-tile:not(.is-past) { width: 26px; height: 26px; }
  .ov-tile.is-past { width: 20px; height: 20px; }
  .rank-value { font-size: 15px; }
  .rank-row[data-tile="0"] .rank-value { font-size: 13px; }
  .payout-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name total' 'cards cards'; gap: 10px 12px; min-height: 0; }
  .payout-name { font-size: 21px; }
  /* A sale's paintings wrap into a grid of legible mini cards. */
  .payout-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 12px 8px; }
  .payout-cards .card-art { width: 50px !important; height: 67px !important; }
  .pay-card figcaption { font-size: 13px; }
  .payout-total { font-size: 30px; }
  .ov-foot { padding-top: 24px; }
  .ov-continue.btn { min-width: 0; width: 100%; }
  /* Once Continue is armed it sticks to the bottom of the dialog, over a fade. */
  #scoring-dialog[data-ready="true"] .ov-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0 -16px -24px;
    padding: 28px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(18, 16, 14, 0), rgba(18, 16, 14, .94) 26px, var(--ov-night) 60%);
  }
  #scoring-dialog[data-ready="true"] .ov-note:empty { min-height: 0; margin-top: -10px; }
  /* The sticky foot stays in flow, so it is the list's bottom padding: at the
     end of the scroll the last sale sits fully above the button (52px button
     + 28px fade + 14px inset, never less than the button + 16px). */

  /* Phone: the winner, then the first row of the wall above the fold, then
     the standings; Play again floats at the bottom of the screen once armed. */
  .go-sheet { gap: 24px; padding-top: calc(24px + env(safe-area-inset-top, 0px)); }
  .go-stage { display: contents; }
  .go-head { order: 1; }
  .go-head::after { margin-top: 16px; }
  .go-sub { margin-top: 8px; }
  .go-wall { order: 2; margin-top: 0; }
  .go-caption { order: 3; margin-top: -14px; text-align: center; }
  .go-ledger { order: 4; }
  .go-title { font-size: 46px; }
  .go-wall { min-height: 200px; padding: 48px 10px 22px; }
  #gameover-dialog[data-ready="true"] .go-sheet { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  #gameover-dialog[data-ready="true"] .go-ledger .ov-foot {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 28px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(18, 16, 14, 0), rgba(18, 16, 14, .94) 26px, var(--ov-night) 60%);
  }
  #gameover-dialog[data-ready="true"] .go-ledger .ov-note:empty { display: none; }
  .go-hangs { gap: 22px 16px; }
  .go-hang .card { zoom: .82; }
  .standing-row { padding: 12px 0; grid-template-columns: 28px minmax(0, 1fr) auto; }
  .standing-name { font-size: 23px; }
  .standing-money { font-size: 32px; }

  /* A 12px gutter to the screen edges on every side. */
  dialog.overlay-howto { width: calc(100% - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); }
  .ht-head { padding: 16px 18px 12px; }
  .ht-title { font-size: 32px; }
  .ht-body { padding: 14px 18px 18px; }
  .ht-type { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
  .ht-card .card { zoom: .45; }
  .ht-scoring { flex-direction: column; align-items: flex-start; gap: 12px; }
  .ht-deal th, .ht-deal td { padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .ht-more svg { animation: none; }
  dialog.overlay-full, dialog.overlay-full * { animation: none !important; }
  .standing-screen, .go-wall, .go-cone { transition: none !important; }
}

/* ---------------------------------------------------------------- magnify (magnify.js) */

dialog.magnify {
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  padding: 28px 28px 22px;
  border: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse 110% 80% at 50% 30%, var(--wall-2), var(--wall) 80%);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(200, 162, 84, .35), 0 30px 80px rgba(0, 0, 0, .7);
  cursor: zoom-out;
  overflow: hidden;
}
dialog.magnify::backdrop { background: rgba(10, 9, 8, .82); }
dialog.magnify:focus, dialog.magnify:focus-visible { outline: none; }
dialog.magnify[open] { animation: mag-in .22s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes mag-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.mag-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mag-frame {
  display: block;
  line-height: 0;
  padding: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--artist) 78%, #fff6e0), var(--artist) 42%, color-mix(in srgb, var(--artist) 68%, #000));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 0 0 4px var(--brass), 0 0 0 5px rgba(0, 0, 0, .5), 0 34px 50px -18px rgba(0, 0, 0, .85);
}
.mag-frame canvas { display: block; outline: 1px solid rgba(0, 0, 0, .55); }
.mag-caption { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(200, 162, 84, .55); min-width: 70%; }
.mag-artist { display: inline-flex; align-items: center; gap: 10px; margin: 0; font: 600 28px/1.1 var(--display); color: var(--ink); }
.mag-swatch { width: 14px; height: 14px; border-radius: 2px; background: var(--artist); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.mag-meta { display: flex; align-items: center; gap: 14px; margin: 0; font-size: 14px; color: var(--brass-2); }
.mag-type { display: inline-flex; align-items: center; gap: 6px; }
.mag-glyph { width: 18px; height: 18px; }
@media (max-width: 480px) {
  dialog.magnify { padding: 18px 16px 16px; }
  .mag-frame { padding: 9px; }
  .mag-artist { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.magnify[open] { animation: none; }
}
