:root {
  --bg-deep: #050a14;
  --bg: #0a1220;
  --panel: rgba(10, 22, 48, 0.72);
  --panel-solid: #0c1830;
  --panel-elevated: rgba(16, 32, 64, 0.88);
  --glass: rgba(12, 28, 56, 0.55);
  --glass-border: rgba(56, 189, 248, 0.22);
  --accent: #38bdf8;
  --accent-bright: #67e8f9;
  --accent-soft: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.45);
  --accent-dim: rgba(56, 189, 248, 0.12);
  --text: #e8f4ff;
  --text-soft: #b8d4f0;
  --muted: #7a9bb8;
  --border: rgba(56, 120, 180, 0.28);
  --border-bright: rgba(103, 232, 249, 0.35);
  --warm: #e54b5d;
  --cold: #2563eb;
  --sidebar-width: 320px;
  --panel-glow: 0 0 24px rgba(56, 189, 248, 0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border);
  --font-ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Orbitron", sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --stage-base: #0a1424;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-ui);
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
}

.layout-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(14, 116, 178, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 15% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
    linear-gradient(165deg, #050a14 0%, #0a1628 45%, #060d18 100%);
}
.layout-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 60% 50%, black 20%, transparent 75%);
}

.layout {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  min-width: 0;
  background: var(--stage-base);
}

.topic-nav-column {
  position: relative;
  width: var(--sidebar-width);
  flex-shrink: 0;
  min-height: 0;
  overflow: visible;
  z-index: 3;
  transition: width 0.22s ease;
}

.layout.panel-collapsed .topic-nav-column {
  width: 0;
  min-width: 0;
}

.topic-nav {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-right: 1px solid var(--border);
  box-shadow: var(--panel-glow);
  color-scheme: dark;
  transition: opacity 0.18s ease, border-color 0.22s ease;
}

.layout.panel-collapsed .topic-nav {
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
}

.topic-nav-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topic-nav-toggle-btn {
  position: absolute;
  left: 100%;
  top: 50%;
  z-index: 20;
  transform: translateY(-50%);
  width: 28px;
  height: 52px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border: 1px solid var(--border-bright);
  border-left: none;
  background: rgba(12, 28, 56, 0.95);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.35);
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}

.topic-nav-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent);
  color: var(--accent-bright);
}

.layout.panel-collapsed .topic-nav-body { display: none; }

.panel-header {
  flex-shrink: 0;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    165deg,
    rgba(56, 189, 248, 0.14) 0%,
    rgba(14, 116, 178, 0.06) 45%,
    transparent 100%
  );
  box-shadow: inset 0 -1px 0 rgba(56, 189, 248, 0.1);
}

.panel-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  color: #f2fbff;
  text-shadow:
    0 0 14px rgba(56, 189, 248, 0.65),
    0 0 32px rgba(56, 189, 248, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

.panel-title-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.22em;
  letter-spacing: 0.06em;
  color: var(--accent-bright);
  margin: 0 0.1em;
  vertical-align: -0.02em;
  text-shadow:
    0 0 18px rgba(56, 189, 248, 0.95),
    0 0 36px rgba(56, 189, 248, 0.45);
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--accent-bright);
  margin: 0 0 8px;
  opacity: 0.9;
}

.section-label--subblock {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.control-group {
  margin: 0 10px;
  padding: 10px 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 20, 40, 0.5);
}

.control-group[hidden] {
  display: none !important;
}

.panel-select {
  display: block;
  width: 100%;
  padding: 6px 32px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 40, 70, 0.5);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  line-height: 1.25;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2367e8f9' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.panel-select:hover,
.panel-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.panel-select option {
  background: #0a1828;
  color: var(--text);
}

.topic-nav-controls {
  padding: 0;
}

.layer-checkboxes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 10px;
}

.control-group-layers .layer-checkboxes {
  margin-top: 0;
}

.control-group-season .season-hint {
  margin: 8px 0 0;
  font-size: 0.64rem;
  line-height: 1.45;
  color: var(--muted);
}

.control-group-season .season-hint[hidden] {
  display: none !important;
}

.layer-checkboxes > label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
  font-family: var(--font-ui);
  cursor: pointer;
}

