body {
  margin: 0;
  padding: 0;
  font-family: Georgia, serif;
  background: #f4f1ea;
  color: #1f2933;
}

h1 {
  margin-top: 0;
  font-size: 2rem;
}

.experimental-map-heading {
  margin: 0;
  padding: 1rem;
  background: #1a202c;
  color: #fff;
}

a {
  color: #0b6e4f;
}

.svg-map-page {
  --map-background: #0c1014;
  --map-surface: #11181c;
  --map-deep: #080b0d;
  --map-card: #151c20;
  --map-foreground: #e7e0cf;
  --map-muted: #a59f91;
  --map-border: #58615d;
  --map-current: #d8bb61;
  --map-reachable: #71a98b;
  --map-selected: #bb533e;

  box-sizing: border-box;
  min-height: 100vh;
  padding: 1rem;
  overflow-x: hidden;
  background: var(--map-background);
  color: var(--map-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.svg-map-heading {
  max-width: 74rem;
  margin: 0 auto 0.75rem;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.svg-map-container {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 74rem;
  min-height: 624px;
  margin: 0 auto;
  border: 2px solid var(--map-border);
  background:
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px),
    var(--map-surface);
  background-size: 12px 12px;
  overflow: hidden;
}

.svg-map {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 620px;
  background: radial-gradient(circle at 30% 40%, #172125, var(--map-deep) 72%);
  color: var(--map-foreground);
}

.travel-corridors polyline {
  fill: none;
  stroke: #58615d;
  stroke-width: 0.9;
  stroke-linecap: square;
}

.travel-corridors polyline[data-state="reachable"] {
  stroke: var(--map-reachable);
  stroke-dasharray: 2.2 1.5;
}

.svg-poi-control {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.svg-poi-marker {
  r: 1.75px;
  fill: var(--map-deep);
  stroke: var(--map-muted);
  stroke-width: 0.75;
}

.svg-poi-marker[data-state~="reachable"] {
  stroke: var(--map-reachable);
  stroke-width: 1.25;
}

.svg-poi-marker[data-state~="current"] {
  fill: var(--map-current);
  stroke: var(--map-foreground);
  stroke-dasharray: 1.4 0.8;
  stroke-width: 1.25;
}

.svg-poi-marker[data-state~="selected"] {
  fill: var(--map-selected);
  stroke: var(--map-foreground);
  stroke-dasharray: 1.5 0.75;
  stroke-width: 1.5;
}

.svg-poi-icon {
  fill: none;
  stroke: var(--map-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.1;
}

.svg-poi-icon[data-state~="reachable"] {
  stroke: var(--map-reachable);
}

.svg-poi-icon[data-state~="current"] {
  stroke: var(--map-foreground);
  stroke-width: 1.35;
}

.svg-poi-icon[data-state~="selected"] {
  stroke: var(--map-foreground);
  stroke-width: 1.45;
}

.svg-poi-control:focus-visible {
  outline: 2px solid var(--map-current);
  outline-offset: 2px;
}

.svg-poi-destination {
  r: 2.75px;
  fill: none;
  stroke: #111827;
  stroke-dasharray: 1.5 0.75;
  stroke-width: 0.75;
}

.svg-poi-label,
.svg-poi-state {
  fill: var(--map-foreground);
  font-size: 1.3px;
  paint-order: stroke;
  stroke: var(--map-deep);
  stroke-width: 0.2px;
}

.svg-poi-state {
  fill: var(--map-current);
  font-size: 1.1px;
  font-weight: bold;
  text-transform: uppercase;
}

.expedition-edges line {
  stroke: var(--map-reachable);
  stroke-width: 1;
  stroke-dasharray: 2 1.5;
}

.expedition-nodes circle {
  fill: var(--map-deep);
  stroke: var(--map-muted);
  stroke-width: 1;
}

.expedition-nodes circle[data-state="current"] {
  fill: var(--map-current);
  stroke: var(--map-foreground);
  stroke-width: 1.5;
}

.expedition-nodes circle[data-state="available"] {
  stroke: var(--map-reachable);
  stroke-width: 1.5;
}

.expedition-journey {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 624px;
  min-height: 624px;
  background: radial-gradient(circle at 50% 75%, #202a2f, var(--map-deep) 72%);
}

.journey-header {
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--map-border);
  background: rgb(8 11 13 / 88%);
  color: var(--map-foreground);
}

.journey-header strong {
  color: var(--map-selected);
}

.journey-header [data-journey-destination] {
  margin-left: 0.5rem;
}

.journey-graph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
}

.journey-graph [data-layer="expedition-edges"] line {
  stroke: var(--map-border);
  stroke-dasharray: none;
}

.journey-graph [data-layer="expedition-edges"] line[data-state="available"] {
  stroke: var(--map-reachable);
  stroke-width: 1.4;
}

.journey-graph [data-expedition-choice] {
  outline: none;
}

.journey-graph [data-expedition-choice]:focus,
.journey-graph [data-expedition-choice]:focus-visible {
  outline: none;
}

.journey-completion {
  padding: 1rem;
  border-top: 1px solid var(--map-border);
  background: var(--map-card);
  color: var(--map-foreground);
  text-align: center;
}

.expedition-command-error {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 5;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--map-selected);
  background: var(--map-card);
  color: var(--map-foreground);
}

.destination-dialog .expedition-command-error {
  position: static;
  margin-top: 0.75rem;
}

.destination-dialog {
  position: fixed;
  inset: auto 1rem 1rem;
  box-sizing: border-box;
  max-width: 36rem;
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid var(--map-current);
  background: var(--map-card);
  color: var(--map-foreground);
}

.destination-dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}

.destination-dialog h2 {
  margin: 0 2rem 0.5rem 0;
}

.dialog-close {
  float: right;
  border: 0;
  background: transparent;
  color: var(--map-foreground);
  font: inherit;
  font-size: 1.5rem;
}

.expedition-node-label {
  fill: var(--map-foreground);
  font-size: 1.4px;
}

.journey-graph .expedition-node-icon {
  fill: var(--map-foreground);
  font-family: sans-serif;
  font-size: 4.5px;
  font-weight: 700;
}

.map-legend {
  position: absolute;
  left: 18px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--map-border);
  background: rgb(21 28 32 / 94%);
  font-size: 0.75rem;
}

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

.legend-mark {
  display: inline-block;
  box-sizing: border-box;
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--map-muted);
}

