@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
  --sky: #5ab5c8;
  --sky-light: #7dcad8;
  --blossom: #f2bdd0;
  --blossom-deep: #e89ab5;
  --cloud: #f8efe8;
  --green: #1d3808;
  --green-dark: #5a9a28;
  --trunk-dark: #3a3340;
  --trunk-mid: #6b6470;
  --trunk-light: #9da4a8;
  --house-blue: #6888a8;
  --house-dark: #4a6280;
  --roof-red: #d45840;
  --white-bloom: #e8f0f0;
  --ground: #8faab8;
  --tree-bark: #270b10;
  --page-ink: var(--trunk-dark);
  --branch-shadow: rgba(58, 51, 64, 0.26);
  --branch-shell: var(--tree-bark);
  --tree-outline-glow: rgba(242, 189, 208, 0.18);
  --branch-highlight: rgba(232, 240, 240, 0.24);
  --branch-ridge: rgba(157, 164, 168, 0.34);
  --branch-furrow: rgba(58, 51, 64, 0.32);
  --node-core: var(--blossom-deep);
  --node-glow: rgba(242, 189, 208, 0.36);
  --bud-fill: rgba(242, 189, 208, 0.92);
  --bud-stroke: rgba(232, 240, 240, 0.78);
  --tooltip-fill: rgba(248, 239, 232, 0.96);
  --tooltip-stroke: rgba(104, 136, 168, 0.22);
  --tooltip-shadow: rgba(58, 51, 64, 0.14);
  --tip-ring: rgba(104, 136, 168, 0.56);
  --tip-ring-hover: rgba(90, 181, 200, 0.92);
  --tip-plus: rgba(74, 98, 128, 0.9);
  --tip-plus-hover: rgba(212, 88, 64, 1);
  --tip-surface: rgba(248, 239, 232, 0.96);
  --tip-loading: rgba(232, 240, 240, 0.98);
  --tip-error: rgba(242, 189, 208, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: var(--green);
}

body {
  position: relative;
  color: var(--page-ink);
  background: #f8f8f8;
  font-family: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body::before {
  display: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 12px 12px 0;
}

.app-brand {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #000;
}

.app-brand-logo {
  display: block;
  width: auto;
  height: 26px;
  flex: 0 0 auto;
}

.app-brand-name {
  display: inline-block;
  color: inherit;
  font: 700 26px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.03em;
  text-transform: lowercase;
}

.build-banner {
  width: min(100%, 960px);
  margin: 0 auto 8px;
  padding: 7px 12px;
  border: 1px solid rgba(104, 136, 168, 0.18);
  border-radius: 999px;
  background: rgba(90, 181, 200, 0.92);
  color: var(--trunk-dark);
  font:
    700 12px/1.25 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(104, 136, 168, 0.14);
}

.canvas-frame {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  aspect-ratio: 1000 / 720;
  overflow: clip;
  cursor: grab;
  isolation: isolate;
}

.canvas-frame.is-panning {
  cursor: grabbing;
}

.canvas-frame.is-panning * {
  cursor: grabbing !important;
}

.petal-particles {
  pointer-events: none;
}

.petal-particle {
  display: block;
  width: 22px;
  height: 22px;
  opacity: 0;
  filter: drop-shadow(0 5px 9px rgba(242, 189, 208, 0.32));
  overflow: visible;
  pointer-events: none;
}

.petal-particle-shape {
  vector-effect: non-scaling-stroke;
}

.canvas-hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  padding: 8px 12px;
  border: 1px solid rgba(232, 154, 181, 0.24);
  border-radius: 999px;
  background: rgba(58, 51, 64, 0.54);
  color: rgba(248, 239, 232, 0.96);
  font:
    700 11px/1.2 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.canvas-legend {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 13px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  background: rgba(248, 248, 248, 0.92);
  font:
    600 11px/1.25 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  color: rgba(40, 40, 40, 0.92);
  backdrop-filter: blur(10px);
  pointer-events: none;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
}

.canvas-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.canvas-legend-dot.is-pending {
  background: rgba(255, 247, 226, 1);
  border: 1.5px solid rgba(196, 138, 30, 0.92);
  box-shadow: 0 0 0 2px rgba(232, 178, 60, 0.3);
}

.canvas-legend-dot.is-complete {
  background: rgba(46, 132, 70, 1);
  box-shadow: 0 0 0 2px rgba(46, 132, 70, 0.25);
}

.canvas-legend-dot.is-prereq {
  background: rgba(196, 138, 30, 1);
  box-shadow: 0 0 0 2px rgba(232, 178, 60, 0.3);
}

.discovery-toast {
  position: absolute;
  left: 50%;
  top: 28px;
  transform: translate(-50%, -10px);
  z-index: 22;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(46, 132, 70, 0.96);
  color: rgba(255, 255, 255, 1);
  font:
    700 14px/1.3 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms ease, transform 280ms ease;
  max-width: min(540px, calc(100vw - 48px));
  text-align: center;
}

.discovery-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.space-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  z-index: 25;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.92);
  color: rgba(255, 255, 255, 0.98);
  font:
    600 13px/1.3 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  max-width: calc(100vw - 48px);
}

