.branch-map-stack {
  margin: 0 -1.5rem 1.5rem;
}

.branch-map-stack.is-flush-top {
  margin-top: 0;
}

.branch-map-stack.is-card-flush {
  margin: 0;
}

.branch-map-stack.is-card-flush.has-hero {
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

.branch-map-stack.has-hero {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgb(229 231 235);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.dark .branch-map-stack.has-hero {
  border-color: rgb(55 65 81);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35);
}

.branch-map-hero-top {
  margin: 0;
  height: clamp(160px, 28vw, 240px);
  overflow: hidden;
  background: rgb(15 23 42);
}

.dark .branch-map-hero-top {
  background: rgb(3 7 18);
}

.branch-map-hero-top__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.branch-genesis-hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(220px, 38vw, 340px);
  background: rgb(15 23 42);
}

.dark .branch-genesis-hero {
  background: rgb(3 7 18);
}

.branch-genesis-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.branch-genesis-hero__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 4, 8, 0.35) 0%, rgba(2, 4, 8, 0.55) 42%, rgba(2, 4, 8, 0.92) 100%);
  pointer-events: none;
}

.branch-genesis-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: inherit;
  padding: 1.5rem 1.5rem 1.75rem;
}

@media (min-width: 640px) {
  .branch-genesis-hero__content {
    padding: 2rem 2rem 2.25rem;
  }
}

.branch-genesis-hero__label {
  margin: 0 0 0.5rem;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.branch-genesis-hero__heading {
  margin: 0 0 0.75rem;
  font-size: clamp(1.125rem, 2.8vw, 1.5rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 52rem;
}

.branch-genesis-hero__detail {
  margin: 0;
  max-width: 52rem;
  font-size: clamp(0.8125rem, 1.8vw, 0.9375rem);
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.92);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 640px) {
  .branch-genesis-hero__detail {
    -webkit-line-clamp: 5;
  }
}

.branch-map-panel-wrap {
  position: relative;
  isolation: isolate;
}

.branch-map-hero-ghost {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.branch-map-hero-ghost__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0.2;
  transform: scale(1.08);
  filter: saturate(0.85) blur(1px);
}

.dark .branch-map-hero-ghost__img {
  opacity: 0.14;
  filter: saturate(0.7) blur(2px);
}

.branch-map-panel {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgb(229 231 235);
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08), transparent 55%),
    rgb(249 250 251);
}

.branch-map-stack.has-hero .branch-map-panel {
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(249, 250, 251, 0.9) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dark .branch-map-panel {
  border-color: rgb(55 65 81);
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.12), transparent 55%),
    rgb(17 24 39 / 0.5);
}

.dark .branch-map-stack.has-hero .branch-map-panel {
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.92) 0%, rgba(3, 7, 18, 0.88) 100%);
}

.branch-map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.branch-map-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(107 114 128);
}

.dark .branch-map-stats {
  color: rgb(156 163 175);
}

.branch-map-stat-heat {
  color: rgb(217 119 6);
}

.branch-spine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgb(229 231 235);
}

.dark .branch-spine {
  border-bottom-color: rgb(55 65 81);
}

.branch-map-stack.has-hero .branch-spine {
  border-bottom-color: rgba(148, 163, 184, 0.35);
}

.dark .branch-map-stack.has-hero .branch-spine {
  border-bottom-color: rgba(75, 85, 99, 0.55);
}

.branch-spine-node {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  border-radius: 9999px;
  border: 1px solid rgb(229 231 235);
  background: white;
  color: rgb(55 65 81);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.dark .branch-spine-node {
  border-color: rgb(55 65 81);
  background: rgb(17 24 39);
  color: rgb(209 213 219);
}

.branch-map-stack.has-hero .branch-spine-node {
  background: rgba(255, 255, 255, 0.88);
}

.dark .branch-map-stack.has-hero .branch-spine-node {
  background: rgba(17, 24, 39, 0.82);
}

.branch-spine-node:hover {
  border-color: rgb(99 102 241);
  color: rgb(79 70 229);
}

.branch-spine-node.is-focus {
  border-color: rgb(99 102 241);
  background: rgba(99, 102, 241, 0.14);
  color: rgb(79 70 229);
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.22),
    0 8px 24px rgba(99, 102, 241, 0.18);
  transform: scale(1.03);
}

.branch-spine-node.is-conflict {
  border-color: rgb(248 113 113);
}

.branch-spine-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: rgb(156 163 175);
  flex-shrink: 0;
}

.branch-spine-dot.is-root {
  background: rgb(245 158 11);
}

.branch-spine-dot.is-conflict {
  background: rgb(239 68 68);
}