.layer-checkboxes input[type="checkbox"] {
  width: auto;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.layer-checkboxes > label.layer-check-full {
  grid-column: 1 / -1;
}

.layer-check-with-select {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
  font-family: var(--font-ui);
}

.layer-check-with-select .layer-check-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
}

.layer-check-with-select .panel-select--compact {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 5px 28px 5px 9px;
  font-size: 0.75rem;
}

.layer-check-with-select .panel-select--compact[hidden] {
  display: none !important;
}

#topicNavControlsSection.view-3d-readonly::after {
  content: '立体视图下不可编辑，请切回平面视图。';
  display: block;
  margin-top: 8px;
  font-size: 0.64rem;
  line-height: 1.4;
  color: var(--accent-bright);
}

.knowledge-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(5, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: var(--panel-glow);
}

.panel-explain-entry {
  flex-shrink: 0;
  margin: 0 10px 8px;
  min-width: 0;
  max-height: min(38vh, 300px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-explain-entry:not(.collapsed) .collapsible-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

.panel-explain-entry .collapsible-head {
  flex-shrink: 0;
}

.collapsible-box {
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  box-sizing: border-box;
}

.collapsible-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.collapsible-box:not(.collapsed) .collapsible-head {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.collapsible-head-title {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.collapsible-head-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 40, 70, 0.5);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.collapsible-head-btn:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(56, 189, 248, 0.1);
}

.collapsible-box.collapsed .collapsible-content {
  display: none;
}

.collapsible-box.collapsed .collapsible-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.panel-explain-entry .step-title {
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 6px;
  line-height: 1.45;
  color: var(--text);
}

.knowledge-explain-body {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-soft);
  font-family: var(--font-ui);
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ctrl-btn {
  display: block;
  width: 100%;
  padding: 5px 8px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ctrl-btn:hover:not(:disabled) {
  border-color: var(--border-bright);
  color: var(--text);
  background: var(--accent-dim);
}
.ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ctrl-btn--primary {
  background: linear-gradient(135deg, var(--accent-soft), #0284c7);
  color: #fff;
  border-color: var(--accent);
}
.ctrl-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #fff;
}

.ctrl-btn-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.ctrl-btn-row .ctrl-btn {
  margin-bottom: 0;
  padding: 5px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arrow-settings {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.arrow-settings[hidden] { display: none !important; }

.ctrl-label {
  font-size: 0.66rem;
  color: var(--muted);
  margin: 5px 0 3px;
  letter-spacing: 0.04em;
}

.color-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.color-toggle {
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-soft);
  font-size: 0.64rem;
  line-height: 1.25;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.color-toggle[data-color="blue"].active {
  border-color: var(--cold);
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.25);
}
.color-toggle[data-color="red"].active {
  border-color: var(--warm);
  color: #fca5a5;
  background: rgba(229, 75, 93, 0.25);
}
.color-toggle[data-color="white"].active {
  border-color: #e2e8f0;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.18);
}
.color-toggle[data-color="black"].active {
  border-color: #64748b;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.55);
}

.color-toggle-row--quad {
  grid-template-columns: repeat(4, 1fr);
}

.cause-factor-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.cause-factor-btn {
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-soft);
  font-size: 0.64rem;
  line-height: 1.3;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cause-factor-btn:hover:not(.active) {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--text);
}

.cause-factor-btn.active {
  border-color: var(--accent);
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.12);
}

.cause-factor-btn:nth-child(5) {
  grid-column: 1 / -1;
}

.ctrl-text-input {
  display: block;
  width: 100%;
  padding: 5px 8px;
  margin-bottom: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.76rem;
  font-family: inherit;
  line-height: 1.35;
}
.ctrl-text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 2px 0;
  accent-color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
}

.ctrl-value {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  margin-top: 2px;
  margin-bottom: 2px;
  color: var(--accent-bright);
}

.topic-nav-copyright-entry {
  flex-shrink: 0;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
}
.copyright-text-btn {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.copyright-text-btn:hover {
  background: var(--accent-dim);
  border-color: var(--border-bright);
  color: var(--text-soft);
}

/* ========== 右侧动画区 ========== */
.stage-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--stage-base);
  overflow: hidden;
  z-index: 1;
}

.stage-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(14, 116, 178, 0.12) 0%, transparent 60%);
}

