:root {
  color-scheme: light;
  font-family: "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: #253c2f;
  background: #192c24;
  --pine: #233f30;
  --muted: #576758;
  --paper: #fffdf4;
  --gold: #f1cf80;
  --hud-top: max(10px, env(safe-area-inset-top));
  --hud-left: max(10px, env(safe-area-inset-left));
  --hud-right: max(10px, env(safe-area-inset-right));
  --hud-bottom: max(12px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
[hidden], .symbols { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #ad4e24; outline-offset: 2px; }
svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
p, h2 { margin: 0; }
.eyebrow { font-size: 11px; letter-spacing: .16em; font-weight: 850; color: #626b51; }

#game { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
.map, .world { position: absolute; inset: 0; }
.map { overflow: hidden; background: #233b2a; }
.world { background: #516c36 url("assets/camp.webp") center / 100% 100% no-repeat; will-change: transform; }
canvas { display: block; width: 100%; height: 100%; }
.marker {
  position: absolute; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 4px 10px 4px 6px; border-radius: 10px; border: 1px solid #fffee3;
  background: #fff7d8; box-shadow: 0 3px 8px #20311e70; white-space: nowrap;
  font-size: 14px; font-weight: 850;
}
.marker::after { content: ""; position: absolute; left: 50%; top: 100%; translate: -50% 0; border: 6px solid transparent; border-top-color: #fff7d8; }
.marker b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--pine); color: #ffefb0; font-size: 12px; }
.marker:hover, .marker.near { background: #ffdf91; }
.marker.done b { background: #427047; color: white; }
.marker[aria-current="true"] { box-shadow: 0 0 0 3px #fff5c2, 0 5px 12px #20311e80; }

.hud {
  position: absolute; z-index: 1; inset: var(--hud-top) var(--hud-right) auto var(--hud-left);
  display: grid; grid-template-columns: auto minmax(0, 410px) auto; justify-content: space-between;
  align-items: start; gap: 8px; pointer-events: none;
}
.hud > * { pointer-events: auto; }
.progress-chip, .tool, .station {
  border: 1px solid #fffae19c; border-radius: 11px; background: #fff9e8f5;
  box-shadow: 0 3px 9px #14261955;
}
.progress-chip { display: flex; align-items: center; padding: 0 3px 0 10px; min-height: 46px; }
.progress-copy { display: grid; gap: 1px; font-size: 11px; font-weight: 750; }
.progress-copy strong { font-size: 17px; line-height: 1; font-variant-numeric: tabular-nums; }
.badge-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 9px; background: transparent; }
.badge-button:disabled img { filter: grayscale(.9); opacity: .62; }
.badge-button:not(:disabled) { background: #f8e2a4; }
.tools { display: flex; gap: 8px; justify-self: end; }
.tool { min-width: 46px; min-height: 46px; padding: 6px 10px; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; font-weight: 800; }
.tool svg { width: 18px; height: 18px; flex: none; }
.tool:hover, .station:hover { background: #f4ebc9; }
.station-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.station { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 5px; font-size: 14px; font-weight: 850; white-space: nowrap; }
.station-index { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 5px; background: var(--pine); color: #fff0b4; font-size: 11px; }
.station.done { background: #e6f1d7; }
.station.done .station-index { background: #427047; color: #fff; }

.touch-controls {
  position: absolute; z-index: 1; inset: auto var(--hud-right) var(--hud-bottom) var(--hud-left);
  display: flex; justify-content: space-between; align-items: end; pointer-events: none;
}
.dpad { --size: clamp(45px, 7.4vmin, 60px); display: grid; grid-template-columns: repeat(3, var(--size)); gap: 8px; }
.dpad button, .interact {
  pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none;
  color: #fff6d7; background: #203a2aeb; border: 1px solid #fff3caa8; border-radius: 13px;
  font-weight: 850; box-shadow: 0 3px 8px #13211766;
}
.dpad button { width: var(--size); height: var(--size); padding: 0; font-size: 24px; line-height: 1; }
.dpad button:active { background: #496f45; }
.dpad button:first-child { grid-column: 2; }
.dpad button:nth-child(2) { grid-column: 1; }
.interact { min-height: 54px; min-width: 74px; padding: 0 14px; }
.interact.ready, .interact:active { background: var(--gold); color: #2b311e; }
.map-toast {
  position: absolute; z-index: 1; left: 50%; bottom: calc(var(--hud-bottom) + 75px); translate: -50% 0;
  width: max-content; max-width: calc(100% - 24px); padding: 7px 13px; border-radius: 10px;
  background: #22392fee; color: #fff7da; font-size: 14px; font-weight: 750; text-align: center;
  pointer-events: none;
}
@media (max-width: 720px) {
  .hud { grid-template-columns: 1fr auto; }
  .progress-chip { justify-self: start; }
  .tools { grid-area: 1 / 2; }
  .tool { padding: 6px 8px; }
  .tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .station-list { grid-column: 1 / -1; width: min(410px, 100%); }
  .map-toast { bottom: calc(var(--hud-bottom) + 108px); }
}
.mission-art {
  background-image: url("assets/field-stations.webp"); background-repeat: no-repeat; background-size: 300% auto;
}
.art-packing { background-color: #bf9252; background-position: left center; }
.art-direction { background-color: #82906a; background-position: center; }
.art-cleanup { background-color: #4f7967; background-position: right center; }

dialog { border: 1px solid #e0dac2; border-radius: 20px; padding: 0; width: min(520px, 100% - 24px); max-height: 93dvh; color: #253c2f; background: var(--paper); box-shadow: 0 22px 90px #10291870; }
dialog::backdrop { background: #132c23b8; }
.dialog-paper { position: relative; padding: clamp(17px, 4vw, 29px); }
.close { position: absolute; z-index: 2; right: 12px; top: 12px; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid #dadccb; background: #f3f3e6; font-size: 24px; line-height: 1; }
.mission-heading { display: flex; gap: 15px; align-items: center; margin-bottom: 13px; }
.mission-art { flex: 0 0 clamp(84px, 23vw, 104px); height: clamp(98px, 18dvh, 126px); border-radius: 10px; }
.dialog-paper h2 { font-size: 27px; margin: 5px 36px 8px 0; }
.dialog-copy { color: var(--muted); line-height: 1.65; }
.picks, .cleanup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.choice { min-height: 44px; padding: 8px; background: #f4f4e7; border: 1px solid #d7dbc4; border-radius: 9px; font-weight: 700; }
.choice:hover { background: #e9edd7; }
.choice[aria-pressed="true"], .choice.collected { background: #e2eccf; border-color: #7f9b67; }
.choice.collected { color: #315c39; }
.feedback { min-height: 23px; margin: 10px 0; color: #83441e; font-size: 14px; font-weight: 700; }
.primary, .secondary { min-height: 44px; border-radius: 9px; padding: 8px 15px; font-weight: 800; }
.primary { background: var(--pine); color: #fff7d7; border: 1px solid var(--pine); }
.primary:hover { background: #3b6046; }
.secondary { background: #f4f1e1; border: 1px solid #d9d8c1; margin-left: 6px; }
.rose {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 5px; align-items: stretch; width: min(250px, 100%); margin: 12px auto;
  padding: 12px; border-radius: 50%; border: 1px solid #e3dcc1; background: #f8f3de;
}
.rose .choice { min-height: 44px; }
.rose .north { grid-area: 1 / 2; } .rose .west { grid-area: 2 / 1; }
.rose .east { grid-area: 2 / 3; } .rose .south { grid-area: 3 / 2; }
.rose .needle { grid-area: 2 / 2; align-self: center; justify-self: center; color: #9a462b; width: 28px; height: 28px; }
.cleanup { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cleanup .choice { min-height: 76px; }
.cleanup .choice span { display: block; font-size: 24px; margin-bottom: 3px; }
.result-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 10px; border-radius: 15px; color: #6a4d21; background: #f6e4a5; }
.result-icon svg { width: 33px; height: 33px; }
.result-actions { margin-top: 17px; }
.merit-patch {
  display: block; width: 112px; height: 112px; object-fit: contain; margin: 0 auto 10px;
  filter: drop-shadow(0 6px 7px #3a332b35);
}
.tutorial-cover {
  display: grid; align-content: end; min-height: clamp(76px, 18dvh, 148px); padding: 14px;
  margin-bottom: 14px; border-radius: 12px; color: #fff7dc;
  background: linear-gradient(90deg, #17291be8, #17291b15),
    #34462a url("assets/forest-cover.webp") center 42% / cover no-repeat;
}
.tutorial-cover .eyebrow { color: #f3d584; }
.tutorial-cover h2 { margin-bottom: 0; }
.tutorial-steps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.tutorial-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; }
.tutorial-steps b {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  color: #fff7d7; background: var(--pine); font-size: 13px;
}
.tutorial-steps p { font-size: 14px; color: var(--muted); line-height: 1.5; }
.keyboard-tip { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
#start-play { width: 100%; }
