:root {
  color-scheme: light;
  --paper: #f7f2e7;
  --panel: #fffbf1;
  --green: #24382e;
  --forest: #192a23;
  --ink: #272b23;
  --muted: #615d50;
  --line: #d9ceba;
  --gold: #e7bb71;
  --clay: #9a402b;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #c37637; outline-offset: 3px; }
.shell { width: min(1180px, calc(100% - 64px)); margin: auto; }
.masthead { background: var(--forest); color: var(--panel); border-bottom: 3px solid #b78c50; }
.masthead-inner { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.masthead-controls, .guide-header-controls { display: flex; align-items: center; gap: 8px; }
.language-control { display: inline-flex; }
.language-control select { min-height: 34px; padding: 4px 7px; border: 1px solid #a89b7d; border-radius: 5px; background: #24382e; color: #fff3d9; font: 700 12px system-ui, sans-serif; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.brand { display: flex; gap: 13px; align-items: center; text-decoration: none; font: 700 22px/1.1 Georgia, serif; }
.brand small { display: block; margin-top: 5px; color: #dfcaa5; font: 600 10px/1.2 system-ui, sans-serif; letter-spacing: .15em; text-transform: uppercase; }
.mark { color: var(--gold); border: 1px solid #887346; border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center; }
nav { display: flex; gap: 5px; padding: 5px; border: 1px solid #516257; border-radius: 8px; }
nav[hidden] { display: none; }
nav a { text-decoration: none; padding: 9px 13px; border-radius: 4px; font-size: 14px; font-weight: 650; }
nav a[aria-current="page"] { color: var(--forest); background: #e3ebe1; }
.home-mode { background: #17271f; color: #fff4dc; }
.home-mode .masthead { position: absolute; inset: 0 0 auto; z-index: 2; background: transparent; border: 0; }
.home-mode .brand small { display: none; }
.home-mode #app { width: 100%; }
.home-mode .footer { border-color: #4d5d47; color: #e0d3b4; }
.splash { position: relative; isolation: isolate; display: grid; align-items: center; min-height: 100svh; overflow: hidden; }
.splash::after { content: ''; position: absolute; z-index: -1; inset: 0; pointer-events: none; background:
  linear-gradient(90deg, #14251ded 0%, #14251dcc 30%, #14251d61 54%, #14251d13 82%),
  linear-gradient(0deg, #14251d66 0%, transparent 28%); }
.splash-content { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 100px 0 70px; }
.splash h1 { max-width: 530px; color: #fff2d4; font-size: clamp(47px, 7.5vw, 102px); line-height: .96; letter-spacing: -.06em; text-wrap: balance; }
.splash-heading-group p { margin-top: 14px; color: #f0dfb8; font-size: clamp(15px, 1.5vw, 19px); line-height: 1.45; }
.splash-media { position: absolute; inset: 0; z-index: -2; background: #253b30 url('splash.webp') center 54% / cover no-repeat; }
.splash-media video { display: block; width: 100%; height: 100%; object-fit: cover; visibility: hidden; }
.splash-media video.has-frame { visibility: visible; }
.splash-video-control { position: absolute; right: clamp(14px, 3vw, 38px); bottom: 17px; border: 1px solid #ffffff73; border-radius: 5px;
  padding: 5px 8px; background: #182a23ec; color: #fff7e7; font-size: 12px; font-weight: 650; }
.splash-video-control:hover { background: #324b3d; }
.splash-options { display: grid; gap: 10px; max-width: 430px; margin-top: 24px; }
.splash-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px;
  padding: 13px 16px; border: 1px solid #dfc392; border-radius: 7px; background: #fff3d9; color: #293529; text-decoration: none; box-shadow: 0 6px 18px #111d1650; }
.splash-option:hover { background: #f5ddb0; border-color: #f5ddb0; }
.splash-option strong, .splash-option small { display: block; }
.splash-option strong { font: 700 clamp(19px, 3vw, 23px)/1.15 Georgia, serif; }
.splash-option small { margin-top: 5px; color: #514e3f; font-size: 12px; line-height: 1.35; }
.splash-credits { width: fit-content; max-width: 430px; margin-top: 20px; color: #f2e6ca; font-size: 12px; line-height: 1.5; }
.splash-credits p:last-child { margin-top: 5px; }
.splash-credits a { color: #fff2d4; font-weight: 700; text-underline-offset: 3px; }
.splash-arrow { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; border: 1px solid #bd9f65; color: #273729; }
@media (max-width: 740px) {
  .splash { align-items: end; }
  .splash::after { background: linear-gradient(180deg, #14251d99 0%, #14251d26 23%, #14251db3 50%, #14251df5 93%); }
  .splash-content { width: min(430px, calc(100% - 36px)); padding: clamp(105px, 26svh, 185px) 0 59px; }
  .splash h1 { font-size: clamp(37px, 8.7vw, 62px); }
  .splash-heading-group p { margin-top: 7px; }
  .splash-options { max-width: none; margin-top: 16px; }
  .splash-option { padding: 10px 12px; }
  .splash-video-control { right: 18px; bottom: 15px; font-size: 11px; }
}
.intro { padding: 46px 0 31px; }
.eyebrow { margin: 0 0 10px; color: var(--clay); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: Georgia, serif; }
h1 { font-size: clamp(38px, 6vw, 66px); line-height: .98; letter-spacing: -.055em; color: var(--forest); }
.intro > p:last-child { color: var(--muted); font-size: 17px; line-height: 1.55; max-width: 610px; margin-top: 16px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: clamp(20px, 3vw, 31px); }
.panel h2 { font-size: clamp(26px, 3vw, 35px); letter-spacing: -.035em; line-height: 1.08; }
.panel h3 { font-size: 21px; }
.panel p, .panel li, dialog p { line-height: 1.55; }
.lesson-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 650; }
.lesson-meta span:last-child { color: var(--muted); text-align: right; }
progress { appearance: none; display: block; width: 100%; height: 5px; border: 0; border-radius: 5px; overflow: hidden; margin: 11px 0 26px; background: #e9dfcc; }
progress::-webkit-progress-bar { background: #e9dfcc; }
progress::-webkit-progress-value { background: #a45133; } 
progress::-moz-progress-bar { background: #a45133; }
.description { margin-top: 12px; color: var(--muted); }
.primary, .secondary { border: 1px solid transparent; border-radius: 6px; padding: 10px 14px; font-weight: 700; line-height: 1.35; }
.lesson-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 23px; }
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: #395744; }
.primary:disabled, .secondary:disabled { opacity: .45; cursor: default; }
.secondary { color: var(--green); border-color: var(--line); background: transparent; }
.secondary:hover:not(:disabled) { background: #eaddc3; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.source { color: var(--muted); font-size: 12px; margin-top: 14px; }
.footer { margin-top: 27px; padding: 17px 0 23px; border-top: 1px solid var(--line); display: flex; gap: 14px; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.score { box-shadow: 0 5px 14px #352c1612; }
.setup { max-width: 720px; }
.setup label { display: block; font-weight: 700; margin: 20px 0 8px; }
select, input[type="number"] { border: 1px solid #b8ad97; border-radius: 5px; background: #fffdf7; color: var(--ink); padding: 8px; }
.setup ul, .checklist { padding-left: 20px; margin-bottom: 0; }
.days { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.day { display: grid; place-items: center; height: 37px; width: 37px; border: 1px solid var(--line); border-radius: 5px; font-weight: 700; }
.day.past { background: #e0e5d6; }
.day.current { background: var(--green); color: white; }
.event { margin: 0 0 18px; padding: 11px 13px; background: #f1e4cd; border-radius: 6px; font-size: 14px; }
.session-log { margin-top: 18px; color: var(--muted); font-size: 14px; }
.stack { display: grid; gap: 16px; }
.score { overflow-x: auto; }
.score table { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 13px; }
.score th, .score td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.score tbody th { font-weight: 500; }
.score input[type="number"] { width: 60px; padding: 5px 3px 5px 8px; }
.score tfoot th,.score tfoot td { font-weight: 800; padding-top: 10px; }
.score-result { margin-top: 12px; font-weight: 700; }
dialog { width: min(540px, calc(100% - 32px)); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
dialog::backdrop { background: #15261cbf; }
dialog header { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 13px; }
dialog dl { display: grid; gap: 8px; grid-template-columns: 1fr auto; }
dialog dd { margin: 0; }
.walk-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 17px; align-items: start; }
.guide-panel { position: fixed; inset: 0 auto var(--dock-height, 0px) 0; z-index: 8; overflow-y: auto;
  overscroll-behavior: contain; border-radius: 0; border-width: 0 1px 0 0; background: var(--panel); }
.guide-panel .guide-header { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin: 0; font-size: 13px; font-weight: 750; }
.guide-panel:has(.gear-reference):is(aside, [open]) { display: flex; flex-direction: column; overflow: hidden; }
.guide-body { min-width: 0; overflow-wrap: anywhere; }
.guide-panel:has(.gear-reference) .guide-body { min-height: 0; max-width: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-inline-end: 9px; }
.gear-reference { flex: none; margin: 10px 0 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #f4ecdc; }
.gear-reference > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; justify-content: space-between; margin-bottom: 5px; }
.gear-reference h3 { font-size: 16px; }
.gear-reference p { color: var(--muted); font-size: 11px; }
.gear-reference img { max-height: clamp(72px, 19dvh, 150px); object-fit: contain; }
.inline-symbol { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.inline-symbol .legend-icon { width: min(1.25em, 23px); height: min(1.25em, 23px); flex-basis: auto; flex-shrink: 0; }
.guide-close { font-size: 12px; padding: 6px 8px; }
.guide-panel .guide-header { margin-bottom: 14px; }
.guide-header-controls { flex-wrap: wrap; justify-content: flex-end; }
.guide-progress { color: var(--muted); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-step .guide-progress { display: block; margin-bottom: 4px; }
.guide-command { margin-top: 14px; border-left: 3px solid #bc741d; padding: 9px 11px; background: #f7e9cc; font-weight: 680; }
.guide-command strong { display: block; margin-bottom: 2px; color: #6e471a; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.guide-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 6px; margin-top: 9px; }
.guide-actions:empty { display: none; }
.guide-actions .guide-next { margin-top: 0; }
.guide-actions .source { width: 100%; margin-top: 3px; }
.step-explanation { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.step-explanation h3 { font: 750 13px system-ui, sans-serif; margin-top: 11px; color: var(--ink); }
.step-explanation .step-explanation-title { margin-top: 0; color: var(--green); }
.step-explanation p { margin-top: 6px; }
.step-explanation ol { padding-left: 18px; margin: 6px 0 8px; }
.step-explanation li + li { margin-top: 4px; }
.guide-timeline .phase-track { margin: 6px 0; }
.guide-panel .guide-header small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; margin-top: 4px; }
.guide-next, .guide-command + .secondary { display: inline-block; margin-top: 14px; text-decoration: none; }
.phase-track { display: flex; flex-wrap: wrap; list-style: none; gap: 4px; margin: 0 0 10px; padding: 0; }
.phase-track li { border-radius: 4px; padding: 3px 6px; background: #eee6d6; color: #544d3f; font-size: 11px; font-weight: 650; }
.phase-track li[aria-current="step"] { background: var(--green); color: #fff8e8; }
.phase-track + h2 { margin-top: 16px; }
.free-choices { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; font-size: 13px; }
.free-choices summary { cursor: pointer; color: var(--green); font-weight: 740; }
.free-choices p { margin-top: 7px; color: var(--muted); }
.dock-hint { margin-top: 8px; color: #70462b; font-size: 13px; font-weight: 650; }
.guided-mode { padding-bottom: calc(var(--dock-height, 0px) + 22px); }
.guided-mode .intro { padding-top: 20px; padding-bottom: 15px; }
.guided-mode .intro .eyebrow { margin-bottom: 6px; }
.guided-mode .intro h1 { font-size: clamp(31px, 4vw, 46px); }
.guided-mode .intro > p:last-child { max-width: 700px; margin-top: 7px; font-size: 14px; }
html:has(.guided-mode) { scroll-padding-bottom: calc(var(--dock-height, 0px) + 8px); }
.hand-dock { position: fixed; inset: auto 0 0; z-index: 10; color: #f9f0de; background: var(--forest);
  border-top: 2px solid #b78c50; box-shadow: 0 -4px 15px #1b25191a; padding-bottom: env(safe-area-inset-bottom); }
.dock-inner { display: flex; align-items: center; gap: 14px; padding: 7px 0; }
.dock-status { flex: 0 0 235px; min-width: 0; display: grid; gap: 5px; }
.dock-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: center; gap: 5px; margin: 0; }
.dock-stat { min-width: 0; padding: 5px 2px; text-align: center; border: 1px solid #3c5144; border-radius: 4px; background: #23372e; }
.dock-stat dt { display: flex; align-items: center; justify-content: center; gap: 3px; color: #e9dbc2; font-size: 10px; line-height: 1.25; }
.dock-stat .legend-icon { flex: 0 0 16px; width: 16px; height: 16px; }
.dock-tool-short { display: none; }
.dock-stat dd { margin: 2px 0 0; color: #fff6e5; font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 750; line-height: 1.1; }
.dock-hand { flex: 1; min-width: 0; }
.dock-tools { align-self: stretch; display: grid; align-content: center; min-width: 104px; }
.dock-group + .dock-group { border-left: 1px solid #58674f; padding-left: 14px; }
.dock-group h3 { font: 750 12px/1.2 system-ui, sans-serif; margin-bottom: 6px; }
.dock-group h3 small { font-weight: 500; color: #e2d4b9; margin-left: 4px; }
.dock-cards { display: flex; align-items: stretch; gap: 8px; }
.dock-hand .dock-cards { overflow-x: auto; padding: 4px; scrollbar-width: thin; }
.dock-empty { display: grid; align-content: center; min-height: 32px; color: #c9c6b5; font-size: 13px; }
.dock-cards .game-card { flex: 0 0 114px; color: var(--ink); }
.dock-cards .card-art img { height: 82px; object-fit: contain; background: #e5d9be; }
.dock-cards .card-caption { padding: 4px 5px; min-height: 30px; font-size: 10px; }
.dock-cards .card-caption small { margin-top: 2px; }
.dock-tools .game-card { flex-basis: 92px; }
.dock-tools .card-art img { height: 46px; }
.dock-actions { display: flex; flex: none; flex-wrap: wrap; gap: 5px; }
.dock-button { flex: none; color: #fff2d8; border: 1px solid #9a9e83; background: transparent; border-radius: 5px; padding: 8px 10px; font-size: 12px; font-weight: 700; }
.dock-button:hover { background: #3b4b3d; }
.dock-gear-card { display: flex; align-items: center; justify-self: start; gap: 4px; padding: 3px 5px; }
.dock-gear-card img { width: 36px; height: 27px; object-fit: contain; }
.turn-note { margin-top: 9px; color: var(--muted); font-size: 13px; }
.resource-choice { display: flex; gap: 7px; flex-wrap: wrap; }
.tabletop { padding: 0; overflow: hidden; min-width: 0; }
.table-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 11px; background: var(--green); }
.table-tab { border: 1px solid transparent; border-radius: 5px; padding: 7px 9px; color: #fff7e3; background: transparent; font-size: 13px; font-weight: 650; }
.table-tab:hover { border-color: #ab9b72; }
.table-tab[aria-pressed="true"] { background: #e3ebe1; color: #203127; }
.table-tab span { font-size: 11px; margin-left: 3px; }
.table-content { padding: clamp(12px, 2.5vw, 24px); }
.table-step { padding: 10px 12px; background: #fbf6e9; font-size: 13px; }
.table-step p { margin-top: 3px; }
.setup-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.duel-setup { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rival-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rival-heading button { color: var(--muted); font-size: 12px; }
.rival-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 5px; margin: 8px 0 14px; }
.rival-stats div { padding: 5px 2px; text-align: center; border: 1px solid var(--line); border-radius: 4px; background: #f4ecdc; }
.rival-stats dt { color: var(--muted); font-size: 11px; }
.rival-stats dd { margin: 2px 0 0; color: var(--green); font-variant-numeric: tabular-nums; font-weight: 750; }
.rival-recap { margin: 12px 0 0; padding-left: 18px; font-size: 13px; }
.rival-recap li + li { margin-top: 6px; }
.setup-cards .game-card { max-width: 310px; }
.setup-cards .card-art img { max-height: 360px; object-fit: contain; background: #ece3d1; }
.market-group + .market-group { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 12px; margin-top: 10px; }
.game-card { min-width: 0; border: 1px solid #dacca9; border-radius: 6px; background: #f3eddf; overflow: hidden; }
.card-art { display: block; position: relative; margin: 0; padding: 0; border: 0; background: transparent; width: 100%; color: inherit; }
.card-art img { display: block; width: 100%; height: auto; }
.card-caption { display: flex; gap: 4px; align-items: baseline; justify-content: space-between; padding: 7px; font-weight: 700; font-size: 12px; line-height: 1.2; }
.card-caption small { display: block; font-weight: 500; margin-top: 5px; color: var(--muted); }
.card-ruffian { position: absolute; inset: 5px auto auto 5px; display: flex; gap: 4px; align-items: center; color: white; background: #683b58; padding: 3px 5px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.ruffian-piece { display: inline-block; width: 1.35em; aspect-ratio: 1; vertical-align: middle; background: url('ruffian.webp') center / contain no-repeat; }
.landscape-piece { display: inline-block; width: 1.35em; aspect-ratio: 1; vertical-align: middle;
  background: url('terrain.webp') no-repeat calc(var(--terrain-col) * 25%) center / 500% 100%; }
.game-target { outline: 3px solid #e8a638; outline-offset: -2px; position: relative; z-index: 2; }
.game-card.game-target { background: #fbe9bc; outline-offset: 1px; }
.card-caption .card-step-label { margin-top: 4px; font-size: 10px; font-weight: 750; color: #744511; }
.target-coordinate { position: absolute; right: 1px; bottom: 1px; padding: 1px 3px; border-radius: 3px; background: #faedc4; color: #513410; font-size: 9px; font-weight: 750; pointer-events: none; }
button.game-target:hover, .game-card.game-target:focus-within, .game-card.game-target:hover { outline-color: #a45224; }
.moved-token { padding: 7px 10px; background: #ede0e9; color: #5d324d; border-radius: 5px; margin-bottom: 10px; font-weight: 650; }
.player-district { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; }
.district-frame { width: 100%; max-width: 640px; min-width: 0; margin-inline: auto; }
.resident-side:empty { display: none; }
.resident-side { width: 106px; }
.resident-side h3 { font-size: 15px; margin-bottom: 6px; }
.district-board { display: grid; grid-template-columns: 16px repeat(8, minmax(0, 1fr)); grid-template-rows: 21px repeat(8, auto) auto; gap: 3px; max-width: 640px; }
.axis { display: grid; place-items: center; color: #415242; font-size: 11px; font-weight: 800; }
.district-cell, .lane-button { border: 1px solid #a3af82; border-radius: 4px; display: grid; place-items: center; padding: 0; text-align: center; min-width: 0; }
.district-cell { aspect-ratio: 1; width: 100%; background: #cfd9ad; color: #2f4a31; font-size: clamp(8px, 1vw, 12px); font-weight: 750; overflow: hidden; }
.district-cell:nth-child(2n) { background: #d7e0b8; }
.district-cell.gear-building-space { background: #e4c7a2; border-color: #ac936c; }
.district-cell.gear-terrain { position: relative; background: #e1e7cc; }
.district-cell .landscape-piece { width: 94%; }
.district-cell.gear-terrain .landscape-piece { width: min(68%, 40px); opacity: .68; }
.gear-terrain.game-target .landscape-piece { opacity: 1; }
.district-cell.footprint { background: #edd597; border-color: #b78e3d; }
.district-cell.ruffian, .district-cell.farm, .district-cell.outhouse, .district-cell.stall { font-size: clamp(14px, 2.4vw, 24px); }
.district-cell.ruffian { background: #b492ac; }
.district-cell.ruffian .ruffian-piece { width: min(82%, 64px); }
.district-cell.farm { background: #d7b15d; color: #462c1c; }
.district-cell.outhouse { background: #9cc4ba; color: #254b43; }
.district-cell.stall { background: #ddad88; color: #61382d; }
.lane-button { background: #334c3c; color: #fdf5df; border-color: #334c3c; min-height: 29px; font-size: clamp(8px, 1vw, 12px); font-weight: 650; }
.lane-button.assigned { background: #dce7d9; border-color: #839681; color: #25362a; }
.placed-building { position: relative; display: block; z-index: 1; padding: 0; border: 1px solid #596944; border-radius: 6px; overflow: hidden; background: #5f6e47; min-width: 0; }
.placed-building.game-target { z-index: 3; }
.placed-building img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.door-target, .resident-marker { position: absolute; top: 72.6%; left: 85.6%; transform: translate(-50%, -50%); pointer-events: none; }
.door-target { width: 20%; height: 11%; border: 2px solid #ffe192; box-shadow: 0 0 0 1px #563d1f; border-radius: 3px; }
.resident-marker { display: grid; place-items: center; width: clamp(14px, 18%, 28px); aspect-ratio: 1; padding: 1px; background: #fff4dc; border: 1px solid #65473c; border-radius: 5px; }
.resident-marker .legend-icon { width: 100%; height: 100%; }
.board-legend { display: flex; flex-wrap: wrap; gap: 5px 13px; margin: 10px 0 0 19px; color: var(--muted); font-size: 12px; }
.board-legend b { color: #6e4a51; }
.market-note { margin-bottom: 14px; padding: 8px 11px; background: #f1e8d4; border-radius: 5px; color: #534b39; font-size: 13px; }
.free-choices ol { padding-left: 19px; margin: 7px 0 0; }
.free-choices li + li { margin-top: 4px; }
#card-dialog[open] { display: flex; flex-direction: column; width: min(840px, calc(100% - 24px)); max-height: 91dvh; overflow: hidden; }
#card-dialog header { flex: 0 0 auto; }
#card-dialog h2 { font-size: clamp(24px, 4vw, 34px); line-height: 1.08; }
#card-dialog .card-kind { margin: 0 0 6px; line-height: 1.3; }
.card-reading { overflow-y: auto; min-height: 0; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; padding: 2px 4px 6px 0; }
.inspect-art img { display: block; width: auto; max-width: 100%; max-height: 440px; margin: auto; border-radius: 6px; }
.inspect-notes dl { display: grid; grid-template-columns: 1fr; margin: 0 0 14px; gap: 7px; }
.card-facts > div { padding: 8px 10px; background: #f1eadb; border-radius: 5px; }
.card-facts dt { font-weight: 750; font-size: 13px; }
.card-facts dd { margin: 3px 0 0; color: #5b5344; font-size: 13px; line-height: 1.42; }
.card-effects { display: grid; gap: 7px; }
.card-effect { display: flex; gap: 9px; align-items: start; padding-top: 8px; border-top: 1px solid var(--line); }
.card-effect h3 { font: 750 13px system-ui, sans-serif; }
.card-effect p { font-size: 13px; margin-top: 3px; }
.card-effect .timing-when { font-size: 12px; color: var(--muted); }
.timing-icon { flex: 0 0 25px; min-height: 25px; display: grid; place-items: center; background: #e7dcc7; color: #2f3e30; border-radius: 4px; font-weight: 800; }
.legend-icon { display: block; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 4px;
  background: url('legend.webp') no-repeat calc(var(--icon-col) * 20%) calc(var(--icon-row) * 20%) / 600% 600%; }
.legend-sidebar { display: none; }
.legend-group { border-top: 1px solid var(--line); padding: 8px 0; }
.legend-group summary { cursor: pointer; color: var(--green); font-size: 13px; font-weight: 750; }
.legend-group dl, #symbol-dialog .legend-group dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 8px 0 0; }
.legend-group dl > div { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 7px; align-items: start; }
.legend-group .legend-icon { grid-row: 1 / span 2; }
.legend-group dt { font-size: 12px; font-weight: 750; align-self: end; }
.legend-group dd { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.legend-context { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
#symbol-dialog[open] { display: flex; flex-direction: column; max-height: 88dvh; overflow: hidden; }
.symbol-dialog-content { min-height: 0; overflow-y: auto; }
@media (min-width: 1150px) {
  .guided-mode .shell { width: min(1370px, calc(100% - 64px)); }
  .walk-layout { grid-template-columns: minmax(0, 1fr) 210px; }
  .player-district { grid-template-columns: minmax(0, 1fr) 106px; max-width: 790px; margin-inline: auto; padding-inline-start: 32px; }
  .resident-side { padding-top: 21px; }
  .legend-sidebar { display: block; position: sticky; top: 12px; padding: 14px; max-height: calc(100dvh - var(--dock-height, 0px) - 25px); overflow-y: auto; }
  .legend-sidebar h2 { font-size: 25px; margin-bottom: 10px; }
  .dock-symbols { display: none; }
}
.card-decision:not([hidden]) { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.card-decision p { color: var(--muted); font-size: 13px; }
.card-decision button { flex: 0 0 auto; }
@media (max-width: 600px) {
  #card-dialog[open] { padding: 14px; }
  .card-reading { grid-template-columns: 1fr; gap: 12px; }
  .inspect-art img { max-height: 190px; }
  .card-decision:not([hidden]) { align-items: stretch; flex-direction: column; gap: 7px; padding-top: 7px; }
}
.score-preview { margin-top: 16px; font-size: 13px; }
.score-preview dl { display: grid; grid-template-columns: 1fr auto; font-variant-numeric: tabular-nums; gap: 4px 8px; }
.score-preview dd { margin: 0; font-weight: 650; }
@media (min-width: 951px) {
  .guided-mode { --guide-width: clamp(288px, 25vw, 354px); padding-inline-start: var(--guide-width); }
  .guide-panel { width: var(--guide-width); padding: 26px clamp(17px, 2vw, 28px); }
}
@media (max-width: 950px) {
  dialog.guide-panel { width: min(355px, calc(100% - 24px)); height: calc(100dvh - var(--dock-height, 0px)); max-height: none; margin: 0; padding: 18px; }
}
@media (max-width: 1050px) {
  .hand-dock .dock-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 7px; width: calc(100% - 20px); }
  .dock-status { grid-area: 1 / 1 / auto / -1; }
  .dock-stats { gap: 3px; }
  .dock-stat { padding: 3px 1px; }
  .dock-stat dt { font-size: 9px; }
  .dock-stat dd { font-size: 14px; }
  .dock-hand { display: contents; }
  .dock-hand h3 { grid-area: 2 / 1; margin: 0; }
  .dock-hand h3 small { white-space: nowrap; margin-left: 1px; }
  .dock-hand .dock-cards { grid-area: 3 / 1 / auto / -1; }
  .dock-hand .game-card { flex-basis: clamp(72px, calc((100vw - 54px) / 3), 115px); }
  .dock-hand .card-art img { height: 72px; }
  .dock-tools { grid-area: 2 / 2; display: flex; align-items: center; min-width: 0; gap: 4px; }
  .dock-group.dock-tools { border: 0; padding: 0; }
  .dock-tools h3 { margin: 0; }
  .dock-equipped-label { display: none; }
  .dock-tool-short { display: inline; }
  .dock-tools .game-card { display: flex; align-items: center; flex: none; }
  .dock-tools .card-art { width: 23px; }
  .dock-tools .card-art img { height: 25px; }
  .dock-tools .card-caption { align-items: center; min-height: 0; padding: 3px; font-size: 0; }
  .dock-tools .card-caption small { font-size: 10px; margin: 0; }
  .dock-empty { min-height: 38px; }
  .dock-tools .dock-empty { min-height: 0; font-size: 11px; }
  .dock-actions { grid-area: 2 / 3; gap: 3px; }
  .dock-button { font-size: 11px; padding: 5px 6px; }
}
@media (max-width: 360px) {
  .dock-tools h3 { font-size: 10px; }
  .dock-button { font-size: 10px; padding: 5px; }
}
@media (max-width: 470px) {
  .duel-setup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-tabs { padding: 7px; gap: 1px; }
  .table-tab { font-size: 11px; padding: 6px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .district-board { gap: 2px; grid-template-columns: 11px repeat(8, minmax(0, 1fr)); }
  .district-cell { padding: 0 1px; line-height: 1.05; }
  .board-legend { margin-left: 0; }
}
@media (max-width: 800px) {
  .shell { width: calc(100% - 36px); }
  .layout { grid-template-columns: 1fr; }
  .intro { padding-top: 34px; }
}
@media (max-width: 520px) {
  .masthead-inner { align-items: flex-start; flex-direction: column; gap: 11px; padding: 12px 0; }
  .masthead-controls { width: 100%; }
  .home-mode .masthead-inner { align-items: center; flex-direction: row; }
  .home-mode .masthead-controls { width: auto; }
  .brand { font-size: 19px; }
  .mark { width: 33px; height: 33px; }
  nav { flex: 1; min-width: 0; }
  nav a { flex: 1; text-align: center; padding: 6px; }
  .footer { align-items: flex-start; flex-direction: column; }
}