#canvas3d {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  cursor: grab;
  touch-action: none;
  background: var(--stage-base);
}
#canvas3d:active { cursor: grabbing; }
.stage-wrap.flat #canvas3d { display: none; }
.stage-wrap:not(.flat) .stage-content {
  visibility: hidden;
  pointer-events: none;
}

.stage-content {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.map-stage {
  width: 100%;
  height: 100%;
  position: relative;
}
.map-stage[hidden] { display: none !important; }

.map-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

.map-transform {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-stack {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.map-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.arrow-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.grid-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.graticule-label-layer {
  position: absolute;
  left: calc(-1 * var(--graticule-label-left-pad, 34px));
  top: calc(-1 * var(--graticule-label-top-pad, 12px));
  overflow: visible;
  pointer-events: none;
}

.graticule-line {
  stroke: rgba(103, 232, 249, 0.38);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}

.graticule-line.graticule-major {
  stroke: rgba(147, 197, 253, 0.58);
  stroke-width: 1.25;
}

.graticule-label {
  fill: #ffffff;
  font-family: var(--font-ui);
  font-weight: 500;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, 0.32);
  stroke-width: 1px;
}

.graticule-label-lat {
  text-anchor: end;
  dominant-baseline: middle;
}

.graticule-label-lon {
  text-anchor: middle;
  dominant-baseline: alphabetic;
}

.map-stage.is-view-only .arrow-group,
.map-stage.is-view-only .label-group {
  pointer-events: none;
  cursor: default;
}

.map-viewport.is-pannable { cursor: grab; }
.map-viewport.is-panning { cursor: grabbing; }

.arrow-group {
  pointer-events: all;
  cursor: grab;
}
.arrow-group:active { cursor: grabbing; }
.arrow-group.selected { cursor: grab; }

.arrow-shaft,
.arrow-head {
  fill: var(--cold);
  stroke: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  transition: filter 0.15s;
}
.arrow-group[data-color="red"] .arrow-shaft,
.arrow-group[data-color="red"] .arrow-head { fill: var(--warm); }
.arrow-group[data-color="blue"] .arrow-shaft,
.arrow-group[data-color="blue"] .arrow-head { fill: var(--cold); }

.arrow-group.selected .arrow-shaft,
.arrow-group.selected .arrow-head {
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.55)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.arrow-group.selected .selection-ring {
  display: block;
}

.arrow-flow {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-linecap: round;
  stroke-dasharray: 6 10;
  pointer-events: none;
  animation: arrow-flow-dash 1.3s linear infinite;
  animation-delay: calc(var(--flow-phase, 0) * -1.3s);
}

@keyframes arrow-flow-dash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -32; }
}

.selection-ring {
  display: none;
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.label-group {
  pointer-events: all;
  cursor: grab;
}
.label-group:active { cursor: grabbing; }

.label-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
  cursor: grab;
}

.label-text {
  font-family: var(--font-ui);
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: visiblePainted;
  cursor: grab;
}
.label-group[data-color="blue"] .label-text { fill: var(--cold); }
.label-group[data-color="red"] .label-text { fill: var(--warm); }
.label-group[data-color="white"] .label-text { fill: #ffffff; }
.label-group[data-color="black"] .label-text { fill: #111827; }

.label-group.selected .label-text {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.55));
}
.label-group.selected .selection-ring { display: block; }

.text-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.text-stage[hidden] { display: none !important; }