.branch-spine-dot.is-focus {
  background: rgb(99 102 241);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.branch-map-canvas {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgb(229 231 235);
  border-radius: 0.875rem;
  background: white;
  min-height: 0;
}

.branch-map-canvas svg.branch-map-svg {
  display: block;
  width: max(100%, var(--branch-map-layout-width, 100%));
  height: auto;
  max-height: 420px;
}

.branch-map-stack.has-hero .branch-map-canvas {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(148, 163, 184, 0.35);
}

.dark .branch-map-canvas {
  border-color: rgb(55 65 81);
  background: rgb(3 7 18);
}

.dark .branch-map-stack.has-hero .branch-map-canvas {
  background: rgba(3, 7, 18, 0.78);
  border-color: rgba(75, 85, 99, 0.55);
}

.branch-graph-edge {
  fill: none;
  stroke: rgb(209 213 219);
  stroke-width: 2;
}

.dark .branch-graph-edge {
  stroke: rgb(75 85 99);
}

.branch-graph-edge.is-spine {
  stroke: rgb(99 102 241);
  stroke-width: 2.5;
}

.branch-graph-edge.is-conflict {
  stroke: rgb(248 113 113);
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
}

.branch-graph-node {
  cursor: pointer;
}

.branch-graph-node__icon {
  pointer-events: none;
}

.branch-graph-node__icon-bg {
  fill: rgb(243 244 246);
  stroke: rgb(229 231 235);
  stroke-width: 1;
}

.dark .branch-graph-node__icon-bg {
  fill: rgb(31 41 55);
  stroke: rgb(75 85 99);
}

.branch-graph-node__icon-glyph {
  fill: rgb(71 85 105);
}

.dark .branch-graph-node__icon-glyph {
  fill: rgb(203 213 225);
}

.branch-graph-node.is-kind-genesis .branch-graph-node__icon-bg {
  fill: rgb(254 243 199);
  stroke: rgb(245 158 11);
}

.branch-graph-node.is-kind-genesis .branch-graph-node__icon-glyph {
  fill: rgb(180 83 9);
}

.branch-graph-node.is-kind-conflict .branch-graph-node__icon-bg {
  fill: rgb(254 226 226);
  stroke: rgb(248 113 113);
}

.branch-graph-node.is-kind-conflict .branch-graph-node__icon-glyph {
  fill: rgb(185 28 28);
}

.branch-graph-node.is-kind-philosophical .branch-graph-node__icon-bg {
  fill: rgb(224 231 255);
  stroke: rgb(129 140 248);
}

.branch-graph-node.is-kind-philosophical .branch-graph-node__icon-glyph {
  fill: rgb(67 56 202);
}

.branch-graph-node.is-kind-fictional .branch-graph-node__icon-bg {
  fill: rgb(224 231 255);
  stroke: rgb(129 140 248);
}

.branch-graph-node.is-kind-fictional .branch-graph-node__icon-glyph {
  fill: rgb(79 70 229);
}

.branch-graph-node.is-kind-poetic .branch-graph-node__icon-bg {
  fill: rgb(237 233 254);
  stroke: rgb(167 139 250);
}

.branch-graph-node.is-kind-poetic .branch-graph-node__icon-glyph {
  fill: rgb(109 40 217);
}

.branch-graph-node.is-kind-question .branch-graph-node__icon-bg {
  fill: rgb(224 242 254);
  stroke: rgb(56 189 248);
}

.branch-graph-node.is-kind-question .branch-graph-node__icon-glyph {
  fill: rgb(3 105 161);
}

.branch-spine-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 9999px;
  flex-shrink: 0;
  background: rgb(243 244 246);
  border: 1px solid rgb(229 231 235);
}

.dark .branch-spine-icon {
  background: rgb(31 41 55);
  border-color: rgb(75 85 99);
}

.branch-kind-icon {
  font-size: 0.62rem;
  line-height: 1;
}

.branch-kind-icon--genesis { color: rgb(217 119 6); }
.branch-kind-icon--conflict { color: rgb(220 38 38); }
.branch-kind-icon--philosophical { color: rgb(79 70 229); }
.branch-kind-icon--fictional { color: rgb(99 102 241); }
.branch-kind-icon--poetic { color: rgb(124 58 237); }
.branch-kind-icon--question { color: rgb(14 165 233); }
.branch-kind-icon--default { color: rgb(100 116 139); }

.branch-spine-node.is-focus .branch-spine-icon {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgb(129 140 248);
}

.branch-spine-node.is-conflict .branch-spine-icon {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgb(248 113 113);
}

.branch-spine-node.is-root .branch-spine-icon {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgb(245 158 11);
}