.space-hint:not([hidden]) {
  opacity: 1;
  transform: translate(-50%, 0);
}

.space-hint kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font:
    700 11px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.04em;
}

.canvas-zoom {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(64px, env(safe-area-inset-bottom));
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(248, 248, 248, 0.9);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
}

.canvas-zoom-button,
.canvas-zoom-readout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.88);
  border-radius: 999px;
  background: rgba(248, 248, 248, 0.96);
  color: #000;
  font-family: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  transition:
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease,
    opacity 140ms ease;
}

.canvas-zoom-button {
  padding: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.canvas-zoom-readout {
  min-width: 72px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.canvas-zoom-button:hover,
.canvas-zoom-readout:hover {
  background: rgba(29, 56, 8, 0.08);
  transform: translateY(-1px);
}

.canvas-zoom-button:disabled,
.canvas-zoom-readout:disabled {
  opacity: 0.42;
  cursor: default;
  transform: none;
}

.node-info-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4;
  width: min(340px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px 18px;
  border: 1px solid rgba(0, 0, 0, 0.84);
  border-radius: 20px;
  background: rgba(248, 248, 248, 0.94);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
  font-family: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-info-eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font: 700 11px/1.2 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.node-info-title {
  margin: 0;
  color: #000;
  font: 700 34px/0.98 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-info-summary {
  margin: 10px 0 0;
  color: rgba(0, 0, 0, 0.82);
  font: 400 13px/1.65 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-info-hint {
  margin: 10px 0 0;
  color: var(--green);
  font: 700 11px/1.4 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.node-info-meta {
  margin: 18px 0 0;
}

.node-info-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(29, 56, 8, 0.14);
}

.node-info-row dt {
  margin: 0;
  color: rgba(29, 56, 8, 0.82);
  font: 700 11px/1.2 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.node-info-row dd {
  margin: 0;
  color: #000;
  font: 400 12px/1.65 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  word-break: break-word;
}

.node-info-extra {
  margin-top: 18px;
  padding-top: 4px;
}

.node-info-extra h3 {
  margin: 0 0 8px;
  color: #000;
  font: 700 22px/1.05 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-info-empty {
  padding: 12px 14px;
  border: 1px solid rgba(29, 56, 8, 0.14);
  border-radius: 16px;
  background: rgba(29, 56, 8, 0.06);
  color: rgba(0, 0, 0, 0.72);
  font: 400 12px/1.6 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-info-empty[hidden] {
  display: none;
}

.node-info-meta-list {
  margin-top: 4px;
}

.node-info-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.node-info-explain,
.node-info-cta {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font: 700 12px/1.3 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.04em;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.node-info-explain {
  border: 1.5px solid rgba(104, 136, 168, 0.3);
  background: transparent;
  color: var(--house-blue, #5a7fa0);
}

.node-info-explain:hover {
  background: rgba(104, 136, 168, 0.08);
  border-color: var(--house-blue, #5a7fa0);
}

.node-info-cta {
  border: 1.5px solid rgba(29, 56, 8, 0.3);
  background: transparent;
  color: var(--green);
}

.node-info-cta:hover {
  background: rgba(29, 56, 8, 0.07);
  border-color: var(--green);
}

.node-info-explain[hidden],
.node-info-cta[hidden] {
  display: none;
}

.node-detail-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(8px);
}

.node-detail-layer[hidden] {
  display: none;
}

.node-detail-panel {
  width: min(720px, calc(100vw - 16px));
  max-height: min(78vh, calc(100vh - 16px));
  overflow: auto;
  padding: 24px 24px 22px;
  border: 1px solid rgba(0, 0, 0, 0.84);
  border-radius: 22px;
  background: rgba(248, 248, 248, 0.97);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
  font-family: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.node-detail-eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font: 700 11px/1.2 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.node-detail-title {
  margin: 0;
  color: #000;
  font: 700 40px/0.96 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-detail-path {
  margin: 10px 0 0;
  color: rgba(29, 56, 8, 0.82);
  font: 400 12px/1.6 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-detail-close {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid #000;
  border-radius: 999px;
  background: #000;
  color: rgba(248, 248, 248, 0.98);
  font: 700 11px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.node-detail-close:hover {
  background: var(--green);
  border-color: var(--green);
}

.node-detail-body {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(29, 56, 8, 0.14);
  color: #000;
  font: 400 13px/1.8 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  white-space: pre-wrap;
}

.node-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.node-detail-cta,
.node-detail-explain {
  padding: 11px 18px;
  border-radius: 999px;
  cursor: pointer;
  font: 700 12px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.06em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.node-detail-cta {
  border: 1.5px solid var(--green);
  background: var(--green);
  color: #fff;
}

.node-detail-cta:hover {
  background: #1a4a06;
  border-color: #1a4a06;
}

.node-detail-explain {
  border: 1.5px solid rgba(104, 136, 168, 0.4);
  background: transparent;
  color: var(--house-blue, #5a7fa0);
}

.node-detail-explain:hover {
  background: rgba(104, 136, 168, 0.08);
  border-color: var(--house-blue, #5a7fa0);
}

.node-detail-cta[hidden],
.node-detail-explain[hidden] {
  display: none;
}

.node-detail-status {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  font: 700 12px/1.55 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-detail-status[hidden] {
  display: none;
}

.node-detail-status[data-tone="info"] {
  background: rgba(104, 136, 168, 0.08);
  color: var(--house-blue, #5a7fa0);
}

.node-detail-status[data-tone="success"] {
  background: rgba(29, 56, 8, 0.08);
  color: var(--green);
}

.node-detail-status[data-tone="error"] {
  background: rgba(173, 77, 56, 0.1);
  color: #a3442f;
}

@keyframes flourishFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.node-detail-insights {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.node-detail-insights[hidden] {
  display: none;
}

.node-detail-insight-intro {
  margin: 0;
  padding: 20px 22px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.96), rgba(244, 231, 238, 0.9));
  border: 1px solid rgba(192, 137, 161, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  animation: flourishFadeUp 320ms ease both;
}

.node-detail-insight-kicker {
  margin: 0 0 10px;
  color: #9a5d73;
  font: 700 11px/1.2 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.node-detail-insight-title {
  margin: 0;
  color: #2f1420;
  font: 700 30px/1.06 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-detail-insight-body {
  margin: 12px 0 0;
  color: rgba(0, 0, 0, 0.84);
  font: 400 14px/1.8 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  white-space: pre-wrap;
}

.node-detail-insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.node-detail-insight-card {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(29, 56, 8, 0.1);
  border-left-width: 3px;
  background: rgba(255, 255, 255, 0.86);
  opacity: 0;
  animation: flourishFadeUp 260ms ease both;
}

.node-detail-insight-grid .node-detail-insight-card:nth-child(1) { animation-delay: 80ms; }
.node-detail-insight-grid .node-detail-insight-card:nth-child(2) { animation-delay: 170ms; }
.node-detail-insight-grid .node-detail-insight-card:nth-child(3) { animation-delay: 260ms; }
.node-detail-insight-grid .node-detail-insight-card:nth-child(4) { animation-delay: 350ms; }

.node-detail-insight-card[data-tone="analogy"] {
  background: rgba(104, 136, 168, 0.07);
  border-color: rgba(104, 136, 168, 0.18);
  border-left-color: var(--house-blue);
}

.node-detail-insight-card[data-tone="example"] {
  background: rgba(255, 242, 223, 0.72);
  border-color: rgba(180, 138, 52, 0.16);
  border-left-color: #b48a34;
}

.node-detail-insight-card[data-tone="support"] {
  background: rgba(237, 247, 230, 0.82);
  border-color: rgba(29, 56, 8, 0.14);
  border-left-color: var(--green);
}

.node-detail-insight-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.node-detail-insight-step {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.07);
  color: rgba(0, 0, 0, 0.44);
  font: 700 10px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.node-detail-insight-card-title {
  margin: 0;
  color: #1f2015;
  font: 700 11px/1.3 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.node-detail-insight-nudge {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(29, 56, 8, 0.05);
  color: rgba(29, 56, 8, 0.72);
  font: 400 13px/1.65 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  text-align: center;
  font-style: italic;
  animation: flourishFadeUp 260ms ease both;
  animation-delay: 440ms;
  opacity: 0;
}

#treeSvg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: none;
  position: relative;
  z-index: 1;
}

#treeMotion {
  transform-box: view-box;
  transform-origin: 500px 690px;
  animation: treeSway 7600ms cubic-bezier(0.42, 0, 0.2, 1) infinite;
  will-change: transform;
}

.branch-shadow {
  fill: var(--branch-shadow);
  pointer-events: none;
}

.branch-outline-glow {
  fill: var(--tree-outline-glow);
  filter: blur(5px);
  pointer-events: none;
}

.branch-shell {
  fill: var(--branch-shell);
  pointer-events: none;
}

.branch-surface {
  pointer-events: none;
}

.branch-grain-overlay {
  fill: var(--branch-shell);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.branch-gradient-stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.branch-bark-ridge,
.branch-bark-furrow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.branch-bark-ridge {
  stroke: var(--branch-ridge);
}

.branch-bark-furrow {
  stroke: var(--branch-furrow);
}

.branch-highlight {
  fill: none;
  stroke: var(--branch-highlight);
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.branch-preview-pulse,
.branch-preview-pulse-glow {
  pointer-events: none;
}

.branch-preview-pulse {
  fill: rgba(242, 189, 208, 0.18);
  mix-blend-mode: screen;
}

.branch-preview-pulse-glow {
  fill: rgba(242, 189, 208, 0.28);
  filter: blur(8px);
}

.branch-enchant-glow,
.branch-enchant-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.branch-enchant-glow {
  filter: blur(4px);
  mix-blend-mode: screen;
}

.branch-enchant-core {
  filter: drop-shadow(0 0 5px rgba(242, 189, 208, 0.42));
}

.branch-hit {
  fill: none;
  stroke: transparent;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
}

.node-core {
  fill: var(--node-core);
  pointer-events: none;
}

.node-glow {
  fill: var(--node-glow);
  pointer-events: none;
}

.topic-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.topic-tooltip-plate {
  fill: var(--tooltip-fill);
  stroke: var(--tooltip-stroke);
  stroke-width: 1;
  filter: drop-shadow(0 6px 14px var(--tooltip-shadow));
  pointer-events: none;
}

.topic-tooltip-text {
  fill: var(--trunk-dark);
  font:
    700 12px/1.2 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  pointer-events: none;
}

.tree-base-topic {
  fill: rgba(248, 248, 248, 0.98);
  stroke: rgba(29, 56, 8, 0.42);
  stroke-width: 6px;
  paint-order: stroke fill;
  font-family: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.tip-button {
  cursor: pointer;
}

.tip-glow {
  fill: rgba(242, 189, 208, 0.34);
  transition: fill 150ms ease, opacity 150ms ease;
}

.tip-ring {
  fill: var(--tip-surface);
  stroke: var(--tip-ring);
  stroke-width: 0.95;
  transition:
    fill 150ms ease,
    stroke 150ms ease,
    opacity 150ms ease;
}

.tip-plus {
  stroke: var(--tip-plus);
  stroke-width: 1.45;
  stroke-linecap: round;
  transition: stroke 150ms ease, opacity 150ms ease;
}

.tip-button:hover .tip-glow {
  fill: rgba(242, 189, 208, 0.56);
}

.tip-button:hover .tip-ring {
  stroke: var(--tip-ring-hover);
  fill: rgba(248, 239, 232, 0.98);
}

.tip-button:hover .tip-plus {
  stroke: var(--tip-plus-hover);
}

.tip-button.is-disabled {
  pointer-events: none;
  opacity: 0.46;
}

.tip-button.is-loading .tip-ring {
  fill: var(--tip-loading);
  stroke: rgba(104, 136, 168, 0.52);
}

.tip-button.is-loading .tip-plus {
  stroke: rgba(104, 136, 168, 0.76);
  animation: tipPulse 900ms ease-in-out infinite alternate;
}

.tip-button.is-error .tip-ring {
  fill: var(--tip-error);
  stroke: rgba(212, 88, 64, 0.64);
}

.tip-button.is-error .tip-plus {
  stroke: rgba(212, 88, 64, 0.96);
}

/* Quiz-pending tip-button: amber ? glyph */
.tip-button.is-quiz .tip-glow {
  fill: rgba(232, 178, 60, 0.36);
}
.tip-button.is-quiz .tip-ring {
  stroke: rgba(196, 138, 30, 0.92);
  stroke-width: 1.15;
  fill: rgba(255, 247, 226, 0.98);
  animation: nodePendingPulse 1700ms ease-in-out infinite;
}
.tip-button.is-quiz .tip-question {
  fill: rgba(150, 96, 12, 1);
  font:
    700 7.4px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  pointer-events: none;
  user-select: none;
}
.tip-button.is-quiz:hover .tip-glow {
  fill: rgba(232, 178, 60, 0.6);
}
.tip-button.is-quiz:hover .tip-ring {
  stroke: rgba(150, 96, 12, 1);
  fill: rgba(255, 251, 240, 1);
}
.tip-button.is-quiz:hover .tip-question {
  fill: rgba(110, 64, 4, 1);
}

/* Node state: pending (has unanswered question) — amber pulsing ring */
.node-pending-ring {
  fill: none;
  stroke: rgba(196, 138, 30, 0.85);
  stroke-width: 1.2;
  pointer-events: none;
  animation: nodePendingPulse 1700ms ease-in-out infinite;
}
@keyframes nodePendingPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Node state: complete — green check, brighter core */
.node-core.is-complete {
  fill: rgba(46, 132, 70, 1);
}
.node-glow.is-complete {
  fill: rgba(46, 132, 70, 0.34);
}
.node-complete-check {
  fill: none;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Node state: locked — dim, slightly desaturated */
.node-core.is-locked {
  fill: rgba(120, 120, 120, 0.72);
}
.node-glow.is-locked {
  fill: rgba(120, 120, 120, 0.18);
}

/* Node state: prerequisite — soft amber tint */
.node-core.is-prereq {
  fill: rgba(196, 138, 30, 1);
}
.node-glow.is-prereq {
  fill: rgba(232, 178, 60, 0.4);
}

@keyframes tipPulse {
  from {
    opacity: 0.5;
  }

  to {
    opacity: 1;
  }
}

@keyframes treeSway {
  0% {
    transform: translateX(-1.8px) rotate(-0.8deg);
  }

  20% {
    transform: translateX(-1.1px) translateY(-0.45px) rotate(-0.46deg);
  }

  40% {
    transform: translateX(0.45px) translateY(0.22px) rotate(0.08deg);
  }

  60% {
    transform: translateX(1.75px) translateY(0.08px) rotate(0.54deg);
  }

  80% {
    transform: translateX(0.35px) translateY(-0.28px) rotate(0.02deg);
  }

  100% {
    transform: translateX(-1.8px) rotate(-0.8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #treeMotion {
    animation: none;
  }

  .petal-particles {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding-inline: 8px;
  }

  .canvas-frame {
    aspect-ratio: auto;
    min-height: 760px;
  }

  .node-info-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: min(48vh, 360px);
    padding: 18px 16px;
  }

  .canvas-hint {
    left: 10px;
    bottom: calc(min(48vh, 360px) + 22px);
  }

  .canvas-zoom {
    left: max(10px, env(safe-area-inset-left));
    bottom: calc(min(48vh, 360px) + 68px + env(safe-area-inset-bottom));
    gap: 6px;
    padding: 7px;
  }

  .canvas-zoom-button,
  .canvas-zoom-readout {
    height: 38px;
  }

  .canvas-zoom-button {
    min-width: 38px;
    font-size: 22px;
  }

  .canvas-zoom-readout {
    min-width: 66px;
    padding-inline: 14px;
    font-size: 12px;
  }

  .node-detail-layer {
    padding: 10px;
  }

  .node-detail-panel {
    width: 100%;
    max-height: calc(100vh - 8px);
    padding: 20px 18px 18px;
  }

  .node-detail-header {
    flex-direction: column;
  }

  .node-detail-title {
    font-size: 32px;
  }

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

  .node-detail-insight-title {
    font-size: 24px;
  }
}

.topic-modal[hidden],
.question-panel[hidden],
.question-panel-status[hidden],
.topic-modal-status[hidden] {
  display: none;
}

.topic-modal {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 28px;
  pointer-events: none;
}

.topic-modal-card {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 280ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.topic-modal.is-exiting .topic-modal-card {
  opacity: 0;
  transform: translateY(34px);
}

.topic-modal-title {
  margin: 0 0 16px;
  color: #000;
  text-align: center;
  font: 700 32px/1.02 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.03em;
  text-shadow: none;
}

.topic-modal-form {
  margin: 0;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.topic-modal-status {
  margin: 10px 0 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #000;
  text-align: center;
  font: 400 13px/1.55 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.topic-modal-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topic-modal-input,
.question-panel-input {
  width: 100%;
  border: 1px solid rgba(104, 136, 168, 0.22);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--trunk-dark);
  font: 400 15px/1.5 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.topic-modal-input {
  min-height: 66px;
  padding: 0 20px;
  border: 1.5px solid #000;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: #000;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.topic-modal-input::placeholder,
.question-panel-input::placeholder {
  color: rgba(39, 11, 16, 0.48);
}

.topic-modal-input:focus,
.question-panel-input:focus {
  outline: none;
  border-color: #000;
  background: transparent;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.topic-modal-submit,
.question-panel-submit,
.question-panel-reset,
.question-panel-close,
.topic-chip {
  border: 0;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.topic-modal-submit,
.question-panel-submit {
  padding: 0 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--roof-red), #dc765f);
  color: rgba(248, 239, 232, 0.98);
  font:
    700 13px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.04em;
  box-shadow: 0 16px 30px rgba(212, 88, 64, 0.24);
}

.topic-modal-submit {
  min-height: 48px;
  padding: 0 22px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topic-modal-submit:hover,
.question-panel-submit:hover,
.question-panel-reset:hover,
.question-panel-close:hover,
.topic-chip:hover {
  transform: translateY(-1px);
}

.topic-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(104, 136, 168, 0.1);
  color: var(--house-dark);
  font:
    700 12px/1.1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.02em;
}

.topic-chip:hover {
  background: rgba(90, 181, 200, 0.18);
  box-shadow: 0 10px 24px rgba(104, 136, 168, 0.14);
}

.question-panel {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(8px);
}

.question-panel-card {
  width: min(720px, calc(100vw - 16px));
  max-height: min(85vh, calc(100vh - 48px));
  overflow: auto;
  padding: 24px 24px 22px;
  border: 1px solid rgba(0, 0, 0, 0.82);
  border-radius: 22px;
  background: rgba(248, 248, 248, 0.97);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
}

.question-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.question-panel-title {
  margin: 0;
  color: #000;
  font: 700 28px/1.08 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
}

.question-panel-close,
.question-panel-reset {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(104, 136, 168, 0.12);
  color: var(--house-dark);
  font:
    700 11px/1 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-panel-close {
  background: #000;
  border: 1px solid #000;
  color: rgba(248, 248, 248, 0.98);
}

.question-panel-close:hover {
  background: var(--green);
  border-color: var(--green);
  box-shadow: none;
  transform: none;
}

.question-panel-reset:hover {
  background: rgba(104, 136, 168, 0.2);
  box-shadow: 0 10px 22px rgba(104, 136, 168, 0.14);
}

.question-panel-close:disabled,
.question-panel-reset:disabled,
.question-panel-submit:disabled {
  cursor: wait;
  transform: none;
  box-shadow: none;
  opacity: 0.68;
}

.question-panel-prompt {
  margin: 12px 0 0;
  color: var(--trunk-dark);
  font: 400 14px/1.7 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.question-panel-form {
  margin-top: 16px;
}

.question-panel-input {
  min-height: 136px;
  padding: 14px 16px;
  resize: vertical;
}

.question-panel-input:disabled {
  background: rgba(255, 255, 255, 0.52);
  color: rgba(58, 51, 64, 0.72);
}

.question-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.question-panel-submit,
.question-panel-reset {
  min-height: 46px;
  padding-inline: 16px;
}

.question-panel-submit,
.topic-modal-submit {
  background: var(--green);
  box-shadow: 0 10px 24px rgba(29, 56, 8, 0.22);
}

.question-panel-submit:hover,
.topic-modal-submit:hover {
  background: #1a4a06;
  box-shadow: 0 14px 28px rgba(29, 56, 8, 0.28);
}

.question-panel-status {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(232, 154, 181, 0.14);
  color: var(--trunk-dark);
  font: 700 12px/1.55 "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.question-panel-status[data-tone="info"] {
  background: rgba(104, 136, 168, 0.12);
}

.question-panel-status[data-tone="warning"] {
  background: rgba(232, 154, 181, 0.18);
}

.question-panel-status[data-tone="error"] {
  background: rgba(212, 88, 64, 0.14);
}

@media (max-width: 980px) {
}

@media (max-width: 820px) {
  .app-brand {
    top: 14px;
    left: 14px;
    gap: 5px;
  }

  .app-brand-logo {
    height: 22px;
  }

  .app-brand-name {
    font-size: 22px;
  }

  .topic-modal {
    padding: 18px;
  }

  .topic-modal-card {
    width: min(100%, 460px);
    padding: 24px 20px 18px;
  }

  .topic-modal-title {
    font-size: 26px;
  }

  .question-panel {
    padding: 12px;
  }

  .question-panel-card {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 18px 18px 16px;
    border-radius: 20px;
  }

  .question-panel-header {
    flex-direction: column;
  }

  .question-panel-title {
    font-size: 20px;
  }
}
