:root {
  font-family:"Nunito","PingFang TC","Microsoft JhengHei",system-ui,sans-serif;
  color:#193d3a;
  background:#fafbf6;
  font-synthesis:weight;
  --ink:#193d3a;
  --spruce:#124b48;
  --muted:#526d65;
  --line:#cfdbce;
  --orange:#ffba5c;
  --paper:#fafbf6;
}

* {
  box-sizing:border-box;
}

html {
  scroll-behavior:smooth;
  scroll-padding-top:1rem;
}

body {
  margin:0;
}

button,select,a {
  font:inherit;
}

button,select {
  cursor:pointer;
}

button,a {
  touch-action:manipulation;
}

button {
  color:inherit;
}

button:disabled {
  cursor:default;
}

button:focus-visible,a:focus-visible,select:focus-visible {
  outline:3px solid #a74710;
  outline-offset:3px;
}

a {
  color:inherit;
}

button:active:enabled {
  translate:0 1px;
}

.shell {
  max-width:1320px;
  margin:auto;
  padding-inline:clamp(16px,4vw,64px);
}

.skip {
  position:absolute;
  z-index:20;
  top:-80px;
  background:white;
  padding:12px;
}

.skip:focus {
  top:0;
}

.top {
  background:var(--paper);
  border-bottom:1px solid var(--line);
}

.bar,.brand,nav,.hero-actions,.section-title,.map-foot,.grade-buttons,.dialog-top,.row-actions {
  display:flex;
  align-items:center;
}

.bar {
  height:76px;
  gap:40px;
}

.brand {
  gap:10px;
  font-size:1.38rem;
  font-weight:900;
  letter-spacing:.04em;
  text-decoration:none;
  white-space:nowrap;
}

.brand img {
  border-radius:12px;
}

nav {
  margin-left:auto;
  gap:26px;
}

nav a,nav button,.install {
  font-weight:750;
  text-decoration:none;
  background:none;
  border:0;
  padding:8px 0;
}

nav :hover {
  text-decoration:underline;
  text-underline-offset:5px;
}

.install {
  background:#e2eddf;
  border-radius:24px;
  padding:10px 18px;
  font-size:.9rem;
  border:1px solid #ccddcb;
}

.hero {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  display:grid;
  grid-template-columns:36% 64%;
  align-items:center;
  min-height:420px;
  margin-top:22px;
  border-radius:27px;
  background:linear-gradient(115deg,#d7eee5 7%,#def1e5 35%,#c5e9e9 76%,#cae7eb);
  border:1px solid #c5dfd4;
}

.hero-copy {
  padding:34px 0 40px clamp(20px,3.6vw,53px);
  position:relative;
  z-index:1;
}

.year,.section-mark,.dialog-top>span {
  font-weight:800;
  letter-spacing:.07em;
}

.year {
  font-size:.9rem;
  color:#2d6254;
  margin:0 0 17px;
}

.flag {
  color:#ac4d1c;
  font-size:1.24rem;
}

.hero h1 {
  margin:0;
  color:#124b48;
  font-size:clamp(2.5rem,4.55vw,4.5rem);
  font-weight:900;
  letter-spacing:-.05em;
  line-height:1.12;
}

.intro {
  color:#31574d;
  line-height:1.75;
  margin:18px 0 22px;
}

.hero-actions,.row-actions {
  gap:10px;
  flex-wrap:wrap;
}

.primary,.secondary,.choice,.game-link,.small {
  border:1px solid #bccfc3;
  border-radius:12px;
  padding:11px 18px;
  font-weight:750;
  text-decoration:none;
  background:#fff;
}

.primary {
  background:var(--spruce);
  border-color:var(--spruce);
  color:white;
  box-shadow:0 3px 0 #07302d;
}

.primary:hover {
  background:#20645c;
}

.secondary {
  background:#f5fbef;
  border-color:#a8cab6;
}

.map-panel {
  position:relative;
  width:100%;
  height:clamp(400px,36vw,490px);
  isolation:isolate;
}

#island,#pins {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

#island {
  display:block;
  touch-action:pan-y;
}

#pins {
  pointer-events:none;
}

.map-pin {
  pointer-events:auto;
}

.map-foot {
  position:absolute;
  bottom:10px;
  right:13px;
  gap:8px;
  color:#355d51;
  font-size:.78rem;
  font-weight:650;
}

.map-foot span,.map-foot button {
  background:#f9fff2e8;
  border-radius:22px;
  border:1px solid #bed8c3;
  padding:5px 10px;
}