.branch-graph-node rect {
  fill: white;
  stroke: rgb(209 213 219);
  stroke-width: 1.5;
}

.dark .branch-graph-node rect {
  fill: rgb(17 24 39);
  stroke: rgb(75 85 99);
}

.branch-map-stack.has-hero .branch-graph-node rect {
  fill: rgba(255, 255, 255, 0.94);
}

.dark .branch-map-stack.has-hero .branch-graph-node rect {
  fill: rgba(17, 24, 39, 0.92);
}

.branch-graph-node.is-focus rect {
  stroke: rgb(99 102 241);
  stroke-width: 2.5;
  fill: rgba(99, 102, 241, 0.1);
  filter: drop-shadow(0 0 16px rgba(99, 102, 241, 0.45));
}

.dark .branch-graph-node.is-focus rect {
  fill: rgba(99, 102, 241, 0.18);
}

.branch-graph-node.is-focus text.badge {
  fill: rgb(99 102 241);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dark .branch-graph-node.is-focus text.badge {
  fill: rgb(165 180 252);
}

.branch-graph-node.is-focus text:not(.sub):not(.badge) {
  font-size: 12px;
  font-weight: 800;
}

.branch-graph-node.is-root rect {
  stroke: rgb(245 158 11);
}

.branch-graph-node.is-trending rect {
  stroke: rgb(251 191 36);
  stroke-dasharray: 4 3;
}

.branch-graph-node.is-conflict rect {
  stroke: rgb(248 113 113);
  filter: drop-shadow(0 0 8px rgba(248, 113, 113, 0.25));
}

.branch-graph-node text {
  fill: rgb(17 24 39);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.dark .branch-graph-node text {
  fill: rgb(243 244 246);
}

.branch-graph-node text.sub {
  fill: rgb(107 114 128);
  font-size: 10px;
  font-weight: 500;
}

.dark .branch-graph-node text.sub {
  fill: rgb(156 163 175);
}

.branch-graph-cluster {
  fill: rgb(243 244 246);
  stroke: rgb(209 213 219);
}

.dark .branch-graph-cluster {
  fill: rgb(31 41 55);
  stroke: rgb(75 85 99);
}

.branch-map-empty-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: rgb(107 114 128);
}

.dark .branch-map-empty-hint {
  color: rgb(156 163 175);
}

@media (min-width: 640px) {
  .branch-map-stack {
    margin-left: -3rem;
    margin-right: -3rem;
  }

  .branch-map-panel {
    padding: 1.25rem 2rem 1.5rem;
  }
}

.answer-card {
  border-left-width: 3px;
  border-left-color: rgb(229 231 235);
}

.dark .answer-card {
  border-left-color: rgb(55 65 81);
}

.answer-card--conflict {
  border-left-color: rgb(248 113 113);
}

.answer-card--philosophical {
  border-left-color: rgb(99 102 241);
}

.answer-card--fictional {
  border-left-color: rgb(129 140 248);
}

.answer-card--poetic {
  border-left-color: rgb(167 139 250);
}

.answer-card--question {
  border-left-color: rgb(56 189 248);
}

.answer-card--pending {
  border-left-color: rgb(209 213 219);
}

.emotion-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.25;
  white-space: nowrap;
}

.emotion-badge--anger {
  background: #fee2e2;
  color: #991b1b;
}

.dark .emotion-badge--anger {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.emotion-badge--fear {
  background: #f3e8ff;
  color: #6b21a8;
}

.dark .emotion-badge--fear {
  background: rgba(168, 85, 247, 0.25);
  color: #f3e8ff;
}

.emotion-badge--anxiety {
  background: #ffedd5;
  color: #9a3412;
}

.dark .emotion-badge--anxiety {
  background: rgba(249, 115, 22, 0.25);
  color: #fed7aa;
}

.emotion-badge--happiness {
  background: #d9f99d;
  color: #3f6212;
}

.dark .emotion-badge--happiness {
  background: rgba(132, 204, 22, 0.25);
  color: #ecfccb;
}

.emotion-badge--surprise {
  background: #e0f2fe;
  color: #075985;
}

.dark .emotion-badge--surprise {
  background: rgba(14, 165, 233, 0.25);
  color: #e0f2fe;
}

.emotion-badge--disgust {
  background: #e7e5e4;
  color: #44403c;
}

.dark .emotion-badge--disgust {
  background: rgba(120, 113, 108, 0.35);
  color: #e7e5e4;
}

.emotion-badge--neutral {
  background: #f3f4f6;
  color: #374151;
}

.dark .emotion-badge--neutral {
  background: rgba(75, 85, 99, 0.35);
  color: #e5e7eb;
}
