:root {
  --bg: #050914;
  --bg-soft: #0b1430;
  --panel: rgba(10, 20, 45, .84);
  --panel-solid: #0d1835;
  --text: #f5f8ff;
  --muted: #a9b8d6;
  --line: rgba(190, 215, 255, .18);
  --silver: #d9e5f5;
  --blue: #62d9ff;
  --blue-deep: #2866ff;
  --violet: #8d74ff;
  --good: #76f0aa;
  --warn: #ffd166;
  --danger: #ff7a8a;
  --shadow: 0 24px 80px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% -10%, rgba(98, 217, 255, .28), transparent 31rem),
    radial-gradient(circle at 86% 8%, rgba(141, 116, 255, .24), transparent 28rem),
    radial-gradient(circle at 50% 110%, rgba(40, 102, 255, .18), transparent 42rem),
    linear-gradient(180deg, #050914 0%, #071024 48%, #050914 100%);
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
canvas {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 20, .78);
  backdrop-filter: blur(18px);
}

.site-header.compact {
  position: relative;
}

.brand {
  color: var(--silver);
  font-weight: 950;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  color: var(--muted);
  font-size: .95rem;
}

.nav a {
  text-decoration: none;
}

.nav a:hover {
  color: var(--blue);
}

.hero,
.section {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 4vw, 4rem);
}

.hero {
  display: grid;
  min-height: 70vh;
  align-content: center;
}

.eyebrow {
  margin: 0 0 .75rem;
  color: var(--blue);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 900px;
  margin-bottom: 1rem;
  color: #fff;
  font-size: clamp(3.2rem, 10vw, 7.8rem);
  line-height: .9;
  letter-spacing: -.08em;
  text-shadow: 0 0 48px rgba(98, 217, 255, .28);
}

h2 {
  max-width: 760px;
  margin-bottom: 1.4rem;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -.05em;
}

h3 {
  margin-bottom: .5rem;
}

.hero-copy {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.hero-actions,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  padding: .85rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 850;
  text-decoration: none;
}

.button.primary {
  color: #061224;
  background: linear-gradient(135deg, var(--blue), var(--silver));
  box-shadow: 0 16px 48px rgba(98, 217, 255, .24);
}

.button.primary:hover {
  transform: translateY(-1px);
}

.feature-panel,
.hud-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .035));
  box-shadow: var(--shadow);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  min-height: 12rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(5, 9, 20, .36);
}

.card p,
.muted {
  color: var(--muted);
}

.site-footer {
  justify-content: space-between;
  padding: 1.5rem clamp(1rem, 4vw, 4rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 1rem;
}

.game-panel {
  position: relative;
  min-height: min(70vh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #050914;
  box-shadow: var(--shadow);
}

#world-canvas {
  display: block;
  width: 100%;
  height: min(72vh, 720px);
  min-height: 480px;
  cursor: crosshair;
  image-rendering: pixelated;
}

.interaction-box {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  min-height: 3rem;
  padding: .85rem 1rem;
  border: 1px solid rgba(98, 217, 255, .42);
  border-radius: 18px;
  color: var(--silver);
  background: rgba(5, 9, 20, .78);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
}

.hud {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.hud-card {
  padding: 1rem;
  background: var(--panel);
}

.hud h1 {
  margin-bottom: 1rem;
  font-size: 2rem;
  letter-spacing: -.04em;
}

.stat-list {
  display: grid;
  gap: .65rem;
  margin: 0;
}

.stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  color: var(--silver);
  font-weight: 800;
  text-align: right;
}

.help-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.help-list li + li {
  margin-top: .45rem;
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  color: var(--muted);
  font-size: .92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.swatch {
  width: 1rem;
  height: 1rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 4px;
}

.swatch.grass { background: #2f8d52; }
.swatch.path { background: #9a8257; }
.swatch.water { background: #175d9e; }
.swatch.blocked { background: #24324d; }
.swatch.marker { background: #62d9ff; }

@media (max-width: 980px) {
  .game-shell,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  #world-canvas {
    min-height: 420px;
  }
}

@media (max-width: 620px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(3rem, 18vw, 5rem);
  }

  .game-shell {
    padding: .5rem;
  }

  #world-canvas {
    min-height: 360px;
  }
}