.map-foot button {
  font-size:1.05rem;
  width:34px;
  height:34px;
  padding:0;
}

.grades {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:23px 0;
  border-bottom:1px solid var(--line);
}

.grades>div,.grades label {
  display:flex;
  align-items:center;
  gap:16px;
}

.grades h2,.grades label {
  font-size:1rem;
  margin:0;
  font-weight:800;
}

.grade-buttons {
  gap:5px;
  flex-wrap:wrap;
}

.grade-buttons button {
  border:1px solid transparent;
  background:transparent;
  border-radius:22px;
  padding:9px 14px;
  font-weight:670;
}

.grade-buttons button:hover {
  background:#e9f0e6;
}

.grade-buttons [aria-pressed=true] {
  background:var(--spruce);
  color:#fff;
}

.grades select {
  background:#fff;
  border:1px solid var(--line);
  border-radius:10px;
  padding:8px;
  color:var(--ink);
}

.stops,.books {
  margin-block:36px 42px;
}

.section-title {
  justify-content:space-between;
  gap:10px;
  margin-bottom:16px;
}

.section-title h2 {
  font-size:clamp(1.55rem,3vw,2.05rem);
  letter-spacing:-.035em;
  line-height:1.25;
  margin:0;
}

.section-mark {
  margin:0 0 5px;
  color:#547569;
  font-size:.83rem;
}

.section-title>span,.subtext,.status {
  color:var(--muted);
  font-size:.92rem;
}

.station-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}

.stop-card {
  display:grid;
  grid-template-columns:52px 1fr;
  gap:14px;
  align-items:center;
  text-align:left;
  border:1px solid #d3ddd2;
  border-radius:17px;
  padding:17px 15px;
  background:#fff;
  transition:background .15s,transform .15s;
}

.stop-card:hover {
  background:#f2f7ef;
  transform:translateY(-2px);
}

.stop-icon {
  width:52px;
  height:52px;
  display:grid;
  place-items:center;
  background:var(--tint);
  color:var(--color);
  font-size:1.45rem;
  font-weight:900;
  border-radius:17px 19px 14px 20px;
}

.stop-card strong,.stop-card small {
  display:block;
}

.stop-card strong {
  font-size:1.06rem;
}

.stop-card small {
  font-size:.85rem;
  color:var(--muted);
  margin-top:3px;
  line-height:1.5;
}

.books {
  border-top:1px solid var(--line);
  padding-top:26px;
}

.subtext {
  line-height:1.7;
}

.book-table {
  border-collapse:collapse;
  width:100%;
  font-size:.95rem;
}

.book-table td,.book-table th {
  text-align:left;
  padding:10px;
  border-bottom:1px solid #dce4da;
}

.book-table thead {
  background:#e8efe5;
}

.book-table small {
  font-size:.85rem;
  color:var(--muted);
}

.status {
  margin:20px 0;
}

.status:empty {
  display:none;
}

footer {
  border-top:1px solid var(--line);
  padding:20px 0;
}

footer .shell {
  display:flex;
  justify-content:space-between;
  gap:8px;
  font-size:.85rem;
  color:var(--muted);
}

dialog {
  color:var(--ink);
  background:#fafff7;
  border:1px solid #ccdacc;
  border-radius:24px;
  padding:22px;
  max-height:90dvh;
  width:min(510px,calc(100% - 24px));
  box-shadow:0 18px 70px #143b3b45;
}

dialog::backdrop {
  background:#153c3ac2;
}

.dialog-top {
  justify-content:space-between;
  gap:8px;
}

.dialog-top>span {
  font-size:.86rem;
  color:#527365;
}

.dialog-top button {
  border:1px solid var(--line);
  width:36px;
  height:36px;
  border-radius:50%;
  font-size:1.35rem;
  background:white;
}

dialog h2 {
  font-size:1.65rem;
  line-height:1.35;
  margin:14px 0 9px;
}

dialog p {
  line-height:1.65;
}

#view {
  overflow-wrap:anywhere;
}

.game-link,.choice {
  width:100%;
  margin:4px 0;
  text-align:left;
}

.game-link:hover,.choice:hover:enabled {
  background:#edf6e8;
}

.game-link small {
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-weight:500;
}

.choice[data-result=good] {
  background:#d9f3dc;
  border-color:#3b835b;
}

.choice[data-result=bad] {
  background:#ffe4d6;
  border-color:#bf6a44;
}

.feedback {
  border-left:4px solid #72a784;
  padding-left:12px;
}

.mode-grid,.stamp-list {
  display:grid;
  gap:6px;
}

