:root {
  --bg: #f3f0e7;
  --panel: rgba(255, 252, 245, 0.82);
  --panel-strong: rgba(255, 252, 245, 0.96);
  --text: #18212f;
  --muted: #5f6a79;
  --line: rgba(24, 33, 47, 0.16);
  --shadow: 0 22px 60px rgba(38, 48, 66, 0.14);
  --accent: #155eef;
  --accent-soft: #dbe8ff;
  --stream: #0f766e;
  --stream-soft: #d8f3ee;
  --outcome: #9a3412;
  --outcome-soft: #ffe6d8;
  --card: #ffffff;
  --task-chip: rgba(21, 94, 239, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(21, 94, 239, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 22%),
    linear-gradient(180deg, #f9f6ee 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Source Sans 3", sans-serif;
}

body {
  padding: 16px;
}

.app-shell {
  width: min(1400px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.topbar,
.summary-panel {
  backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 18px 20px;
}

.eyebrow,
.panel-label,
.select-wrap span {
  margin: 0 0 6px;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

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

h1,
h2 {
  font-family: "Manrope", sans-serif;
}

h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.select-wrap {
  display: grid;
  min-width: 220px;
}

select {
  appearance: none;
  border: 1px solid rgba(24, 33, 47, 0.12);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.summary-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
}

.diagram-subtitle {
  color: var(--muted);
  max-width: 72ch;
  margin-top: 6px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.stream-dot {
  background: var(--stream);
}

.support-dot {
  background: var(--accent);
}

.canvas-shell {
  overflow: auto;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58)),
    linear-gradient(90deg, rgba(21, 94, 239, 0.05), rgba(15, 118, 110, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.canvas {
  position: relative;
  min-height: 520px;
  min-width: 1100px;
  padding: 28px;
}

.diagram-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.node {
  position: absolute;
  width: 220px;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid rgba(24, 33, 47, 0.08);
  box-shadow:
    0 16px 30px rgba(25, 35, 52, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  display: grid;
  gap: 12px;
}

.node::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  border-radius: 22px 0 0 22px;
}

.node-support::before {
  background: linear-gradient(180deg, #155eef, #4f89ff);
}

.node-stream::before {
  background: linear-gradient(180deg, #0f766e, #2ea89f);
}

.node-outcome::before {
  background: linear-gradient(180deg, #c2410c, #f97316);
}

.node-main {
  font-size: 1.02rem;
  line-height: 1.24;
  font-weight: 700;
  font-family: "Manrope", sans-serif;
  padding-right: 8px;
}

.node-task {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--accent);
  background: var(--task-chip);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 700;
}

.node-task::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.node-note {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.25;
}

.stream-band {
  position: absolute;
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.04)),
    rgba(255, 255, 255, 0.42);
  border: 1px dashed rgba(15, 118, 110, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.stream-band-label {
  position: absolute;
  top: 10px;
  left: 16px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stream);
}

.arrow-path {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.arrow-support {
  stroke: rgba(21, 94, 239, 0.72);
}

.arrow-stream {
  stroke: rgba(15, 118, 110, 0.74);
}

.arrow-outcome {
  stroke: rgba(154, 52, 18, 0.66);
}

.arrow-label {
  font-size: 12px;
  font-weight: 700;
  fill: rgba(24, 33, 47, 0.64);
}

@media (max-width: 820px) {
  body {
    padding: 10px;
  }

  .topbar,
  .summary-panel {
    border-radius: 20px;
    padding: 14px;
  }

  .topbar,
  .summary-panel {
    align-items: start;
    flex-direction: column;
  }

  .controls,
  .select-wrap {
    width: 100%;
  }

  .select-wrap {
    min-width: 0;
  }

  select {
    width: 100%;
  }

  .canvas {
    min-height: 440px;
    min-width: 980px;
    padding: 20px;
  }

  .node {
    width: 190px;
    min-height: 122px;
    padding: 12px 14px;
  }
}
