/* ARISAN — "Afternoon Table" design system, radial edition.
 * See 01-konsep/KONSEP.md: the site IS the round table, not a stack of sections.
 * Design language: paper, wood, clay, brass, pine; Fraunces + Public Sans + IBM Plex Mono.
 */
:root {
  --paper: #F3EBDD;
  --paper-2: #EADFCB;
  --paper-3: #F8F2E7;
  --table: #6B3F2A;
  --table-edge: #4A2A1C;
  --ink: #1F1A15;
  --ink-2: #5E5246;
  --line: #D3C3A8;
  --clay: #C4502F;
  --clay-soft: #FBE9DF;
  --brass: #D9A23A;
  --brass-light: #F0C66A;
  --pine: #2E6B5E;
  --dusk: #8B7FB5;
  --sim: #B23A6B;

  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-text: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --maxw: 1200px;
  --maxw-table: 760px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--f-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- simulation ribbon + pill ---------- */
.sim-ribbon {
  background: var(--sim); color: #fff; text-align: center;
  font: 600 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 12px;
}
.sim-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--sim); color: #fff;
  font: 600 11px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 999px;
}
.sim-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .85; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
header.site {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.brand-name { font: 600 22px/1 var(--f-display); letter-spacing: .02em; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main a {
  text-decoration: none; padding: 8px 12px; border-radius: 999px;
  font-weight: 500; font-size: 15px; color: var(--ink-2);
  transition: background .2s, color .2s;
}
nav.main a:hover { background: var(--paper-2); color: var(--ink); }
nav.main a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Radial stage — the page IS the table. One composition per page. */
.stage {
  position: relative;
  max-width: var(--maxw-table);
  margin: 0 auto;
  padding: 8px 16px 24px;
}
.stage > .eyebrow { text-align: center; }

/* The radial table occupies the center; "clefs" ring around it.
   On wide screens clefs sit to the sides of the table; on narrow they stack below. */
.table-ring {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin-top: 8px;
}
@media (min-width: 980px) {
  .table-ring { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
  .table-ring .clef-col { display: grid; gap: 18px; }
}

/* ---------- table widget (unchanged JS contract; new framing) ---------- */
.table-widget { position: relative; }
.table-widget .tw-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.table-widget .tw-title { font: 500 13px/1.3 var(--f-mono); color: var(--ink-2); }
.table-stage { position: relative; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 1; }
.table-stage svg { width: 100%; height: 100%; display: block; overflow: visible; }
.seat { cursor: pointer; }
.seat:focus { outline: none; }
.seat:focus-visible .seat-ring { stroke: var(--clay); stroke-width: 6; }
.seat-ring { transition: stroke .4s, stroke-width .3s; }
.seat-num { font: 600 22px var(--f-display); fill: var(--ink); pointer-events: none; }
.seat-tag { font: 600 10px var(--f-mono); letter-spacing: .08em; pointer-events: none; }
.pot-amount { font: 500 44px var(--f-display); fill: #2b1d0e; font-variation-settings: "SOFT" 100; }
.pot-asset { font: 600 14px var(--f-mono); fill: #3d2a14; letter-spacing: .06em; }
.pot-time { font: 600 18px var(--f-mono); fill: var(--paper); }
.pot-label { font: 600 10px var(--f-mono); fill: var(--paper); letter-spacing: .14em; opacity: .85; }
/* Ring, pot and pointer are eased frame by frame in table.js (paint), so no CSS transitions here. */
.seat-body, .pot-disc, .pot-burst, .seat-star { transform-box: fill-box; transform-origin: center; }
.seat-ripple { opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.seat.is-turn .seat-ripple { animation: seat-ripple 2.4s cubic-bezier(.2,.6,.3,1) infinite; }
.seat.is-urgent .seat-ripple { animation-duration: .9s; }
@keyframes seat-ripple {
  0% { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.75); }
}
.seat:hover .seat-body { transform: scale(1.06); }
.seat-body { transition: transform .2s ease-out; }
.time-chip { transition: fill .3s; }

/* payout toast: appears above the pot when a round settles */
.pay-toast {
  position: absolute; left: 50%; top: 7%; z-index: 4; pointer-events: none;
  transform: translate(-50%, 8px); opacity: 0;
  background: var(--ink); color: var(--paper); border-radius: 999px;
  font: 600 12.5px/1.3 var(--f-mono); letter-spacing: .02em; padding: 9px 14px; white-space: nowrap;
  max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 10px 24px rgba(31,26,21,.22);
}
.pay-toast::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brass); margin-right: 8px; vertical-align: 0; }
.pay-toast.show { animation: toast 2.6s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.96); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}
@media (prefers-reduced-motion: reduce) {
  .seat.is-turn .seat-ripple { animation: none; opacity: .5; }
  .seat-body { transition: none; }
  .pay-toast.show { animation: none; opacity: 0; }
}

.seat-card {
  position: absolute; z-index: 5; min-width: 210px; pointer-events: none;
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(31,26,21,.15);
  transform: translate(-50%, calc(-100% - 14px)); opacity: 0; transition: opacity .15s;
}
.seat-card.show { opacity: 1; }
.seat-card b { font-family: var(--f-display); font-size: 16px; font-weight: 600; }
.seat-card .row { display: flex; justify-content: space-between; gap: 12px; }
.seat-card .row span:last-child { font-family: var(--f-mono); }

.tw-controls { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.tw-status { text-align: center; font: 500 13px/1.4 var(--f-mono); color: var(--ink-2); margin-top: 8px; min-height: 1.4em; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 3px solid; background: var(--paper); }

/* ---------- round rail (below the table) ---------- */
.rail { position: relative; margin: 22px auto 0; max-width: 620px; padding: 22px 6px 0; }
.rail-track { position: absolute; left: 24px; right: 24px; top: 30px; height: 3px; background: var(--line); border-radius: 2px; }
.rail-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--pine); border-radius: 2px; transition: width .25s linear; }
.rail-train { position: absolute; top: -6px; width: 22px; height: 15px; border-radius: 8px; background: var(--brass); border: 2px solid var(--table-edge); transform: translateX(-50%); transition: left .25s linear; }
.rail-stations { position: relative; display: flex; justify-content: space-between; }
.station { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 36px; }
.station .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 3px solid var(--line); }
.station.done .dot { background: var(--pine); border-color: var(--pine); }
.station.active .dot { border-color: var(--clay); background: var(--clay); box-shadow: 0 0 0 5px rgba(196,80,47,.18); }
.station .lbl { font: 600 11px/1 var(--f-mono); color: var(--ink-2); }
.station.active .lbl { color: var(--clay); }
@media (prefers-reduced-motion: reduce) { .rail-fill, .rail-train { transition: none; } }

