:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --panel: #ffffff;
  --panel-soft: #eef4f8;
  --text: #18212f;
  --muted: #687589;
  --line: #dce5ed;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --brand-soft: #dff4f0;
  --accent: #5b6ee1;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(26, 44, 64, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #f8fbfd 0%, var(--bg) 44%, #eef5f5 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.92rem;
  box-shadow: var(--shadow);
}

.status-pill.ready {
  border-color: #a9d9d0;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.status-pill.error {
  border-color: #ffd3ce;
  background: #fff1ef;
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.upload-panel,
.progress-panel,
.result-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 18px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1.5px dashed #aec4d2;
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  background: #fbfdfe;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--brand);
  background: #f2fbf8;
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  font-size: 1.25rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.drop-subtitle,
.file-name {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.file-name {
  max-width: 100%;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel-soft);
  overflow-wrap: anywhere;
}

.controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.controls label {
  color: var(--muted);
  font-size: 0.92rem;
}

select {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.primary-button,
.copy-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--brand);
  color: white;
  transition: background 160ms ease, transform 160ms ease;
  white-space: normal;
  overflow-wrap: anywhere;
}

.primary-button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  background: #9aa8ad;
  transform: none;
}

.progress-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  color: var(--muted);
}

.progress-header strong {
  color: var(--text);
  text-align: right;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e4edf1;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 260ms ease;
}

#helperText {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.results {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}

.result-block {
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.copy-button {
  min-width: 64px;
  padding: 8px 12px;
  background: var(--panel-soft);
  color: var(--brand-strong);
}

.copy-button:hover {
  background: var(--brand-soft);
}

pre,
.rich-text {
  margin: 0;
  max-width: 100%;
  color: #263445;
  font-size: 0.98rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rich-text p {
  margin-bottom: 12px;
}

.rich-text ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.mindmap {
  max-width: 100%;
  min-width: 0;
}

.mindmap-viewer {
  position: relative;
  min-width: 0;
}

.mindmap-toolbar {
  position: absolute;
  inset: 12px auto auto 12px;
  z-index: 3;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(180, 195, 207, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(24, 33, 47, 0.1);
  backdrop-filter: blur(10px);
}

.mindmap-tool-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f2f6f8;
  color: #2f3b4a;
  cursor: pointer;
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1;
}

.mindmap-tool-button:hover,
.mindmap-tool-button.is-active {
  border-color: #a9d9d0;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.mindmap-stage {
  position: relative;
  height: clamp(360px, 58vh, 540px);
  min-height: 320px;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #eef3f6;
  border-radius: 8px;
  background: #fff;
}

.mindmap-canvas {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: 0 0;
  will-change: transform;
}

.mindmap-viewer.is-pan-enabled .mindmap-stage {
  cursor: grab;
  touch-action: none;
}

.mindmap-viewer.is-dragging .mindmap-stage {
  cursor: grabbing;
}

.mindmap svg {
  display: block;
  max-width: none;
  user-select: none;
  background: #fff;
}

.mindmap text {
  fill: #3d4148;
  font-weight: 650;
  letter-spacing: 0;
}

.mindmap .root-label {
  font-size: 30px;
  font-weight: 700;
}

.mindmap .node-label {
  font-size: 24px;
}

.mindmap .leaf-label {
  font-size: 20px;
  font-weight: 560;
}

.mindmap .root-box {
  fill: #fff;
  stroke: #ff7a4f;
  stroke-width: 7;
}

.mindmap .branch-path,
.mindmap .branch-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 22px, 720px);
    padding: 22px 0 34px;
  }

  .intro {
    display: grid;
    align-items: start;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2rem, 11vw, 2.85rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .lead {
    font-size: 1rem;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 210px;
    padding: 20px;
  }

  .drop-title {
    font-size: 1.08rem;
  }

  .block-header,
  .progress-header {
    align-items: flex-start;
  }

  .mindmap {
    margin-inline: -4px;
  }

  .mindmap-stage {
    height: min(430px, 62vh);
    min-height: 340px;
  }

  .mindmap-toolbar {
    inset: 10px auto auto 10px;
    gap: 5px;
    padding: 5px;
  }

  .mindmap-tool-button {
    width: 32px;
    height: 32px;
  }

  .mindmap .root-label {
    font-size: 26px;
  }

  .mindmap .node-label {
    font-size: 21px;
  }

  .mindmap .leaf-label {
    font-size: 18px;
  }
}
