﻿:root {
  color-scheme: light;
  --paper: #f5efe3;
  --card: #fffcf5;
  --ink: #263d31;
  --muted: #536155;
  --line: #d9cdb8;
  --red: #a1362a;
  --moss: #dce8d5;
  --shadow: 0 4px 0 #e8ddca;
  --serif: "Noto Serif TC", "PMingLiU", "Songti TC", serif;
  font: 16px/1.65 system-ui, "Microsoft JhengHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(#9a805524 0.7px, transparent 0.7px) 0 0 / 7px 7px, var(--paper);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a, input { touch-action: manipulation; }
:focus-visible { outline: 3px solid #9e3228; outline-offset: 4px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 800; }
.wrap { width: min(1200px, calc(100% - 72px)); margin-inline: auto; }

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-weight: 800; letter-spacing: .08em; }
.brand > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px double var(--card);
  border-radius: 9px;
  background: var(--red);
  color: var(--card);
  font-size: 1.45rem;
}
.brand small { display: block; color: var(--muted); font: 700 .65rem/1.3 system-ui; letter-spacing: .08em; }
.nav nav { display: flex; align-items: center; gap: 20px; font-size: .9rem; font-weight: 700; }
.nav nav a:hover, .back:hover { text-decoration: underline; text-underline-offset: .25em; }
.nav b { margin-left: 5px; color: var(--red); white-space: nowrap; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 14px;
  margin-top: 28px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.hero-copy { align-self: center; padding: clamp(12px, 3vw, 38px); }
.eyebrow { color: var(--red); font-size: .875rem; font-weight: 750; letter-spacing: .12em; }
.hero-copy .eyebrow { display: inline-block; padding: 3px 9px; border: 1px solid #cc8e7e; border-radius: 4px; }
.hero h1 { margin: 16px 0; font-size: clamp(2.3rem, 5.1vw, 4.9rem); line-height: 1.12; letter-spacing: .055em; }
.hero h1 span { display: block; color: var(--red); }
.hero-copy > p:not(.eyebrow) { color: var(--muted); font-size: 1.05rem; }
.hero-map {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(360px, 36vw, 495px);
  border: 1px solid #587051;
  border-radius: 12px;
  background: url("farm.jpg") center / cover, #67825d;
}
.hero-wizard {
  position: absolute;
  inset: 48% auto auto 50%;
  width: 79%;
  height: auto;
  max-height: 95%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 12px #302b2b55);
  pointer-events: none;
}
.map-caption {
  position: absolute;
  right: 12px;
  bottom: 11px;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--card);
  font-size: .875rem;
  font-weight: 700;
}
.map-caption span { color: var(--red); }
.map-point {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
}
.map-point.open { z-index: 2; }
.marker {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--red);
  color: white;
  box-shadow: 0 2px 5px #28261d75;
  font-weight: 800;
  padding: 0;
}
.marker:hover, .marker:focus-visible, .marker[aria-expanded="true"] { background: #76281f; }
.marker.done { background: #31543d; }
.map-card {
  position: absolute;
  top: 100%;
  left: 0;
  display: grid;
  gap: 4px;
  width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 6px 18px #28261d55;
  line-height: 1.4;
}
.map-card[hidden] { display: none; }
.map-point[data-align="right"] .map-card { left: auto; right: 0; }
.map-point[data-align="center"] .map-card { left: 50%; transform: translateX(-50%); }
.map-point[data-side="above"] .map-card { top: auto; bottom: 100%; }
.map-card:hover { border-color: var(--red); }
.map-card-cover {
  position: relative;
  overflow: hidden;
  height: 66px;
  border-radius: 5px;
  background-color: var(--moss);
}
.map-card-cover::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  aspect-ratio: 3 / 4;
  transform: translateY(-50%);
  background: url("map-covers.jpg") var(--cover-x) var(--cover-y) / 400% 200% no-repeat;
}
.map-card strong { font-family: var(--serif); }
.map-card-magic, .map-card-action { font-size: .875rem; }
.map-card-magic { color: var(--muted); }
.map-card-action { color: var(--red); font-weight: 750; }

.journal { padding-block: 32px; }
#map { scroll-margin-top: 74px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
h2 { font-size: 1.8rem; letter-spacing: .06em; }
.progress { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .875rem; }
.progress strong { color: var(--red); white-space: nowrap; }
progress { width: 90px; accent-color: var(--red); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card, .panel, .scene {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.card { display: flex; flex-direction: column; gap: 7px; padding: 14px; }
.card:hover { border-color: var(--red); }
.icon {
  display: grid;
  place-items: center;
  min-height: 76px;
  width: 100%;
  border-radius: 8px;
  background: radial-gradient(#52664824 1px, transparent 1px) 0 0 / 9px 9px, var(--moss);
  font-size: 2rem;
}
.card:nth-child(4n + 2) .icon { background-color: #f2dfcc; }
.card:nth-child(4n + 3) .icon { background-color: #ede0ed; }
.card:nth-child(4n + 4) .icon { background-color: #e4e8d1; }
.card h3 { font-size: 1.14rem; line-height: 1.35; }
.card p { color: var(--muted); font-size: .875rem; }
footer { border-top: 1px solid var(--line); padding-block: 16px; color: var(--muted); font-size: .875rem; }

.level { padding-block: 24px 44px; }
.back { display: inline-block; margin-bottom: 10px; color: var(--red); font-weight: 750; }
.level h1 { margin: 4px 0 16px; font-size: clamp(1.8rem, 4vw, 3.25rem); }
.play { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.scene {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 360px;
  background: radial-gradient(ellipse at 50% 45%, #eaf0df, #bacda8);
}
.scene-art { font-size: clamp(3.1rem, 10vw, 8rem); text-align: center; line-height: 1; transition: transform .25s; user-select: none; }
.scene-cap { position: absolute; bottom: 12px; left: 12px; padding: 4px 9px; border-radius: 5px; background: var(--card); color: var(--muted); font-size: .875rem; }
.compare { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse, #f4e3a6, #d7bc7f); }
.hotspots { position: absolute; inset: auto 12px 56px; justify-content: center; }
.panel { padding: 18px; }
.panel > * + * { margin-top: 12px; }
.panel p { color: var(--muted); }
.controls { display: grid; gap: 9px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.gold, .choice { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 7px; font-weight: 750; }
.gold { margin-top: 20px; border: 1px solid var(--red); background: var(--red); color: white; }
.gold:hover { background: #76281f; }
.choice { border: 1px solid #a5b6a1; background: var(--card); color: var(--ink); }
.choice:hover, .choice[aria-pressed="true"] { border-color: #52795e; background: var(--moss); }
input[type="range"] { width: 100%; accent-color: var(--red); }
.panel .feedback { min-height: 1.6em; color: var(--red); }
.reveal { padding-top: 12px; border-top: 1px solid var(--line); }
.reveal h3 { color: var(--red); }
.reveal p { margin-top: 5px; }

@media (max-width: 940px) {
  .wrap { width: calc(100% - 40px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 26px); }
  .nav { min-height: 65px; }
  .nav nav { gap: 10px; }
  .nav nav > a:first-child { display: none; }
  .brand { gap: 6px; }
  .brand > span { width: 34px; height: 34px; }
  .brand small { font-size: .52rem; }
  .hero { grid-template-columns: 1fr; margin-top: 14px; padding: 8px; }
  .hero-copy { padding: 13px 12px 5px; }
  .hero h1 { margin: 12px 0; }
  .hero h1 span { display: inline; }
  .hero-map { min-height: 340px; }
  .grid { gap: 10px; }
  .card { padding: 10px; }
  .card h3 { font-size: 1.04rem; }
  .play { grid-template-columns: 1fr; }
  .scene { min-height: 230px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-art { transition: none; }
}

/* Glossy toy illustration with oversized editorial type */
:root {
  --paper: #f3faec;
  --card: #fff;
  --ink: #101010;
  --muted: #393a46;
  --line: #a4a7a1;
  --red: #242374;
  --moss: #caff92;
  --shadow: none;
  --serif: system-ui, "Microsoft JhengHei", sans-serif;
}
:focus-visible { outline: 3px solid #242374; outline-offset: 4px; }
.bar { background: var(--paper); border: 0; }
.brand { font-weight: 900; letter-spacing: -.02em; }
.brand > span { border: 0; border-radius: 50%; background: var(--ink); color: white; }
.nav nav { gap: 5px; }
.nav nav a { display: inline-block; padding: 7px 14px; border-radius: 100vw; background: #b3c9ff; }
.nav nav a:last-child { background: #ffa0ed; }
.nav b { color: var(--ink); }

.hero {
  position: relative;
  display: block;
  min-height: clamp(550px, 55vw, 740px);
  margin: 0 0 26px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.hero-map {
  position: absolute;
  inset: 0 0 0 3%;
  isolation: auto;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}
.hero-art {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
  object-position: 56% 50%;
  mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 96%, transparent);
  mask-composite: intersect;
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: max-content;
  max-width: 100%;
  padding: 18px 0 0;
  pointer-events: none;
}
.hero-copy .eyebrow {
  padding: 3px 11px;
  border: 0;
  border-radius: 100vw;
  background: var(--moss);
  color: var(--ink);
  font-weight: 850;
  letter-spacing: .04em;
}
.hero h1 {
  margin: 9px 0 14px;
  font-size: clamp(3.2rem, 8.3vw, 7.3rem);
  font-weight: 950;
  line-height: .98;
  letter-spacing: -.09em;
  color: var(--ink);
  text-shadow: 0 0 .16em #f3faec, 0 0 .25em #f3faec;
}
.hero h1 span { color: inherit; }
.hero-copy > p:not(.eyebrow) {
  display: table;
  padding: 7px 13px;
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font-size: .94rem;
  font-weight: 700;
}
.hero .progress {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 11px;
  border-radius: 100vw;
  background: var(--ink);
  color: white;
  font-size: .875rem;
}
.hero .progress strong { color: var(--moss); }
.hero progress { accent-color: var(--moss); }
.map-caption { border-color: transparent; border-radius: 100vw; font-weight: 800; }
.marker {
  border: 2px solid var(--ink);
  background: #ffa0ed;
  color: var(--ink);
  box-shadow: 0 3px 0 #10101055;
  font-size: 1.1rem;
}
.map-point:nth-child(3n + 2) .marker { background: #a9c1ff; }
.map-point:nth-child(3n + 3) .marker { background: var(--moss); }
.map-point .marker.done, .map-point.open .marker, .map-point .marker:focus-visible { background: var(--ink); color: white; border-color: white; }
.map-card { border: 1px solid var(--ink); border-radius: 15px; box-shadow: 0 5px 20px #17132e5c; }
.map-card-action { text-decoration: underline; text-underline-offset: .14em; }

.level h1, .journal h2 { font-weight: 950; letter-spacing: -.035em; }
.gold { border-color: var(--ink); border-radius: 100vw; background: var(--ink); color: white; }
.gold:hover { background: #31313c; }
.choice { border-color: #8985a0; border-radius: 100vw; background: white; }
.choice:hover, .choice[aria-pressed="true"] { border-color: var(--ink); background: var(--moss); }
.scene { background: radial-gradient(ellipse at center, #ffc0ed, #a6baff); }
.scene-cap { border-radius: 100vw; background: white; }
.compare { background: radial-gradient(ellipse, #f4ffaf, #acdc79); }

@media (max-width: 680px) {
  .hero-copy { padding: 9px 0 12px; width: auto; }
  .hero h1 { font-size: clamp(2.05rem, 8.8vw, 3.75rem); }
  .hero h1 span { display: inline; }
  .hero-map { position: relative; inset: auto; min-height: 380px; }
  .hero { min-height: 0; }
  .hero-art { mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent); mask-composite: add; }
}

.hero-art-moving {
  transform: translate(var(--drift-x, 0px), var(--drift-y, 0px)) scale(1.025);
}
.hero-effects {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero-character {
  position: absolute;
  left: 61%;
  top: 50%;
  width: min(46%, 465px);
  height: 76%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.hero-art-moving ~ .hero-character {
  animation: character-float 4.4s ease-in-out infinite;
}
@keyframes character-float {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 9px)); }
}
@media (max-width: 680px) {
  .hero-character { left: 51%; width: 68%; height: 81%; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art-moving ~ .hero-character { animation: none; }
}
.motion-toggle {
  position: absolute;
  z-index: 1;
  bottom: 11px;
  left: 12px;
  padding: 5px 11px;
  border: 1px solid var(--ink);
  border-radius: 100vw;
  background: var(--card);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 750;
}
