:root {
  color-scheme: light;
  --ink: #1d2b36;
  --muted: #647787;
  --soft: #eef7ff;
  --paper: #f7fbff;
  --panel: #ffffff;
  --line: #dbeaf5;
  --blue-soft: #eaf5ff;
  --blue: #5f93bd;
  --blue-deep: #2f668f;
  --blue-ink: #214964;
  --clay: #8c8fb8;
  --aqua: #6fb8d8;
  --lavender: #9da7df;
  --shadow: 0 18px 46px rgba(41, 91, 128, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(190, 223, 247, 0.56), transparent 28%),
    radial-gradient(circle at 84% 8%, rgba(226, 236, 255, 0.78), transparent 26%),
    linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(234, 245, 255, 0.88)),
    var(--paper);
}

button,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.hero-panel,
.analysis-view,
.result-view {
  width: min(1080px, 100%);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
}

.hero-panel {
  display: flex;
  flex-direction: column;
}

.brand-row,
.analysis-header,
.result-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-deep);
  font-weight: 700;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--blue-deep) 0 3px, transparent 4px),
    conic-gradient(from 30deg, #8ec3e6, #d9ecfb, var(--blue), #a9d7ee);
  box-shadow: inset 0 0 0 7px var(--paper);
  display: inline-flex;
  flex: 0 0 auto;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 34px;
  align-items: center;
  padding: 48px 0 24px;
}

.intro-grid.single-column {
  grid-template-columns: minmax(0, 1fr);
  padding: 34px 0 22px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue-deep);
  font-size: 14px;
  font-weight: 800;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(36px, 5.2vw, 58px);
  line-height: 1.12;
  letter-spacing: 0;
}

.subcopy {
  margin: 20px 0 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 16px;
}

.guide-card {
  min-height: 150px;
  padding: 17px;
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 248, 255, 0.84));
  box-shadow: 0 12px 28px rgba(41, 91, 128, 0.07);
  position: relative;
  overflow: hidden;
}

.guide-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(95, 147, 189, 0.1);
}

.guide-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 28px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(47, 102, 143, 0.1);
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 900;
}

.guide-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  font-size: 14px;
}

.input-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 253, 255, 0.88));
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.input-card label {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  background: #fbfdff;
  line-height: 1.8;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

textarea::placeholder {
  color: #8898a6;
}

textarea:focus {
  border-color: rgba(95, 147, 189, 0.8);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(95, 147, 189, 0.14);
}

.input-guide {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(219, 234, 245, 0.95);
  border-radius: 8px;
  background: var(--blue-soft);
}

.input-guide strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-deep);
}

.input-guide span,
.input-guide li,
.form-footer p {
  color: var(--muted);
  line-height: 1.7;
}

.input-guide ul {
  margin: 0;
  padding-left: 20px;
}

.input-guide li + li {
  margin-top: 6px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.form-footer p {
  margin: 0;
}

button {
  border: 0;
  cursor: pointer;
}

#submitButton,
.ghost-button {
  min-height: 46px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

#submitButton {
  padding: 0 18px 0 20px;
  background: var(--blue-deep);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(47, 102, 143, 0.2);
}

#submitButton:hover {
  background: #255475;
}

#submitButton:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.analysis-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
}

.analysis-header {
  justify-content: center;
}

.analysis-header p {
  margin: 0;
}

.analysis-stage {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(280px, 1.05fr);
  gap: 24px;
  align-items: center;
}

.process-card {
  min-height: 360px;
  padding: 26px;
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.process-title {
  color: var(--blue-deep);
  font-size: 20px;
  font-weight: 850;
}

.process-lines {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.process-lines span {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbeaf5, #cfe5f6, #edf7ff);
  background-size: 200% 100%;
  animation: shimmer 2.4s ease-in-out infinite;
}

.process-lines span:nth-child(2) {
  width: 82%;
  animation-delay: 0.25s;
}

.process-lines span:nth-child(3) {
  width: 64%;
  animation-delay: 0.5s;
}

.thought-map {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 34px;
}

.thought-map div {
  min-height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--muted);
  font-weight: 800;
  animation: softPop 2.8s ease-in-out infinite;
}

.thought-map div:nth-child(2) {
  animation-delay: 0.25s;
}

.thought-map div:nth-child(3) {
  animation-delay: 0.5s;
}

.thought-map div:nth-child(4) {
  animation-delay: 0.75s;
}

.stage-list {
  display: grid;
  gap: 12px;
}

.stage-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  transition: border-color 220ms ease, color 220ms ease, background 220ms ease;
}

.stage-item.active {
  color: var(--ink);
  border-color: rgba(95, 147, 189, 0.5);
  background: var(--blue-soft);
}

.stage-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(95, 147, 189, 0.38);
  display: grid;
  place-items: center;
}

.stage-dot::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.result-view {
  padding: 18px 0 42px;
}

.result-topbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

.ghost-button {
  padding: 0 13px;
  border: 1px solid rgba(219, 234, 245, 0.98);
  background: rgba(255, 255, 255, 0.82);
  color: var(--blue-deep);
  font-weight: 750;
}

.report-hero {
  padding: 24px;
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(234, 245, 255, 0.96), rgba(255, 255, 255, 0.92)),
    var(--blue-soft);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.report-hero::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 22px;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(95, 147, 189, 0.22);
  border-radius: 50%;
  box-shadow: inset 0 0 0 18px rgba(255, 255, 255, 0.35);
}