.stamp-list {
  grid-template-columns:1fr 1fr;
  padding:0;
  list-style:none;
}

.stamp-list li {
  border-radius:12px;
  border:1px solid var(--line);
  padding:9px;
}

.stamp-list .earned {
  background:#fff0c8;
}

.game-progress {
  display:block;
  width:100%;
  accent-color:var(--spruce);
}

.signal {
  font-size:.88rem;
  color:var(--muted);
}

.target-grid {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:6px;
  margin:12px 0;
}

.target-grid button {
  min-height:55px;
  background:#e2f0e7;
  border:1px solid #bbd3c5;
  border-radius:12px;
  font-size:1.4rem;
}

.target-grid button.lit {
  background:#ffd079;
  border-color:#b87323;
}

.row-actions {
  margin-top:14px;
}

.small {
  font-size:.9rem;
  padding:9px 12px;
}

@media(max-width:900px) {
  .bar {
    gap:20px;
  }
  .grade-buttons button {
    padding:8px 10px;
  }
  .station-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .hero-copy {
    padding-right:0;
  }
  .grades>div,.grades label {
    gap:8px;
  }
}

@media(max-width:680px) {
  .bar {
    height:auto;
    padding-block:9px;
    display:grid;
    grid-template-columns:1fr auto;
    gap:7px;
  }
  .brand {
    font-size:1.18rem;
  }
  .brand img {
    width:32px;
    height:32px;
  }
  .install {
    grid-column:2;
    grid-row:1;
    padding:7px 11px;
  }
  nav {
    grid-column:1/-1;
    justify-content:space-between;
    margin:0;
    border-top:1px solid var(--line);
    padding-top:3px;
    gap:8px;
  }
  nav a,nav button {
    font-size:.9rem;
    padding:4px 6px;
  }
  .hero {
    grid-template-columns:1fr;
    margin-top:12px;
    border-radius:20px;
  }
  .hero-copy {
    padding:20px 20px 0;
  }
  .hero h1 {
    font-size:clamp(1.7rem,6.9vw,2.8rem);
  }
  .hero h1 br,.intro br {
    display:none;
  }
  .year {
    margin-bottom:6px;
    font-size:.82rem;
  }
  .intro {
    margin:8px 0 12px;
    font-size:.92rem;
  }
  .hero-actions {
    gap:8px;
  }
  .hero-actions>* {
    padding:8px 14px;
  }
  .map-panel {
    height:clamp(288px,80vw,415px);
  }
  .map-foot {
    bottom:4px;
  }
  .grades {
    align-items:flex-start;
    position:relative;
    padding:20px 0 13px;
  }
  .grades>div {
    display:block;
    width:100%;
  }
  .grade-buttons {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    width:100%;
    gap:4px;
    margin-top:13px;
  }
  .grades label {
    position:absolute;
    right:0;
    top:10px;
    font-size:.88rem;
  }
  .grades h2 {
    margin-block:2px;
  }
  .grade-buttons button {
    background:#eff2e9;
  }
  .station-grid {
    gap:8px;
  }
  .stop-card {
    grid-template-columns:36px 1fr;
    gap:8px;
    padding:11px 8px;
  }
  .stop-icon {
    width:36px;
    height:40px;
    font-size:1.12rem;
    border-radius:10px;
  }
  .stop-card strong {
    font-size:.94rem;
  }
  .stop-card small {
    font-size:.79rem;
  }
  .section-title>span {
    font-size:.78rem;
  }
  .stops,.books {
    margin-block:24px;
  }
  .book-table td,.book-table th {
    padding:8px 5px;
  }
  footer .shell {
    flex-wrap:wrap;
  }
}

@media(max-width:365px) {
  .stop-card {
    grid-template-columns:1fr;
  }
  .hero-copy {
    padding-inline:14px;
  }
  .section-title>span {
    max-width:40%;
    text-align:right;
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    scroll-behavior:auto!important;
    transition:none!important;
    animation:none!important;
  }
}

.map-pin {
  position:absolute;
  left:0;
  top:0;
  display:flex;
  align-items:center;
  gap:4px;
  white-space:nowrap;
  padding:3px 8px 3px 4px;
  border:1.5px solid #315b50;
  border-radius:12px;
  background:#fffff1;
  box-shadow:0 3px 0 #426f5a55;
  font-size:.78rem;
  font-weight:850;
  line-height:1.3;
}

.map-pin::after {
  content:"";
  position:absolute;
  bottom:-5px;
  left:45%;
  width:7px;
  height:7px;
  background:#fffff1;
  transform:rotate(45deg);
  border:solid #315b50;
  border-width:0 1.5px 1.5px 0;
}

