:root {
  color-scheme: light;
  --ink: #253831;
  --green: #205747;
  --signal: #ae3e29;
  --paper: #fbf8e9;
  --rule: #b4bbaa;
  color: var(--ink);
  background: var(--paper);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid #196b9c; outline-offset: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.mast { border-bottom: 1px solid var(--rule); }
.mast-inner, .screen { width: min(100%, 1440px); margin: auto; padding-inline: clamp(16px, 4.2vw, 65px); }
.mast-inner { display: flex; justify-content: space-between; align-items: center; min-height: 57px; }
.back, .help { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-weight: 740; font-size: .87rem; }
.back { text-underline-offset: .22em; }
.back span { font-size: 1.15em; }
.help { padding: 0; border: 0; background: none; }
.help span { display: grid; place-items: center; width: 19px; height: 19px; border: 1.5px solid; border-radius: 50%; font-weight: 850; font-size: 12px; }
.help:hover { text-decoration: underline; }
.intro {
  display: grid;
  grid-template-columns: minmax(230px, .62fr) minmax(0, 1.38fr);
  align-items: center;
  gap: clamp(24px, 4vw, 68px);
  padding-block: clamp(35px, 7vw, 106px);
}
.intro h1 { margin: 0 0 .38em; font-size: clamp(44px, 5.5vw, 90px); line-height: 1.07; letter-spacing: -.075em; font-weight: 920; }
.intro h1 span, .intro h1 strong { display: block; }
.intro h1 strong { color: var(--signal); font-size: 1.28em; }
.intro-text p { margin: 10px 0; max-width: 28em; font-size: clamp(.88rem, 1.19vw, 1.04rem); line-height: 1.85; font-weight: 630; }
.intro-art { min-width: 0; border: 1px solid var(--ink); background: #e0e3cf; box-shadow: 4px 5px 0 #b7bfaa; }
.intro-art svg, #city-map { display: block; width: 100%; height: auto; }
.cta, .soft {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 44px; border: 1.5px solid var(--ink); border-radius: 4px; padding: 9px 16px;
  font-weight: 800; line-height: 1.4;
}
.cta { background: var(--green); color: white; box-shadow: 2px 3px 0 var(--ink); }
.cta:hover { background: #2b6957; }
.soft { background: var(--paper); }
.soft:hover, .soft[aria-pressed="true"] { background: #eee5bf; }
.intro .cta { margin-top: 15px; padding: 13px 21px; font-size: clamp(.94rem, 1.4vw, 1.15rem); }
.game { padding-block: clamp(16px, 2.5vw, 38px) 24px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.stage-info { min-width: 0; }
#stage-count { font-size: .82rem; font-weight: 820; letter-spacing: .075em; color: var(--green); }
.stage-info h1 { margin: 2px 0 5px; font-size: clamp(1.48rem, 3vw, 2.65rem); line-height: 1.12; letter-spacing: -.05em; }
#stage-story { margin: 0; font-size: clamp(.78rem, 1.15vw, .95rem); line-height: 1.5; }
.clock { border-left: 2px solid var(--green); padding-left: 12px; flex: none; }
.clock span, .clock b { display: block; }
.clock span { font-size: .68rem; font-weight: 700; }
.clock b { font: bold clamp(1.25rem, 2.3vw, 2rem)/1.1 ui-monospace, monospace; color: var(--green); }
.atlas { display: grid; grid-template-columns: clamp(146px, 16vw, 204px) minmax(0, 1fr); gap: clamp(14px, 2.1vw, 30px); align-items: start; }
.specimen-card { border-top: 4px solid var(--green); border-bottom: 1px solid var(--rule); padding: 13px 0 16px; text-align: center; }
.specimen-card h2 { color: var(--green); margin: 0 0 10px; font-size: .91rem; }
.specimen { padding: 12px 6px; display: grid; place-items: center; background: #f3edd6; }
.specimen img { width: min(115px, 92%); height: 78px; display: block; object-fit: contain; }
.ward-label { margin: 12px 0 15px; }
.ward-label strong, .ward-label span { display: block; }
.ward-label strong { font-size: clamp(1.2rem, 1.8vw, 1.6rem); line-height: 1.3; }
.ward-label span { color: #66553b; font-size: .78rem; }
.order-actions button { width: 100%; min-height: 40px; font-size: .87rem; }
.map-view, .map-tools { min-width: 0; }
.map-tools { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 6px; }
#find-message { margin: 0; font-size: .87rem; font-weight: 680; line-height: 1.5; }
.zoom { margin-left: auto; display: inline-flex; align-items: center; flex: none; border: 1px solid var(--ink); border-radius: 3px; }
.zoom button { width: 40px; min-height: 36px; background: var(--paper); border: none; font-size: 1.05rem; font-weight: 850; }
.zoom button:disabled { opacity: .4; }
.zoom button:hover:not(:disabled) { background: #e4edda; }
.zoom output { min-width: 32px; text-align: center; font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.map-frame { position: relative; overflow: auto; aspect-ratio: 3 / 2; border: 1px solid #465543; background: #e2e2c8; overscroll-behavior: contain; }
.map-frame:not(.magnified) { overflow: hidden; }
.map-frame.magnified { cursor: grab; }
.map-frame.dragging, .map-frame.dragging * { cursor: grabbing !important; }
#city-map { max-width: none; touch-action: pan-x pan-y pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.board-item, [data-slot] { cursor: pointer; outline: none !important; }
.city-resident { filter: drop-shadow(.8px 1.5px 1px #30291570); }
.focus-ring { display: none; pointer-events: none; }
[data-slot]:focus-visible .focus-ring { display: block; }
.finish { max-width: 850px; padding-block: clamp(28px, 5vw, 72px); text-align: center; }
.finish-sheet { padding: clamp(18px, 5vw, 58px) clamp(12px, 3vw, 36px); border-block: 2px solid var(--green); }
.finish h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -.07em; color: var(--green); }
#collection { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 24px auto; }
#collection figure { margin: 0; }
#collection img { width: 100%; height: 65px; object-fit: contain; padding: 3px; }
#collection figcaption { font-size: .72rem; font-weight: 700; }
.score, .finish-actions { display: flex; justify-content: center; gap: clamp(16px, 4vw, 42px); }
.score { padding: 16px 0; border-block: 1px solid var(--rule); }
.score dt { font-weight: 690; font-size: .78rem; }
.score dd { margin: 4px 0 0; color: var(--green); font-weight: 820; font-size: 1.5rem; }
.finish-actions { flex-wrap: wrap; gap: 12px; }
#share-message { font-size: .82rem; }
dialog { width: min(92vw, 440px); padding: 24px; border: 2px solid var(--green); border-radius: 5px; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #172d26a6; }
dialog h2 { margin-top: 0; }
dialog p { font-size: .95rem; line-height: 1.7; }
@media (max-width: 740px) {
  .mast-inner { min-height: 46px; }
  .intro { max-width: 580px; padding-block: 26px; grid-template-columns: 1fr; gap: 24px; }
  .intro h1 { margin: 0 0 12px; font-size: clamp(2rem, 8vw, 3.3rem); }
  .intro h1 span, .intro h1 strong { display: inline; }
  .intro h1 strong { font-size: 1.12em; }
  .intro-text p { margin: 5px 0; line-height: 1.65; }
  .intro .cta { margin-top: 12px; }
  .game { padding-inline: clamp(10px, 3vw, 16px); }
  .stage-head { margin-bottom: 11px; }
  .atlas { grid-template-columns: 1fr; gap: 8px; }
  .specimen-card { display: grid; grid-template-columns: 62px 1fr auto; gap: 1px 9px; align-items: center; padding: 7px 0; text-align: left; border-top-width: 2px; }
  .specimen-card h2 { grid-area: 1 / 2; margin: 0; font-size: .66rem; }
  .specimen { grid-area: 1 / 1 / 3 / 2; padding: 3px; }
  .specimen img { width: 100%; height: 45px; }
  .ward-label { grid-area: 2 / 2; margin: 0; }
  .ward-label strong { font-size: 1.05rem; }
  .ward-label span { font-size: .66rem; }
  .order-actions { grid-area: 1 / 3 / 3 / 4; }
  .order-actions button { min-height: 38px; padding: 7px 9px; font-size: .77rem; }
  .map-tools { gap: 6px; }
  #find-message { font-size: .76rem; }
  .zoom button { width: 37px; }
  .map-frame.magnified { aspect-ratio: 1 / 1; max-height: 55svh; }
  #collection { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  .found-mark { animation: appear .2s ease-out; }
  @keyframes appear { from { opacity: .25; } to { opacity: 1; } }
}
