:root {
  --bg: #0b1020;
  --bg-deep: #05070d;
  --panel: rgba(15, 22, 40, 0.88);
  --text: #edf2ff;
  --muted: #91a0bf;
  --accent: #ff8a3d;
  --link: #78b7ff;
  --line: rgba(237, 242, 255, 0.14);
  --node: #1c2741;
  --node-active: #f2f6ff;
  --node-reachable: #183a46;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(120, 183, 255, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(255, 138, 61, 0.18), transparent 20%),
    linear-gradient(180deg, #10162a 0%, var(--bg) 50%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.layout {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.intro {
  margin-bottom: 18px;
  padding: 18px 8px;
}

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

h1 {
  margin: 0 0 14px;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.lead {
  max-width: 46rem;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-panel {
  display: inline-block;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-panel p {
  margin: 0;
  line-height: 1.7;
}

.board-shell {
  position: relative;
  min-height: 700px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(13, 19, 33, 0.95), rgba(9, 13, 23, 0.98));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.edge-layer,
.map-root {
  position: absolute;
  inset: 0;
}

.edge-layer line {
  stroke: rgba(120, 183, 255, 0.3);
  stroke-width: 4;
  stroke-linecap: round;
}

.map-root {
  padding: 24px;
}

.node {
  position: absolute;
  width: 72px;
  height: 72px;
  margin-left: -36px;
  margin-top: -36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--node);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: not-allowed;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.node span {
  pointer-events: none;
}

.node.is-current {
  background: var(--node-active);
  color: #0c1220;
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.06);
}

.node.is-reachable {
  background: var(--node-reachable);
  border-color: rgba(120, 183, 255, 0.45);
  color: #d7f2ff;
  cursor: pointer;
}

.node.is-reachable:hover,
.node.is-reachable:focus-visible {
  transform: translateY(-3px);
  outline: none;
}

.node.is-encounter {
  box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.38);
}

.encounter-panel {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: min(360px, calc(100% - 44px));
  padding: 20px;
  border: 1px solid rgba(255, 138, 61, 0.28);
  border-radius: 24px;
  background: rgba(11, 16, 32, 0.96);
  box-shadow: var(--shadow);
  z-index: 3;
}

.encounter-panel.is-hidden,
.encounter-button.is-hidden {
  display: none;
}

.encounter-panel h2 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

.encounter-text {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.7;
}

.encounter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.encounter-button {
  border: 1px solid rgba(255, 138, 61, 0.24);
  border-radius: 999px;
  padding: 11px 16px;
  background: rgba(255, 138, 61, 0.12);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.encounter-button.secondary {
  background: rgba(120, 183, 255, 0.12);
  border-color: rgba(120, 183, 255, 0.24);
}

@media (max-width: 820px) {
  .layout {
    width: min(100vw - 20px, 1200px);
  }

  .board-shell {
    min-height: 760px;
  }

  .encounter-panel {
    left: 16px;
    right: 16px;
    width: auto;
  }
}
