:root {
  color-scheme: light;
  --ink: #20242b;
  --muted: #5d6a73;
  --paper: #f5f0e6;
  --panel: #fffdf7;
  --navy: #18324a;
  --teal: #2f7f7a;
  --grass: #7aa05a;
  --gold: #d09a35;
  --rust: #bb6046;
  --bog: #58664d;
  --line: #d6cab8;
  --shadow: 0 18px 44px rgba(24, 50, 74, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(47, 127, 122, 0.18), transparent 42%),
    linear-gradient(300deg, rgba(208, 154, 53, 0.2), transparent 40%),
    var(--paper);
}

button,
a {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 20px 0 34px;
}

.top-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.top-nav a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 800;
  padding: 9px 12px;
  border: 2px solid rgba(24, 50, 74, 0.16);
  background: rgba(255, 253, 247, 0.78);
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rust);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: clamp(2.2rem, 8vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: #3e4d55;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.5;
}

.scoreboard,
.status-box {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 14px;
  padding: 14px;
  border: 2px solid rgba(24, 50, 74, 0.16);
  background: rgba(255, 253, 247, 0.84);
  box-shadow: var(--shadow);
}

.scoreboard span,
.status-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.scoreboard strong,
.status-box strong {
  justify-self: end;
  color: var(--navy);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.map-panel,
.side-panel {
  border: 2px solid rgba(24, 50, 74, 0.14);
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
}

.map-panel {
  padding: 18px;
}

.side-panel {
  padding: 16px;
  display: grid;
  gap: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2,
.side-panel h2 {
  margin-bottom: 5px;
  font-size: 1.15rem;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

button {
  min-height: 44px;
  border: 0;
  background: var(--navy);
  color: white;
  font-weight: 850;
  padding: 11px 13px;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4);
  opacity: 0.55;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.board-wrap {
  display: grid;
  place-items: center;
}

.board {
  width: min(100%, 620px);
  aspect-ratio: 1;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 3px solid var(--navy);
  background: #d4c39f;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid rgba(24, 50, 74, 0.18);
  background: #f0dfb7;
  color: var(--navy);
  font-weight: 900;
  font-size: clamp(1rem, 5vw, 2.2rem);
}

.cell::after {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1px dashed rgba(24, 50, 74, 0.12);
  pointer-events: none;
}

.cell.path {
  background: #e8d093;
}

.cell.bog {
  background: var(--bog);
  color: white;
}

.cell.stamp {
  background: #dcb262;
}

.cell.visited {
  background: var(--grass);
  color: white;
}

.cell.camp {
  background: var(--teal);
  color: white;
}

.cell.surveyor {
  outline: 4px solid var(--rust);
  outline-offset: -5px;
}

.cell.trail {
  box-shadow: inset 0 0 0 5px rgba(187, 96, 70, 0.32);
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card {
  min-height: 72px;
  padding: 10px;
  background: var(--teal);
  text-align: left;
}

.card strong {
  display: block;
  font-size: 1.05rem;
}

.card span {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.86;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#reset,
#newRun {
  background: var(--rust);
}

.message {
  min-height: 4.4em;
  margin: 0;
  padding: 12px;
  color: var(--navy);
  background: #fff1cf;
  border-left: 5px solid var(--gold);
  line-height: 1.45;
}

@media (max-width: 820px) {
  .hero,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .scoreboard {
    width: 100%;
  }

  .panel-head {
    display: grid;
  }

  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .shell {
    width: min(100vw - 18px, 1120px);
    padding-top: 12px;
  }

  .map-panel,
  .side-panel {
    padding: 12px;
  }

  .board {
    gap: 4px;
    padding: 5px;
  }
}
