:root {
  color-scheme: dark;
  --ink: #f3f0e9;
  --muted: #a9afa8;
  --faint: rgba(243, 240, 233, 0.12);
  --line: rgba(243, 240, 233, 0.15);
  --leaf: #b6d674;
  --leaf-dark: #8ba855;
  --midnight: #101412;
  --panel: #181d1a;
  --orange: #ff9f6e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 76% -6%, rgba(90, 128, 78, 0.2), transparent 28rem),
    radial-gradient(circle at 8% 96%, rgba(36, 74, 70, 0.27), transparent 35rem),
    var(--midnight);
}

button, input { font: inherit; }
button { cursor: pointer; }

.page-shell {
  width: min(1360px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 24px;
  display: flex;
  flex-direction: column;
}

.topbar, footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.brand-mark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid var(--leaf);
  border-radius: 50%;
  transform: rotate(-24deg);
}

.brand-mark i {
  width: 14px;
  height: 6px;
  display: block;
  border-top: 1px solid var(--leaf);
  border-bottom: 1px solid var(--leaf);
  border-radius: 50%;
}

.scoreboard { display: flex; gap: 20px; color: var(--muted); font-size: 0.86rem; }
#route-label { color: #7d8a7e; }
.route-button {
  padding: 0;
  border: 0;
  color: var(--leaf);
  background: transparent;
  font-size: inherit;
  font-weight: 760;
  text-decoration: underline;
  text-decoration-color: rgba(182, 214, 116, 0.48);
  text-underline-offset: 3px;
}
.route-button:hover { color: #d4ed9e; }
.route-button:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.scoreboard .score { color: var(--ink); }
.score strong { color: var(--leaf); font-weight: 750; }

.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: clamp(24px, 3vw, 48px);
  align-items: center;
  padding: 48px 0;
}

.image-panel { min-width: 0; }
.image-heading { margin: 0 0 21px; }
.eyebrow {
  margin: 0 0 9px;
  color: var(--leaf);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: -0.052em; }
.image-heading h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 0.98; }

.satellite-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1.38 / 1;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
  background: #202d2a;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
}

.tile-mosaic {
  position: absolute;
  top: -34%;
  left: -34%;
  width: 168%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  transform-origin: 50% 50%;
  transition: opacity 220ms ease, transform 480ms cubic-bezier(.2,.8,.2,1);
}

.tile-mosaic.loading { opacity: 0.22; }
.tile-mosaic img { width: 100%; height: 100%; object-fit: cover; }

.waterway-overlay,
.border-overlay {
  position: absolute;
  top: -34%;
  left: -34%;
  width: 168%;
  aspect-ratio: 1;
  overflow: hidden;
  pointer-events: none;
  transform-origin: 50% 50%;
  transition: opacity 220ms ease, transform 480ms cubic-bezier(.2,.8,.2,1);
}
.waterway-overlay { z-index: 2; }
.waterway-overlay .river {
  fill: none;
  stroke: rgba(105, 220, 255, 0.92);
  stroke-width: 0.022;
  filter: drop-shadow(0 0 2px rgba(0, 20, 30, 0.88));
}
.waterway-overlay .lake {
  fill: rgba(82, 192, 235, 0.32);
  stroke: rgba(132, 226, 255, 0.82);
  stroke-width: 0.014;
  filter: drop-shadow(0 0 2px rgba(0, 20, 30, 0.82));
}
.border-overlay { z-index: 3; }
.border-overlay path {
  fill: none;
  stroke: rgba(255, 213, 108, 0.92);
  stroke-width: 0.014;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.85));
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.34;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}

.image-tag {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 12px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,0.34);
  background: rgba(4, 8, 7, 0.55);
  color: rgba(255,255,255,0.85);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 14px; margin: 11px 2px 0; }
.image-credit, .cloud-budget { margin: 0; color: #758077; font-size: 0.7rem; }
.cloud-budget { color: #a7bd7b; }
.imagery-attribution {
  position: absolute;
  z-index: 3;
  left: 14px;
  bottom: 12px;
  max-width: calc(100% - 170px);
  padding: 4px 7px;
  border-radius: 2px;
  background: rgba(4, 8, 7, 0.68);
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.2;
}

.guess-panel {
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(31, 38, 34, 0.93), rgba(19, 24, 21, 0.93));
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.16);
}

.guess-panel h2 { max-width: 10ch; margin-bottom: 15px; font-size: clamp(1.62rem, 2.3vw, 2.1rem); line-height: 1.04; }
.muted { color: var(--muted); font-size: 0.94rem; line-height: 1.55; }
.guess-form { margin-top: 30px; }
.guess-form label { display: block; margin-bottom: 9px; font-size: 0.78rem; font-weight: 750; }
.input-row { display: flex; gap: 8px; }

