:root {
  color-scheme: light;
  --ink: #173f45;
  --paper: #fff9e9;
  --cream: #f4e7c4;
  --road: #e5c77d;
  --green: #28745b;
  --green-dark: #185344;
  --coral: #d95f45;
  --orange: #e99a3d;
  --blue: #397aa0;
  --sky: #bfe5df;
  --shadow: rgba(23, 63, 69, .16);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #e9dec0; }
body {
  margin: 0;
  color: var(--ink);
  background-color: #f5efd9;
  background-image: radial-gradient(circle at 12px 12px, rgba(23, 63, 69, .035) 1.2px, transparent 1.5px);
  background-size: 24px 24px;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}

button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid #f1b94e; outline-offset: 3px; }
[hidden] { display: none !important; }

.site-header {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px dashed rgba(23, 63, 69, .26);
}
.back-link { color: var(--ink); font-weight: 800; text-decoration: none; }
.sound-button {
  min-width: 88px;
  min-height: 42px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-weight: 900;
}

main { width: min(1180px, calc(100% - 28px)); margin: 24px auto 48px; }
.screen { min-height: 640px; }
.eyebrow, .map-kicker {
  margin: 0 0 10px;
  font-size: .76rem;
  font-weight: 1000;
  letter-spacing: .18em;
  color: var(--green-dark);
}

.start-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(390px, 1.2fr) minmax(330px, .8fr);
  gap: clamp(30px, 6vw, 86px);
  align-items: center;
  padding: clamp(24px, 4vw, 56px);
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 12px 12px 0 var(--ink);
  overflow: hidden;
}
.start-screen::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px dashed rgba(23, 63, 69, .22);
  pointer-events: none;
}
.start-map {
  position: relative;
  min-height: 500px;
  background: #abd9c4;
  border: 4px solid var(--ink);
  clip-path: polygon(4% 0, 97% 3%, 100% 96%, 3% 100%, 0 5%);
  overflow: hidden;
}
.start-map::before, .start-map::after {
  content: "";
  position: absolute;
  background: #76b18d;
  border: 3px solid var(--ink);
}
.start-map::before { width: 130px; height: 180px; left: -30px; bottom: -28px; border-radius: 49% 51% 12% 12%; transform: rotate(-12deg); }
.start-map::after { width: 155px; height: 120px; right: -38px; top: 145px; border-radius: 50%; transform: rotate(20deg); }
.sun-disc { position: absolute; width: 120px; height: 120px; border: 4px solid var(--ink); border-radius: 50%; right: 26px; top: 25px; background: #f5c85c; }
.road-stroke { position: absolute; height: 36px; border: 3px solid var(--ink); background: #f3d58a; border-radius: 50%; transform-origin: left center; }
.road-a { width: 440px; left: 25px; top: 310px; transform: rotate(-30deg); }
.road-b { width: 370px; left: 72px; top: 120px; transform: rotate(47deg); }
.road-c { width: 260px; left: 210px; top: 380px; transform: rotate(-72deg); }
.start-place {
  position: absolute;
  z-index: 2;
  width: 86px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  background: var(--paper);
  font: 1000 1.9rem/1 serif;
  box-shadow: 6px 7px 0 rgba(23, 63, 69, .55);
}
.start-place::before { content: ""; position: absolute; left: 11px; right: 11px; top: -24px; height: 30px; background: var(--coral); border: 4px solid var(--ink); transform: skew(-18deg); z-index: -1; }
.p1 { left: 34px; top: 86px; transform: rotate(-3deg); }
.p2 { right: 72px; bottom: 45px; transform: rotate(4deg); }
.p3 { right: 44px; top: 180px; transform: rotate(-3deg); }
.p4 { left: 105px; bottom: 52px; transform: rotate(2deg); }
.walker { position: absolute; z-index: 3; width: 46px; height: 64px; left: 49%; top: 47%; border: 4px solid var(--ink); border-radius: 48% 48% 32% 32%; background: var(--orange); box-shadow: 4px 5px 0 rgba(23, 63, 69, .45); }
.walker::before { content: ""; position: absolute; width: 36px; height: 36px; left: 1px; top: -31px; border: 4px solid var(--ink); border-radius: 50%; background: #f0b884; }
.walker i::before, .walker i::after { content: ""; position: absolute; width: 8px; height: 22px; bottom: -20px; background: var(--ink); }
.walker i::before { left: 5px; transform: rotate(8deg); }.walker i::after { right: 5px; transform: rotate(-8deg); }
.start-copy { position: relative; z-index: 2; }
.start-copy h1 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(2.7rem, 5vw, 5.2rem); line-height: 1.05; letter-spacing: -.04em; }
.start-copy h1 em { color: var(--coral); font-style: normal; border-bottom: 10px solid #f4cd66; }
.lead { font-size: clamp(1rem, 1.6vw, 1.18rem); font-weight: 700; margin: 26px 0; }
.start-rules { display: grid; gap: 8px; margin: 0 0 24px; }
.start-rules span { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.start-rules b { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: #f4cd66; }
.start-button {
  width: 100%;
  min-height: 72px;
  padding: 12px 22px;
  border: 3px solid var(--ink);
  background: var(--coral);
  color: #fff;
  box-shadow: 7px 7px 0 var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.start-button span { font-size: 1.2rem; font-weight: 1000; }
.start-button small { font-weight: 700; }
.start-button:hover { transform: translate(2px, 2px); box-shadow: 5px 5px 0 var(--ink); }
.quiet-note { font-weight: 700; color: #45666a; }

.play-screen { display: block; }
.paper-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
}
.paper-strip div { min-height: 66px; padding: 9px 16px; border-right: 2px dashed rgba(23, 63, 69, .3); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.paper-strip div:last-child { border-right: 0; }
.paper-strip small { font-weight: 800; }.paper-strip strong { font: 1000 1.35rem/1 monospace; }
.forecast-band { margin: 18px 0; padding: 14px 18px; border-left: 12px solid var(--orange); background: #fff3c6; display: flex; align-items: center; gap: 15px; box-shadow: inset 0 0 0 2px rgba(23, 63, 69, .2); }
.forecast-band.is-danger { border-left-color: var(--coral); background: #ffe2d7; }
.forecast-icon { font-size: 2.2rem; }.forecast-band p, .forecast-band small { display: block; margin: 0; }.forecast-band p { font-weight: 1000; font-size: 1.15rem; }.forecast-band small { font-weight: 700; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(285px, .65fr); gap: 20px; align-items: stretch; }
.town-panel, .task-panel { border: 3px solid var(--ink); background: var(--paper); box-shadow: 7px 7px 0 var(--ink); }
.town-panel { padding: 18px; min-width: 0; }
.map-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.map-heading p, .map-heading h2 { margin: 0; }.map-heading h2 { font-size: 1.35rem; font-family: "Yu Mincho", serif; }
.danger-key { font-size: .8rem; font-weight: 900; display: flex; align-items: center; gap: 7px; }
.danger-key span { width: 18px; height: 18px; border-radius: 50%; background: var(--coral); border: 2px solid var(--ink); }
.town-map {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border: 3px solid var(--ink);
  background-color: #9ed4b2;
  background-image: linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px);
  background-size: 36px 36px;
  touch-action: pan-y;
}
.town-map::before { content: ""; position: absolute; width: 280px; height: 120px; left: 30%; top: 39%; border: 3px solid rgba(23,63,69,.35); border-radius: 50%; background: rgba(80, 163, 184, .35); transform: rotate(-10deg); }
.road-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.road-line { stroke: var(--road); stroke-width: 7; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 2px 0 rgba(23,63,69,.4)); }
.road-line.is-open { stroke: #fff1bd; stroke-width: 10; }
.place-button {
  position: absolute;
  z-index: 3;
  width: clamp(76px, 12vw, 116px);
  min-height: 70px;
  transform: translate(-50%, -50%);
  padding: 8px 6px 6px;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 5px 0 rgba(23, 63, 69, .55);
  cursor: pointer;
  font-weight: 1000;
  line-height: 1.15;
}
.place-button::before { content: ""; position: absolute; left: 10px; right: 10px; top: -14px; height: 15px; background: var(--roof, #e88949); border: 3px solid var(--ink); border-bottom: 0; transform: skew(-18deg); }
.place-button .place-icon { display: block; font: 1000 1.15rem/1 serif; margin-bottom: 4px; }
.place-button small { display: block; font-size: .68rem; margin-top: 4px; color: #45666a; }
.place-button.is-current { background: #f7cf63; box-shadow: 0 0 0 6px rgba(255,255,255,.8), 4px 5px 0 var(--ink); }
.place-button.is-reachable { animation: reachable 1.4s ease-in-out infinite; }
.place-button.is-urgent { --roof: var(--coral); background: #ffe1d8; }
.place-button.is-resolved { --roof: var(--green); background: #e8f4dc; }
.place-button:disabled { cursor: default; opacity: .67; }
.place-button.is-reachable:disabled { opacity: .67; animation: none; }
.walker-token { position: absolute; z-index: 5; width: 38px; height: 38px; transform: translate(-50%, -50%); border: 3px solid var(--ink); border-radius: 50%; background: var(--coral); color: #fff; box-shadow: 3px 4px 0 var(--ink); transition: left .42s ease, top .42s ease; pointer-events: none; }
.walker-token span::before { content: ""; position: absolute; left: 10px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 10px 0 #fff; }
.walker-token b { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); padding: 1px 5px; white-space: nowrap; background: var(--ink); color: #fff; font-size: .66rem; }
.map-message { position: absolute; z-index: 7; left: 50%; bottom: 14px; width: min(92%, 610px); transform: translateX(-50%); padding: 10px 14px; border: 2px solid var(--ink); background: rgba(255, 249, 233, .95); box-shadow: 4px 4px 0 var(--ink); font-weight: 800; text-align: center; }
.success-ripple { position: absolute; z-index: 6; width: 60px; height: 60px; transform: translate(-50%, -50%); border: 7px double #fff; border-radius: 50%; opacity: 0; pointer-events: none; }
.success-ripple.is-active { animation: ripple .8s ease-out; }
.map-actions { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(230px, 1.3fr); gap: 12px; margin-top: 14px; }
.map-actions button { min-height: 64px; border: 3px solid var(--ink); cursor: pointer; box-shadow: 4px 4px 0 var(--ink); }
.map-actions button:disabled { opacity: .48; cursor: default; box-shadow: none; }
.bell-button { background: #d7ecdf; display: grid; grid-template-columns: 42px 1fr; text-align: left; align-items: center; padding: 8px 12px; }
.bell-button span { grid-row: 1 / 3; font-size: 2rem; }.bell-button b, .bell-button small { display: block; }
.phase-button { background: #f4cd66; padding: 7px 14px; }.phase-button b, .phase-button small { display: block; }.phase-button b { font-size: 1.05rem; }
.task-panel { padding: 18px; display: flex; flex-direction: column; }
.task-heading { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 3px double var(--ink); }.task-heading p, .task-heading h2 { margin: 0 0 9px; }.task-heading p { color: var(--coral); font-weight: 1000; }.task-heading h2 { font-family: "Yu Mincho", serif; }
.task-list { display: grid; gap: 11px; margin: 15px 0; }
.task-card { position: relative; padding: 12px 12px 11px 50px; border: 2px solid var(--ink); background: #fffdf4; transform: rotate(var(--tilt, -.3deg)); }
.task-card::before { content: attr(data-number); position: absolute; left: 10px; top: 13px; width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--road); font-weight: 1000; }
.task-card b, .task-card span, .task-card small { display: block; }.task-card b { line-height: 1.35; }.task-card span { margin-top: 6px; font-size: .82rem; font-weight: 900; }.task-card small { color: #45666a; }
.task-card.is-urgent { border-width: 4px; border-color: var(--coral); background: #ffe4d9; }.task-card.is-urgent::before { background: var(--coral); color: #fff; }
.task-card.is-delayed { border-style: dashed; }.task-card.is-done { background: #e7f3da; opacity: .78; }.task-card.is-done::after { content: "つながった"; position: absolute; right: 8px; top: 7px; color: var(--green-dark); font-weight: 1000; transform: rotate(4deg); }
.cause-board { margin-top: auto; padding: 13px; border-left: 8px solid var(--blue); background: #e4f1ed; }.cause-board span { font-size: .76rem; font-weight: 1000; letter-spacing: .14em; }.cause-board p { margin: 4px 0 0; font-weight: 700; font-size: .9rem; }
.role-notebook { margin-top: 13px; padding-top: 10px; border-top: 2px dashed rgba(23,63,69,.35); }.role-notebook p { margin: 0 0 8px; font-weight: 900; display: flex; justify-content: space-between; }
.role-marks { display: flex; flex-wrap: wrap; gap: 5px; }.role-marks span { padding: 3px 7px; border: 1px solid var(--ink); background: #fff; font-size: .72rem; font-weight: 900; }.role-marks span.is-found { background: #f4cd66; }
.phase-timeline { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 3px solid var(--ink); background: var(--paper); }
.phase-timeline li { padding: 10px; text-align: center; border-right: 2px dashed rgba(23,63,69,.35); }.phase-timeline li:last-child { border: 0; }.phase-timeline span, .phase-timeline b { display: block; }.phase-timeline span { font-size: .75rem; }.phase-timeline li.is-current { background: #f4cd66; }.phase-timeline li.is-done { background: #dfeccf; }

.quiz-screen {
  width: min(850px, 100%);
  margin: 36px auto;
  padding: clamp(24px, 5vw, 54px);
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 10px 10px 0 var(--ink);
  position: relative;
  overflow: hidden;
}
.quiz-route { display: flex; gap: 36px; margin-bottom: 28px; align-items: center; }.quiz-route span { width: 24px; height: 24px; border: 3px solid var(--ink); border-radius: 50%; background: var(--orange); position: relative; }.quiz-route span:not(:last-child)::after { content: ""; position: absolute; width: 42px; height: 5px; left: 20px; top: 7px; background: var(--road); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.quiz-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }.quiz-header h2 { margin: 0; font: 1000 clamp(1.55rem, 4vw, 2.4rem)/1.25 "Yu Mincho", serif; }.quiz-header b { flex: 0 0 auto; border: 2px solid var(--ink); padding: 6px 10px; background: #f4cd66; }
.quiz-question { margin: 26px 0 18px; font-weight: 1000; font-size: clamp(1.1rem, 2.3vw, 1.4rem); }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quiz-choices button { min-height: 58px; padding: 10px 14px; border: 3px solid var(--ink); background: #fff; box-shadow: 3px 3px 0 var(--ink); cursor: pointer; font-weight: 900; text-align: left; }
.quiz-choices button[data-result="correct"] { background: #dcefcf; border-style: double; border-width: 5px; }.quiz-choices button[data-result="wrong"] { background: #ffe0d7; text-decoration: line-through; }
.quiz-feedback { min-height: 64px; padding: 12px; border-left: 8px solid var(--blue); background: #e4f1ed; font-weight: 800; }
.quiz-next { min-height: 54px; padding: 8px 20px; border: 3px solid var(--ink); background: #f4cd66; box-shadow: 4px 4px 0 var(--ink); cursor: pointer; font-weight: 1000; }

.result-screen { position: relative; padding: clamp(24px, 5vw, 54px); border: 4px solid var(--ink); background: var(--paper); box-shadow: 10px 10px 0 var(--ink); overflow: hidden; }
.result-town { height: 230px; position: relative; background: #9ed4b2; border: 3px solid var(--ink); overflow: hidden; margin-bottom: 28px; }.house { position: absolute; bottom: 35px; width: 90px; height: 75px; background: #fff3d2; border: 3px solid var(--ink); }.house::before { content: ""; position: absolute; left: -9px; top: -38px; border-left: 52px solid transparent; border-right: 52px solid transparent; border-bottom: 42px solid var(--coral); filter: drop-shadow(0 -3px 0 var(--ink)); }.h1 { left: 7%; }.h2 { left: 31%; transform: scale(.82); }.h3 { right: 29%; transform: scale(.9); }.h4 { right: 6%; }
.result-road { position: absolute; height: 26px; background: var(--road); border: 3px solid var(--ink); border-radius: 50%; }.r1 { width: 55%; left: 8%; top: 125px; transform: rotate(-9deg); }.r2 { width: 50%; right: 4%; top: 85px; transform: rotate(14deg); }.r3 { width: 48%; left: 28%; bottom: 12px; transform: rotate(-4deg); }
.thank-wave { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: space-around; padding-top: 28px; }.thank-wave span { position: relative; z-index: 3; padding: 6px 12px; border: 2px solid var(--ink); background: #f4cd66; font-weight: 1000; transform: rotate(-4deg); }.thank-wave span:nth-child(2) { transform: translateY(48px) rotate(3deg); }.thank-wave span:nth-child(3) { transform: rotate(5deg); }
.result-screen h2 { margin: 0; font: 1000 clamp(1.8rem, 4vw, 3.2rem)/1.2 "Yu Mincho", serif; }.result-screen > p:not(.eyebrow) { max-width: 800px; font-weight: 700; }
.result-stats { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 10px; margin: 24px 0; }.result-stats > div { min-height: 90px; padding: 12px; border: 3px solid var(--ink); background: #fff; display: flex; flex-direction: column; justify-content: center; }.result-stats small { font-weight: 800; }.result-stats strong { font: 1000 1.6rem/1.1 monospace; }.score-ticket { background: #f4cd66 !important; }.score-ticket span { font-size: .74rem; font-weight: 900; }
.result-actions { display: grid; grid-template-columns: 1.3fr .7fr; gap: 14px; align-items: stretch; }.start-button.compact { min-height: 62px; }.ranking-toggle { border: 3px solid var(--ink); background: #dceee9; box-shadow: 5px 5px 0 var(--ink); cursor: pointer; font-weight: 1000; }
.ranking-panel { margin-top: 20px; padding: 16px; border: 3px solid var(--ink); background: #fff; color: var(--ink); min-height: 120px; }
.ranking-panel *, .ranking-panel button, .ranking-panel a { color: var(--ink); }
.ranking-panel [aria-selected="true"], .ranking-panel .is-active, .ranking-panel .active { background: var(--ink) !important; color: #fff !important; }

footer { width: min(1120px, calc(100% - 36px)); margin: 0 auto 34px; padding-top: 20px; border-top: 2px dashed rgba(23,63,69,.35); color: #45666a; font-size: .86rem; font-weight: 700; }

@keyframes reachable { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.055); } }
@keyframes ripple { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(3.2); } }

@media (max-width: 880px) {
  .start-screen { grid-template-columns: 1fr; }
  .start-map { min-height: 360px; order: 2; }
  .play-layout { grid-template-columns: 1fr; }
  .town-map { min-height: 570px; }
  .task-panel { min-height: 420px; }
}

@media (max-width: 620px) {
  main { width: min(100% - 16px, 1180px); margin-top: 12px; }
  .site-header { width: calc(100% - 20px); }
  .screen { min-height: 0; }
  .start-screen { padding: 22px 18px 28px; box-shadow: 6px 6px 0 var(--ink); }
  .start-map { min-height: 300px; }
  .start-copy h1 { font-size: 2.7rem; }
  .paper-strip { grid-template-columns: 1fr 1fr; }
  .paper-strip div:nth-child(2) { border-right: 0; }.paper-strip div:nth-child(-n+2) { border-bottom: 2px dashed rgba(23,63,69,.3); }
  .town-panel, .task-panel { box-shadow: 4px 4px 0 var(--ink); }
  .town-panel { padding: 10px; }
  .map-heading { align-items: flex-start; flex-direction: column; }
  .town-map { min-height: 530px; }
  .place-button { width: 77px; min-height: 65px; font-size: .76rem; padding-left: 3px; padding-right: 3px; }
  .place-button small { font-size: .58rem; }
  .map-actions { grid-template-columns: 1fr; }
  .phase-timeline b { font-size: .69rem; }
  .quiz-screen, .result-screen { padding: 22px 16px; box-shadow: 5px 5px 0 var(--ink); }
  .quiz-header { align-items: flex-start; }
  .quiz-choices { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-actions { grid-template-columns: 1fr; }
  .ranking-toggle { min-height: 54px; }
  .ranking-panel { scroll-margin-top: 10px; }
}

@media (max-width: 390px) {
  .start-place { transform: scale(.82); }
  .town-map { min-height: 500px; }
  .place-button { width: 70px; min-height: 61px; }
  .place-button .place-icon { font-size: .95rem; }
  .map-message { font-size: .78rem; bottom: 7px; }
  .forecast-band { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
