:root {
  color-scheme: dark;
  --base: #191d1b;
  --raised: #202522;
  --panel: #222824;
  --border: #37413a;
  --line: #303b34;
  --text: #f1eee3;
  --muted: #a9b3a9;
  --quiet: #829086;
  --gold: #f0c682;
  --gold-dark: #2b2113;
  --mint: #92d9b6;
  --copper: #efa68a;
  --enemy: #c7bbd2;
  --shadow: 0 16px 48px #0b120e64;
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: radial-gradient(ellipse at 33% 16%, #252e28 0, transparent 58%), var(--base); min-height: 100vh; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
button, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.masthead { background: #181d1aea; border-bottom: 1px solid #333b35; }
.masthead-inner { min-height: 68px; max-width: 1330px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.wordmark { display: flex; align-items: center; gap: 12px; color: #f6e2b9; font: bold 15px/1 Georgia, serif; letter-spacing: .16em; }
.brand-mark { width: 27px; height: 27px; position: relative; display: grid; place-items: center; transform: rotate(45deg); border-radius: 6px; border: 1px solid #bc9b63; background: radial-gradient(ellipse at 20% 0, #60503c, #2b2a22); box-shadow: 0 2px 8px #0007; }
.brand-mark i { width: 11px; height: 11px; background: var(--gold); clip-path: polygon(50% 0, 63% 38%, 100% 50%, 63% 62%, 50% 100%, 37% 62%, 0 50%, 37% 38%); transform: rotate(-45deg); }
.modes { display: flex; align-items: center; gap: 4px; padding: 4px; background: #121714; border: 1px solid #303930; border-radius: 11px; }
.modes button, .quiet { border: 1px solid transparent; background: transparent; border-radius: 7px; color: var(--muted); white-space: nowrap; font-size: 13px; font-weight: 650; padding: 8px 12px; }
.modes button span { margin-right: 5px; color: var(--quiet); font-size: 15px; line-height: .8; }
.modes button[aria-pressed="true"] { background: #30352b; border-color: #4c4d39; color: #f7dcac; box-shadow: 0 2px 5px #0005; }
.modes button[aria-pressed="true"] span { color: var(--gold); }
.modes button:not([aria-pressed="true"]):hover, .quiet:hover { color: var(--text); background: #272e29; }
.rules-button { grid-column: 3; justify-self: end; }
.question { display: inline-grid; place-items: center; border: 1px solid #7d8a7e; width: 16px; height: 16px; border-radius: 100%; margin-right: 4px; font-size: 10px; }

.shell { width: min(100%, 1330px); margin: 0 auto; padding: 35px 32px 25px; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.heading h1 { font: 500 clamp(36px, 5vw, 62px)/1 Georgia, "Times New Roman", serif; letter-spacing: -.048em; color: #fbf2de; }
.heading p { color: var(--muted); margin-top: 10px; font-size: 14px; }
.button { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 720; white-space: nowrap; transition: background .16s, border-color .16s, transform .16s; }
.button:not(:disabled):active { transform: translateY(1px); }
.outline { background: #262e28; color: var(--text); }
.outline:not(:disabled):hover { background: #303b32; border-color: #556456; }
.primary { background: linear-gradient(160deg,#f1cf97,#e5b66b); border-color: #f4d29a; color: var(--gold-dark); box-shadow: 0 3px 11px #160e0b48, inset 0 1px #fff4; }
.primary:not(:disabled):hover { background: #f9dca8; }
.heading .button { margin-bottom: 2px; }
.heading-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; align-items: start; }
.layout.is-lobby { grid-template-columns: minmax(0,1fr); }
.table-card, .panel { background: var(--panel); border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow); }
.table-card { overflow: hidden; }
.lobby { display: grid; justify-items: center; align-content: center; min-height: 355px; padding: 30px 18px; text-align: center; background: radial-gradient(ellipse at 50% 25%, #34463a, transparent 66%), #222a24; }
.lobby h2 { color: #fbf2de; font: 500 clamp(25px,4vw,38px)/1.12 Georgia, serif; letter-spacing: -.035em; }
.lobby p { color: var(--muted); margin-top: 8px; font-size: 13px; }
.lobby-modes { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
#restart-tutorial { margin-top: 10px; text-decoration: underline; text-underline-offset: 3px; }
.lobby-emblem { display: flex; align-items: center; gap: 5px; height: 53px; margin-bottom: 13px; }
.lobby-emblem span { display: block; width: 32px; height: 32px; transform: rotate(-15deg) translateY(5px); border-radius: 6px; background: linear-gradient(135deg, #9bd4b6, #527e67); box-shadow: inset 0 0 0 2px #b5dfc1; }
.lobby-emblem span:nth-child(2) { width: 42px; height: 42px; transform: none; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #f8e7b8, #d6a352); box-shadow: inset 0 0 0 2px #ffe4a3, inset 0 0 0 4px #a9783a74; }
.lobby-emblem span:nth-child(3) { transform: rotate(15deg) translateY(5px); clip-path: polygon(50% 0,95% 23%,95% 77%,50% 100%,5% 77%,5% 23%); border-radius: 0; background: linear-gradient(135deg, #d5cce0, #897f98); box-shadow: none; }
.lobby #lobby-status { color: var(--gold); }
.scoreboard { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: stretch; background: #1c231f; }
.seat { --side: var(--mint); min-width: 0; position: relative; display: grid; align-items: center; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; padding: 15px 18px; }
.seat[data-seat="2"] { --side: var(--copper); }
.seat.active { background: radial-gradient(ellipse at bottom, color-mix(in srgb, var(--side) 13%, transparent), transparent 80%); }
.seat.active::after { content: ""; position: absolute; bottom: 0; height: 2px; left: 17px; right: 17px; background: var(--side); opacity: .78; }
.emblem { width: 34px; height: 34px; border: 1px solid color-mix(in srgb, var(--side) 44%, transparent); border-radius: 9px; display: grid; place-items: center; color: var(--side); background: color-mix(in srgb, var(--side) 10%, #17221b); font-size: 20px; }
.seat-name { color: var(--side); font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-role { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health { color: var(--side); font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.health small { color: var(--muted); font-size: 10px; display: block; font-weight: 600; }
.round { border-inline: 1px solid var(--line); display: grid; align-content: center; justify-items: center; min-width: 83px; padding: 6px 12px; }
.round span { color: var(--quiet); font-weight: 750; font-size: 9px; text-transform: uppercase; letter-spacing: .14em; }
.round strong { font: 400 24px/1.05 Georgia, serif; color: #f3dfb7; font-variant-numeric: tabular-nums; }

.board-wrap { padding: 14px 15px 15px; background: #1b2420; border-block: 1px solid #39463c; }
.board { --label: 106px; --gap: 5px; display: grid; grid-template-columns: var(--label) repeat(5, minmax(0, 1fr)); gap: var(--gap); position: relative; min-height: 305px; padding: 7px; background: radial-gradient(ellipse at 57% 48%, #34453c, transparent 75%), #26332c; border: 1px solid #49594c; border-radius: 10px; box-shadow: inset 0 0 25px #0f181377; }
.column-number { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 24px; color: #b2bdb0; font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.column-number.start { color: #f3d39c; }
.column-number b { font-size: 9px; }
.lane-label { --lane: var(--mint); grid-column: 1; display: grid; align-content: center; padding: 4px 7px; color: var(--lane); font-size: 11px; font-weight: 750; line-height: 1.25; }
.lane-label span { font-size: 10px; color: #adb7aa; font-weight: 550; margin-top: 4px; }
.lane-label[data-lane="2"] { --lane: var(--copper); }
.lane-label[data-lane="enemy"] { --lane: var(--enemy); }
.lane-label .promotion-direction { display: flex; align-items: center; gap: 4px; width: max-content; max-width: 100%; padding: 2px 5px; border: 1px solid color-mix(in srgb, var(--lane) 42%, transparent); border-radius: 5px; color: var(--lane); background: color-mix(in srgb, var(--lane) 11%, transparent); font-weight: 750; }
.promotion-direction b { font-size: 15px; line-height: 1; }
.promotion-direction[data-direction="right"] b { order: 1; }
.promotion-route { --lane: var(--mint); grid-column: 2 / -1; position: relative; height: 10px; color: var(--lane); }
.promotion-route[data-lane="2"] { --lane: var(--copper); }
.promotion-route[data-placed="true"]::before { content: ""; position: absolute; z-index: 1; left: var(--origin); top: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); transform: translate(-50%, -50%); box-shadow: 0 0 6px #ffd18c69; }
.promotion-ray { position: absolute; top: calc(50% - 1px); height: 2px; }
[data-direction="right"] > .promotion-ray { left: var(--origin); right: 7px; background: linear-gradient(to right, #f0c68299, currentColor); }
[data-direction="left"] > .promotion-ray { left: 7px; right: calc(100% - var(--origin)); background: linear-gradient(to left, #f0c68299, currentColor); }
.promotion-ray::after { content: ""; position: absolute; top: 50%; width: 7px; height: 7px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; }
[data-direction="right"] > .promotion-ray::after { right: 0; transform: translateY(-50%) rotate(45deg); }
[data-direction="left"] > .promotion-ray::after { left: 0; transform: translateY(-50%) rotate(-135deg); }
.cell { --lane: var(--mint); --felt: #293d33; position: relative; container-type: inline-size; min-height: 80px; min-width: 0; padding: 7px 3px; display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: center; gap: 4px; background: linear-gradient(142deg, #ffffff06, #0b100c17), var(--felt); border: 1px solid color-mix(in srgb, var(--lane) 19%, #29352e); border-radius: 6px; box-shadow: inset 0 1px 4px #131d1663; }
.cell[data-lane="2"] { --lane: var(--copper); --felt: #3d3431; }
.cell[data-lane="enemy"] { --lane: var(--enemy); --felt: #383640; min-height: 70px; }
.cell.promotion-origin { border-color: #f0c6828c; }
.cell.promotion-zone { background: linear-gradient(0deg, color-mix(in srgb, var(--lane) 20%, transparent), color-mix(in srgb, var(--lane) 7%, transparent)), var(--felt); border-color: color-mix(in srgb, var(--lane) 42%, var(--felt)); box-shadow: inset 0 -2px color-mix(in srgb, var(--lane) 50%, transparent); }
.cell.empty::after { content: "＋"; color: color-mix(in srgb, var(--lane) 36%, var(--felt)); font-size: 16px; font-weight: 400; pointer-events: none; }
.cell .slot { position: absolute; inset: 0; border: 0; background: transparent; color: transparent; border-radius: inherit; padding: 0; cursor: default; }
.cell.can-drop { border-color: color-mix(in srgb, var(--lane) 61%, var(--felt)); cursor: pointer; }
.cell.can-drop .slot { cursor: pointer; z-index: 2; }
.cell.can-drop:not(.empty) .slot { inset: auto 1px 1px auto; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid color-mix(in srgb, var(--lane) 45%, var(--felt)); border-radius: 5px; color: var(--lane); background: #212824; }
.cell.can-drop:not(.empty) .slot::after { content: '+'; font: 600 15px/1 system-ui; pointer-events: none; }
.cell.can-drop:not(.empty) .slot:hover { background: var(--lane); color: var(--base); }
.cell .slot:disabled { pointer-events: none; }
.cell .die[aria-pressed="true"] { z-index: 3; }
.cell.can-drop:hover, .cell.hover-drop { background: color-mix(in srgb, var(--lane) 22%, var(--felt)); }
.cell.battle-focus { border-color: var(--gold); box-shadow: inset 0 0 18px #e8b45d5e; }
.cell.swap-source { border-color: var(--lane); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lane) 60%, transparent); }
.cell.swap-destination { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--felt)); box-shadow: inset 0 0 0 1px var(--gold), 0 0 12px #edc4824d; }
.cell .die { z-index: 1; width: clamp(20px, calc((100cqi - 4px) / 2), 43px); height: auto; aspect-ratio: 1; }
.cell .die b { font-size: clamp(12px, 27cqi, 18px); }
.cell .die small { font-size: clamp(6px, 13cqi, 8px); }
.die { --die-light: #a9e3c3; --die-mid: #69ac91; --die-border: #d0f0d7; --ink: #10281e; --shape: polygon(0 0, 100% 0, 100% 100%, 0 100%); position: relative; display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: end; isolation: isolate; padding: 4px 2px 4px; width: 43px; height: 43px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; user-select: none; overflow: visible; }
.die:not(button) { pointer-events: none; }
.die::before, .die::after { content: ""; position: absolute; inset: 0; z-index: -2; clip-path: var(--shape); border-radius: inherit; }
.die::before { background: var(--die-border); box-shadow: 0 3px 0 #0005; }
.die::after { inset: 1px 1px 3px; z-index: -1; background: linear-gradient(155deg, #fff3, transparent 58%), linear-gradient(150deg,var(--die-light),var(--die-mid)); }
.die[data-lane="2"] { --die-light: #f1b79d; --die-mid: #c87b64; --die-border: #ffd4bd; --ink: #371e19; }
.die[data-lane="enemy"] { --die-light: #d6cde0; --die-mid: #aa9bb8; --die-border: #efe8f6; --ink: #2a2232; --shape: polygon(50% 0,95% 22%,95% 77%,50% 100%,5% 77%,5% 22%); }
.die.promotion { --shape: circle(49%); --ink: #34200c; border-radius: 50%; }
.die.promotion::before { inset: -1px; background: conic-gradient(from 285deg, #fff2c1, #ffda80, #a97532, #ffce63, #fff2c1); }
.die.promotion::after { inset: 2px; background: radial-gradient(circle at 34% 25%, #fff2c4, #e8ae56 78%); box-shadow: inset 0 0 0 1px #93632c8c; }
.die[data-tier="d8"] { --shape: polygon(50% 0,100% 28%,100% 72%,50% 100%,0 72%,0 28%); }
.die[data-tier="d12"] { --shape: polygon(25% 0,75% 0,100% 28%,100% 70%,75% 100%,25% 100%,0 70%,0 28%); }
.die b { font-weight: 830; font-size: 18px; align-self: center; }
.die small { min-height: 9px; font-weight: 750; font-size: 8px; letter-spacing: .025em; text-transform: uppercase; }
.die.waiting { opacity: .57; }
button.die { touch-action: none; -webkit-user-drag: none; }
button.die:hover { transform: translateY(-2px); filter: brightness(1.14); }
button.die.swap-target { outline: 1px dashed color-mix(in srgb, var(--gold) 56%, transparent); outline-offset: 2px; }
button.die.swap-receiver { outline: 2px solid var(--gold); outline-offset: 3px; filter: brightness(1.22); transform: translateY(-2px); }
button.die[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; transform: translateY(-2px); }
.die.dragged-die { position: fixed; z-index: 100; margin: 0; pointer-events: none; transform: none; outline: none; filter: drop-shadow(0 5px 7px #0008); }
.die.drag-shadow::before { background: color-mix(in srgb, var(--die-border) 32%, transparent); }
.die.drag-shadow::after { inset: 1px; background: #111816bc; box-shadow: inset 0 2px 8px #080e0bcc; }
.die.drag-return { filter: drop-shadow(0 0 4px #f0c68285); }
button.die.drag-receiver { opacity: .28; }
.dice-dragging, .dice-dragging .cell, .dice-dragging .slot, .dice-dragging button.die { cursor: grabbing; }
.dice-dragging button.die:not(.dragged-die) { transform: none; }
.die.roll-queued { opacity: .65; }
.die.roll { animation: toss 210ms cubic-bezier(.18,.75,.36,1) both; z-index: 4; }
@keyframes toss { 0% { transform: translateY(-7px) rotate(-85deg) scale(.78); } 48% { transform: translateY(-9px) rotate(90deg) scale(1.13); } 78% { transform: translateY(2px) rotate(186deg); } 100% { transform: rotate(360deg); } }
.column-number.battle-active { background: #f0c682; border-radius: 5px; color: #2b2113; }
.cell.battle-active { z-index: 3; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--felt)); box-shadow: inset 0 0 0 1px #f0c68276, 0 0 15px #f0c68245; }
.battle-score { position: absolute; z-index: 5; top: 0; left: 50%; transform: translate(-50%, -64%); display: flex; align-items: center; justify-content: center; gap: 4px; padding: 2px 5px; border: 1px solid var(--lane); border-radius: 5px; color: var(--lane); background: #1b211de8; line-height: 1; white-space: nowrap; pointer-events: none; }
.battle-score b { font: 750 15px/1 system-ui; font-variant-numeric: tabular-nums; }
.battle-score small { font-size: 8px; font-weight: 700; }
.battle-damage { position: absolute; z-index: 7; top: 12%; right: 4px; color: #ffc5ab; font: 850 clamp(18px,3vw,30px)/1 system-ui; text-shadow: 0 1px 2px #24130f, 0 0 7px #431b14; animation: damage-pop 450ms ease-out both; pointer-events: none; }
@keyframes damage-pop { 0% { opacity: 0; transform: translateY(12px) scale(.65); } 32% { opacity: 1; transform: translateY(0) scale(1.15); } 100% { opacity: 1; transform: translateY(-10px) scale(1); } }
.battle-defeated { animation: defeat 210ms ease-in both; }
@keyframes defeat { 0% { opacity: 1; transform: scale(1); } 35% { opacity: 1; filter: brightness(1.25) saturate(.5); transform: scale(1.12) rotate(8deg); } 100% { opacity: 0; filter: saturate(0); transform: translateY(7px) scale(.4) rotate(-20deg); } }
.clash-hidden { visibility: hidden; }
.clash-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.clash-layer .clash-die { position: absolute; }
.clash-impact { position: absolute; z-index: 1; width: 20px; height: 20px; border: 2px solid var(--gold); border-radius: 50%; background: #f6d8a3ba; box-shadow: 0 0 18px #f6bb6dbb; animation: clash-flash 135ms ease-out 176ms both; }
@keyframes clash-flash { from { opacity: .94; transform: translate(-50%, -50%) scale(.5); } to { opacity: 0; transform: translate(-50%, -50%) scale(2.4); } }
.tray { min-height: 53px; display: flex; gap: 9px 15px; flex-wrap: wrap; align-items: center; padding: 7px 17px; background: #202823; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.tray strong { color: var(--text); font-size: 12px; font-weight: 680; }
.tray-group { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tray .die { width: 30px; height: 31px; padding: 3px; }
.tray .die b { font-size: 13px; }
.tray .die small { font-size: 6px; min-height: 7px; }

.actions { min-height: 73px; background: #252d27; padding: 13px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-note { color: var(--muted); font-size: 12px; flex: 1 1 122px; }
.action-note strong { display: block; color: var(--text); font-size: 13px; font-weight: 740; margin-bottom: 2px; }
#animation-status strong { color: var(--gold); }
.playback { display: flex; gap: 4px; }
.playback .button { min-width: 36px; padding-inline: 10px; }
.playback .play { min-width: 86px; }
.actions .button:last-child { margin-left: auto; }
.engine-error { color: #ffb39e; }

.desk { display: grid; gap: 14px; min-width: 0; }
.panel { overflow: hidden; }
.panel-header { display: flex; gap: 9px; align-items: center; border-bottom: 1px solid var(--border); padding: 12px 15px; background: #262e28; }
.panel-header h2 { color: #eee6d3; font-size: 13px; font-weight: 740; letter-spacing: .01em; }
.section-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1px solid #625741; border-radius: 5px; color: var(--gold); font: 15px/1 system-ui; }
.panel-body { padding: 14px 15px; }
.turn-state { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.turn-state h3 { font: 400 22px/1.13 Georgia, serif; letter-spacing: -.02em; }
.turn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px #89ce9b81; flex: 0 0 auto; }
.turn-dot[data-seat="2"] { background: var(--copper); box-shadow: 0 0 8px #e6a69271; }
.turn-panel p, .log-panel p, .replay-panel p { color: var(--muted); font-size: 12px; }
.turn-facts { margin-top: 13px; display: grid; gap: 7px; }
.turn-fact { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.turn-fact b { color: #e6e4d7; font-weight: 680; text-align: right; }
.log-body { max-height: 295px; overflow: auto; }
.log-empty { display: flex; align-items: center; gap: 11px; min-height: 55px; }
.log-empty > span { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px dashed #5b675b; border-radius: 7px; color: #a0b0a1; }
.log-entry { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #1d241f; }
.log-entry:last-child { margin-bottom: 0; }
.log-entry summary { display: flex; align-items: center; justify-content: space-between; gap: 6px; cursor: pointer; list-style: none; font-size: 12px; padding: 8px 10px; color: var(--text); }
.log-entry summary::after { content: '+'; color: var(--quiet); }
.log-entry[open] summary::after { content: '−'; }
.log-entry summary span { margin-left: auto; color: var(--muted); font-size: 10px; }
.report-columns { display: grid; gap: 3px; padding: 0 7px 8px; }
.report-columns > p { padding: 5px 4px 2px; font-size: 10px; }
.report-col { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; text-align: left; padding: 5px; background: transparent; border: 1px solid transparent; border-radius: 4px; }
.report-col:hover, .report-col:focus-visible { border-color: #796847; color: var(--text); }
.report-col b { color: var(--gold); }
.report-col span:last-child { margin-left: auto; white-space: nowrap; }
.replay-panel label, .setup-fields label { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.replay-panel select, .setup-fields select { width: 100%; display: block; margin-top: 5px; padding: 7px 8px; border: 1px solid #49554a; border-radius: 6px; background: #1b231e; color: var(--text); }
.slider-row { margin: 12px 0 6px; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.slider-row b { color: var(--gold); font-variant-numeric: tabular-nums; }
.replay-panel input { width: 100%; accent-color: var(--gold); margin: 2px 0 9px; cursor: pointer; }
.replay-panel p { min-height: 18px; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 2px 0; color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 8px 17px; align-items: center; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-shape { width: 9px; height: 9px; display: inline-block; border-radius: 2px; background: var(--mint); }
.promotion-key { background: var(--gold); border-radius: 50%; border: 1px solid #ffebbd; }
.enemy-key { background: var(--enemy); clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%); }
.connection { display: flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.connection i { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }

dialog { width: min(480px, calc(100% - 28px)); max-height: calc(100% - 28px); color: var(--text); background: #232b25; border: 1px solid #596653; border-radius: 15px; box-shadow: 0 24px 75px #0009; padding: 22px; }
dialog::backdrop { background: #0a100bd4; backdrop-filter: blur(5px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 9px; }
dialog h2 { font: 400 33px/1 Georgia, serif; color: #f8e8c9; letter-spacing: -.035em; }
.close { padding: 2px 10px; font-size: 25px; line-height: 1.15; }
dialog p { color: var(--muted); font-size: 14px; }
#round-review { width: min(940px, calc(100% - 28px)); }
#round-review .dialog-header { align-items: start; margin-bottom: 15px; }
#round-review .dialog-header h2 { font-size: clamp(24px, 4vw, 33px); }
#round-review .dialog-header p { margin-top: 5px; }
#round-review .table-card { box-shadow: none; }
#review-board .cell.empty::after { content: none; }
.review-navigation { justify-content: center; margin-top: 14px; gap: 6px; }
.review-navigation select { min-width: 120px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; background: #1b231e; color: var(--text); }
.setup-fields { display: grid; gap: 12px; margin-top: 19px; }
#difficulty-note { margin-top: 12px; font-size: 12px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 20px; }
#handoff::backdrop { background: #161e18; }
.handoff-content { text-align: center; padding: 15px 3px; }
.handoff-mark { display: grid; place-items: center; width: 51px; height: 51px; margin: 0 auto 18px; border: 1px solid #7a6949; border-radius: 11px; color: var(--gold); background: #37352a; font-size: 27px; }
.handoff-content p { margin: 9px 0 19px; }
.rules-content h3 { font: 400 21px/1.2 Georgia, serif; color: #edd7ab; margin: 16px 0 5px; }
.rules-content p { line-height: 1.55; }

.practice-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; padding: 12px 15px; border: 1px solid var(--border); border-radius: 9px; background: #262e28; }
.practice-banner > div { flex: 1 1 230px; }
.practice-banner h2 { color: var(--gold); font-size: 14px; }
.practice-banner p { color: var(--muted); font-size: 13px; }
#tutorial { width: min(580px, calc(100% - 24px)); }
#tutorial.has-example { width: min(850px, calc(100% - 24px)); }
.tutorial-header { margin-bottom: 12px; }
.tutorial-header p { margin-bottom: 6px; color: var(--gold); font-size: 12px; font-weight: 700; }
#tutorial-title:focus { outline: none; }
#tutorial-copy p + p { margin-top: 8px; }
#tutorial-copy ul { margin: 8px 0 0; padding-inline-start: 20px; color: var(--muted); font-size: 14px; }
#tutorial-copy li + li { margin-top: 3px; }
#tutorial-copy strong { color: var(--text); }
#tutorial-example { margin-top: 14px; box-shadow: none; }
.tutorial-example-actions { justify-content: space-between; min-height: 0; }
.tutorial-example-actions p { flex: 1 1 205px; font-size: 13px; }
.tutorial-selected { outline: 2px solid var(--text); outline-offset: 2px; }
#tutorial-error { margin-top: 10px; color: #ffb39e; }
.tutorial-footer, .tutorial-navigation { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tutorial-footer { margin-top: 16px; }
.tutorial-navigation { justify-content: end; margin-left: auto; }
.tutorial-skip { padding-inline: 6px; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; white-space: normal; text-align: left; }

@media (max-width: 1050px) {
  .layout { grid-template-columns: minmax(0,1fr) 248px; gap: 13px; }
  .board { --label: 88px; }
  .shell, .masthead-inner { padding-inline: 22px; }
  .die { width: 36px; height: 37px; }
  .die b { font-size: 16px; }
}
@media (max-width: 830px) {
  .layout { grid-template-columns: 1fr; }
  .desk { grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); }
  .shell { padding-top: 26px; }
  .board { --label: 92px; }
}
@media (max-width: 560px) {
  .masthead-inner { min-height: 0; padding: 12px 12px 8px; gap: 8px; grid-template-columns: 1fr 1fr; }
  .wordmark { grid-row: 1; font-size: 13px; letter-spacing: .12em; padding-left: 4px; }
  .brand-mark { width: 22px; height: 22px; }
  .rules-button { grid-row: 1; grid-column: 2; }
  .modes { grid-column: span 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 2px; }
  .modes button { padding: 7px 2px; font-size: 11px; }
  .modes button span { display: none; }
  .shell { padding: 19px 10px 16px; }
  .heading { margin-bottom: 15px; align-items: start; gap: 7px; }
  .heading p { margin-top: 6px; font-size: 12px; }
  .heading .button { min-height: 32px; font-size: 11px; padding: 5px 8px; margin-top: 3px; gap: 3px; }
  .heading-controls { flex-direction: column; gap: 0; }
  #tutorial { padding: 12px; }
  #tutorial h2 { font-size: 28px; }
  #tutorial .button, .practice-banner .button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
  #round-review { padding: 13px; }
  #round-review .dialog-header { gap: 8px; }
  #round-review .dialog-header .button { min-height: 34px; padding: 5px 8px; font-size: 11px; }
  .seat { gap: 5px; padding: 10px 7px; font-size: 11px; }
  .seat.active::after { left: 8px; right: 8px; }
  .emblem { width: 23px; height: 25px; font-size: 13px; border-radius: 6px; }
  .seat-role { font-size: 8px; }
  .health { font-size: 14px; }
  .health small { font-size: 8px; }
  .round { min-width: 50px; padding-inline: 5px; }
  .round span { font-size: 8px; }
  .round strong { font-size: 19px; }
  .board-wrap { padding: 7px 5px; }
  .board { --label: 49px; --gap: 3px; min-height: 245px; padding: 3px; }
  .lane-label { font-size: 8px; padding: 0 2px; }
  .lane-label span { font-size: 7px; margin-top: 3px; }
  .lane-label .promotion-direction { gap: 2px; padding-inline: 2px; }
  .promotion-direction b { font-size: 11px; }
  .cell { min-height: 64px; padding: 4px 1px; gap: 3px; }
  .cell .die { padding-block: 3px; }
  .cell[data-lane="enemy"] { min-height: 53px; }
  .die { width: 30px; height: 32px; border-radius: 5px; }
  .die b { font-size: 14px; }
  .die small { font-size: 7px; min-height: 7px; }
  .actions { padding: 9px; }
  .actions .button { min-height: 35px; padding: 6px 9px; font-size: 11px; }
  .actions .button:last-child { margin-left: 0; }
  .action-note { flex-basis: 100%; }
  .tray { padding: 6px 9px; gap: 5px 8px; }
  .footer { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