.report-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  max-width: 860px;
  position: relative;
  z-index: 1;
}

.report-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(47, 102, 143, 0.1);
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 850;
  position: relative;
  z-index: 1;
}

.report-hero h2 {
  margin: 14px 0 12px;
  max-width: 820px;
  color: var(--ink);
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.26;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

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

.report-section {
  padding: 20px;
  border: 1px solid rgba(219, 234, 245, 0.98);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(41, 91, 128, 0.06);
  position: relative;
  overflow: hidden;
}

.report-section::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -42px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(95, 147, 189, 0.12);
  background: rgba(234, 245, 255, 0.36);
  pointer-events: none;
}

.report-section > * {
  position: relative;
  z-index: 1;
}

.report-section.visual-band {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(235, 247, 255, 0.88)),
    rgba(255, 255, 255, 0.88);
}

.report-section.wide {
  grid-column: 1 / -1;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}

.section-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(95, 147, 189, 0.12);
  flex: 0 0 auto;
}

.report-section h3 {
  margin: 0;
  color: var(--blue-deep);
  font-size: 18px;
}

.report-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.report-section li,
.detail-item {
  padding: 14px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(251, 253, 255, 0.98), rgba(245, 250, 255, 0.92));
  border: 1px solid rgba(219, 234, 245, 0.74);
  color: var(--muted);
  line-height: 1.75;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.detail-item:hover,
.report-section li:hover {
  transform: translateY(-1px);
  border-color: rgba(95, 147, 189, 0.36);
  box-shadow: 0 8px 20px rgba(41, 91, 128, 0.07);
}

.report-section li {
  position: relative;
  padding-left: 34px;
}

.report-section li::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 23px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--clay);
}

.detail-item + .detail-item {
  margin-top: 10px;
}

.detail-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.mechanism-item {
  position: relative;
}

.side-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  margin-bottom: 9px;
  border-radius: 999px;
  background: rgba(140, 143, 184, 0.14);
  color: #555989;
  font-size: 12px;
  font-weight: 850;
}

.detail-item p {
  margin: 0;
}

.detail-item p + p {
  margin-top: 6px;
}

.cause-stack {
  display: grid;
  gap: 12px;
}

.cause-item {
  padding: 18px;
}

.cause-head {
  display: block;
  margin-bottom: 8px;
}

.cause-head strong {
  font-size: 19px;
  line-height: 1.45;
  margin-bottom: 8px;
}

.cause-item p {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.78;
  margin-bottom: 0;
}

.confidence-wrap {
  width: min(220px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(72px, 1fr) auto;
  gap: 7px;
  align-items: center;
  margin-top: 12px;
}

.confidence-bubble {
  min-width: 38px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue-deep), var(--aqua));
  color: white;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(47, 102, 143, 0.18);
}

.confidence-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(95, 147, 189, 0.14);
  overflow: hidden;
}

.confidence-track span {
  display: block;
  width: var(--confidence);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lavender), var(--aqua));
}

.confidence-text {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.relationship-visual {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(242, 248, 255, 0.9));
}

.loop-stack {
  display: grid;
  gap: 14px;
}

.loop-chain {
  display: flex;
  align-items: stretch;
  gap: 18px;
  flex-wrap: wrap;
}

.loop-step {
  min-width: 180px;
  flex: 1 1 180px;
  padding: 15px;
  border: 1px solid rgba(95, 147, 189, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 247, 255, 0.92));
  position: relative;
  box-shadow: 0 8px 18px rgba(41, 91, 128, 0.06);
}

.loop-step:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -13px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
  transform: translateY(-50%) rotate(45deg);
}

.loop-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(47, 102, 143, 0.1);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 900;
}

.loop-step p,
.loop-note {
  margin: 0;
  color: var(--ink);
  line-height: 1.72;
}

.loop-note {
  padding: 14px;
  border: 1px solid rgba(219, 234, 245, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.reminder {
  margin-top: 14px;
  padding: 16px;
  border-left: 3px solid var(--clay);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  line-height: 1.75;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.primary-action {
  background: var(--blue-deep);
  color: white;
  border-color: var(--blue-deep);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--blue-deep);
  color: #fff;
  box-shadow: var(--shadow);
}

@keyframes breathe {
  50% {
    transform: translateY(-4px);
  }
}

@keyframes shimmer {
  50% {
    background-position: 100% 0;
  }
}

@keyframes softPop {
  50% {
    background: var(--blue-soft);
    border-color: rgba(95, 147, 189, 0.42);
  }
}

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

  .hero-panel,
  .analysis-view,
  .result-view {
    min-height: calc(100vh - 28px);
  }

  .intro-grid,
  .how-it-works,
  .analysis-stage,
  .report-grid,
  .input-guide {
    grid-template-columns: 1fr;
  }

  .intro-grid {
    gap: 18px;
    padding: 32px 0 20px;
  }

  .form-footer,
  .result-topbar,
  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #submitButton,
  .ghost-button {
    width: 100%;
  }

  .process-card {
    min-height: auto;
  }

  .cause-head,
  .confidence-wrap {
    grid-template-columns: 1fr;
  }

  .confidence-wrap {
    min-width: 0;
    gap: 7px;
  }

  .confidence-bubble {
    width: max-content;
  }

  .loop-chain {
    display: grid;
    gap: 22px;
  }

  .loop-step:not(:last-child)::after {
    right: auto;
    left: 24px;
    top: auto;
    bottom: -15px;
    transform: rotate(135deg);
  }
}
