:root {
  --ink: #1f1b15;
  --paper: #fff7e6;
  --paper-deep: #ffe8b8;
  --sky: #d8f6fb;
  --shell: #f7672b;
  --shell-dark: #cb4015;
  --lime: #d4ff5c;
  --sea: #1e90a8;
  --gold: #ffbd32;
  --danger: #b92b24;
  --line: rgba(31, 27, 21, 0.18);
  --shadow: 0 14px 0 rgba(31, 27, 21, 0.92);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next Condensed", "Arial Black", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.55) 0 2px, transparent 3px 100%),
    radial-gradient(circle at 88% 14%, rgba(255, 255, 255, 0.4) 0 2px, transparent 3px 100%),
    linear-gradient(140deg, #f6b04d 0%, #ffe59b 28%, #a7ebf4 100%);
  background-size: 24px 24px, 28px 28px, auto;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.map-shell {
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.map-hero,
.board-panel,
.detail-panel {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 30px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.map-hero::after,
.board-panel::after,
.detail-panel::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 2px dashed rgba(31, 27, 21, 0.16);
  border-radius: 20px;
  pointer-events: none;
}

.map-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  padding: 28px 30px;
}

.map-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: rgba(31, 27, 21, 0.7);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Impact, "Arial Black", "Trebuchet MS", sans-serif;
  letter-spacing: 0.04em;
}

h1 {
  font-size: clamp(3rem, 6vw, 5.4rem);
  line-height: 0.95;
  max-width: 9ch;
}

h2 {
  font-size: clamp(1.7rem, 2vw, 2.2rem);
}

.map-lede,
.detail-blurb {
  max-width: 72ch;
  margin: 18px 0 0;
  font-size: 1.02rem;
  line-height: 1.6;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  align-self: start;
  position: relative;
  z-index: 1;
}

.map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--shell);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 0 rgba(31, 27, 21, 0.9);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.map-link:hover {
  transform: translateY(2px);
  box-shadow: 0 6px 0 rgba(31, 27, 21, 0.9);
}

.map-link.ghost {
  background: #fff;
  color: var(--ink);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.stat-card {
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: linear-gradient(180deg, #fffdf6, #fff1ce);
  padding: 14px 16px;
  box-shadow: 0 8px 0 rgba(31, 27, 21, 0.86);
}

.stat-card strong {
  display: block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
}

.stat-card span {
  display: block;
  margin-top: 4px;
  font-size: 0.86rem;
  color: rgba(31, 27, 21, 0.7);
}

.map-main {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.55fr);
  gap: 22px;
  margin-top: 22px;
}

.board-panel,
.detail-panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  position: relative;
  z-index: 1;
}

