:root {
  color-scheme: light;
  --ink: #213d32;
  --text: #344b40;
  --paper: #fff9e9;
  --brass: #a16e2e;
  --line: #c9c5ad;
  --sans: "Avenir Next", Avenir, "Trebuchet MS", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* {box-sizing: border-box}
body {margin: 0; color: var(--ink); background: #e7eadb; font-family: var(--sans)}
button {font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent}
button:focus-visible, canvas:focus-visible, .save-options :focus-visible {outline: 3px solid #b5652d; outline-offset: 3px}
button:disabled,button[aria-disabled="true"] {cursor: default; opacity: .57}
.symbols {position: absolute; width: 0; height: 0; overflow: hidden}
.icon {display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none}
.topbar {height: 64px; padding: 0 clamp(20px, 4.2vw, 78px); display: flex; align-items: center; justify-content: space-between; background: #203d33; color: #fff5df; border-bottom: 3px solid #bc9959}
.brand {display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: bold; font-size: 25px; letter-spacing: -.065em; white-space: nowrap}
.brand-mark {width: 31px; height: 31px; display: grid; place-items: center; background: #e5c57a; color: #234134; border-radius: 6px}
.brand-mark svg {width: 27px; height: 27px; margin-top: -2px}
.tools {display: flex; align-items: center; gap: 3px}
.icon-button, .help-button {border: 0; background: transparent; color: inherit; min-width: 42px; min-height: 42px; display: inline-flex; justify-content: center; align-items: center; border-radius: 5px}
.help-button {gap: 8px; font-size: 14px; font-weight: 600; padding: 0 8px}
.icon-button:hover, .help-button:hover {background: #375346}
.divider {width: 1px; height: 20px; background: #627162; margin: 0 7px}
main {display: flex; flex-direction: column; height: calc(100vh - 64px); height: calc(100svh - 64px); min-height: 560px}
.tabletop {position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 52% 50%, #f6f1da 0, #e7e9d6 56%, #cad6c6 100%)}
.tabletop::before {content:''; position:absolute; inset:12px; border:1px solid #57654d35; z-index:0; pointer-events:none}
.print-grain {position: absolute; inset: 0; pointer-events:none; z-index:3; opacity: .14; mix-blend-mode: multiply; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 150 150' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23777' opacity='.54' filter='url(%23p)' d='M0 0h150v150H0z'/%3E%3C/svg%3E")}
.chapter {position: absolute; left: clamp(28px, 4.2vw, 78px); top: clamp(24px, 4.2vh, 64px); z-index: 2; pointer-events: none}
.series {display: flex; align-items: center; gap: 9px; margin: 0 0 8px; color:#5f654f; font-size: 12px; line-height: 1.2; font-weight: 750; letter-spacing: .15em; text-transform: uppercase}
.series span {width: 24px; height: 2px; background: var(--brass)}
.series b {color:#aa8e5a; font-weight: 500}
h1, h2, p {margin: 0}
h1, h2 {font-family: var(--serif)}
h1 {font-weight: 700; font-size: clamp(42px, 5.1vw, 84px); line-height: .96; letter-spacing: -.063em; color:#244330}
.location {margin-top: 10px; display: flex; gap: 5px; align-items: center; color: #4f6251; font-size: 14px}
.location svg {width: 16px; height: 16px}
.playfield {position: absolute; inset: 52px 2% 12px; z-index: 1}
#model {width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent}
#model:active {cursor: grabbing}
.street-tag {position:absolute; z-index: 2; left: clamp(28px,4.2vw,78px); bottom: 26px; padding: 5px 10px; color:#425349; border:1px solid #62786673; border-radius:4px; display:flex; align-items:center; gap:7px; font-size:12px; font-weight:650; line-height:1.2; background:#e4e8d6e6; pointer-events:none}
.view-dot {width:7px;height:7px;border:1.5px solid currentColor;border-radius:50%}
body[data-state="joined"] .view-dot, body[data-state="arrived"] .view-dot {background:#8b5e24;border-color:#8b5e24}
.console {z-index: 3; display:flex; align-items:center; justify-content:space-between; gap:22px; padding: 22px clamp(24px,4.2vw,78px) max(22px,env(safe-area-inset-bottom)); box-shadow:0 -1px 0 #78857560; background:var(--paper)}
.status {display:flex; align-items:center; gap:15px}
.status-emblem {display:grid;place-items:center;width:53px;height:53px;flex:none;color:#49604b;border:1px solid #a9ad93;border-radius:50%; background:#eeefdc}
.status-emblem svg {width:34px;height:28px; stroke-width:1.4}
.status h2 {font-size:clamp(22px,2vw,29px);line-height:1.15;letter-spacing:-.045em}
.status p {font-size:15px; color:var(--text); line-height:1.45; margin-top:3px}
.actions {display: flex; gap: 10px; flex: none}
.action-button {border-radius:6px; min-height: 47px; font-size:15px; font-weight:650; padding: 11px 19px; display:inline-flex;justify-content:center;align-items:center;gap:8px; border:1px solid transparent; transition: background .15s, transform .15s}
.turn-button {color:var(--ink);border-color:#9ba18b;background:transparent}
.turn-button:hover:enabled {background:#e9ead7}
.walk-button {color:var(--paper);background:#2c5040;border-color:#244838; box-shadow:0 2px 0 #203b30}
.walk-button:hover:enabled {background:#3e614b}
.action-button:active:enabled {transform:translateY(1px)}
dialog {color:var(--ink);background:var(--paper);border:1px solid #a8ad93;border-top:5px solid #bc9959; border-radius:8px; max-width:min(455px,calc(100vw - 36px));padding:28px;box-shadow:0 15px 70px #10271e32}
dialog::backdrop {background:#172a21a6}
dialog h2 {font-size:38px;letter-spacing:-.055em;margin:8px 0}
dialog p,dialog li {font-size:16px;line-height:1.5}
dialog ol {padding-left:20px}
dialog li {margin:10px 0}
dialog .action-button {width:100%;margin-top:6px}
noscript {position:absolute;top:50%;width:100%;text-align:center;background:var(--paper)}
@media (min-width:1600px) {.playfield {inset:32px 1% 10px}}
@media (max-width:900px) {.status-emblem {display:none}.console {gap:15px;padding:17px 26px}.action-button {padding-inline:14px}.playfield {inset:82px 1% 12px}}
@media (max-width:680px) {
  .topbar {height:54px;padding:0 14px}.brand {font-size:22px;gap:8px}.brand-mark {width:28px;height:28px}.tools {gap:0}.help-button span {display:none}.divider {margin:0 3px}.icon-button,.help-button {min-width:38px}
  main {height:calc(100vh - 54px);height:calc(100svh - 54px);min-height:0}
  .tabletop::before {inset:8px}.chapter {left:23px;top:23px}h1 {font-size:clamp(40px,9.8vw,55px)}.series {font-size:11px;gap:7px;margin-bottom:7px}.location {margin-top:7px;font-size:13px}
  .playfield {inset:86px 0 26px}.street-tag {left:23px;bottom:19px}
  .console {flex-direction:column;align-items:stretch;gap:12px;padding:14px 18px max(16px,env(safe-area-inset-bottom))}
  .status {min-height:51px}.status h2 {font-size:23px}.status p {font-size:14px;line-height:1.32;margin-top:2px}.actions {gap:8px}.action-button {flex:1;min-height:44px;padding:9px 6px;font-size:14px}.actions .walk-button {flex:1.15}
}
@media (max-height:540px) and (orientation:landscape) {
  .topbar {height:42px}.brand {font-size:20px}.brand-mark {height:25px;width:25px}.tools button {min-height:38px}
  main {min-height:280px;height:calc(100svh - 42px)}.chapter {top:15px;left:22px}.series {font-size:10px}.series span {width:14px}h1 {font-size:32px}.location {display:none}
  .playfield {inset:2px 2% 0}.street-tag {bottom:12px;left:21px}.console {flex-direction:row;align-items:center;padding:7px 14px;gap:12px}.status {min-height:0}.status h2 {font-size:19px}.status p {font-size:12px}.action-button {min-height:36px;font-size:13px;white-space:nowrap}.console .icon {width:17px;height:17px}
}
@media (prefers-reduced-motion:reduce) {* {transition:none!important}}
@media (min-width:901px) and (min-height:541px) {
  .playfield {inset:clamp(62px,8.5vh,94px) 1.5% 12px 11%}
}
#model:focus-visible {outline:none}
.tabletop:has(#model:focus-visible)::before {border:2px solid #946e3e}
body:is([data-state="street"],[data-state="gap"]) .turn-button {color:var(--paper);background:#2c5040;border-color:#244838;box-shadow:0 2px 0 #203b30}
body:is([data-state="street"],[data-state="gap"]) .turn-button:hover {background:#3e614b}
body:is([data-state="street"],[data-state="gap"]) .actions .walk-button {color:var(--ink);background:transparent;border-color:#9ba18b;box-shadow:none}
body:is([data-state="street"],[data-state="gap"]) .actions .walk-button:hover {background:#e9ead7}
[hidden] {display:none!important}
.series strong {font:inherit}
.route-button {margin-right:9px}
.chapter h1.long-title {font-size:clamp(36px,4.2vw,68px)}
.street-tag {gap:7px;min-height:28px}
.tag-separator {color:#8c947c}
.mechanism {position:absolute;z-index:4;right:clamp(23px,4.2vw,78px);bottom:24px;display:flex;gap:9px;align-items:center;min-height:44px;padding:6px 12px;border:1px solid #a88b55;border-radius:6px;color:#433b26;background:#f9ebc7;box-shadow:0 2px 0 #a78d60;text-align:left}
.mechanism .icon {width:25px;height:25px}.mechanism strong,.mechanism small {display:block}.mechanism strong {font-size:14px;line-height:1.15}.mechanism small {font-size:12px;line-height:1.35;color:#695d43}.mechanism:hover:enabled {background:#f4e1ad}
#instructions {max-height:90svh}
#hint {margin:14px 0;padding:10px 12px;background:#eeeeda;border-radius:4px;font-size:15px}
#hint summary {cursor:pointer;font-weight:650}#hint p {margin:8px 0 0}
#route-dialog {width:min(655px,calc(100vw - 30px));max-width:655px;max-height:88svh;padding:23px}
.route-head {display:flex;align-items:center;justify-content:space-between;gap:12px}.route-head h2 {margin-bottom:0}
.route-close {border:1px solid var(--line);border-radius:4px;padding:7px 12px;background:transparent;color:var(--ink);font-size:14px}
.album-status {margin:6px 0 14px;color:var(--text);font-size:15px}
.chapter-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.chapter-stop {display:grid;grid-template-columns:29px 1fr;align-items:center;gap:9px;padding:10px;border:1px solid #cbc8b1;border-radius:5px;background:transparent;text-align:left;color:var(--ink)}
.chapter-stop:hover,.chapter-stop[aria-current="step"] {background:#e9edda;border-color:#7c9479}.chapter-stop .stop-num {width:29px;height:29px;display:grid;place-content:center;flex:none;color:#55624e;border:1px solid #a3a78d;border-radius:50%;font:600 14px var(--sans)}
.chapter-stop.done .stop-num {background:#345344;color:#fbf8e9;border-color:#345344}
.chapter-stop strong,.chapter-stop small {display:block}.chapter-stop strong {font:700 17px/1.1 var(--serif);letter-spacing:-.025em}.chapter-stop small {color:#526252;font:500 12px/1.3 var(--sans);margin-top:3px}
@media(max-width:680px){
  .tools {gap:0}.route-button {margin:0}.tools .divider {display:none}
  .chapter h1.long-title {font-size:clamp(30px,8vw,46px)}
  .street-tag {font-size:11px;gap:4px;padding:4px 6px;left:16px}.mechanism {bottom:16px;right:16px;padding:5px 8px;gap:5px;min-height:40px}.mechanism strong {font-size:12px}.mechanism small {font-size:11px}.mechanism .icon {width:20px;height:20px}
  .tabletop:has(.mechanism:not([hidden])) .playfield {bottom:51px}
  #route-dialog {padding:15px}.chapter-list {gap:5px}.chapter-stop {gap:6px;padding:7px 6px;grid-template-columns:23px 1fr}.chapter-stop .stop-num {width:23px;height:23px;font-size:12px}.chapter-stop strong {font-size:15px}.chapter-stop small {font-size:11px}
}
@media(max-height:540px) and (orientation:landscape) { .chapter h1.long-title {font-size:29px}.mechanism {bottom:11px;min-height:34px}.mechanism .icon {width:18px;height:18px} }
@media (max-width:370px) {
  .topbar {padding-inline:8px}.brand {font-size:19px;gap:6px}.brand-mark {width:25px;height:25px}
  .street-tag {display:grid;grid-template-columns:auto 1fr;column-gap:5px;row-gap:0}
  .street-tag .tag-separator {display:none}.street-tag #view-name {grid-column:2}
}

.sr-only {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:680px) and (max-height:620px) and (orientation:portrait) {
  .chapter {top:13px;left:16px}
  .chapter h1,.chapter h1.long-title {font-size:30px}
  .chapter .series {font-size:10px;margin-bottom:4px}
  .location {margin-top:3px}
  .playfield {top:64px}
  .street-tag {bottom:11px}.mechanism {bottom:8px}
  .console {gap:7px;padding:9px 12px max(10px,env(safe-area-inset-bottom))}
  .status {min-height:0}.status h2 {font-size:20px}.status p {font-size:13px}
}

.book-button {position:absolute;z-index:4;right:clamp(23px,4.2vw,78px);bottom:79px;display:flex;align-items:center;gap:7px;min-height:44px;padding:7px 13px;border:1px solid #233f64;border-radius:6px;color:#fff8df;background:#34577b;box-shadow:0 2px 0 #233f64;font-size:14px;font-weight:650}
.book-button:hover {background:#40668f}
@media(max-width:680px) {.book-button {right:16px;bottom:66px;font-size:13px}}
@media(max-height:540px) and (orientation:landscape) {.book-button {bottom:57px}}
@media(max-width:680px) and (max-height:620px) and (orientation:portrait) {.book-button {bottom:59px}}

.save-options {padding: 16px clamp(20px, 4.2vw, 78px); background: var(--paper); border-top: 1px solid var(--line); color: var(--ink)}
.save-options label {display: inline-flex; gap: 8px; align-items: center; min-height: 32px; font-weight: bold; cursor: pointer}
.save-options input {width: 18px; height: 18px; margin: 0; accent-color: var(--ink)}
.save-options p {max-width: 65ch; margin: 4px 0 8px; line-height: 1.45}
.save-options a {color: inherit}
