.semantic-shell {
  display: grid;
  gap: 18px;
}

.semantic-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 18px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 18%, rgba(244, 197, 66, 0.22), transparent 180px),
    linear-gradient(180deg, #850e07, #650704);
  color: #fff8dc;
  box-shadow: var(--shadow);
  padding: 24px;
}

.semantic-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  line-height: 1;
}

.semantic-hero p {
  max-width: 800px;
  margin: 0;
  color: #fff4c7;
  line-height: 1.5;
}

.semantic-score-card {
  display: grid;
  min-height: 116px;
  place-items: center;
  align-content: center;
  border: 1px solid rgba(255, 240, 189, 0.42);
  border-radius: 8px;
  background: rgba(255, 248, 220, 0.12);
}

.semantic-score-card span {
  color: #f4c542;
  font-size: 2.4rem;
  font-weight: 900;
}

.semantic-score-card small {
  color: #fff4c7;
}

.semantic-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.34fr);
  gap: 18px;
}

.map-zone,
.map-sidebar {
  display: grid;
  gap: 14px;
}

.map-poem-card,
.mind-map,
.map-sidebar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-poem-card {
  padding: 18px;
}

.map-poem-card span {
  display: block;
  margin-bottom: 8px;
  color: #700b06;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.map-poem-card p {
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.8rem);
  font-weight: 900;
  line-height: 1.25;
}

.mind-map {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(244, 197, 66, 0.18), transparent 180px),
    #fffdf4;
}

.svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.mind-edge {
  stroke: #7b5b37;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.edge-association {
  stroke-dasharray: none;
}

.edge-contrast {
  stroke: #700b06;
  stroke-dasharray: 9 7;
}

.edge-main {
  stroke-width: 4;
}

.edge-correct {
  stroke: #3b7c28;
}

.edge-incorrect {
  stroke: #b44d42;
}

.central-node,
.mind-node {
  position: absolute;
  z-index: 2;
  border: 1px solid #d9ba65;
  border-radius: 8px;
  background: #fff9e8;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(89, 43, 8, 0.1);
  touch-action: none;
}

.central-node {
  left: 50%;
  top: 50%;
  width: 180px;
  min-height: 76px;
  transform: translate(-50%, -50%);
  background: #700b06;
  color: #fff8dc;
}

.mind-node {
  display: grid;
  width: clamp(160px, 12vw, 190px);
  min-height: 64px;
  place-items: center;
  padding: 10px 12px;
  transform: translate(-50%, -50%);
}

.mind-node span {
  display: block;
  pointer-events: none;
  line-height: 1.2;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: normal;
}

.mind-node-image {
  background: #fff0bd;
  color: #700b06;
}

.mind-node-concept {
  background: #fffdf4;
}

.mind-node-ai {
  background: #f1faeb;
  color: #315f22;
}

.mind-node:hover,
.mind-node[aria-pressed="true"],
.mind-node.selected {
  border-color: #700b06;
  box-shadow: 0 0 0 4px rgba(112, 11, 6, 0.12), 0 14px 28px rgba(89, 43, 8, 0.14);
}

.mind-node.dragging {
  z-index: 4;
  cursor: grabbing;
}

.mind-map.morphing .mind-node-image,
.mind-map.morphing .mind-node-concept {
  animation: morphPulse 800ms ease both;
}

.map-sidebar {
  align-content: start;
  padding: 18px;
}

.toolbar {
  display: grid;
  gap: 14px;
}

.toolbar strong {
  display: block;
  margin-bottom: 8px;
  color: #700b06;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.relation-picker,
.mode-switch,
.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.relation-picker button,
.mode-switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid #d9ba65;
  border-radius: 8px;
  background: #fffdf4;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 0 11px;
}

.relation-picker button.active,
.mode-switch button.active {
  border-color: #700b06;
  background: #fff0bd;
  color: #700b06;
}

.line-sample {
  display: inline-block;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #7b5b37;
  vertical-align: middle;
}

.line-dashed {
  background: repeating-linear-gradient(90deg, #700b06 0 7px, transparent 7px 12px);
}

.ai-analogy-note {
  margin: 0;
  border-left: 4px solid #700b06;
  color: var(--muted);
  line-height: 1.45;
  padding-left: 12px;
}

.map-guide {
  display: grid;
  gap: 10px;
  border: 1px solid #d9ba65;
  border-radius: 8px;
  background: #fffdf4;
  color: var(--muted);
  line-height: 1.45;
  padding: 12px 14px;
}

.map-guide strong {
  color: #700b06;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.map-guide ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.map-guide li::marker {
  color: #700b06;
  font-weight: 900;
}

.legend {
  display: grid;
  gap: 8px;
}

.legend span {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.legend i {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: #7b5b37;
}

.legend .legend-contrast {
  background: repeating-linear-gradient(90deg, #700b06 0 8px, transparent 8px 14px);
}

.legend .legend-main {
  height: 7px;
  background: #700b06;
}

.feedback-panel {
  min-height: 78px;
  border: 1px solid #d9ba65;
  border-radius: 8px;
  background: #fffdf4;
  color: var(--muted);
  line-height: 1.45;
  padding: 12px;
}

.feedback-panel.success {
  border-color: #6ea45f;
  background: #f1faeb;
  color: #315f22;
}

.feedback-panel.error {
  border-color: #b44d42;
  background: #fff3ef;
  color: #8b1209;
}

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

.mind-reference {
  margin-top: 0;
}

@keyframes morphPulse {
  0%,
  100% {
    filter: none;
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(112, 11, 6, 0.35));
  }
}

@media (max-width: 980px) {
  .semantic-hero,
  .semantic-workbench {
    grid-template-columns: 1fr;
  }

  .mind-map {
    min-height: 720px;
  }

  .mind-node {
    width: clamp(148px, 38vw, 180px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mind-map.morphing .mind-node-image,
  .mind-map.morphing .mind-node-concept {
    animation: none;
  }
}