.panel-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.board-notes,
.detail-notes {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.note-chip,
.detail-note {
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #fffef8;
  padding: 12px 14px;
  box-shadow: 0 7px 0 rgba(31, 27, 21, 0.82);
  line-height: 1.45;
}

.error-strip {
  margin-top: 18px;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: #ffe0da;
  box-shadow: 0 8px 0 rgba(31, 27, 21, 0.85);
  position: relative;
  z-index: 1;
}

.error-lines {
  margin-top: 8px;
  line-height: 1.5;
}

.graph-scroll {
  margin-top: 18px;
  overflow: auto;
  padding-bottom: 8px;
  position: relative;
  z-index: 1;
}

.graph-stage-shell {
  min-width: 1748px;
}

.lane-legend {
  display: grid;
  grid-template-columns: 260px 440px 440px 220px 260px;
  gap: 16px;
  margin-bottom: 14px;
}

.lane-legend-card {
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 14px;
  background: linear-gradient(180deg, #fffef7, #ffeab9);
  box-shadow: 0 8px 0 rgba(31, 27, 21, 0.84);
}

.lane-legend-card strong {
  display: block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.2rem;
}

.lane-legend-card span {
  display: block;
  margin-top: 4px;
  color: rgba(31, 27, 21, 0.72);
  line-height: 1.4;
}

.graph-stage {
  position: relative;
  min-height: 920px;
  border: 4px solid var(--ink);
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(rgba(31, 27, 21, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 27, 21, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 245, 220, 0.86));
  background-size: 44px 44px, 44px 44px, auto;
}

.lane-column {
  position: absolute;
  top: 0;
  bottom: 0;
  border-right: 2px dashed rgba(31, 27, 21, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
}

.lane-column:last-child {
  border-right: 0;
}

.graph-links,
.graph-nodes {
  position: absolute;
  inset: 0;
}

.graph-links {
  pointer-events: none;
  overflow: visible;
}

.graph-nodes {
  pointer-events: auto;
}

.graph-link {
  fill: none;
  stroke-linecap: round;
  opacity: 0.56;
}

.graph-link.tone-channel {
  stroke: var(--shell);
}

.graph-link.tone-route {
  stroke: var(--sea);
}

.graph-link.tone-sync {
  stroke: rgba(31, 27, 21, 0.55);
  stroke-dasharray: 10 10;
}

.graph-link.tone-token {
  stroke: #166b63;
}

.graph-link.tone-config {
  stroke: #ab6d00;
}

.graph-link.is-dimmed {
  opacity: 0.12;
}

.graph-link.is-active {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.88));
}

.node-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  appearance: none;
  width: 204px;
  height: 286px;
  border: 4px solid var(--ink);
  border-radius: 26px;
  padding: 14px;
  font: inherit;
  text-align: left;
  background: #fffdf5;
  box-shadow: 0 10px 0 rgba(31, 27, 21, 0.86);
  cursor: pointer;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.node-card:hover {
  transform: translateY(-3px);
}

.node-card.is-active {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 14px 0 rgba(31, 27, 21, 0.92);
  border-color: var(--shell-dark);
}

.node-card.is-dimmed {
  opacity: 0.38;
}

.node-card.type-channel {
  background: linear-gradient(180deg, #fff4e0, #ffd7a8);
}

.node-card.type-gateway {
  background: linear-gradient(180deg, #fff7d7, #ffe387);
}

.node-card.type-host {
  background: linear-gradient(180deg, #eefcff, #c8f4ff);
}

.node-card.type-agent {
  background: linear-gradient(180deg, #fffef8, #ffe8d0);
}

.node-card.type-assistant {
  background: linear-gradient(180deg, #f7fbff, #d7e4ff);
}

.node-card.type-provider,
.node-card.type-settings {
  background: linear-gradient(180deg, #fbfff0, #e0f8a8);
}

.node-card.status-attention {
  box-shadow: 0 10px 0 rgba(185, 43, 36, 0.88);
}

.node-card.status-idle {
  box-shadow: 0 10px 0 rgba(31, 27, 21, 0.46);
}

.node-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.node-title {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.node-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 900;
}

.node-badge.band-2 {
  background: #fff0bb;
}

.node-badge.band-3 {
  background: #ffd27d;
}

.node-badge.band-4 {
  background: #ff9b60;
}

.node-subtitle {
  margin: 8px 0 0;
  min-height: 28px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: rgba(31, 27, 21, 0.72);
}

.node-summary {
  margin: 8px 0 0;
  min-height: 50px;
  font-size: 0.77rem;
  line-height: 1.45;
  color: rgba(31, 27, 21, 0.88);
}

.node-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.node-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.68rem;
  font-weight: 800;
}

.node-highlights {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.node-highlight {
  border-left: 3px solid var(--ink);
  padding-left: 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(31, 27, 21, 0.8);
}

.node-platform {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.node-platform-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 2px solid rgba(31, 27, 21, 0.82);
  border-radius: 999px;
  background: rgba(212, 255, 92, 0.9);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.node-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.node-metric {
  border: 2px solid rgba(31, 27, 21, 0.18);
  border-radius: 16px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.72);
}

.node-metric span {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(31, 27, 21, 0.6);
}

.node-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
  line-height: 1.25;
}

.detail-panel {
  min-height: 680px;
}

.detail-sections {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.detail-section {
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: #fffef8;
  padding: 16px;
  box-shadow: 0 8px 0 rgba(31, 27, 21, 0.82);
}

.detail-section h3 {
  font-size: 1.2rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.detail-item {
  border: 2px solid rgba(31, 27, 21, 0.14);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.detail-item span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(31, 27, 21, 0.6);
}

.detail-item strong {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
  word-break: break-word;
}

@media (max-width: 1280px) {
  .map-main {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .map-shell {
    padding: 16px 16px 36px;
  }

  .map-hero {
    grid-template-columns: 1fr;
  }

  .map-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .board-panel,
  .detail-panel {
    padding: 18px;
  }

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