.legend-mark.current {
  border-color: var(--map-foreground);
  background: var(--map-current);
  transform: rotate(45deg);
}

.legend-mark.reachable {
  border-color: var(--map-reachable);
}

.legend-mark.selected {
  border-color: var(--map-foreground);
  background: var(--map-selected);
}

.map-card-stack {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 5;
  display: grid;
  gap: 40px;
  width: min(330px, calc(100% - 44px));
  pointer-events: none;
}

.map-info-card {
  box-sizing: border-box;
  max-height: 245px;
  overflow: auto;
  border: 2px solid var(--map-border);
  background: rgb(21 28 32 / 96%);
  color: var(--map-foreground);
  box-shadow: 5px 5px 0 rgb(0 0 0 / 55%);
  pointer-events: none;
}

.map-card-kicker {
  padding: 0.65rem 0.8rem 0.55rem;
  border-bottom: 1px solid var(--map-border);
  color: var(--map-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-card-kicker::before {
  margin-right: 0.45rem;
  color: var(--map-current);
  content: "◆";
}

.context-card .map-card-kicker::before {
  color: var(--map-selected);
}

.map-card-body {
  padding: 0.8rem 0.9rem 0.95rem;
}

.map-card-body h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.map-card-body p,
.map-card-body small {
  margin: 0.35rem 0;
  color: var(--map-muted);
  font-size: 0.75rem;
}

.map-card-body strong {
  color: var(--map-foreground);
}

.map-card-body hr {
  margin: 0.75rem 0;
  border: 0;
  border-top: 1px solid var(--map-border);
}

.corridor-summary,
.status-summary {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.45rem;
  font-size: 0.75rem;
}

.map-primary-action {
  pointer-events: auto;
  box-sizing: border-box;
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--map-selected);
  background: var(--map-selected);
  color: #fff6e8;
  font: inherit;
  text-align: left;
  opacity: 1;
}

.map-primary-action:disabled {
  border-color: var(--map-border);
  background: var(--map-surface);
  color: var(--map-muted);
  cursor: not-allowed;
}

.expedition-progress {
  height: 0.5rem;
  margin-top: 0.7rem;
  border: 1px solid var(--map-border);
  background: #273033;
}

.expedition-progress span {
  display: block;
  height: 100%;
  background: var(--map-current);
}

@media (prefers-reduced-motion: reduce) {
  .svg-map-container,
  .destination-dialog,
  .expedition-journey,
  .expedition-journey * {
    animation: none;
    transition: none;
  }
}

@media (max-width: 860px) {
  .svg-map-container {
    min-height: 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .svg-map {
    height: auto;
    min-height: 380px;
    aspect-ratio: 4 / 3;
    border: 2px solid var(--map-border);
  }

  .expedition-journey {
    height: calc(100vh - 2rem);
    min-height: calc(100vh - 2rem);
  }

  .journey-graph {
    min-height: 640px;
  }

  .map-legend {
    position: static;
    margin-top: 0.5rem;
  }

  .map-card-stack {
    position: static;
    width: 100%;
    margin-top: 0.75rem;
    gap: 0.75rem;
  }

  .map-info-card {
    max-height: none;
    box-shadow: 3px 3px 0 rgb(0 0 0 / 55%);
  }

  .travel-corridors polyline {
    stroke-width: 0.9;
  }

  .svg-poi-label {
    font-size: 1.8px;
  }

  .svg-poi-state {
    font-size: 1.5px;
  }
}

@media (max-width: 500px) {
  .svg-map-page {
    padding: 0;
  }

  .svg-map {
    height: 100%;
    min-height: 100%;
    border: 0;
    background:
      radial-gradient(
        circle at 70% 36%,
        rgb(113 169 139 / 11%),
        transparent 28%
      ),
      radial-gradient(circle at 15% 78%, rgb(216 187 97 / 10%), transparent 25%),
      var(--map-surface);
  }

  .travel-corridors polyline {
    stroke-width: 1.4;
  }

  .svg-poi-label {
    fill: var(--map-foreground);
    font-size: 2.6px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .svg-poi-state {
    font-size: 1.65px;
  }

  .svg-map-heading {
    position: absolute;
    z-index: 2;
    width: auto;
    margin: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--map-current);
    background: rgb(17 24 28 / 94%);
    color: var(--map-current);
    font-size: 1.1rem;
  }

  .svg-map-container {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .svg-poi-marker {
    r: 3.2px;
    fill: var(--map-deep);
    stroke-width: 1.25;
  }

  .svg-poi-marker[data-state~="reachable"] {
    stroke-width: 2.25;
  }

  .svg-poi-marker[data-state~="current"] {
    r: 3.8px;
    stroke-width: 2.25;
  }

  .svg-poi-marker[data-state~="selected"] {
    r: 4px;
    stroke-width: 2.5;
  }

  .map-card-stack {
    display: none;
  }

  .map-legend {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    display: grid;
    gap: 0.55rem;
    padding: 0.9rem 1rem;
    border-color: var(--map-current);
    background: rgb(17 24 28 / 94%);
    font-size: 0.75rem;
  }

  .map-legend strong {
    color: var(--map-current);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .destination-dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.5rem 1rem 1rem;
    border-width: 2px 0 0;
    box-shadow: 0 -1rem 2rem rgb(0 0 0 / 35%);
  }

  .destination-dialog h2 {
    margin: 0 3rem 0.35rem 0;
    color: var(--map-selected);
    font-size: 1.45rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .dialog-close {
    display: grid;
    float: right;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border: 1px solid var(--map-current);
    border-radius: 50%;
    color: var(--map-current);
  }

  .destination-dialog-detail {
    padding: 0.75rem 0;
    border-block: 1px solid var(--map-border);
    color: var(--map-reachable);
    font-weight: 700;
  }

  .destination-dialog-note {
    margin: 1rem 0;
    color: var(--map-foreground);
    line-height: 1.55;
  }

  .destination-dialog .map-primary-action {
    margin: 0;
    padding: 1rem;
    border-color: var(--map-current);
    background: var(--map-current);
    color: var(--map-deep);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-align: center;
  }

  .svg-map-page:has(.expedition-journey) .svg-map-heading {
    display: none;
  }

  .expedition-journey {
    height: 100dvh;
    min-height: 100dvh;
    background:
      radial-gradient(
        circle at 50% 80%,
        rgb(113 169 139 / 16%),
        transparent 28%
      ),
      radial-gradient(circle at 50% 20%, rgb(187 83 62 / 16%), transparent 25%),
      url("/static/assets/terrain-backdrop.png") center / cover,
      var(--map-deep);
  }

  .journey-header {
    min-height: 5.5rem;
    padding: 1rem;
    border: 1px solid var(--map-current);
    background: rgb(21 28 32 / 96%);
  }

  .journey-header strong,
  .journey-header [data-journey-destination] {
    display: block;
    margin-left: 0;
  }

  .journey-header strong {
    color: var(--map-selected);
    font-size: 1.15rem;
    letter-spacing: 0.07em;
  }

  .journey-header [data-journey-destination] {
    margin-top: 0.45rem;
    color: var(--map-foreground);
    font-family: Georgia, serif;
    font-size: 1.1rem;
  }

  .journey-graph {
    min-height: 0;
    background: rgb(8 11 13 / 12%);
  }

  .journey-graph [data-layer="expedition-edges"] line {
    stroke: #665e4d;
    stroke-width: 1.1;
  }

  .journey-graph [data-layer="expedition-edges"] line[data-state="available"] {
    stroke: var(--map-reachable);
    stroke-width: 1.8;
  }

  .journey-graph .expedition-node-marker {
    fill: var(--map-deep);
    stroke: #4f4a42;
    stroke-width: 1.1;
  }

  .journey-graph .expedition-node-marker[data-state="available"] {
    fill: #10251e;
    stroke: var(--map-reachable);
    stroke-width: 1.35;
  }

  .journey-graph .expedition-node-marker[data-state="current"] {
    stroke: var(--map-current);
    stroke-width: 1.7;
  }

  .journey-graph .expedition-node-marker[data-state="destination"] {
    stroke: var(--map-selected);
    stroke-width: 1.7;
  }

  .journey-completion {
    border-top-color: var(--map-current);
    background: var(--map-card);
  }
}

.map-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

#canvas-container {
  height: 75vh;
  width: 100%;
  background: #000;
  position: relative;
  border-bottom: 2px solid #1f2933;
}

#world-map {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

#side-panel {
  flex-grow: 1;
  background: #1a202c;
  color: #fff;
  padding: 1rem;
  overflow-y: auto;
}

#side-panel h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

#landmark-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.landmark-control {
  border: 1px solid #a0aec0;
  border-radius: 0.25rem;
  background: #2d3748;
  color: #fff;
  cursor: pointer;
  padding: 0.5rem;
}

.landmark-control[aria-pressed="true"] {
  border-color: #90cdf4;
  background: #2b6cb0;
}

.simulate-button {
  width: 100%;
  background-color: #3182ce;
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-bottom: 2rem;
}

.simulate-button:hover {
  background-color: #2b6cb0;
}

.version-tag {
  font-size: 0.75rem;
  color: #718096;
  margin-bottom: 1rem;
}

#activity-log {
  list-style: none;
  padding: 0;
  margin: 0;
}

#activity-log li {
  margin-bottom: 0.5rem;
}

.log-entry {
  padding: 0.5rem;
  background-color: #2d3748;
  border-radius: 0.25rem;
  border: 1px solid #4a5568;
}

.log-entry p {
  margin: 0;
  font-size: 0.875rem;
}

.placeholder-text {
  color: #a0aec0;
  font-size: 0.875rem;
}

.journey-graph [data-expedition-choice]:focus-visible .expedition-node-marker {
  stroke: var(--map-foreground);
  stroke-width: 2;
}
