/* Isle of Bots — play client. Everything here sits on Nora's tokens.css.
   Printed poster rules: flat inks, 3px keylines, hard offset shadows, cream paper. Never dark. */

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
#app { height: 100dvh; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-soft); }
.small { font-size: 0.82rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; }
.stack > * + * { margin-top: 0.6rem; }
.grow { flex: 1; min-width: 0; }

/* Buttons: Nora's .btn-isle, plus quieter siblings */
.btn { border: var(--line-print) solid var(--ink); border-radius: var(--radius-md); background: var(--surface);
  padding: 0.45rem 0.9rem; font-weight: 600; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease; }
.btn:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible, .btn-isle:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.btn.sea { background: var(--brand-2); color: var(--ink-invert); }
.btn.coral { background: var(--coral); color: var(--ink-invert); }
.btn.tiny { padding: 0.15rem 0.55rem; border-width: 2px; border-radius: var(--radius-sm); box-shadow: 2px 2px 0 var(--ink); font-size: 0.82rem; }
.btn.on { background: var(--sun-soft); }
/* Off is a different ink, not a 45% print of the same one: disabled coral was a seat pink with cream text at 1.58:1 (Nora). This is 5.0:1. AFTER the colours: .btn.coral weighs the same and would win. */
.btn[disabled] { opacity: 1; background: var(--surface-soft); color: var(--ink-soft); border-color: var(--ink-soft); box-shadow: none; transform: none; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; }

input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; }
textarea { resize: vertical; min-height: 4.5rem; }
label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.2rem; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 1.6rem; background: transparent; margin: 0; cursor: pointer; --fill: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 0.75rem; box-sizing: border-box; border: 2px solid var(--ink); border-radius: var(--radius-round); background: linear-gradient(to right, var(--brand-2) var(--fill), var(--bg-soft) var(--fill)); }
input[type=range]::-moz-range-track { height: 0.75rem; box-sizing: border-box; border: 2px solid var(--ink); border-radius: var(--radius-round); background: var(--bg-soft); }
input[type=range]::-moz-range-progress { height: 0.75rem; box-sizing: border-box; border: 2px solid var(--ink); border-radius: var(--radius-round); background: var(--brand-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.35rem; height: 1.35rem; margin-top: calc((0.75rem - 4px - 1.35rem) / 2); box-sizing: border-box; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); box-shadow: 2px 2px 0 var(--ink); }
input[type=range]::-moz-range-thumb { width: 1.35rem; height: 1.35rem; box-sizing: border-box; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); box-shadow: 2px 2px 0 var(--ink); }
input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none; width: 1.5rem; height: 1.5rem; margin: 0; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; vertical-align: middle; }
input[type=checkbox]:checked { background: var(--palm); }
input[type=checkbox]:checked::after { content: '✓'; color: var(--ink-invert); font-weight: 700; line-height: 1; }

/* ── Front door and lobby ── */
.page { flex: 1; overflow: auto; padding: 1rem; }
.page-inner { max-width: 980px; margin: 0 auto; }
.masthead { display: flex; align-items: center; gap: 0.8rem; margin: 0.4rem 0 1.2rem; }
.masthead img { width: 56px; height: 56px; border-radius: var(--radius-md); border: var(--line-print) solid var(--ink); }
.masthead h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.card { background: var(--surface); border: var(--line-print) solid var(--ink); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-print); padding: 1.1rem; }
/* The harbour (lobby.js): one column of tables beside a rail, never three equal columns. Tables are the page; the high
   scores and your bots are reference, so they sit in the rail and fold under on a narrow screen. */
.page-inner.wide { max-width: 1180px; }
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1.6rem; align-items: start; margin-top: 1.4rem; }
.lobby > * { min-width: 0; }
.lmain { display: grid; gap: 1.8rem; }
.lside { display: grid; gap: 1.2rem; position: sticky; top: 0.2rem; }
.lsec > * + * { margin-top: 0.6rem; }
.lsec h2, .lside h2, .callout h2, .composer h2 { font-size: 1.45rem; }
/* dotted, like the routes on the chart */
.lsec.empty { border: var(--line-print) dotted var(--line-strong); border-radius: var(--radius-lg); padding: 1.4rem; text-align: center; }
.callout { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--brand); color: var(--ink-invert); border: var(--line-print) solid var(--ink);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-print); padding: 1rem 1.3rem; }
.callout h2 { color: var(--ink-invert); }
.tablegrid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); align-items: stretch; }
.tablecard { background: var(--surface); border: var(--line-print) solid var(--ink); border-radius: var(--radius-md); box-shadow: 4px 4px 0 var(--ink); padding: 0.9rem 1rem; }
.tablecard.waiting { box-shadow: 4px 4px 0 var(--coral); }   /* coral = your turn: this table waits on your orders */
.tablecard.stack { display: flex; flex-direction: column; gap: 0.6rem; } .tablecard.stack > * + * { margin-top: 0; }
.tablecard.stack > .last { margin-top: auto; }   /* rows square off: the buttons of a row share a baseline */
.tablecard h3 { font-size: 1.3rem; min-width: 0; overflow-wrap: anywhere; }
.row.tight { gap: 0.3rem; flex-wrap: nowrap; }
.row.foot { border-top: 2px solid var(--line); padding-top: 0.7rem; }
.seatlist { border: 2px solid var(--ink); border-radius: var(--radius-sm); overflow: hidden; }
.seatrow { display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.55rem; min-height: 2.35rem; background: var(--surface-soft); }
.seatrow + .seatrow { border-top: 2px solid var(--line); }
.seatrow.open { background: transparent; font-style: italic; }
.seatrow .face, .scorerow .face, .whorow .face { margin-right: 0; flex: none; }
.num { width: 1.2rem; text-align: right; flex: none; font-size: 0.78rem; }
.x { border: 2px solid var(--ink); background: var(--surface); border-radius: 6px; width: 1.5rem; height: 1.5rem; line-height: 1; cursor: pointer; font-weight: 700; flex: none; padding: 0; }
.x:hover { background: var(--coral); color: var(--ink-invert); }
select.inline { width: auto; max-width: 100%; padding: 0.15rem 0.4rem; font-size: 0.82rem; font-weight: 600; flex: 1 1 11rem; }
.seatchip { display: inline-flex; align-items: center; white-space: nowrap; font-size: 0.85rem; margin-right: 0.35rem; line-height: 2; }
.seatchip.out { opacity: 0.45; }
.seatchip .tag { margin-left: 0.25rem; } .seatchip .face { margin-right: 0.25rem; }
.ok-text { color: var(--palm); font-weight: 600; }
.seatchip .star, .donerow .star { color: var(--sun); }
.donelist { border: var(--line-print) solid var(--ink); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.donerow { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.8rem; }
.donerow + .donerow { border-top: 2px solid var(--line); }
.donerow .faces { display: flex; flex: none; } .donerow .faces .face { margin: 0 0 0 -0.35rem; }
.scorelist { display: grid; }
.scorerow { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; line-height: 1.2; }
.scorerow + .scorerow { border-top: 2px solid var(--line); }
.scorerow .right { text-align: right; flex: none; }
.scorerow .pts { display: block; font-family: var(--font-display); font-variation-settings: var(--display-variation); font-weight: 800; font-size: 1.3rem; line-height: 1.1; color: var(--ink); }
.face.blank { display: inline-grid; place-items: center; font-size: 0.8rem; color: var(--ink-soft); flex: none; }
/* The composer: who plays on the left, what match on the right. */
.composer > * + * { margin-top: 0.8rem; }
.composer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6rem; }
.composer h3 { font-family: var(--font-text); font-variation-settings: normal; font-weight: 600; font-size: 0.95rem; letter-spacing: 0; border-bottom: 2px solid var(--ink); padding-bottom: 0.3rem; }
.whorow { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--surface-soft); padding: 0.45rem 0.65rem; line-height: 1.25; }
button.whorow { cursor: pointer; font: inherit; color: inherit; }
.whorow.pick.on { background: var(--sun-soft); box-shadow: 3px 3px 0 var(--ink); }
.whorow.pick[disabled] { opacity: 0.5; cursor: not-allowed; }
.whorow .tick { flex: none; width: 1.5rem; height: 1.5rem; border: 2px solid var(--ink); border-radius: 6px; display: grid; place-items: center; font-weight: 700; background: var(--surface); }
.whorow.on .tick { background: var(--palm); color: var(--ink-invert); }
.stepper { display: inline-flex; align-items: center; gap: 0.5rem; flex: none; }
.stepper button { width: 1.8rem; height: 1.8rem; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); font-weight: 700; cursor: pointer; padding: 0; line-height: 1; }
.stepper button[disabled] { opacity: 0.4; cursor: not-allowed; }
.stepper b { min-width: 1.2rem; text-align: center; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: var(--radius-round); overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--surface); padding: 0.3rem 0.9rem; font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--ink); color: var(--ink-invert); }
.btn-isle[disabled] { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 900px) {
  .lobby { grid-template-columns: minmax(0, 1fr); } .lside { position: static; }
  .composer-grid { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
  .tablegrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) { .donerow .faces { display: none; } .callout .btn-isle { width: 100%; } .seg button { padding: 0.3rem 0.6rem; } }
.match { border: 2px solid var(--ink); border-radius: var(--radius-md); padding: 0.7rem 0.8rem; background: var(--surface-soft); }
.pill { display: inline-block; border: 2px solid var(--ink); border-radius: var(--radius-round); padding: 0 0.55rem;
  font-size: 0.75rem; font-weight: 600; background: var(--bg); }
.pill.live { background: var(--palm-soft); } .pill.lobby { background: var(--sun-soft); } .pill.done { background: var(--bg-soft); }
.keybox { background: var(--surface-soft); border: 2px dashed var(--ink); border-radius: var(--radius-sm); padding: 0.5rem;
  font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; }
/* --coral is a fill. As small type on cream it is 3.16:1, so text uses this darker derivative (5.61:1). Nora's review 2026-09-21;
   it belongs in her tokens.css, and this line goes when it is there. */
:root { --coral-ink: #b5371f; }
.error { color: var(--coral-ink); font-weight: 600; }

/* ── The game ── */
/* The top bar: the turn as a printed medallion, the match, then the purse — what you hold in all — and the clock. */
.topbar { display: flex; align-items: stretch; gap: 0.6rem; padding: 0.3rem 0.6rem; background: var(--brand); color: var(--ink-invert);
  border-bottom: var(--line-print) solid var(--ink); flex: none; min-height: 3.1rem; }
.topbar > * { align-self: center; }
.topbar .back { border: 2px solid var(--ink); background: var(--ink); color: var(--ink-invert); border-radius: var(--radius-sm); width: 2rem; height: 2rem; display: grid; place-items: center; cursor: pointer; padding: 0; }
.topbar .back:hover { background: var(--brand-2); }
.topbar .turn { display: grid; grid-template-columns: auto auto; column-gap: 0.35rem; align-items: center; background: var(--surface); color: var(--ink); border: 2px solid var(--ink);
  border-radius: var(--radius-sm); box-shadow: 3px 3px 0 var(--ink); padding: 0.05rem 0.55rem 0.05rem 0.5rem; line-height: 1; }
.topbar .turn b { grid-row: 1 / span 2; grid-column: 2; font-family: var(--font-display); font-variation-settings: var(--display-variation); font-weight: 800; font-size: 1.75rem; }
.topbar .turn small { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.topbar .matchname { display: flex; flex-direction: column; min-width: 0; max-width: 15rem; line-height: 1.15; }
.topbar .matchname b { font-family: var(--font-display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .matchname small { font-family: var(--font-mono); font-size: 0.62rem; opacity: 0.8; white-space: nowrap; }
.purse { flex: 1; display: flex; gap: 0.35rem; justify-content: center; align-items: center; min-width: 0; overflow: hidden; }
.plate { display: flex; align-items: center; gap: 0.3rem; background: var(--bg); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius-round);
  padding: 0.12rem 0.6rem 0.12rem 0.35rem; cursor: pointer; white-space: nowrap; line-height: 1; transition: transform 0.08s ease; }
.plate:hover { transform: translateY(-1px); background: var(--surface); }
.plate b { font-family: var(--font-display); font-variation-settings: var(--display-variation); font-size: 1.12rem; font-weight: 800; }
.plate small { font-family: var(--font-mono); font-size: 0.68rem; color: var(--palm); font-weight: 700; }
.plate small.neg { color: var(--coral-ink); }
.plate.wide b { font-family: var(--font-text); font-size: 0.82rem; font-weight: 600; max-width: 8.5rem; overflow: hidden; text-overflow: ellipsis; }
.plate.alert { background: var(--sun-soft); }
.purse .watching { display: flex; gap: 0.4rem; align-items: center; font-family: var(--font-mono); font-size: 0.8rem; }
.topbar .clock { font-family: var(--font-mono); font-weight: 700; background: var(--ink); border-radius: var(--radius-sm); padding: 0.3rem 0.6rem; white-space: nowrap; }
.topbar .clock.soon { background: var(--coral); }
.ico { flex: none; vertical-align: -0.22em; }

.game { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 468px; min-height: 0; }
.game > * { min-width: 0; }
.chart { position: relative; min-height: 0; overflow: hidden; background: var(--bg); touch-action: none; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* The sheet: a little ink pooled in the corners, then the brand's paper grain over everything printed. */
.chart::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(5,65,75,0) 55%, rgba(5,65,75,0.16) 100%); }
.chart::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background-image: var(--grain-url);
  background-size: 320px; mix-blend-mode: multiply; opacity: var(--grain-opacity); }
.chart .zoom .btn.off { opacity: 0.55; text-decoration: line-through; }
/* The tile card: pinned over the tapped tile by main.js (transform), with a tail pointing at it. */
.tilecard { position: absolute; left: 0; top: 0; z-index: 3; width: min(290px, calc(100% - 16px)); background: var(--surface);
  border: var(--line-print) solid var(--ink); border-radius: var(--radius-md); box-shadow: 4px 4px 0 var(--ink); padding: 0.55rem 0.7rem 0.65rem;
  touch-action: auto; will-change: transform; }
.tilecard .stack { gap: 0.35rem; }
.tilecard .title { font-family: var(--font-display, inherit); font-size: 1.05rem; }
.tilecard .row { align-items: center; gap: 0.5rem; }
.tilecard .x { border: 0; background: none; font-size: 1.35rem; line-height: 1; padding: 0 0.15rem; cursor: pointer; color: var(--ink); }
.tilecard .part { border-top: 2px dotted var(--ink-soft); padding-top: 0.35rem; }
.tilecard .find b { color: var(--coral); }
.tilecard .swatch { margin-right: 0.35rem; }
.tilecard::after { content: ""; position: absolute; left: var(--tip, 50%); bottom: -9px; width: 14px; height: 14px; margin-left: -7px; background: var(--surface);
  border-right: var(--line-print) solid var(--ink); border-bottom: var(--line-print) solid var(--ink); transform: rotate(45deg); }
.tilecard.below::after { bottom: auto; top: -9px; transform: rotate(225deg); }
.chart .hint { position: absolute; left: 50%; top: 0.7rem; transform: translateX(-50%); z-index: 2; background: var(--sun);
  border: var(--line-print) solid var(--ink); border-radius: var(--radius-md); box-shadow: 3px 3px 0 var(--ink);
  padding: 0.3rem 0.8rem; font-weight: 600; max-width: 92%; text-align: center; }
.chart .zoom { position: absolute; right: 0.6rem; top: 0.6rem; z-index: 2; display: flex; flex-direction: column; gap: 0.4rem; }

/* The side: a rail of sections down its left edge, the section itself, and the order tray under it. */
.side { display: flex; min-height: 0; border-left: var(--line-print) solid var(--ink); background: var(--bg-soft); }
.side-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.rail { flex: none; width: 68px; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.45rem 0.35rem; background: var(--bg); border-right: var(--line-print) solid var(--ink); overflow-y: auto; scrollbar-width: none; }
.rail button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.12rem; border: 2px solid transparent; border-radius: var(--radius-sm); background: none;
  color: var(--ink); padding: 0.35rem 0 0.25rem; cursor: pointer; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.02em; transition: transform 0.08s ease; }
.rail button:hover { background: var(--surface-soft); }
.rail button.on { background: var(--sun-soft); color: var(--ink); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px); }
.rail .dot { position: absolute; top: 1px; right: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--coral); border: 2px solid var(--ink); animation: dot-pulse 2.4s ease-in-out infinite; }
/* Something on this tab wants you: a buoy, not a heartbeat. One bob, then a rest; hard ink, no ring (Nora: a fading ring is a bloom). */
@keyframes dot-pulse { 0%, 45%, 100% { transform: scale(1); } 20% { transform: scale(1.22); } }
@media (prefers-reduced-motion: reduce) { .rail .dot { animation: none; } }
/* On a desk the icons stand at the right edge of the window, and the page of the tab you are on lies between them and the chart (OHH). */
@media (min-width: 861px) { .rail { order: 2; border-right: 0; border-left: var(--line-print) solid var(--ink); } }
.panel { flex: 1; overflow: auto; padding: 0.8rem 0.85rem 1.2rem; -webkit-overflow-scrolling: touch; }
.title { display: flex; align-items: center; gap: 0.5rem; }
.title h2 { font-size: 1.5rem; letter-spacing: var(--tracking-display); }
.head { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 1.1rem !important; }
.head h3 { font-size: 1.08rem; margin: 0 !important; white-space: nowrap; }
.head .dots { flex: 1; border-bottom: 3px dotted var(--ink-soft); opacity: 0.55; transform: translateY(-0.28em); }
.empty { color: var(--ink-soft); font-size: 0.85rem; border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 0.5rem 0.65rem; }
.coral-text { color: var(--coral-ink); font-weight: 600; }
.panel h2 { font-size: 1.35rem; }
.panel h3 { font-size: 1.05rem; margin-top: 1rem; }
.box { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-md); padding: 0.6rem 0.7rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.stats .box { text-align: center; padding: 0.35rem; }
.stats b { font-family: var(--font-display); font-size: 1.35rem; display: block; line-height: 1.1; }
.stats span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.list { display: grid; gap: 0.4rem; }
.item > span { min-width: 0; overflow-wrap: anywhere; }
.item { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; background: var(--surface);
  border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 0.35rem 0.55rem; }
.item.off { opacity: 0.55; }
.warn { background: var(--coral); color: var(--ink-invert); border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; font-weight: 600; }
.brief-veil { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 0.8rem; background: rgba(5, 65, 75, 0.55); }
.brief { width: min(560px, 100%); max-height: calc(100dvh - 1.6rem); overflow-y: auto; padding: 0.9rem 1rem 1rem; }
.brief h2 { margin: 0; font-size: 1.5rem; } .brief h3 { margin: 0.5rem 0 0.2rem; font-size: 1.25rem; }
table.odds { width: 100%; border-collapse: collapse; }
table.odds th { text-align: left; font-weight: 600; color: var(--ink-soft); padding: 0.15rem 0.3rem; }
table.odds td { padding: 0.15rem 0.3rem; border-top: 1px solid rgba(0, 0, 0, 0.08); }
table.odds tr.yours td, table.odds tr.going td { background: var(--surface-soft); font-weight: 700; }
.fleet { border-top: 2px dotted var(--ink-soft); padding-top: 0.4rem; gap: 0.3rem; }
.fleet .stepper input { width: 2.6rem; }
.fleet label { cursor: pointer; }
.fleet input[type=checkbox] { width: 1.3rem; height: 1.3rem; accent-color: var(--ink); }
.note { background: var(--surface-soft); border-left: 5px solid var(--sun); padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); }
.letter { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 0.55rem 0.65rem; position: relative; }
.letter.read-by-you { border-style: dashed; background: var(--surface-soft); }
ol.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
.letter p { margin: 0.3rem 0; font-family: var(--font-display); font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.bar { height: 10px; border: 2px solid var(--ink); border-radius: var(--radius-round); overflow: hidden; background: var(--surface); }
.bar i { display: block; height: 100%; background: var(--lagoon); }
.face { width: 1.5rem; height: 1.5rem; border: 2px solid var(--ink); border-radius: 6px; vertical-align: middle; margin-right: 0.35rem; background: var(--surface); object-fit: cover; }
.face.big { width: 2.4rem; height: 2.4rem; border-radius: 8px; }
.swatch { display: inline-block; width: 1rem; height: 1rem; flex: none; border: 2px solid var(--ink); border-radius: 4px; vertical-align: -2px; margin-right: 0.3rem; }   /* 1 rem: the cream band stays over 4 px where no disc carries the colour */

/* The order tray: one ticket per order. "Four orders" should be a thing you can see. */
.tray { flex: none; min-width: 0; overflow: hidden; border-top: var(--line-print) solid var(--ink); background: var(--bg); padding: 0.5rem 0.6rem calc(0.5rem + env(safe-area-inset-bottom)); }
.tickets { display: flex; gap: 0.4rem; overflow-x: auto; padding: 2px 2px 6px; }
.ticket { flex: 0 0 auto; min-width: 118px; max-width: 190px; min-height: 52px; border: 2px dashed var(--ink-soft); border-radius: var(--radius-sm);
  padding: 0.25rem 0.45rem; font-size: 0.74rem; line-height: 1.2; color: var(--ink-soft); display: flex; flex-direction: column; justify-content: center; position: relative; }
.ticket.full { border: 2px solid var(--ink); background: var(--surface); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.ticket.bad { background: #fbe1da; }
.ticket b { font-size: 0.8rem; }
.ticket .x { position: absolute; top: -7px; right: -5px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink);
  background: var(--coral); color: var(--ink-invert); font-weight: 700; line-height: 14px; font-size: 0.8rem; cursor: pointer; padding: 0; }
.ready-row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.3rem; }
.ready-row .btn-isle { flex: 1; padding: 0.55rem 1rem; font-size: 1.02rem; cursor: pointer; }
.ready-row .btn-isle.is-ready { background: var(--palm-soft); }
.leave-row { text-align: right; margin-top: 0.25rem; }
.leave-row .link { color: var(--ink-soft); font-size: 0.85rem; }
.replay { margin-left: 0.6rem; }
.replay .btn:not([disabled]) { color: var(--ink); }                /* the top bar is cream-on-brand: say ink */
.replay input[type=range] { margin: 0 0.2rem; }

.banner { position: absolute; inset: auto 0.8rem 0.8rem 0.8rem; z-index: 3; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 7.5rem; transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--ink-invert);
  border-radius: var(--radius-md); padding: 0.5rem 0.9rem; font-weight: 600; max-width: 92vw; box-shadow: var(--shadow-md); }

.rail button.only-phone { display: none; }
/* A phone shows one thing at a time under the icons: the chart, or the page of whatever you opened (.game.paged). The order
   slots stay at the foot of both. .side and .side-main dissolve so the rail, the chart/page and the tray share one grid. */
@media (max-width: 860px) {
  .rail button.only-phone { display: flex; }
  .game .side, .game .side-main { display: contents; }
  .game .rail { grid-area: rail; } .game .tray { grid-area: tray; }
  .game .chart, .game .panel { grid-area: main; min-height: 0; }
  .game .panel { display: none; background: var(--bg-soft); }
  .game.paged .panel { display: block; }
  .game.paged .chart { visibility: hidden; pointer-events: none; }
  .tilecard { width: min(250px, calc(100% - 16px)); padding: 0.4rem 0.55rem 0.5rem; }
  .tilecard .small { font-size: 0.76rem; line-height: 1.35; }
  .tilecard .title { font-size: 0.95rem; }
  .game { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: 'rail' 'main' 'tray'; }

  .topbar { gap: 0.45rem; padding: 0.3rem 0.5rem; }
  .topbar .hide-s { display: none; }
  .ticket { min-width: 104px; }
}

/* Civics */
.chip { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 0.05rem 0.5rem; margin: 0 0.25rem 0.25rem 0; font-size: 0.78rem; font-weight: 600; background: var(--surface); }
.motion { border-left: 4px solid var(--sun); padding: 0.3rem 0 0.3rem 0.6rem; }
.motion .row { gap: 0.3rem; }
.preamble { font-family: var(--font-display); font-style: italic; margin: 0; }
.invite { border-color: var(--coral); box-shadow: 4px 4px 0 var(--coral); }
.form { border-top: 2px dashed var(--line-strong); padding-top: 0.6rem; }
.check { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; margin: 0.15rem 0; }
.check input { width: 1.5rem; flex: none; }
.article { margin-bottom: 0.45rem; }
details > summary { cursor: pointer; }

/* ── the overview: islands at a glance ── */
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip { font-size: 0.74rem; line-height: 1.25; padding: 0.1rem 0.45rem; border: 2px solid var(--ink); border-radius: var(--radius-round); background: var(--surface-soft); }
.chip.ok { background: var(--surface); }
.chip.idle { background: var(--sun-soft); font-weight: 600; }
.chip.warn { background: var(--coral); color: var(--ink-invert); font-weight: 600; }
.chip.plan { border-style: dashed; opacity: 0.8; }
.item.isle { flex-direction: column; align-items: stretch; gap: 0.3rem; cursor: pointer; text-align: left; }
.item.isle .spread { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.item.todo { cursor: pointer; text-align: left; border-left: 6px solid var(--sun); }
/* .warn by itself is a coral slab with cream type (2.84:1). On a row the coral bar is the whole signal. */
.item.warn { background: var(--surface); color: var(--ink); border-color: var(--ink); border-left: 6px solid var(--coral); padding: 0.35rem 0.55rem; font-weight: inherit; }
.nowrap { white-space: nowrap; }
.neg { color: var(--coral-ink); font-weight: 700; }
.idle-text { color: var(--ink); font-weight: 600; background: var(--sun-soft); padding: 0 0.3rem; border-radius: var(--radius-sm); }
.lore-line { cursor: pointer; padding: 0.3rem 0.5rem; border-left: 5px solid var(--lagoon); background: var(--surface-soft); border-radius: var(--radius-sm); }
.lore-line.idle { border-left-color: var(--sun); font-weight: 600; }


/* ── the new HUD: plaques, goods, thumbnails, the ledger, the post, the race ── */
.plaques { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.plaque { display: flex; gap: 0.4rem; align-items: center; background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 0.35rem 0.45rem; min-width: 0; box-shadow: 2px 2px 0 var(--ink); }
.plaque b { font-family: var(--font-display); font-variation-settings: var(--display-variation); font-size: 1.3rem; line-height: 1; }
.plaque .delta { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: var(--palm); margin-left: 0.25rem; }
.plaque .delta.neg, .rate.neg { color: var(--coral-ink); }
.plaque small { display: block; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goods { display: inline-flex; flex-wrap: wrap; gap: 0.15rem 0.7rem; align-items: center; }
.good { display: inline-flex; align-items: center; gap: 0.22rem; white-space: nowrap; }
.good .rate { font-size: 0.72rem; color: var(--palm); font-weight: 700; }
.costline { display: flex; flex-wrap: wrap; gap: 0.1rem 0.6rem; align-items: center; }
.thumbbox { flex: none; width: 38px; height: 34px; display: grid; place-items: center; }
.thumbbox.big { width: 52px; height: 48px; }
.thumb { display: block; background-repeat: no-repeat; }
.item { text-align: left; color: inherit; }
button.item { cursor: pointer; width: 100%; font: inherit; }
button.item:hover, .tr:hover { background: var(--surface-soft); }
.item .grow { min-width: 0; }
.item.todo .ico, .event .ico { margin-right: 0.15rem; }
.item.todo.quiet { border-left-color: var(--lagoon); }
.item.unit, .item.isle .name { font-size: 0.95rem; }
.item.isle { box-shadow: 2px 2px 0 var(--ink); }
.item.isle .name { font-family: var(--font-display); font-size: 1.08rem; }
.row.tight { gap: 0.25rem; flex-wrap: nowrap; }
.row.top { align-items: flex-start; }
.events { gap: 0.25rem; }
.event { display: flex; gap: 0.4rem; align-items: flex-start; padding: 0.3rem 0.45rem; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line-strong); }
.lore-line { display: flex; gap: 0.4rem; align-items: center; width: 100%; border: 0; text-align: left; font: inherit; font-size: 0.82rem; color: inherit; }
.chip .ico { margin-right: 0.2rem; }
.qn { width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--sun-soft); font-weight: 700; font-size: 0.75rem; flex: none; }
.stepper { display: inline-flex; align-items: stretch; border: 2px solid var(--ink); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); flex: none; }
.stepper button { border: 0; background: var(--bg-soft); width: 1.7rem; font-weight: 700; cursor: pointer; font-size: 1rem; line-height: 1; }
.stepper button:hover { background: var(--sun-soft); }
.stepper button[disabled] { opacity: 0.4; cursor: not-allowed; }
.stepper input[type=number] { width: 3.4rem; border: 0; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); border-radius: 0; text-align: center; padding: 0.2rem 0.1rem; font-family: var(--font-mono); font-weight: 700;
  -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.form-box { background: var(--surface-soft); border-style: dashed; }
.job .ico { margin-right: 0.2rem; }
.policies .btn { text-transform: capitalize; }
/* the ledger */
.table { display: grid; gap: 0.25rem; }
.tr { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr)); gap: 0.2rem; align-items: center; background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-sm);
  padding: 0.3rem 0.45rem; font: inherit; color: inherit; text-align: right; }
button.tr { cursor: pointer; }
.tr > span { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; min-width: 0; }
.tr .name { align-items: flex-start; text-align: left; font-weight: 600; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.tr b { font-family: var(--font-display); font-size: 1.05rem; }
.tr small { font-size: 0.66rem; color: var(--palm); font-weight: 700; }
.tr small.neg, .neg { color: var(--coral-ink); }
.tr.th { background: none; border-color: transparent; padding-top: 0; padding-bottom: 0; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.tr.total { background: var(--sun-soft); box-shadow: 2px 2px 0 var(--ink); }
/* the post */
.subtabs { display: flex; border: 2px solid var(--ink); border-radius: var(--radius-round); overflow: hidden; background: var(--surface); }
.subtabs button { flex: 1; border: 0; border-right: 2px solid var(--ink); background: none; padding: 0.3rem 0.2rem; font-weight: 600; font-size: 0.82rem; cursor: pointer; }
.subtabs button:last-child { border-right: 0; }
.subtabs button.on { background: var(--sun-soft); }
.subtabs .count { display: inline-block; min-width: 1.15rem; margin-left: 0.3rem; border-radius: 999px; background: var(--coral); color: var(--ink-invert); font-size: 0.7rem; font-family: var(--font-mono); padding: 0 0.25rem; }
.letter.fresh { box-shadow: 3px 3px 0 var(--coral); }
.letter.sent { background: var(--surface-soft); border-left: 6px solid var(--lagoon); }
.letter .attach { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; border-top: 2px dotted var(--ink-soft); padding-top: 0.3rem; }
.who { display: inline-flex; align-items: center; white-space: nowrap; }
.who .muted { margin-left: 0.3em; }   /* a flex item drops its leading space */
.carriers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.carrier { display: flex; gap: 0.45rem; align-items: center; text-align: left; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--surface); padding: 0.35rem 0.5rem; cursor: pointer; }
.carrier.on { background: var(--sun-soft); box-shadow: 2px 2px 0 var(--ink); }
.carrier b { display: block; text-transform: capitalize; font-size: 0.85rem; } .carrier small { display: block; font-size: 0.68rem; line-height: 1.2; color: var(--ink-soft); }
.side-goods .spread { margin: 0.25rem 0; }
.side-goods { border-top: 2px dotted var(--ink-soft); padding-top: 0.35rem; }
.side-goods > label { font-family: var(--font-display); font-size: 0.95rem; }
.deal { border-color: var(--coral); box-shadow: 4px 4px 0 var(--coral); }
.swap { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: center; background: var(--surface-soft); border-radius: var(--radius-sm); padding: 0.4rem 0.5rem; }
.swap small { display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
/* rivals */
.racer { display: grid; gap: 0.15rem; }
.bar { position: relative; }
.bar.sun i { background: var(--sun); }
.bar u { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: 0.55; }
.dossier { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-md); padding: 0.45rem 0.55rem; }
.dossier.open { box-shadow: 4px 4px 0 var(--ink); }
.dossier.off { opacity: 0.6; }
.dossier-head b { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.dossier-head .who-line { display: flex; align-items: center; }
.dossier-head { display: flex; gap: 0.5rem; align-items: center; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; padding: 0; }
.dossier .chips { margin-top: 0.35rem; }
.dossier .body { border-top: 2px dotted var(--ink-soft); margin-top: 0.4rem; padding-top: 0.4rem; }
.swatch.big { width: 2.4rem; height: 2.4rem; border-radius: 8px; margin: 0; }
.votes { display: flex; gap: 0.2rem; margin-top: 0.2rem; }
.votes .swatch { margin: 0; } .votes .vote-no { opacity: 0.3; }
.open-hoard { border-color: var(--coral); }
.league .stack { margin-top: 0.3rem; }
/* the tray */
.ticket { gap: 0.1rem; }
.ticket:not(.full) { flex: 1 1 0; min-width: 2.6rem; }   /* free slots share what is left, so all of them show */
.ticket.full { flex: 1 1 118px; min-width: 5rem; }          /* written ones give way before anything is pushed out of the tray */
.ticket.full span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket.full b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket .mono { font-size: 1rem; font-weight: 700; opacity: 0.6; }
.ticket b { display: flex; gap: 0.25rem; align-items: center; }
.hide-xs { }

@media (max-width: 1180px) { .hide-m { display: none; } }
@media (min-width: 861px) and (max-width: 1180px) { .game { grid-template-columns: minmax(0, 1fr) 430px; } }
@media (max-width: 860px) {
  .side { flex-direction: column; }
  .rail { width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 0.3rem 0.4rem; border-right: 0; border-bottom: var(--line-print) solid var(--ink); }
  .rail { gap: 0.1rem; padding: 0.3rem 0.2rem; }
  .rail button { flex: 1 1 0; min-width: 0; padding: 0.2rem 0; font-size: 0.54rem; letter-spacing: 0; }
  .ticket { min-height: 40px; }
  .rail button .ico { width: 22px; height: 22px; }
  .panel { padding: 0.6rem 0.65rem 1rem; }
  .plate { padding: 0.1rem 0.45rem 0.1rem 0.3rem; } .plate b { font-size: 1rem; }
  .purse { justify-content: flex-start; }
  .topbar .clock { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; padding: 0.3rem 0.4rem; font-size: 0.8rem; }
  .side-main { min-height: 0; }
  .topbar .turn b { font-size: 1.45rem; }
  .hide-xs { display: none; }
}