.text-stage-inner {
  max-width: 720px;
  width: 100%;
  padding: 28px 32px;
  background: var(--panel-elevated);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.text-stage-inner h3 {
  font-size: 1.1rem;
  color: var(--accent-bright);
  margin-bottom: 16px;
  letter-spacing: 0.06em;
}
.text-stage-inner p {
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.text-stage-inner ul {
  margin: 0 0 12px 1.2em;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--text-soft);
}
.text-stage-inner li { margin-bottom: 6px; }

.text-stage--cause {
  position: relative;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.text-stage--cause .text-stage-inner {
  display: none !important;
}

.cause-demo-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.text-stage--types {
  position: relative;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.text-stage--types .text-stage-inner {
  display: none !important;
}

.text-stage--impact {
  position: relative;
  align-items: stretch;
  justify-content: stretch;
  padding: 12px;
}

.text-stage--impact .text-stage-inner {
  display: none !important;
}

.stage-image-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage-image-viewport {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(3, 8, 14, 0.35);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35), 0 8px 32px rgba(0, 0, 0, 0.35);
  touch-action: none;
  cursor: default;
  outline: none;
}

.stage-image-viewport.is-dragging {
  cursor: grabbing;
}

.stage-image-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  will-change: transform;
}

.stage-image {
  display: block;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.stage-image-toolbar {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(5, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: var(--panel-glow);
}

.stage-image-tool-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-family: var(--font-ui);
  color: var(--muted);
  background: rgba(0, 40, 70, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.stage-image-tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}

.stage-image-tool-reset {
  width: auto;
  padding: 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.stage-image-zoom-val {
  min-width: 3.2em;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-align: center;
}

.stage-image-error {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-soft);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: rgba(12, 28, 56, 0.45);
}

.types-demo-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.types-demo-canvas {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.types-demo-btn-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 10px 16px 16px;
}

.types-demo-btn {
  min-width: 120px;
  padding: 8px 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent, #38bdf8);
  background: rgba(56, 189, 248, 0.12);
  color: var(--text, #e8f4ff);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.types-demo-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.22);
  border-color: #67e8f9;
}

.types-demo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--border, rgba(255, 255, 255, 0.15));
  background: rgba(0, 0, 0, 0.15);
}

.types-flow-caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  max-width: min(760px, calc(100% - 48px));
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.55;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}
.types-flow-caption[hidden] { display: none !important; }
.types-flow-caption--warm { color: #dc2626; }
.types-flow-caption--cold { color: #2563eb; }

.hint-map {
  position: absolute;
  z-index: 8;
  top: 14px;
  left: 14px;
  max-width: min(420px, calc(100% - 28px));
  font-size: 0.74rem;
  color: var(--text-soft);
  background: var(--glass);
  backdrop-filter: blur(10px);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  border: 1px solid var(--glass-border);
}
.hint-map[hidden] { display: none !important; }
.hint-map.hint-map--single-line {
  max-width: none;
  white-space: nowrap;
}

.stage-view-tabs {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.stage-view-tabs[hidden] { display: none !important; }
.stage-view-tabs > .view-tabs {
  pointer-events: auto;
  background: var(--panel-elevated);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-bright);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.1);
}
.view-tabs {
  display: flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 3px;
  gap: 2px;
}
.view-tabs button {
  padding: 9px 20px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-family: inherit;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.view-tabs button:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
}
.view-tabs button.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.5), rgba(56, 189, 248, 0.35));
  color: #fff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
}

.stage-reset-wrap {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 28;
}
.stage-reset-wrap button {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.86rem;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.stage-reset-wrap button:hover {
  background: var(--accent-dim);
  border-color: var(--border-bright);
  color: var(--text);
}

/* 版权弹窗 */
.copyright-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 16, 0.75);
  backdrop-filter: blur(6px);
}
.copyright-modal-overlay[hidden] { display: none !important; }

.copyright-modal-dialog {
  width: min(96vw, 520px);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-bright);
  background: linear-gradient(165deg, #0f1f3d 0%, #060d1f 55%, #040810 100%);
  padding: 20px;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.6);
}
.copyright-modal-title {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: var(--text);
  text-align: center;
}
.copyright-modal-qr-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 30px;
}
.copyright-modal-qr-col { text-align: center; }
.copyright-qrcode {
  display: block;
  margin: 0 auto;
  max-width: 150px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
}
.copyright-modal-qr-caption {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}
.copyright-note {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.65;
  text-align: center;
}
.copyright-modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}
.copyright-modal-actions button {
  min-width: 120px;
  padding: 9px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--accent-dim);
  color: var(--text);
  font-family: inherit;
}

@media (max-width: 720px) {
  :root { --sidebar-width: min(100%, 100vw); }
  .layout.panel-collapsed .topic-nav-column { width: 0; }
  .topic-nav-toggle-btn {
    left: auto;
    right: 12px;
    top: auto;
    bottom: 12px;
    transform: none;
    border-radius: var(--radius-sm);
    border-left: 1px solid var(--border-bright);
    width: 36px;
    height: 36px;
  }
}