input {
  min-width: 0;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #4c554e;
  border-radius: 4px;
  outline: none;
  color: var(--ink);
  background: #111512;
}
input::placeholder { color: #758077; }
input:focus { border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(182,214,116,0.14); }
input:disabled { opacity: 0.64; }

.primary-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  color: #17200e;
  background: var(--leaf);
  font-size: 0.82rem;
  font-weight: 850;
  transition: transform 150ms ease, background 150ms ease;
}
.primary-button:hover { background: #cae98a; transform: translateY(-1px); }
.primary-button:focus-visible, .text-button:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #58635a;
  border-radius: 4px;
  color: var(--ink);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 750;
}
.secondary-button:hover { border-color: var(--leaf); color: var(--leaf); }
.secondary-button:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.feedback { min-height: 24px; margin: 13px 0 0; color: var(--orange); font-size: 0.84rem; line-height: 1.4; }
.feedback.success { color: var(--leaf); font-weight: 700; }

.clue-box {
  display: flex;
  gap: 10px;
  margin-top: 13px;
  padding: 12px;
  border-left: 2px solid var(--leaf-dark);
  background: rgba(182, 214, 116, 0.08);
  color: #d8e5be;
  font-size: 0.82rem;
  line-height: 1.45;
}
.clue-box p { margin: 0; }
.clue-icon { color: var(--leaf); }
.feature-clue-box { border-left-color: #70d9ff; background: rgba(100, 210, 255, 0.09); color: #d5f1ff; }
.feature-clue-box .clue-icon { color: #70d9ff; }

.actions { display: flex; flex-wrap: wrap; gap: 3px 16px; margin-top: 18px; }
.text-button {
  padding: 3px 0;
  border: 0;
  color: #d2d7ce;
  background: transparent;
  font-size: 0.76rem;
  text-decoration: underline;
  text-decoration-color: #667168;
  text-underline-offset: 3px;
}
.text-button:hover { color: var(--leaf); }
.text-button:disabled { color: #69736a; cursor: default; text-decoration: none; }
.text-button span { color: var(--orange); }

.how-points-work { margin-top: 32px; padding-top: 17px; border-top: 1px solid var(--line); }
.how-points-work span { color: var(--muted); font-size: 0.67rem; font-weight: 760; letter-spacing: 0.1em; text-transform: uppercase; }
.how-points-work p { margin: 6px 0 0; color: #879087; font-size: 0.74rem; line-height: 1.45; }

.location-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(340px, 1.25fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}
.location-copy h2 { max-width: 15ch; margin-bottom: 11px; font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.04; }
.map-note { margin-bottom: 16px; color: #879087; font-size: 0.8rem; line-height: 1.5; }
.map-link { color: var(--leaf); font-size: 0.82rem; font-weight: 760; text-underline-offset: 3px; }
.map-preview {
  position: relative;
  overflow: hidden;
  width: min(100%, 470px);
  justify-self: end;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #28342d;
}
.map-mosaic {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.map-mosaic img { width: 100%; height: 100%; object-fit: cover; }
.source-footprint {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 55.1%;
  height: 46.7%;
  border: 2px solid var(--orange);
  box-shadow: 0 0 0 1px rgba(10, 12, 10, 0.58), inset 0 0 0 1px rgba(10, 12, 10, 0.58);
  transform-origin: 50% 50%;
  pointer-events: none;
}
.north-marker, .map-attribution {
  position: absolute;
  z-index: 1;
  padding: 4px 6px;
  background: rgba(8, 12, 10, 0.72);
  font-size: 0.64rem;
}
.north-marker { top: 8px; left: 8px; color: var(--ink); font-weight: 800; }
.map-attribution { right: 0; bottom: 0; color: #d5dad2; }
.map-attribution a { color: inherit; }

.summary { flex: 1; max-width: 760px; margin: auto; padding: 58px 0; }
.summary h1 { max-width: 12ch; margin-bottom: 10px; font-size: clamp(2.6rem, 6vw, 5rem); line-height: 0.95; }
.summary h1 span { color: var(--leaf); }
.summary-score { margin-bottom: 32px; color: var(--muted); font-size: 1.1rem; }
.round-recap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 30px; }
.recap-item { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,0.03); }
.recap-item span { color: var(--muted); font-size: 0.78rem; }
.recap-item strong { font-size: 0.85rem; }
.recap-item.success strong { color: var(--leaf); }
.recap-item.missed strong { color: var(--orange); }
.summary-actions { display: flex; flex-wrap: wrap; gap: 10px; }

footer { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(243,240,233,0.09); color: #768077; font-size: 0.72rem; }
footer a { color: var(--muted); }
.hidden { display: none; }

@media (max-width: 780px) {
  .page-shell { width: min(100% - 32px, 600px); padding-top: 20px; }
  .game-layout { grid-template-columns: 1fr; gap: 28px; padding: 34px 0; }
  .guess-panel { padding: 26px; }
  .image-heading h1 { font-size: 2.25rem; }
  .round-recap { grid-template-columns: 1fr; }
  .location-panel { grid-template-columns: 1fr; }
  .map-preview { justify-self: stretch; width: 100%; }
}

@media (max-width: 430px) {
  .scoreboard { gap: 10px; font-size: 0.75rem; }
  .scoreboard #round-count, .scoreboard #route-label { display: none; }
  .input-row { flex-direction: column; }
  .primary-button { width: 100%; }
  footer { align-items: flex-start; gap: 8px; flex-direction: column; }
}