/* ---------- clef panels (knowledge around the table) ---------- */
.clef {
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 18px 20px;
  border-left: 4px solid var(--brass);
  transition: opacity .3s;
}
.clef.is-turn { border-left-color: var(--clay); }
.clef.is-pine { border-left-color: var(--pine); }
.clef.is-ink  { border-left-color: var(--ink); }
.clef h3 { font-size: 18px; margin: 2px 0 8px; }
.clef .clef-eyebrow {
  font: 500 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2); display: block; margin-bottom: 4px;
}
.clef p { margin: 0 0 8px; font-size: 14.5px; }
.clef p:last-child { margin-bottom: 0; }
.clef ul { margin: 0; padding-left: 18px; }
.clef ul li { margin-bottom: 6px; font-size: 14px; }
.clef .num { font: 500 12px/1 var(--f-mono); color: var(--clay); display: block; margin-bottom: 8px; }

/* ---------- typography ---------- */
h1, h2, h3 { font-family: var(--f-display); font-weight: 500; line-height: 1.1; margin: 0 0 16px; font-variation-settings: "SOFT" 80; }
h1 { font-size: clamp(34px, 5.4vw, 60px); letter-spacing: -.015em; }
h2 { font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.01em; }
h3 { font-size: 20px; }
p { margin: 0 0 14px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 36em; }
.eyebrow { font: 500 12px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 12px; display: block; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: 600 14px/1 var(--f-text); padding: 11px 16px; border-radius: 999px;
  cursor: pointer; text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.btn.primary:hover { background: #a8421f; border-color: #a8421f; }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- reveal-on-scroll: soft settle, staggered per column (--d set by motion.js) ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--d, 0ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
/* clefs slide in from the side of the table they belong to */
/* side-slide only when the clefs really flank the table; stacked on mobile it would push past the screen edge */
@media (min-width: 980px) {
  .js .clef-col:first-child .clef[data-reveal] { transform: translate(-18px, 10px); }
  .js .clef-col:last-child .clef[data-reveal] { transform: translate(18px, 10px); }
}
/* elements already on screen at load: shown at once, no fade (set by motion.js) */
.js [data-reveal].no-anim { transition: none !important; }
.js .clef-col .clef[data-reveal].is-in { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js .clef-col .clef[data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* clef that is being read lights its edge; links attention back to the table */
.clef { transition: opacity .3s, box-shadow .35s, transform .35s; }
.clef.is-reading { background: var(--paper-3); box-shadow: 0 10px 30px rgba(31,26,21,.08); }
/* once revealed, drop the stagger so hover responds at once */
.js [data-reveal].is-settled { transition: opacity .3s, transform .3s ease-out, background .35s, box-shadow .35s; transition-delay: 0ms; }
.clef:hover, .js .clef-col .clef[data-reveal].is-in:hover { transform: translateY(-2px); }

/* ---------- page-to-page: the same table, seen from another angle ---------- */
@view-transition { navigation: auto; }
.table-stage { view-transition-name: turn-table; }
.brand { view-transition-name: turn-brand; }
::view-transition-old(root) { animation: vt-out .28s ease-in both; }
::view-transition-new(root) { animation: vt-in .45s cubic-bezier(.2,.7,.2,1) both; }
::view-transition-group(turn-table) { animation-duration: .6s; animation-timing-function: cubic-bezier(.3,.8,.2,1); }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- event log ---------- */
.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper-3); }
.log li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 14px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.log li:last-child { border-bottom: 0; }
.log time { font: 500 12px/1.6 var(--f-mono); color: var(--ink-2); }
.log .ev-settle { color: var(--clay); font-weight: 600; }
.log .ev-claim { color: var(--pine); font-weight: 600; }
.log .ev-default { color: #7a6f66; text-decoration: line-through; }
.log li.is-new { animation: log-in .5s cubic-bezier(.2,.7,.2,1); }
@keyframes log-in { from { opacity: 0; transform: translateY(-8px); background: rgba(217,162,58,.22); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .log li.is-new { animation: none; } }

/* ---------- cards / grids (still used for token + honesty surfaces) ---------- */
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }
.card { background: var(--paper-2); border-radius: var(--r); padding: 20px; }
.card .num { font: 500 13px/1 var(--f-mono); color: var(--clay); display: block; margin-bottom: 12px; }
.card p:last-child { margin-bottom: 0; }

.pill { display: inline-block; font: 600 11px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; }
.pill.open { background: rgba(139,127,181,.18); color: #5a4f8a; }
.pill.live { background: rgba(196,80,47,.14); color: var(--clay); }
.pill.closed { background: rgba(46,107,94,.15); color: var(--pine); }
.pill.cancelled { background: rgba(94,82,70,.15); color: var(--ink-2); }
.pill.flash { background: rgba(217,162,58,.25); color: #7a5410; }

/* table list — each item IS a mini radial table, not a box card */
.tbl-list { display: grid; gap: 12px; }
.tbl-item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center;
  background: var(--paper-2); border: 1.5px solid transparent; border-radius: var(--r); padding: 14px 16px;
  cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%;
  transition: border-color .2s, background .2s;
}
.tbl-item:hover { border-color: var(--line); }
.tbl-item[aria-selected="true"] { border-color: var(--ink); background: var(--clay-soft); }
.tbl-item h3 { margin: 0 0 4px; font-size: 18px; }
.tbl-item .meta { font: 500 12.5px/1.4 var(--f-mono); color: var(--ink-2); }
.tbl-item .right { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.rounds-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.15fr); gap: 28px; align-items: start; }
@media (max-width: 960px) { .rounds-layout { grid-template-columns: minmax(0, 1fr); } }
.detail { position: sticky; top: 16px; background: var(--paper-3); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }

.ledger { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 18px; }
.ledger th { text-align: left; font: 600 11px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 8px; border-bottom: 1.5px solid var(--ink); }
.ledger td { padding: 9px 8px; border-bottom: 1px dashed var(--line); font-family: var(--f-mono); font-size: 13px; }
.ledger tr.active td { color: var(--clay); font-weight: 600; }
/* the active round row fills like the ring: elapsed share of the round */
.ledger tr.active { background: linear-gradient(90deg, rgba(196,80,47,.12) var(--p, 0%), transparent var(--p, 0%)); }

/* mini tables: a live table's turn seat and pot breathe */
.mini-table .mini-turn, .mini-table .mini-pot { transform-box: fill-box; transform-origin: center; }
.mini-table .mini-turn { animation: mini-turn 1.8s ease-in-out infinite; }
.mini-table .mini-pot { animation: mini-pot 1.8s ease-in-out infinite; }
@keyframes mini-turn { 50% { transform: scale(1.35); } }
@keyframes mini-pot { 50% { opacity: .7; } }
.detail-swap { animation: detail-swap .5s cubic-bezier(.2,.7,.2,1); }
@keyframes detail-swap { from { opacity: 0; transform: scale(.97) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) {
  .mini-table .mini-turn, .mini-table .mini-pot, .detail-swap { animation: none; }
}

/* ---------- flash: the countdown strip ---------- */
.flash-strip {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  background: var(--ink); color: var(--paper); border-radius: var(--r-lg);
  padding: 14px 20px; margin: 18px auto 10px; max-width: 640px;
  transition: background .35s;
}
.flash-strip.is-urgent { background: var(--clay); }
.flash-strip .fs-label { font: 600 11px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.flash-strip .fs-clock { font: 600 40px/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; display: inline-flex; }
.flash-strip .fs-clock span { display: inline-block; min-width: .62em; text-align: center; }
.flash-strip .fs-clock span.roll { animation: digit-roll .32s cubic-bezier(.2,.7,.2,1); }
@keyframes digit-roll { from { transform: translateY(-45%); opacity: 0; } }
.flash-strip .fs-who { font: 500 14px/1.35 var(--f-text); }
.flash-strip .fs-who b { font-family: var(--f-display); font-size: 19px; font-weight: 600; }
.flash-strip .fs-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(243,235,221,.18); overflow: hidden; }
.flash-strip .fs-bar i { display: block; height: 100%; width: 100%; background: var(--brass); transform-origin: left; }
.flash-strip.is-urgent .fs-bar i { background: var(--paper); }
.flash-strip.is-urgent .fs-clock { animation: clock-beat .8s ease-in-out infinite; }
@keyframes clock-beat { 50% { opacity: .72; } }
@media (max-width: 620px) {
  .flash-strip { grid-template-columns: 1fr; text-align: center; }
  .flash-strip .fs-clock { font-size: 34px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .flash-strip .fs-clock span.roll, .flash-strip.is-urgent .fs-clock { animation: none; }
}
.queue li .mini-table { flex: none; }
.queue li .q-main { display: flex; align-items: center; gap: 12px; }

/* ---------- honesty + token surfaces ---------- */
.honesty { background: var(--paper-2); border-left: 4px solid var(--ink); border-radius: 0 var(--r) var(--r) 0; padding: 24px 26px; }
.honesty ul { margin: 0; padding-left: 20px; }
.honesty li { margin-bottom: 8px; }
.honesty h3 { margin-top: 6px; }
.token-box { border: 1.5px dashed var(--ink-2); border-radius: var(--r-lg); padding: 26px; display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.token-box .coin { width: 92px; height: 92px; }
@media (max-width: 620px) { .token-box { grid-template-columns: 1fr; } }
.token-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; font-family: var(--f-mono); font-size: 14px; margin-top: 10px; }
.token-facts span b { font-weight: 600; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--f-mono); text-align: right; }
.queue { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.queue li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; background: var(--paper-2); border-radius: var(--r-sm); padding: 10px 14px; font-size: 14px; }

/* ---------- footer ---------- */
footer.site { padding: 36px 0 52px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- page title block above a radial stage ---------- */
.page-title { text-align: center; max-width: 40em; margin: 0 auto 6px; }
.page-title h1 { margin-bottom: 10px; }
.page-title .lede { margin: 0 auto; }

/* hero lede under the live table */
.stage-cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }

/* ---------- small screens (390px class): nothing may be wider than the screen ---------- */
html, body { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
.stage, .table-widget, #hero-table, #flash-table, #detail-table, .detail, .clef, .page-title { min-width: 0; max-width: 100%; }
.table-stage { max-width: min(560px, 100%); }
.page-title, .eyebrow, .lede, h1, h2, h3 { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .stage { padding: 4px 0 20px; }
  /* nav: brand on its own row, links in a tidy 3-column grid below it */
  header.site { flex-wrap: wrap; gap: 10px; padding: 12px 0; }
  nav.main { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  nav.main a { text-align: center; padding: 12px 4px; font-size: 14px; line-height: 1.2; }
  .sim-ribbon { font-size: 11px; line-height: 1.4; letter-spacing: .05em; }
  .eyebrow { letter-spacing: .06em; line-height: 1.4; }
  .lede { font-size: 16.5px; }
  .detail { padding: 14px; }
  .clef { padding: 16px; }
  .seat-card { min-width: 0; width: max-content; max-width: 220px; }
  /* rail: stations may shrink so 10-round tables still fit */
  .station { width: 28px; flex: 0 1 28px; min-width: 0; }
  .rail { padding-left: 2px; padding-right: 2px; }
  .rail-track { left: 16px; right: 16px; }
  .station .lbl { font-size: 10px; }
  .tbl-item { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .tbl-item .mini-table { width: 52px; height: 52px; }
  .tbl-item .right { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; }
  .ledger th, .ledger td { padding: 7px 5px; font-size: 12px; }
  .log li { grid-template-columns: 58px minmax(0, 1fr); padding: 8px 10px; }
  .kv { gap: 6px 12px; }
  footer.site { flex-direction: column; }
}

/* --- 3D table showcase (round 3) --- */
.table-3d { margin: 64px 0 10px; }
.table-3d h2 { font-family: var(--f-display); font-weight: 560; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; margin: 8px 0 10px; color: var(--ink); }
.table-3d model-viewer { width: 100%; height: min(560px, 72vh); background: #171310; border-radius: 18px; display: block; }
.table-3d .note { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }
