:root {
  --bg: #15171a;
  --card: #1f2226;
  --line: #30343a;
  --text: #e4e6e9;
  --muted: #8b9098;
  --accent: #e0a030;
  --ok: #4cbb6c;
  --bad: #e05050;
  --info: #6aa8e8;
  --control: #2a2e33;
  --control-hover: #33383e;
  --raised: #262a2f;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f3f5;
    --card: #ffffff;
    --line: #d3d7dc;
    --text: #1c1f23;
    --muted: #5d646d;
    --accent: #b0700a;
    --ok: #1f8445;
    --bad: #c62828;
    --info: #1f62b0;
    --control: #eceef1;
    --control-hover: #e1e4e8;
    --raised: #ffffff;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* 17px on a phone, 14px on a laptop. */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 system-ui, sans-serif;
}
@media (min-width: 900px) { body { font-size: 14px; line-height: 1.4; } }

/*
 * The top bar. On a phone: the name, then the Status headline across the width. On a laptop,
 * one row: the name, the headline, then Open on phone and Advanced at the end.
 */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
h1 { margin: 0; font-size: 17px; font-weight: 700; }
.spacer { flex: 1; }
.topbar .spacer { display: none; }
.topbar .headline { flex: 1 1 100%; order: 1; }
.phone-open, .view-link { display: none; }
@media (min-width: 900px) {
  .topbar { padding: 12px 24px; }
  .topbar .spacer { display: block; }
  .topbar .headline { flex: 0 1 auto; order: 0; }
  .phone-open { display: inline-flex; align-items: center; gap: 8px; }
  .view-link { display: inline-block; }
}
/* The one way into Advanced: plain, so the Host isn't drawn to it. */
.view-link { color: var(--muted); text-decoration: none; padding: 8px 4px; }
.view-link:hover { color: var(--text); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none;
  padding: 8px 4px 8px 0; min-height: 44px; }
.back-link:hover { text-decoration: underline; }
@media (min-width: 900px) { .back-link { min-height: 0; } }

/* The Status headline: a pill; green while playing, amber when the Host is needed, red when broken. */
.headline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 0; padding: 8px 8px 8px 14px; min-height: 44px; border-radius: 12px;
  background: var(--control); color: var(--text);
}
.headline .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.headline #headline-text { flex: 1; min-width: 0; }
.headline.ok { background: color-mix(in srgb, var(--ok) 16%, var(--card)); }
.headline.ok .dot { background: var(--ok); }
.headline.warn { background: color-mix(in srgb, var(--accent) 18%, var(--card)); }
.headline.warn .dot { background: var(--accent); }
.headline.bad { background: color-mix(in srgb, var(--bad) 18%, var(--card)); }
.headline.bad .dot { background: var(--bad); }
.headline.info { background: color-mix(in srgb, var(--info) 16%, var(--card)); }
.headline.info .dot { background: var(--info); }
.headline.info b { color: var(--info); font-weight: 600; }
/* A running Table setup's progress along the pill's bottom edge. */
.headline { position: relative; }
.headline .progress { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 3px;
  margin: 0; background: transparent; }  /* inset: the pill's rounded ends would cut it off */
.headline .progress::before { background: var(--text); opacity: .55; }
.headline button { padding: 4px 12px; border-radius: 999px; border-color: transparent; font-weight: 600;
  background: var(--text); color: var(--bg); }
.headline button:hover { border-color: transparent; opacity: .9; }
.headline button { min-height: 44px; }
@media (min-width: 900px) {
  .headline { border-radius: 999px; min-height: 36px; padding: 4px 4px 4px 12px; }
  .headline #headline-text { flex: 0 1 auto; }
  .headline:not(:has(button:not([hidden]))) { padding-right: 14px; }
  .headline button { min-height: 28px; }
}
@media (min-width: 900px) and (pointer: coarse) { .headline button { min-height: 44px; } }

/* Open on phone: a popover under the top bar's button. */
.phone-link {
  position: fixed; inset: 56px 24px auto auto; margin: 0;
  width: 360px; max-width: calc(100vw - 32px); padding: 20px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--raised); color: var(--text);
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.35);
  flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.phone-link:popover-open { display: flex; }
.phone-link h2 { align-self: flex-start; margin: 0; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); }
.phone-link img { display: block; width: 240px; height: 240px; image-rendering: pixelated; border-radius: 10px;
  background: #fff; }
.phone-link .msg { margin: 0; min-height: 0; }
.phone-link a { color: var(--accent); overflow-wrap: anywhere; }
.msg.small { font-size: 13px; }

/*
 * A phone shows the Play view alone; on a laptop the Play view is a column on
 * the left and the Table card takes the rest. Nothing else sits in the main area.
 */
.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}
.play { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.table-card { display: none; }
@media (min-width: 900px) {
  .game { grid-template-columns: clamp(340px, 30vw, 400px) minmax(0, 1fr); gap: 20px; padding: 20px 24px 32px;
    align-items: start; }
  .play { gap: 16px; }
  .table-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
@media (min-width: 900px) { .card { border-radius: 14px; padding: 18px 20px 20px; } }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin-bottom: 12px; }
h2 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
@media (min-width: 900px) { h2 { font-size: 12px; } }
.card-head h2 { margin: 0; }
/* A card's title in the Table card and Advanced, which name a thing rather than label a value. */
h2.title { font-size: 16px; font-weight: 650; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 12px; }
.card-head h2.title { margin: 0; }
.chip { padding: 3px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--control); }
.chip.warn { background: color-mix(in srgb, var(--accent) 18%, var(--card)); color: var(--accent); }

/* The Table card: the live camera, and for now Setup's controls under it, one after another. */
.table-card .sub { padding-top: 14px; border-top: 1px solid var(--line); }
.table-card .sub h3 { margin: 0 0 4px; font-size: 15px; }
.step { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.step h4 { margin: 0 0 8px; font-size: 14px; }
.step dl { margin-bottom: 0; }
details { margin-top: 8px; }
summary { color: var(--muted); cursor: pointer; }
summary:hover { color: var(--text); }
.grid-shape { margin: 0 0 12px; }
.grid-shape .board-toolbar { margin: 8px 0 0; }

.preview { max-width: 960px; }
#preview-frame { position: relative; }
#preview-frame.drawing { cursor: crosshair; }
.preview img {
  display: block;
  width: 100%;
  min-height: 200px;
  background: #000;
  border-radius: 10px;
}
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#overlay .saved { fill: rgba(224, 80, 80, 0.15); stroke: var(--bad); stroke-dasharray: 12 8; }
#overlay .surface { fill: none; stroke: var(--ok); stroke-dasharray: 16 10; }
#overlay .draft { fill: rgba(224, 160, 48, 0.2); stroke: var(--accent); }
#overlay polygon { stroke-width: 3; vector-effect: non-scaling-stroke; }
#overlay circle { fill: var(--accent); }

/* Advanced: the way back in the top bar, a sidebar of sections, one section shown. */
.advanced { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 24px; padding: 16px; }
.sections { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 2px; }
.sections a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.sections a:hover { color: var(--text); background: var(--control-hover); }
.sections a[aria-current="page"] { background: var(--control); color: var(--text); font-weight: 600; }
.sections-body { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) {
  .advanced { flex-wrap: nowrap; padding: 20px 24px 32px; }
  .sections { flex: 0 0 220px; flex-direction: column; position: sticky; top: 20px; }
}

dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

button, .button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--muted); }
button:focus-visible, .button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: default; }
button.active { border-color: var(--accent); color: var(--accent); }
button.quiet, .button.quiet { background: none; color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a1a1a; font-weight: 600; }
button.link { padding: 0 4px; border: 0; background: none; color: var(--accent); font-weight: 600; }
button.link:hover { text-decoration: underline; }
a { color: var(--accent); }

/* One-of-several choices: a segmented control. */
.segmented {
  display: flex;
  flex-wrap: wrap;
  padding: 2px;
  gap: 2px;
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.segmented button, .segmented label { flex: 1; white-space: nowrap; border: 0; background: none; border-radius: 7px;
  padding: 5px 14px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.segmented button:hover, .segmented label:hover { background: var(--control-hover); color: var(--text); }
.segmented button.active, .segmented label:has(input:checked) { background: var(--text); color: var(--bg); font-weight: 600; }
.segmented label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.ok { color: var(--ok); }
.bad { color: var(--bad); }
.msg { margin: 8px 0 0; color: var(--muted); min-height: 1.4em; }

/* Table setup's progress: --progress (0–1) of the bar filled, eased between the 1 s status polls. */
.progress { height: 6px; margin-top: 10px; border-radius: 3px; background: var(--control); overflow: hidden; }
.progress::before { content: ""; display: block; height: 100%; background: var(--accent);
  width: calc(var(--progress, 0) * 100%); transition: width 1s linear; }
.progress[hidden]::before { transition: none; }

.focus-score { display: flex; align-items: baseline; gap: 12px; }
#focus-score { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-bar { position: relative; height: 10px; margin: 6px 0 10px; background: var(--control); border-radius: 5px; overflow: hidden; }
#focus-now { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#focus-peak { position: absolute; top: 0; bottom: 0; width: 2px; left: 0; background: var(--ok); }
.focus-regions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.focus-regions div { padding: 6px 0; text-align: center; border-radius: 4px; background: var(--control); font-variant-numeric: tabular-nums; }
.focus-regions div.weak { color: var(--bad); }
.camera-source { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.camera-source select, .camera-source input { flex: 1 1 200px; min-width: 0; max-width: 420px; padding: 5px 8px;
  background: var(--control); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
select { font: inherit; color: var(--text); background: var(--control); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; max-width: 100%; }

.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.board-toolbar label { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.board-toolbar input, .board-toolbar select {
  width: 4.5em; padding: 4px 6px; background: var(--control); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.board-toolbar select { width: auto; }
.board-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.board-side h3 { margin: 12px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.board-side p { margin: 0 0 8px; }
.brushes button { padding: 4px 8px; font-size: 13px; }

#board-editor { position: relative; width: 100%; background: #000; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; touch-action: none; }
#board-bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.85; }
#board-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#board-svg .hex { fill-opacity: 0.35; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; }
#board-svg .hex.sea { fill-opacity: 0.12; stroke: #5b8fd6; }
#board-svg .hex.none { stroke: #555; stroke-dasharray: 4 4; }
#board-svg .hex.selected { fill: #ffe650; fill-opacity: 0.6; }
#board-svg .num { fill: #fff; text-anchor: middle; dominant-baseline: central; font-weight: 700; pointer-events: none; paint-order: stroke; stroke: #000; stroke-width: 3; vector-effect: non-scaling-stroke; }
#board-svg .pin { fill: none; stroke: var(--accent); stroke-dasharray: 10 6; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
#board-svg .handle { fill: var(--accent); stroke: #000; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }

@media (max-width: 1100px) {
  .board-body { grid-template-columns: 1fr; }
}
#debug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
#debug-grid figure { margin: 0; }
#debug-grid img { display: block; width: 100%; background: #000; border: 1px solid var(--line); border-radius: 8px; }
#debug-grid figcaption { margin-top: 4px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }

.truth-rolls { margin: 8px 0; padding-left: 1.6em; }
.truth-rolls li { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.truth-rolls li span { color: var(--muted); flex: 1; }
.truth-rolls .roll-picture { width: 120px; height: auto; border-radius: 4px; display: block; }
.truth-rolls li.check span { color: var(--bad); }

/* The Pieces map: the pieces ringed, the last roll's hexes outlined. */
.robber-map { display: block; width: 100%; max-width: 420px; margin: 0 auto; }
.robber-map polygon { stroke: var(--bg); stroke-width: var(--hex-line); cursor: pointer; }
.robber-map polygon:hover { filter: brightness(1.2); }
.robber-map .rolled { stroke: var(--accent); stroke-width: var(--rolled-line); }
.robber-map .robber, .robber-map .pirate { stroke: #e02020; stroke-width: var(--robber-line); }
.robber-map .merchant { stroke: #f0b020; stroke-width: var(--robber-line); }
.robber-map .unfit { opacity: 0.35; cursor: default; }
.robber-map .unfit:hover { filter: none; }
.robber-map text { font-family: system-ui, sans-serif; font-weight: bold; fill: #111; text-anchor: middle;
  dominant-baseline: central; pointer-events: none; }
.piece-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.piece-tools select { flex: 1 1 200px; min-width: 0; }
.roll-map { display: block; width: 100%; max-width: 320px; margin: 8px 0 0; cursor: crosshair; }
.roll-map polygon { stroke: #222; stroke-width: var(--hex-line); }
.roll-map .spot { fill: #111; stroke: #fff; stroke-width: var(--hex-line); cursor: pointer; }
.roll-map .spot:hover { fill: #a02020; }
.roll-size { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.roll-size input { flex: 1; }
.lights-row { display: flex; align-items: center; gap: 12px; }
.lights-row input[type="range"] { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.lights-map { display: block; width: 100%; max-width: 480px; margin: 8px 0 0; cursor: crosshair;
  touch-action: none; user-select: none; }
.lights-map .frame { fill: #000; stroke: var(--line); stroke-width: var(--map-line); }
.lights-map .surface { fill: #15181c; stroke: #8a9099; stroke-width: var(--map-line); stroke-dasharray: calc(6 * var(--map-line)); pointer-events: none; }
.lights-map .bowl { fill: none; stroke: var(--bad); stroke-width: calc(2 * var(--map-line)); stroke-dasharray: calc(4 * var(--map-line)); pointer-events: none; }
.lights-map .land { fill: #3a3f46; stroke: #5a6068; stroke-width: var(--map-line); pointer-events: none; }
.lights-map .section { fill: rgb(255 255 255 / 0.55); stroke: #fff; stroke-width: var(--map-line); cursor: pointer; }
.lights-map .section.selected { stroke: var(--accent); stroke-width: calc(3 * var(--map-line)); cursor: move; }
.lights-map .handle { fill: #fff; stroke: var(--accent); stroke-width: calc(2 * var(--map-line)); }
.lights-map .handle.nwse { cursor: nwse-resize; }
.lights-map .handle.nesw { cursor: nesw-resize; }
.lights-map .section.drawing { fill: rgb(255 255 255 / 0.3); stroke-dasharray: calc(6 * var(--map-line)); pointer-events: none; }
.lights-map .delete { cursor: pointer; }
.lights-map .delete circle { fill: var(--bad); stroke: #fff; stroke-width: var(--map-line); }
.lights-map .delete path { stroke: #fff; stroke-width: calc(3 * var(--map-line)); stroke-linecap: round; }

/* The last roll: the sum, big, beside the dice as faces; the picture it was read from. */
.roll-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.last-roll { font-size: 104px; font-weight: 700; line-height: 0.9; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.last-roll.check { color: var(--muted); font-size: 72px; }
.roll-dice { display: flex; align-items: center; gap: 12px; }
.die { display: grid; place-items: center; width: 72px; height: 72px; padding: 6px; border-radius: 15px; }
.die svg { display: block; width: 100%; height: 100%; }
.die.red { background: #cf3b3b; color: #fff; }
.die.yellow { background: #f2c230; color: #1c1f23; }
.die.event { width: 52px; height: 52px; padding: 10px; border-radius: 11px; background: var(--text); color: var(--bg);
  font-weight: 700; font-size: 22px; }
.die.event svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.die.event .gate { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgb(0 0 0 / 0.35); }
@media (min-width: 900px) {
  .last-roll { font-size: 88px; }
  .last-roll.check { font-size: 64px; }
  .roll-line { justify-content: flex-start; gap: 18px; }
  .roll-dice { gap: 10px; }
  .die { width: 60px; height: 60px; padding: 5px; border-radius: 13px; }
  .die.event { width: 44px; height: 44px; padding: 8px; border-radius: 10px; }
}
.roll-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.roll-foot .msg { flex: 1; margin: 0; font-size: 15px; }
@media (min-width: 900px) { .roll-foot .msg { font-size: 13px; } }
.roll-photo { display: block; width: 104px; height: 72px; object-fit: cover; flex: none; border-radius: 10px;
  border: 1px solid var(--line); background: #0d0e10; }
@media (min-width: 900px) { .roll-photo { width: 88px; height: 56px; border-radius: 8px; } }

/* The roll pad: big die faces to tap, the camera's read outlined. */
.roll-pad { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.pad-hint { margin: 0; }
.die-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.die-row.event { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.die-row button { min-height: 0; padding: 7px; border: none; border-radius: 10px; }
.die-row:not(.event) button { aspect-ratio: 1; width: 100%; max-width: 72px; justify-self: center; }
.die-row svg { display: block; width: 100%; height: 100%; }
.die-row.red button { background: #cf3b3b; color: #fff; }
.die-row.yellow button { background: #f2c230; color: #1c1f23; }
.die-row.event button { min-height: 52px; font-weight: 600; }
.die-row .gate { display: inline-block; width: 14px; height: 14px; margin-right: 6px; border-radius: 50%;
  vertical-align: -2px; border: 1px solid rgb(0 0 0 / 0.4); }
.die-row button.read { outline: 3px solid var(--text); outline-offset: 2px; }
.die-row button[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.roll-pad .msg { margin: 0; }
.pad-buttons { display: flex; gap: 10px; }
.pad-buttons button { flex: 1; min-height: 48px; border-radius: 12px; }
.roll-pad button.primary { border: none; color: #15171a; font-weight: 700; }

/* New game: a button with the current Game's summary under it. */
.new-game { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 0; }
button.big { min-height: 52px; border-radius: 14px; font-weight: 600; }
@media (min-width: 900px) { button.big { min-height: 44px; border-radius: 10px; } }

/* A dealt map to lay the tiles on: the map, a big Done, then Deal again and Keep the old board. */
.dealt-card { display: flex; flex-direction: column; gap: 14px; }
.dealt-card .dealt-title { font-size: 22px; font-weight: 700; line-height: 1.2; text-transform: none; letter-spacing: 0;
  color: var(--text); }
@media (min-width: 900px) { .dealt-card .dealt-title { font-size: 18px; } }
.dealt-card .msg { margin: 0; min-height: 0; font-size: 15px; }
@media (min-width: 900px) { .dealt-card .msg { font-size: 13px; } }
.dealt-card .dealt-note { margin-top: -4px; text-align: center; }
.dealt-map { display: block; width: 100%; max-width: 420px; margin: 0 auto; }
.dealt-map polygon { stroke: var(--card); stroke-width: var(--hex-line); }
.dealt-map circle { fill: #f4ecd8; }
.dealt-map text { font-family: system-ui, sans-serif; font-weight: 700; fill: #1c1f23; text-anchor: middle;
  dominant-baseline: central; }
.dealt-map text.red { fill: #c62828; }
.dealt-buttons { display: flex; gap: 10px; }
.dealt-buttons button { flex: 1; border-radius: 12px; }
#dealt-done { font-weight: 700; }

/* The Play view is used by touch at the table: big targets (44px). */
.play button:not(.die-row button), .play select, .play .segmented label, .play .lights-row, .play .switch { min-height: 44px; }
.play input[type="checkbox"] { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
.play input[type="range"] { height: 44px; accent-color: var(--accent); }
@media (min-width: 900px) {
  .play .segmented label { min-height: 30px; padding: 0 12px; }
  .play input[type="checkbox"] { width: 20px; height: 20px; }
}
@media (pointer: coarse) {
  /* Everything else stays reachable by touch too. */
  button, .button, select, summary { min-height: 44px; }
  summary { display: flex; align-items: center; }
}

/* The Game: named in a phone's top bar (a laptop's headline names it) and under New game…. */
.game-short { margin-left: auto; color: var(--muted); font-size: 15px; }
.headline-game { display: none; }
@media (min-width: 900px) {
  .game-short { display: none; }
  .headline-game { display: inline; }
}
.game-summary { margin: 0; text-align: center; }

/* The New game sheet: up from the bottom on a phone, a dialog in the middle on a laptop. */
.sheet {
  width: 100%; max-width: 100%; max-height: calc(100dvh - 48px); margin: auto 0 0; padding: 0;
  border: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
  background: var(--card); color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.55); }
.sheet form { display: flex; flex-direction: column; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px; }
.sheet-head h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); }
.sheet-head .link { justify-self: start; min-height: 44px; padding: 0 12px; font-weight: 400; }
.sheet-body { display: flex; flex-direction: column; gap: 22px; padding: 8px 16px 16px; }
.sheet fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.sheet legend { padding: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); }
.sheet .group { border-radius: 14px; background: var(--control); overflow: hidden; }
.sheet .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px;
  padding: 0 16px; cursor: pointer; }
.sheet .row + .row { border-top: 1px solid var(--line); }
.sheet .row.choice { justify-content: flex-start; }
.sheet .row select { flex: 0 1 auto; min-width: 0; min-height: 40px; }
.sheet input[type="checkbox"], .sheet input[type="radio"] { width: 24px; height: 24px; margin: 0;
  accent-color: var(--accent); }
.sheet .players { border-radius: 12px; padding: 3px; gap: 3px; }
.sheet .players label { min-height: 42px; border-radius: 9px; }
.sheet .msg:empty { display: none; }
.sheet-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot button { width: 100%; }
@media (min-width: 900px) {
  .sheet { width: 420px; margin: auto; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 16px 40px rgb(0 0 0 / 0.35); }
  .sheet .row { min-height: 44px; }
  .sheet input[type="checkbox"], .sheet input[type="radio"] { width: 20px; height: 20px; }
  .sheet .players label { min-height: 34px; }
  .sheet-foot { padding-bottom: 16px; }
}
