@font-face { font-family: Manrope; src: url('./assets/manrope.ttf') format('truetype'); font-weight: 400 600; font-display: swap; }
:root { --sky: #e4ede8; --ink: #354329; --muted: #56644a; --moss: #84905b; --paper: #faf7e9; --rose: #e5a28d; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--sky); font-family: Manrope, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
button:disabled { opacity: .5; cursor: default; }
h1, h2, p { margin: 0; }
button { touch-action: manipulation; }
.game-page { position: relative; height: 100svh; height: 100dvh; min-height: 520px; overflow: hidden; isolation: isolate; }
.playground, #field { position: absolute; inset: 0; width: 100%; height: 100%; }
#field { display: block; image-rendering: pixelated; touch-action: none; outline-offset: -5px; }
.site-header { position: absolute; top: max(22px, env(safe-area-inset-top)); left: max(32px, env(safe-area-inset-left)); right: max(32px, env(safe-area-inset-right)); display: flex; justify-content: flex-end; align-items: center; gap: 20px; }
.site-header nav { display: flex; align-items: center; gap: 28px; }
.site-header nav button { border: 0; background: none; padding: 12px 0; }
.site-header nav a { padding: 11px 18px; border: 1px solid #a4b39a; box-shadow: 3px 3px 0 #bac8b0; background: #edf2e9; }
.site-header nav a span { margin-left: 12px; }
.hero { position: absolute; top: 16%; left: 50%; transform: translateX(-50%); width: min(640px, 90%); text-align: center; pointer-events: none; }
.pixel-wordmark { display: block; width: min(100%, 510px); height: auto; margin: 0 auto 9px; }
h1 { font-weight: 500; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.045em; line-height: 1.25; }
h1 > span { display: block; }
.hero > p { margin-top: 19px; font-size: 15px; }
.hero .hero-invitation { margin-top: 5px; font-size: 12px; color: var(--muted); }
.journey-bar { position: absolute; top: 28px; left: max(32px, env(safe-area-inset-left)); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.quest-progress { display: flex; list-style: none; margin: 0; padding: 0; gap: 27px; white-space: nowrap; font-size: 11px; }
.quest-progress li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.quest-number { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #a7b39a; font-size: 10px; background: #e4ede8; }
.quest-progress li[aria-current='step'] { font-weight: 600; color: var(--ink); }
.quest-progress li[aria-current='step'] .quest-number { color: var(--paper); background: var(--ink); border-color: var(--ink); box-shadow: 2px 2px 0 #a7b39a; }
.quest-progress li.done .quest-number { background: #b6c392; }
.world-label { position: absolute; transform: translateX(-50%); text-align: center; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--paper); padding: 6px 9px; border: 2px solid var(--ink); box-shadow: inset 0 1px 0 #fffdf2, 3px 3px 0 #aab98f; pointer-events: none; }
.world-label.done::before { content: '✓ '; }
.game-hud { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: max(32px, env(safe-area-inset-left)); right: max(32px, env(safe-area-inset-right)); }
.game-message { position: absolute; bottom: 44px; left: 0; max-width: 330px; }
#game-status { font-size: 12px; line-height: 1.6; }
#play-help { margin-top: 5px; font-size: 10px; color: #40502d; }
#play-help span { margin: 0 5px; }
.game-controls { display: flex; gap: 20px; justify-content: flex-end; margin-bottom: 19px; }
.direction-controls, .action-controls { display: flex; gap: 9px; }
.game-controls button { display: flex; align-items: center; justify-content: center; gap: 16px; min-width: 54px; height: 49px; padding: 0 16px; border: 2px solid var(--ink); background: #f6f4dc; box-shadow: inset 0 2px 0 #fffdf1, inset -2px -2px 0 #dcdcb9, 3px 3px 0 #59694b; font-weight: 600; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.direction-controls button { font-size: 24px; }
.action-controls button:last-child { background: #e9b49c; }
.game-controls button:active, .game-controls button.pressed { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); background: #cedba9; }
.game-utilities { display: flex; align-items: center; gap: 24px; }
.game-utilities button { border: 0; background: none; padding: 6px 0; min-height: 30px; font-size: 10px; color: #40502d; text-decoration: underline; text-underline-offset: 3px; }
.game-utilities button:first-child { margin-right: auto; }
#game-win { position: absolute; inset: 0; display: grid; place-items: center; background: #e4ede8d9; padding: 20px; z-index: 2; }
#game-win[hidden] { display: none; }
.win-panel { width: min(520px, 100%); text-align: center; background: var(--paper); border: 3px solid var(--ink); box-shadow: 8px 8px 0 #84905b; padding: 36px; }
.win-icon { font-size: 35px; color: var(--moss); margin-bottom: 12px; }
h2 { font-size: 32px; font-weight: 500; letter-spacing: -.045em; line-height: 1.15; }
.win-panel p:not(.win-icon) { margin: 20px 0; line-height: 1.8; color: var(--muted); }
.primary-button { display: inline-block; background: var(--ink); color: var(--paper); padding: 14px 20px; box-shadow: 3px 3px 0 var(--moss); }
#play-again { display: block; margin: 18px auto 0; padding: 8px; border: 0; background: none; text-decoration: underline; }
dialog { width: min(530px, calc(100% - 32px)); max-height: calc(100dvh - 40px); border: 3px solid var(--ink); border-radius: 0; padding: 33px; color: var(--ink); background: var(--paper); box-shadow: 8px 8px 0 #84905b; overscroll-behavior: contain; }
dialog::backdrop { background: #35432980; }
.dialog-close { position: absolute; top: 3px; right: 3px; width: 44px; height: 44px; border: 0; background: none; font-size: 26px; }
.section-label { margin-bottom: 20px; padding-right: 24px; font-size: 11px; color: var(--muted); }
dialog h2 { margin-bottom: 20px; }
#task-prompt, #about-dialog > p:not(.section-label) { color: var(--muted); font-size: 14px; line-height: 1.8; }
#about-dialog > p + p { margin-top: 15px; }
#about-dialog .primary-button { margin-top: 25px; }
#task-options { display: grid; gap: 12px; margin-top: 25px; }
#task-options button { border: 2px solid #a8b293; border-radius: 0; background: #fffdf3; padding: 12px 15px; text-align: left; min-height: 48px; font-size: 13px; line-height: 1.6; }
#task-options button:hover { background: #e5ebce; border-color: var(--ink); }
#task-feedback { margin-top: 20px; min-height: 20px; font-size: 12px; line-height: 1.6; }
.skip-link { position: fixed; top: -100px; left: 20px; padding: 12px 20px; background: var(--paper); z-index: 4; }
.skip-link:focus { top: 20px; }
.no-script { position: absolute; bottom: 140px; left: 20px; background: var(--paper); padding: 20px; }
@media (max-width: 700px) {
  .site-header { top: max(12px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); right: max(20px, env(safe-area-inset-right)); }
  .site-header nav { gap: 14px; font-size: 12px; }
  .site-header nav a { padding: 11px 12px; }
  .site-header nav a span { margin-left: 4px; }
  .hero { top: 17%; width: 88%; }
  .pixel-wordmark { margin-bottom: 12px; }
  h1 { font-size: clamp(25px, 6.3vw, 35px); }
  .hero > p { font-size: 12px; margin-top: 16px; }
  .hero .hero-invitation { font-size: 10px; }
  .quest-progress { gap: 8px; font-size: 9px; }
  .quest-progress li { gap: 5px; }
  .quest-number { width: 19px; height: 19px; }
  .world-label { font-size: 9px; padding: 5px 7px; }
  .game-hud { left: max(20px, env(safe-area-inset-left)); right: max(20px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  .game-message { position: static; max-width: none; margin-bottom: 12px; }
  #game-status { font-size: 10px; line-height: 1.5; min-height: 30px; max-width: 95%; }
  #play-help { display: none; }
  .game-controls { justify-content: space-between; gap: 10px; margin-bottom: 7px; }
  .game-controls button { min-width: 56px; height: 56px; padding-inline: 12px; gap: 10px; font-size: 13px; }
  .direction-controls button { font-size: 25px; }
  .game-utilities { gap: 14px; }
  .game-utilities button { font-size: 9px; min-height: 36px; }
  #open-task { max-width: 46%; text-align: left; }
  dialog { padding: 28px 22px 20px; }
  dialog h2 { font-size: 28px; }
  .win-panel { padding: 25px; }
}
@media (max-height: 600px) and (min-width: 600px) {
  .game-page { min-height: 320px; }
  .site-header { top: max(8px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); right: max(24px, env(safe-area-inset-right)); }
  .hero { top: 12%; width: 280px; }
  .pixel-wordmark { width: 220px; margin-bottom: 0; }
  h1 { font-size: 21px; }
  .hero > p { margin-top: 6px; font-size: 10px; }
  .hero .hero-invitation { display: none; }

  .quest-number { width: 17px; height: 17px; }
  .game-hud { bottom: max(7px, env(safe-area-inset-bottom)); }
  .game-message { bottom: 36px; max-width: 240px; }
  #game-status { font-size: 9px; }
  #play-help { display: none; }
  .game-controls { margin-bottom: 5px; }
  .game-controls button { height: 44px; min-width: 48px; }
  .game-utilities button { min-height: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 700px) and (max-height: 700px) and (orientation: portrait) {
  .hero { top: 14%; width: 82%; }
  .hero .hero-invitation { display: none; }
  .hero > p { margin-top: 10px; font-size: 11px; }

}

@media (max-height: 600px) and (min-width: 600px) { .world-label { display: none; } }
@media (max-width: 360px) {
  .site-header { gap: 10px; left: 16px; right: 16px; }
  .site-header nav { gap: 10px; font-size: 11px; white-space: nowrap; }
  .site-header nav a { padding-inline: 9px; }
  .site-header nav a span { display: none; }
  .game-controls button { min-width: 48px; padding-inline: 8px; gap: 6px; font-size: 12px; }
  .direction-controls button { font-size: 24px; }
}

#industry-labels { position: absolute; inset: 0; pointer-events: none; }
.industry-label { pointer-events: auto; border-color: #84905b; background: #eff0db; min-height: 36px; }
.industry-label:hover { background: #d5dfbb; }
#explore-industries { border: 0; background: none; padding: 8px 0; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
#industry-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 24px; }
#industry-picker button { text-align: left; padding: 10px 12px; min-height: 44px; border: 1px solid #a8b293; background: #fffdf3; font-size: 11px; }
#industry-picker button[aria-pressed='true'] { border-color: var(--ink); background: #d5dfbb; }
#industry-picker button.visited::after { content: ' ✓'; }
#industry-description { color: var(--muted); line-height: 1.7; }
.industry-steps { list-style: none; counter-reset: industry-step; margin: 25px 0; padding: 0; }
.industry-steps li { position: relative; padding: 0 0 18px 32px; counter-increment: industry-step; }
.industry-steps li::before { content: counter(industry-step); position: absolute; top: 0; left: 0; color: var(--moss); font-size: 12px; }
.industry-steps h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.industry-steps p { font-size: 13px; line-height: 1.7; color: var(--muted); }

@media (max-width: 700px) and (max-height: 700px) and (orientation: portrait) {  .industry-label { display: none; } }


.quest-key { display: none; width: 17px; height: 17px; shape-rendering: crispEdges; }
.quest-progress li.done .quest-number { background: #ecd690; color: var(--ink); border-color: #a68b45; }
.quest-progress li.done .quest-index { display: none; }
.quest-progress li.done .quest-key { display: block; }
@media (max-width: 700px) { .quest-key { width: 14px; height: 14px; } }

@media (max-width: 700px) {
  .journey-bar { top: max(70px, calc(env(safe-area-inset-top) + 56px)); left: max(20px, env(safe-area-inset-left)); right: max(20px, env(safe-area-inset-right)); flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 10px; border: 2px solid #a8b293; background: var(--paper); box-shadow: 3px 3px 0 #becaa8; }
  .quest-progress li { gap: 4px; }
  .phase-label { font-size: 0; }
  .phase-label::after { content: attr(data-short); font-size: 9px; }
  #explore-industries { flex-shrink: 0; min-height: 44px; padding: 4px 0 4px 8px; border-left: 1px solid #c8ceb8; font-size: 0; text-decoration: none; }
  #explore-industries::after { content: attr(data-compact); font-size: 10px; }
  .hero { top: max(136px, 17%, calc(env(safe-area-inset-top) + 122px)); }
}
@media (max-width: 700px) and (max-height: 700px) and (orientation: portrait) {
  .hero { top: max(126px, calc(env(safe-area-inset-top) + 112px)); width: 88%; }
  .pixel-wordmark { width: 82%; }
}
@media (max-width: 360px) {
  .journey-bar { left: 16px; right: 16px; padding-inline: 8px; gap: 6px; }
  .quest-progress { gap: 6px; }
}
@media (max-height: 600px) and (min-width: 600px) {
  .journey-bar { top: max(8px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); right: auto; width: 244px; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 10px; border: 2px solid #a8b293; background: var(--paper); box-shadow: 3px 3px 0 #becaa8; }
  .quest-progress { gap: 6px; font-size: 9px; }
  .quest-progress li { gap: 4px; }
  .phase-label { display: none; font-size: 0; }
  .quest-progress li[aria-current='step'] .phase-label { display: block; }
  .phase-label::after { content: attr(data-short); font-size: 9px; }
  #explore-industries { flex-shrink: 0; padding: 4px 0 4px 8px; border-left: 1px solid #c8ceb8; min-height: 44px; font-size: 0; text-decoration: none; }
  #explore-industries::after { content: attr(data-compact); font-size: 10px; }
}

#player-marker { position: absolute; transform: translate(-50%, -100%); font-size: 10px; font-weight: 600; padding: 3px 5px; background: var(--paper); border: 1px solid #84905b; pointer-events: none; }
#help-dialog p, .play-steps { font-size: 13px; line-height: 1.7; color: var(--muted); }
.play-steps { padding-left: 20px; margin: 0 0 20px; }
.play-steps li + li { margin-top: 13px; }
.play-steps strong { display: block; color: var(--ink); }
#help-dialog p + p { margin-top: 12px; }
#help-close { margin-top: 22px; border: 0; font: inherit; min-height: 44px; }

.pixel-wordmark .letter { animation: hop 4s steps(1, end) infinite; transform-box: fill-box; transform-origin: bottom center; }
.pixel-wordmark .letter-1 { animation-delay: .15s; }
.pixel-wordmark .letter-2 { animation-delay: .3s; }
.pixel-wordmark .letter-3 { animation-delay: .45s; }
.pixel-wordmark .letter-4 { animation-delay: .6s; }
@keyframes hop { 0%, 8%, 100% { transform: translateY(0); } 3%, 6% { transform: translateY(-2px); } }
.motion-paused .pixel-wordmark .letter { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .pixel-wordmark .letter { animation: none; } }
.about-emblem { display: block; object-fit: contain; margin-bottom: 16px; mix-blend-mode: multiply; }
#motion-toggle { display: block; margin-top: 18px; border: 0; padding: 8px 0; background: none; text-decoration: underline; }

.quest-brief { margin: 20px 0 26px; padding: 16px; border: 2px solid #a8b293; background: #edf0d9; }
.quest-brief h3 { margin: 0 0 10px; font-size: 16px; }
.quest-brief p { font-size: 13px; line-height: 1.7; margin-bottom: 15px; }
#quest-accept { border: 0; font: inherit; min-height: 44px; }

/* Map signboards share the scenery's hard pixel edges and point at their destination. */
.world-label { display: block; width: min(196px, 55vw); padding: 0; border: 0; background: transparent; box-shadow: none; transform: translate(-50%, -100%); white-space: normal; }
.world-label[hidden] { display: none; }
.world-label.done::before { content: none; }
.sign-face { position: relative; display: block; min-height: 60px; padding: 9px 8px 10px; border: 4px solid #5a6545; background: #eee4bc; box-shadow: inset 0 3px 0 #fff4d4, inset -3px -3px 0 #b7ad80, 4px 4px 0 #acb88f; }
.sign-face::before { content: ''; position: absolute; left: 3px; top: 3px; width: 3px; height: 3px; background: #929065; box-shadow: 0 43px 0 #929065; }
.sign-title { display: block; margin: 0 0 7px; font-size: 11px; font-weight: 600; line-height: 1.2; }
.sign-action { display: block; width: 100%; height: 13px; fill: var(--ink); shape-rendering: crispEdges; }
.world-label::after { content: ''; display: block; width: 24px; height: 24px; margin: 5px auto 0; background: var(--ink); clip-path: polygon(8px 0, 16px 0, 16px 12px, 24px 12px, 24px 16px, 20px 16px, 20px 20px, 16px 20px, 16px 24px, 8px 24px, 8px 20px, 4px 20px, 4px 16px, 0 16px, 0 12px, 8px 12px); filter: drop-shadow(2px 2px 0 #b6c29f); }
.industry-label:hover { background: transparent; }
.industry-label:hover .sign-face { background: #f5edca; }
.world-label.done .sign-face { background: #d5dfb8; }
@media (max-width: 900px) {
  .quest-progress { display: none; }
  .journey-bar { top: max(12px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); right: auto; width: auto; min-height: 44px; padding: 0; border: 0; background: none; box-shadow: none; }
  #explore-industries { min-height: 44px; padding: 8px 0; border: 0; font-size: 0; }
  #explore-industries::after { content: attr(data-compact); font-size: 11px; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .hero { top: max(82px, calc(env(safe-area-inset-top) + 70px)); }
}
@media (max-height: 600px) and (min-width: 600px) {
  .hero { top: max(8px, env(safe-area-inset-top)); width: 110px; }
  .pixel-wordmark { width: 110px; }
  .hero h1 > span, .hero > p { display: none; }
}

@media (max-width: 700px) and (max-height: 700px) and (orientation: portrait) {
  .hero > p { display: none; }
}

@media (max-height: 600px) and (min-width: 600px) {
  .game-controls { justify-content: space-between; }
  .game-message { position: absolute; left: 140px; right: 220px; bottom: 36px; max-width: none; margin: 0; }
  #game-status { min-height: 0; max-width: none; }
}