.map-pin__icon {
  position:relative;
  z-index:1;
  display:grid;
  place-items:center;
  border-radius:50%;
  min-width:22px;
  height:22px;
  background:var(--pin-color);
  color:#fff;
}

.map-pin:hover,.map-pin.active,.map-pin.active::after {
  background:#ffe298;
}

.map-foot {
  z-index:52;
}

.tour-box {
  background:#ffefce;
  border:1px solid #edce90;
  border-radius:16px;
  padding:16px 20px;
  margin-top:10px;
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.tour-box strong,.tour-box small {
  display:block;
}

.tour-box div:first-child {
  margin-right:auto;
}

.tour-box .row-actions {
  margin:0;
}

.tour-box[hidden] {
  display:none;
}

@media(max-width:1050px) and (min-width:681px),(max-width:480px) {
  .map-pin {
    padding:2px 5px;
    min-width:36px;
    min-height:36px;
    border-radius:18px;
    justify-content:center;
  }
  .map-pin__label {
    display:none;
  }
  .map-pin__icon {
    width:23px;
    height:23px;
  }
  .map-pin::after {
    left:37%;
  }
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}

.stamp-list .game-link {
  margin:0;
}

.book-table tbody th {
  font-weight:650;
}

.map-panel.night {
  background:radial-gradient(ellipse at 20% 18%,#658e9e 0%,#2d5268 60%,#24425d 100%);
  border-radius:22px;
}

.night #island {
  filter:brightness(.87) saturate(.83);
}

.night .map-pin {
  box-shadow:0 0 7px #ffe7a5;
}

.game-progress {
  margin:10px 0;
}


/* The island is the play surface. Controls use the same warm, edged forms as the buildings. */
.hero {
  display:block;
  border:2px solid #37665a;
  border-radius:22px;
  background:#bde9f0;
  box-shadow:0 5px 0 #c2d5c5;
  min-height:0;
}
.map-panel,.map-panel.night {
  position:relative;
  height:clamp(510px,48vw,660px);
  border-radius:0;
  background:radial-gradient(ellipse at 85% 12%,#fff2c5 0%,transparent 28%),
             linear-gradient(176deg,#93d9ed 2%,#ceeeee 62%,#f1e4ce 100%);
}
.map-panel.night {
  background:radial-gradient(ellipse at 85% 12%,#8d89bf 0%,transparent 24%),linear-gradient(176deg,#27365f,#505d86 68%,#a4a1ab);
}
.night #island {filter:none}
#island {touch-action:none;outline-offset:-5px}
.hero-copy {
  position:absolute;left:clamp(16px,2.6vw,38px);top:clamp(16px,2.3vw,32px);padding:0;
  pointer-events:none;
}
.hero .year {color:#24565a;font-size:.86rem;margin:0 0 6px;font-weight:850}
.hero h1 {
  font-size:clamp(2rem,3.55vw,3.35rem);color:#164941;letter-spacing:.015em;
  line-height:1.15;text-shadow:0 2px 0 #fffde1,0 4px 0 #a5cdbc;
}
.hero .intro {font-size:.95rem;color:#234e52;margin:8px 0 0}
.night .hero-copy>* {color:#fff4d9;text-shadow:0 2px 0 #273251}
.map-tools,.map-entry {
  position:absolute;z-index:6;display:flex;gap:7px;
}
.map-tools {top:18px;right:18px}
.map-entry {left:20px;bottom:19px}
.map-entry button,.map-tools button,.map-foot #reset-map,.station-preview button {
  border-radius:10px;border:1.5px solid #395e54;font-weight:800;
  box-shadow:0 3px 0 #45675a70;
}
.map-entry .primary,.station-preview .primary {background:#ffca66;color:#3f3821}
.map-entry .primary:hover,.station-preview .primary:hover {background:#ffdc88}
.map-entry .secondary,.map-foot #reset-map,.map-tools button,.station-preview .small {
  color:#264e47;background:#fffbed;
}
.map-tools button {width:40px;height:40px;font-size:1.25rem;line-height:1}
.map-foot {bottom:19px;right:19px;z-index:5}
.map-foot .map-help {background:#eef9f2db;color:#214a4c}
.map-foot #reset-map {width:auto;height:42px;padding:0 12px;font-size:.95rem}
.map-pin {transform-origin:center;pointer-events:auto;z-index:2;white-space:nowrap}
.map-pin .map-pin__label {display:inline}
.map-pin[hidden],.map-entry[hidden],.station-preview[hidden] {display:none}
.map-pin .map-pin__icon {display:none}
.map-pin {height:auto;min-height:0;padding:5px 9px;border-radius:8px;font-size:.83rem}
.map-pin:focus-visible {z-index:5}
.station-preview {
  position:absolute;z-index:6;left:20px;bottom:18px;padding:12px 14px;
  width:min(420px,60%);border:2px solid #355a51;border-radius:13px;
  background:#fffbedf5;box-shadow:0 4px 0 #3c615154;
}
.station-preview strong {display:block;font-size:1.2rem}
.station-preview small {display:block;color:#456352;font-weight:700;margin-bottom:2px}
.station-preview p {margin:4px 0 8px;color:#3f5f56;line-height:1.45;font-size:.92rem}
.station-preview .row-actions {margin:0;gap:6px}
.station-preview button {padding:7px 12px}
.map-panel[data-stage=station] .hero-copy,
.map-panel[data-stage=tour] .hero-copy {opacity:0}
.map-panel[data-stage=station] .map-help,.map-panel[data-stage=tour] .map-help {display:none}
.map-panel[data-ready=false] .map-tools,.map-panel[data-ready=false] #labels {display:none}
@media (max-width:680px) {
  .map-panel,.map-panel.night {height:clamp(365px,105vw,500px)}
  .hero-copy {left:14px;top:14px}
  .hero .year {font-size:.74rem;margin-bottom:2px}
  .hero h1 {font-size:clamp(1.65rem,6.5vw,2.55rem)}
  .hero .intro {font-size:.82rem;margin:4px 0 0}
  .map-tools {right:9px;top:9px;gap:4px;flex-direction:column}
  .map-tools button {width:34px;height:34px}
  .map-entry {bottom:11px;left:8px;gap:5px}
  .map-entry button,.map-foot #reset-map {font-size:.84rem;height:37px;padding:0 9px}
  .map-foot {bottom:11px;right:8px}
  .map-help {display:none}
  .station-preview {left:8px;right:8px;bottom:56px;width:auto;padding:8px 10px}
  .station-preview strong {font-size:1rem}
  .station-preview p {display:none}
  .station-preview small {font-size:.75rem}
  .station-preview .row-actions {margin-top:5px}
  .map-pin {font-size:.73rem;padding:4px}
}
.map-panel[data-ready=false] #island {touch-action:pan-y}

.map-entry [hidden], .walking-hud[hidden], .walking-hud button[hidden] {display:none}
.map-panel[data-stage=walking] .hero-copy,
.map-panel[data-stage=walking] .map-help {display:none}
.walking-hud {position:absolute;inset:0;pointer-events:none;z-index:4}
.walking-hud button, .walk-stick {pointer-events:auto;touch-action:none}
.walk-door {
  position:absolute;left:50%;bottom:20px;transform:translateX(-50%);
  display:grid;justify-items:center;gap:5px;text-align:center;
  padding:8px 12px;border:1.5px solid #426958;border-radius:12px;
  background:#fffbedf5;color:#234039;font-size:.92rem;font-weight:800;
}
.walk-door button, .walk-action button {
  background:#ffca66;color:#3f3821;border:1.5px solid #536953;border-radius:10px;
  padding:7px 12px;font-weight:850;box-shadow:0 3px 0 #2a533d71;
}
.walk-stick {
  display:none;position:absolute;bottom:15px;left:12px;width:94px;height:94px;
  box-sizing:border-box;border:2px solid #fffae8;border-radius:50%;
  background:#1a423b8c;box-shadow:0 2px 0 #193f3790;user-select:none;
}
.walk-stick span {
  position:absolute;width:38px;height:38px;top:50%;left:50%;background:#fff1b7;
  border:2px solid #355c4f;border-radius:50%;
  transform:translate(calc(-50% + var(--stick-x, 0px)),calc(-50% + var(--stick-y, 0px)));
}
.walk-action {position:absolute;left:16px;bottom:19px}
.walk-hint {margin:0;padding:6px 10px;background:#eef4e9eb;border-radius:8px;color:#254440;font-size:.82rem}
.walk-action button {display:none}
@media (any-pointer:coarse), (max-width:680px) {
  .walk-stick {display:block;width:86px;height:86px;left:8px}
  .walk-action {left:auto;right:13px;bottom:62px}
  .walk-hint {display:none}
  .walk-action button {display:block;min-width:60px;min-height:55px}
  .walk-door {bottom:15px;width:138px;padding:6px 5px;font-size:.81rem}
  .map-entry {bottom:57px}
  .map-entry button {font-size:.83rem;padding:0 7px}
}
