@font-face {
  font-family: Nunito;
  src: url("./assets/nunito.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("./assets/inter.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  font-family: Inter, system-ui, sans-serif;
  color: #233b39;
  background: #193331;
  color-scheme: light;
  --cream: #fff6e5;
  --paper: #fff9ea;
  --ink: #233b39;
  --teal: #246b65;
  --muted: #45625c;
  --mint: #cce5d9;
  --line: #dabf94;
  --gold: #fff1ca;
  --brown: #61421e;
  --coral: #d7442e;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 24%, #31544e, #182f2d 72%); }
button { font: inherit; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: Nunito, Inter, sans-serif; font-weight: 900; }

.phone {
  position: relative;
  inline-size: min(390px, 100%);
  block-size: min(844px, calc(100dvh - 24px));
  min-block-size: min(568px, 100dvh);
  overflow: hidden;
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 24px 80px #0e2225a8, 0 0 0 1px #ffffff18;
}

.screen { inline-size: 100%; block-size: 100%; }
.map-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 18px; padding: 48px 18px 38px; }
.map-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-width: 0; }
.map-heading h1 { font-size: clamp(32px, 10.77vw, 42px); line-height: 1; letter-spacing: -.025em; }
.map-heading p { margin-top: 5px; font-size: 14px; line-height: 19px; font-weight: 600; color: var(--muted); }
.map-account { display: grid; justify-items: center; flex: none; gap: 8px; padding-top: 2px; }
.avatar { width: 80px; height: 80px; object-fit: cover; border: 1px solid #d8c6a7; border-radius: 22px; }
.wallet { display: flex; align-items: center; gap: 5px; background: var(--gold); border: 1px solid var(--line); color: var(--brown); font-weight: 700; font-variant-numeric: tabular-nums; }
.wallet img { display: block; flex: none; width: 17px; height: 17px; }
.wallet--map { justify-content: center; gap: 7px; min-height: 32px; width: max-content; min-width: 104px; max-width: min(144px, 42vw); padding: 5px 12px; border-radius: 16px; font-size: 12px; }
.wallet-total { overflow-wrap: anywhere; }
.route-map { position: relative; overflow: hidden; min-height: 0; border-radius: 22px; background: var(--mint); box-shadow: 0 4px 8px #2e403025; isolation: isolate; }
.route-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.route-dots { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.route-dots circle { fill: var(--teal); }
.stop { position: absolute; display: flex; align-items: center; gap: 7px; height: 57px; padding: 0 12px 0 8px; border: 1px solid #dcc5a1; border-radius: 16px; background: var(--paper); color: var(--ink); text-align: left; box-shadow: 0 3px 6px #2e403029; cursor: pointer; transition: background .12s, transform .10s, box-shadow .12s; }
.stop--attic { right: 17px; bottom: 6.8%; min-width: 147px; }
.stop--greenhouse { left: 22px; top: 39%; min-width: 140px; }
.stop--roof { right: 17px; top: 9.2%; min-width: 127px; }
.stop--active { background: var(--coral); border-color: #942d20; color: white; }
.stop--done { background: var(--teal); border-color: #1c504d; color: white; }
.stop:disabled { cursor: default; }
.stop:not(:disabled):hover { filter: brightness(.94); }
.stop:not(:disabled):active { transform: translateY(2px); box-shadow: none; }
.stop-number { display: grid; place-items: center; width: 37px; height: 37px; flex: none; border-radius: 50%; background: #f3e4c4; font-weight: 750; }
.stop--active .stop-number { background: #9f2d1f; }
.stop--done .stop-number { background: #174542; }
.stop-copy { display: grid; line-height: 19px; }
.stop-copy strong { font-size: 16px; }
.stop-copy small { font-size: 11px; line-height: 14px; font-weight: 600; }
.route-card { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.route-card h2 { font-size: 23px; line-height: 1.16; }
.route-card p { margin-top: 4px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--muted); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s, transform .10s; -webkit-tap-highlight-color: transparent; }
.button:focus-visible, .stop:focus-visible { outline: 3px solid #206a62; outline-offset: 3px; }
.button--primary { height: 54px; padding: 0 12px; border-color: #942d20; border-radius: 19px; background: var(--coral); color: #fff; box-shadow: 0 3px 0 #6e2e1a57; font-size: 18px; line-height: 23px; font-weight: 700; }
.button--primary:not(:disabled):hover { background: #c83a28; }
.button--primary:not(:disabled):active { transform: translateY(2px); background: #a82e20; box-shadow: 0 1px 0 #6e2e1a57; }
.button--primary:disabled { background: #e7dcce; border-color: #cfc0ac; color: #76695e; box-shadow: none; cursor: default; }
.button--map { width: 100px; height: 46px; flex: none; }
.button--icon { width: 48px; height: 48px; border-color: #d8c6a7; border-radius: 15px; background: #fffbed; color: var(--ink); box-shadow: 0 4px 8px #2e403025; font-size: 25px; line-height: 23px; font-weight: 700; }
.button--icon:not(:disabled):hover { border-color: #b8a384; background: #f4ebd5; }
.button--icon:not(:disabled):active { transform: translateY(2px); border-color: #a88f69; background: #e9dbbd; box-shadow: 0 1px 2px #2e403025; }
.button--icon:disabled { background: #f2ebde; color: #817565; border-color: #d5c9b5; box-shadow: none; cursor: default; }

.game-layout { --guide-height: 150px; display: grid; grid-template-rows: 60px minmax(0, 1fr) minmax(var(--guide-height), max-content); height: 100%; gap: 12px; padding: 52px 18px 45px; }
.game-header { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; text-align: center; align-items: start; gap: 12px; }
.game-heading { display: grid; gap: 2px; }
.game-heading p { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--teal); }
.game-heading h1 { font-size: 31px; line-height: 37px; }
.playfield { position: relative; overflow: hidden; min-height: 0; border-radius: 22px; background: #143b3a; box-shadow: 0 4px 8px #2e403025; touch-action: none; user-select: none; }
.playfield canvas { display: block; width: 100%; height: 100%; }
.wallet--flight, .wallet--change { position: absolute; right: 12px; width: 82px; height: 34px; padding: 0 8px; gap: 3px; border-radius: 11px; pointer-events: none; }
.wallet--flight { top: 12px; gap: 7px; width: max-content; min-width: 82px; padding-inline: 12px; font-size: 16px; }
.wallet--flight output, .wallet--change span { flex: 1; text-align: center; }
.wallet--change { top: 54px; font-size: 14px; }
.wallet--change[data-change="loss"] { background: #f5dccd; color: #8a2c22; border-color: #ddad94; }
.flight-guide { min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.hint { padding: 10px 12px; border: 1px solid #b9d2c7; border-radius: 15px; background: var(--mint); }
.hint[data-impact="true"] { border-color: #ddad94; background: #f5dccd; }
.hint strong { display: block; font-size: 15px; line-height: 19px; }
.hint p { margin-top: 3px; font-size: 13px; line-height: 16px; font-weight: 600; color: var(--muted); }
.button--launch { width: 100%; height: 55px; flex: none; }
.flight-controls { text-align: center; color: var(--teal); font-size: 13px; font-weight: 600; line-height: 19px; }
.flight-controls span { padding: 0 3px; }

.result-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 18px 24px; background: #0c2423a3; }
.result { width: min(100%, 342px); display: grid; justify-items: center; text-align: center; padding: 24px 19px; border: 1px solid var(--line); border-radius: 27px; background: var(--paper); }
.result-illustration { display: grid; place-items: center; width: 88px; height: 88px; margin-bottom: 16px; border-radius: 24px; background: var(--mint); }
.result-illustration img { width: 80px; height: 80px; object-fit: cover; border-radius: 21px; }
.result[data-outcome="missed"] .result-illustration { background: #f5dccd; }
.result[data-outcome="missed"] .result-illustration img { width: 64px; height: 55px; object-fit: contain; border-radius: 0; }
.result-heading h2 { font-size: clamp(23px, 7vw, 27px); line-height: 32px; }
.result-heading p { margin-top: 6px; font-size: 15px; line-height: 21px; font-weight: 600; color: var(--muted); }
.result-stats { display: grid; justify-items: center; gap: 8px; margin-top: 18px; }
.result-coins { min-width: 168px; max-width: 100%; min-height: 72px; display: grid; place-content: center; gap: 4px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--gold); }
.result-coins strong { display: flex; align-items: center; justify-content: center; gap: 7px; font: 900 21px/26px Nunito, sans-serif; }
.result-coins img { width: 20px; height: 20px; flex: none; }
#result-coins { overflow-wrap: anywhere; }
.result-coins > span { font-size: 13px; line-height: 17px; font-weight: 600; color: var(--muted); }
#result-record { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--teal); }
#result-action { width: 100%; margin-top: 22px; }
.result[data-outcome="missed"] #result-action { width: min(226px, 100%); }
.home-indicator { pointer-events: none; position: absolute; width: 132px; height: 5px; left: 50%; bottom: max(8px, calc(env(safe-area-inset-bottom) + 4px)); transform: translateX(-50%); border-radius: 3px; background: #27332f; }

@media (max-width: 480px) {
  body { background: var(--cream); }
  .phone { width: 100%; height: 100dvh; min-height: 0; border-radius: 0; box-shadow: none; }
}

@media (max-height: 760px) {
  .map-screen { padding-top: 29px; padding-bottom: 27px; gap: 13px; }
  .route-card { min-height: 86px; }
  .game-layout { padding-top: 29px; padding-bottom: 28px; grid-template-rows: 57px minmax(0, 1fr) minmax(var(--guide-height), max-content); gap: 10px; }
  .hint { padding-block: 9px; }
}

@media (max-width: 370px) {
  .game-layout { --guide-height: 164px; }
}

@media (max-width: 355px) {
  .map-screen, .game-layout { padding-inline: 14px; }
  .map-heading h1 { font-size: 35px; }
  .map-heading p { font-size: 12px; }
  .route-card p { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
