/* ============================================================
   认知模式工具集 · Design System v2
   米白底 · 分层粉彩 · 结构化图示
   ============================================================ */

:root {
  /* ---------- Base palette ---------- */
  --bg:               #FAFAF6;
  --bg-elevated:      #F4F1EA;
  --surface:          #FFFFFF;
  --surface-soft:     #FBF9F3;
  --border-subtle:    #ECE8DE;
  --border:           #DCD7C8;
  --border-strong:    #B9B3A2;
  --text:             #2A2925;
  --text-secondary:   #6B6862;
  --text-tertiary:    #9A9690;
  --text-disabled:    #C4C0B7;
  --accent:           #4A6FA5;  /* neutral accent for buttons etc */

  /* ---------- Dimension theme tokens (overridden per-page via body[data-theme]) ---------- */
  --theme-tint:       #EFEEE8;
  --theme-tint-soft:  #F6F5EF;
  --theme-border:     #C8C2B3;
  --theme-border-soft:#DAD5C7;
  --theme-accent:     #6B6B5E;
  --theme-accent-soft:#8A8779;

  /* ---------- Semantic colors ---------- */
  --color-positive:   #5A9D7E;
  --color-positive-bg:#E8F1EB;
  --color-warning:    #B88346;
  --color-warning-bg: #F6EBDB;
  --color-info:       #4A6FA5;
  --color-info-bg:    #E5ECF4;

  /* ---------- Typography ---------- */
  --font-serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --font-sans:  'Noto Sans SC', -apple-system, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'DM Serif Display', 'Noto Serif SC', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --fs-display: clamp(2.4rem, 4.6vw, 3.6rem);
  --fs-h1:      clamp(1.85rem, 3.2vw, 2.5rem);
  --fs-h2:      clamp(1.35rem, 2.4vw, 1.75rem);
  --fs-h3:      clamp(1.1rem, 1.8vw, 1.35rem);
  --fs-h4:      1.05rem;
  --fs-body-lg: 1.05rem;
  --fs-body:    0.95rem;
  --fs-caption: 0.825rem;
  --fs-label:   0.72rem;

  --lh-tight:   1.2;
  --lh-snug:    1.4;
  --lh-normal:  1.65;
  --lh-relaxed: 1.85;

  --ls-tight:  -0.01em;
  --ls-wide:    0.06em;
  --ls-wider:   0.14em;

  /* ---------- Spacing ---------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  /* ---------- Radius ---------- */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 20px;

  /* ---------- Shadows ---------- */
  --shadow-sm: 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-md: 0 2px 12px rgba(60, 50, 30, 0.06);
  --shadow-lg: 0 8px 28px rgba(60, 50, 30, 0.08);

  /* ---------- Motion ---------- */
  --t-fast: 0.15s;
  --t-base: 0.25s;
  --t-slow: 0.4s;
  --t-slower: 0.7s;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ---------- Layout ---------- */
  --container-narrow: 720px;
  --container-base:   960px;
  --container-wide:  1180px;
}

/* ============================================================
   Per-dimension themes (applied via body[data-theme="..."])
   Each theme defines: tint (page background washes), border, accent
   ============================================================ */

/* 因果 · 雾紫 (lavender) */
body[data-theme="causal"] {
  --theme-tint:        #EEE9F4;
  --theme-tint-soft:   #F6F2FA;
  --theme-border:      #C9BBE0;
  --theme-border-soft: #DDD2EC;
  --theme-accent:      #7261A8;
  --theme-accent-soft: #9C8AC8;
}

/* 概率 · 雾蓝 (slate-blue) */
body[data-theme="probability"] {
  --theme-tint:        #E6EDF5;
  --theme-tint-soft:   #F1F4FA;
  --theme-border:      #B5C7DE;
  --theme-border-soft: #CCD8E8;
  --theme-accent:      #4A6FA5;
  --theme-accent-soft: #7A98C0;
}

/* 系统 · 雾绿 (sage) */
body[data-theme="systems"] {
  --theme-tint:        #E0ECDF;
  --theme-tint-soft:   #EEF5ED;
  --theme-border:      #B0CDB6;
  --theme-border-soft: #C8DACC;
  --theme-accent:      #5A9D7E;
  --theme-accent-soft: #82B89F;
}

/* 身份 · 雾粉 (dusty rose) */
body[data-theme="identity"] {
  --theme-tint:        #F1E1E3;
  --theme-tint-soft:   #F8EFEF;
  --theme-border:      #DAB5BB;
  --theme-border-soft: #E5CACE;
  --theme-accent:      #B36B7E;
  --theme-accent-soft: #C794A1;
}

/* 叙事 · 雾橘 (peach) */
body[data-theme="narrative"] {
  --theme-tint:        #F4E6D5;
  --theme-tint-soft:   #FAF0E2;
  --theme-border:      #E0C49E;
  --theme-border-soft: #EBD5B8;
  --theme-accent:      #B88346;
  --theme-accent-soft: #CCA571;
}

/* 约束 · 雾灰蓝 (slate-grey) */
body[data-theme="constraints"] {
  --theme-tint:        #E5E5EC;
  --theme-tint-soft:   #F0F0F5;
  --theme-border:      #BFBFCE;
  --theme-border-soft: #D4D4DD;
  --theme-accent:      #6E6E89;
  --theme-accent-soft: #9292AB;
}

/* 决策 · 雾青 (teal) */
body[data-theme="decision"] {
  --theme-tint:        #DBE9E9;
  --theme-tint-soft:   #ECF3F3;
  --theme-border:      #A6C6C6;
  --theme-border-soft: #C0D5D5;
  --theme-accent:      #4A8E8E;
  --theme-accent-soft: #7AAFAF;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga";
  min-height: 100vh;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
a { color: var(--theme-accent); text-decoration: none; transition: color var(--t-fast) var(--ease-out); }
a:hover { color: var(--text); }
::selection { background: var(--theme-tint); color: var(--text); }

/* ============================================================
   Typography
   ============================================================ */
.display {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text);
}
h1, .h1 { font-family: var(--font-serif); font-weight: 600; font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); margin: 0; color: var(--text); }
h2, .h2 { font-family: var(--font-serif); font-weight: 500; font-size: var(--fs-h2); line-height: var(--lh-snug); margin: 0; color: var(--text); }
h3, .h3 { font-family: var(--font-serif); font-weight: 500; font-size: var(--fs-h3); line-height: var(--lh-snug); margin: 0; color: var(--text); }
h4, .h4 { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-h4); line-height: var(--lh-snug); margin: 0; }

.body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-relaxed); }
.caption { font-size: var(--fs-caption); color: var(--text-secondary); line-height: var(--lh-normal); }
.label {
  font-size: var(--fs-label);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 500;
}
.label-en {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-tertiary);
  font-weight: 400;
}
.serif { font-family: var(--font-serif); }
.muted { color: var(--text-secondary); }
.dim { color: var(--text-tertiary); }
.accent { color: var(--theme-accent); }

/* ============================================================
   Layout
   ============================================================ */
.container        { width: 100%; max-width: var(--container-base);   margin: 0 auto; padding: 0 var(--s-5); }
.container-narrow { width: 100%; max-width: var(--container-narrow); margin: 0 auto; padding: 0 var(--s-5); }
.container-wide   { width: 100%; max-width: var(--container-wide);   margin: 0 auto; padding: 0 var(--s-5); }

.stack-1 > * + * { margin-top: var(--s-1); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-5 > * + * { margin-top: var(--s-5); }
.stack-6 > * + * { margin-top: var(--s-6); }
.stack-7 > * + * { margin-top: var(--s-7); }

.grid    { display: grid; gap: var(--s-5); }
.grid-2  { grid-template-columns: repeat(2, 1fr); }
.grid-3  { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.section    { padding: var(--s-8) 0; }
.section-lg { padding: var(--s-9) 0; }

/* ============================================================
   Dividers
   ============================================================ */
.divider { width: 100%; height: 1px; background: var(--border-subtle); border: none; margin: var(--s-6) 0; }
.divider-short { width: 32px; height: 1px; background: var(--border); border: none; margin: var(--s-4) 0; }
.divider-dot::before { content: '·'; margin: 0 var(--s-3); color: var(--text-tertiary); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all var(--t-base) var(--ease-out);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--theme-accent);
  color: #fff;
  border-color: var(--theme-accent);
}
.btn-primary:hover {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--s-2) var(--s-3);
}
.btn-ghost:hover { color: var(--text); }
.btn-lg { padding: var(--s-4) var(--s-7); font-size: var(--fs-body-lg); min-height: 52px; }
.btn:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 3px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ============================================================
   Card primitives
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  transition: all var(--t-base) var(--ease-out);
}
.card-hover:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card-soft {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-5);
}

/* ============================================================
   ★ Layered Diagram (the signature pattern from the reference)
   A tinted container that holds multiple white sub-cards.
   Use .diagram > .diagram-header + .diagram-body
   diagram-body contains 3 .diagram-box children.
   ============================================================ */
.diagram {
  background: var(--theme-tint);
  border: 1px solid var(--theme-border);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-5) var(--s-6);
  margin: var(--s-5) 0;
}
.diagram-header {
  text-align: center;
  padding: var(--s-3) var(--s-3) var(--s-5);
}
.diagram-header .layer-label {
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--theme-accent);
  font-size: 1.05rem;
  margin-bottom: var(--s-1);
}
.diagram-header .layer-sub {
  display: block;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-top: var(--s-1);
}
.diagram-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
@media (max-width: 760px) {
  .diagram-body { grid-template-columns: 1fr; }
}
.diagram-box {
  background: var(--surface);
  border: 1px solid var(--theme-border-soft);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.diagram-box .box-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--theme-accent);
  font-weight: 500;
  text-align: center;
  margin: 0;
  padding-bottom: var(--s-1);
}
.diagram-box .box-en {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-tertiary);
  text-align: center;
  margin-bottom: var(--s-2);
  padding-bottom: var(--s-3);
  border-bottom: 1px dashed var(--theme-border-soft);
}
.diagram-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.diagram-box ul li::before {
  content: '·';
  color: var(--theme-accent);
  margin-right: var(--s-2);
  font-weight: bold;
}

/* Footnote / connector below the diagram */
.diagram-footnote {
  text-align: center;
  padding-top: var(--s-4);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  font-style: italic;
}

/* Bottom summary row (the "low vs high" output band) */
.diagram-output {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-5);
}
@media (max-width: 720px) {
  .diagram-output { grid-template-columns: 1fr; }
}
.diagram-output .out-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--border);
}
.diagram-output .out-card.neg { border-color: rgba(196, 130, 130, 0.5); background: #FBF0F0; }
.diagram-output .out-card.pos { border-color: rgba(120, 170, 145, 0.5); background: #F0F7F2; }
.diagram-output .out-card .out-label {
  font-family: var(--font-serif);
  font-weight: 500;
  margin-bottom: var(--s-1);
}
.diagram-output .out-card.neg .out-label { color: #A85A5A; }
.diagram-output .out-card.pos .out-label { color: #4A8865; }
.diagram-output .out-card .out-body {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}

/* ============================================================
   Question Card
   ============================================================ */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-5);
  margin-bottom: var(--s-5);
  box-shadow: var(--shadow-sm);
}
.question-card .q-index {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--theme-accent);
  font-size: 1.05rem;
  margin-bottom: var(--s-2);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.question-card .q-index::before {
  content: '';
  width: 14px;
  height: 1px;
  background: var(--theme-accent);
  display: inline-block;
}
.question-card .q-text {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  line-height: var(--lh-snug);
  color: var(--text);
  margin: 0 0 var(--s-5);
}
.option-list {
  display: grid;
  gap: var(--s-2);
}
.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
  min-height: 56px;
  position: relative;
}
.option-btn .option-key {
  display: inline-block;
  margin-right: var(--s-4);
  color: var(--text-tertiary);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
}
.option-btn:hover {
  background: var(--surface);
  border-color: var(--theme-border);
}
.option-btn.selected {
  background: var(--theme-tint-soft);
  border-color: var(--theme-accent);
  color: var(--text);
}
.option-btn.selected .option-key { color: var(--theme-accent); }
.option-btn:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 2px; }

/* ============================================================
   Result Cards
   ============================================================ */
.result-card {
  border-radius: var(--r-lg);
  padding: var(--s-6);
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.result-card .tag {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--theme-accent);
  margin-bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.result-card .tag::before {
  content: '';
  width: 14px;
  height: 1px;
  background: var(--theme-accent);
}
.result-card h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: var(--s-4);
  color: var(--text);
}
.result-card p {
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--text);
  margin: 0;
}
.result-card p + p { margin-top: var(--s-3); }
.result-card em { font-style: normal; color: var(--theme-accent); font-weight: 500; }
.result-card strong { color: var(--text); font-weight: 600; }

.result-card.strength {
  background: var(--theme-tint-soft);
  border-color: var(--theme-border-soft);
}
.result-card.strength .tag { color: var(--theme-accent); }

.result-card.blind-spot {
  background: var(--color-warning-bg);
  border-color: rgba(184, 131, 70, 0.35);
}
.result-card.blind-spot .tag { color: var(--color-warning); }
.result-card.blind-spot .tag::before { background: var(--color-warning); }
.result-card.blind-spot em { color: var(--color-warning); }

.result-card.ai-tip {
  background: var(--color-info-bg);
  border-color: rgba(74, 111, 165, 0.3);
}
.result-card.ai-tip .tag { color: var(--color-info); }
.result-card.ai-tip .tag::before { background: var(--color-info); }
.result-card.ai-tip em { color: var(--color-info); }

/* ============================================================
   Chips
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-caption);
  padding: var(--s-1) var(--s-3);
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.chip.is-done { color: var(--color-positive); border-color: rgba(90, 157, 126, 0.4); background: var(--color-positive-bg); }
.chip.is-progress { color: var(--theme-accent); border-color: var(--theme-border); }

/* ============================================================
   Progress bar
   ============================================================ */
.progress {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.progress-segments {
  display: flex;
  gap: 4px;
}
.progress-segment {
  width: 18px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  transition: background-color var(--t-base) var(--ease-out);
}
.progress-segment.is-active { background: var(--theme-accent); }
.progress-segment.is-current { background: var(--text); }

/* ============================================================
   ★ i18n / Bilingual content switching
   Wrap any translatable element with two sibling spans/blocks:
     <span data-lang="zh">中文</span><span data-lang="en">English</span>
   The active language shows as `display: contents` (transparent in layout);
   the inactive one is hidden.
   ============================================================ */
html[lang="zh"] [data-lang="zh"] { display: contents; }
html[lang="zh"] [data-lang="en"] { display: none !important; }
html[lang="en"] [data-lang="en"] { display: contents; }
html[lang="en"] [data-lang="zh"] { display: none !important; }

/* For block-level dual content where `display: contents` isn't appropriate,
   use `data-lang-block` attribute — it uses display: block instead. */
html[lang="zh"] [data-lang-block="zh"] { display: block; }
html[lang="zh"] [data-lang-block="en"] { display: none !important; }
html[lang="en"] [data-lang-block="en"] { display: block; }
html[lang="en"] [data-lang-block="zh"] { display: none !important; }

/* Apply English font preferences when language is English */
html[lang="en"] body { font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif; }
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3, html[lang="en"] h4,
html[lang="en"] .serif, html[lang="en"] [data-lang="en"] h1, html[lang="en"] [data-lang="en"] h2 {
  font-family: 'Cormorant Garamond', 'DM Serif Display', Georgia, serif;
}

/* Language toggle button */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 4px 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
  letter-spacing: 0.04em;
}
.lang-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface);
}
.lang-toggle .lang-current {
  font-weight: 600;
  color: var(--text);
}
.lang-toggle .lang-sep { color: var(--text-tertiary); }

/* ============================================================
   Top Navigation
   ============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 250, 246, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}
.topnav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  max-width: var(--container-wide);
  margin: 0 auto;
}
.topnav-left   { justify-self: start; }
.topnav-center { justify-self: center; }
.topnav-right  { justify-self: end; font-size: var(--fs-caption); color: var(--text-secondary); display: flex; align-items: center; gap: var(--s-3); }
.topnav a, .topnav button { font-size: var(--fs-caption); color: var(--text-secondary); transition: color var(--t-fast) var(--ease-out); }
.topnav a:hover { color: var(--text); }

/* ============================================================
   ★ Structured Result Presentation
   Headline diagnosis → reasoning trio → feature block →
   strength/blind-spot pair → AI implication pair
   ============================================================ */

/* Top diagnosis box (uses theme color) */
.diagnose-box {
  margin: var(--s-5) auto var(--s-7);
  max-width: 560px;
  padding: var(--s-5) var(--s-6);
  text-align: center;
  background: var(--theme-tint);
  border: 1.5px solid var(--theme-border);
  border-radius: var(--r-lg);
}
.diagnose-box .dx-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-bottom: var(--s-2);
  letter-spacing: 0.04em;
}
.diagnose-box .dx-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.6vw, 1.85rem);
  color: var(--theme-accent);
  font-weight: 600;
  margin-bottom: var(--s-2);
  line-height: 1.25;
}
.diagnose-box .dx-tagline {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  font-family: var(--font-serif);
}

/* Section wrapper for each reasoning subsection */
.reason-section {
  margin: var(--s-7) auto;
  max-width: var(--container-base);
}
.reason-section-title {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--s-4);
}
.reason-section-title .en {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-weight: 400;
  margin-top: var(--s-1);
  letter-spacing: 0.04em;
}

/* Trio: left box + center connector + right box (for symmetric comparisons) */
.compare-trio {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-3);
  align-items: center;
}
@media (max-width: 720px) {
  .compare-trio { grid-template-columns: 1fr; gap: var(--s-3); }
  .compare-trio .compare-connector { grid-row: 2; max-width: 280px; margin: 0 auto; }
  .compare-trio .compare-side.right { grid-row: 3; }
}
.compare-side {
  background: #E8F1EB;  /* sage tint */
  border: 1px solid rgba(120, 170, 145, 0.4);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.compare-side .cs-label {
  text-align: center;
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--text);
  font-size: 1.05rem;
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
  border-bottom: 1px solid rgba(120, 170, 145, 0.4);
}
.compare-side .cs-attr {
  text-align: center;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: var(--s-3);
  line-height: var(--lh-normal);
}
.compare-side .cs-attr strong {
  color: var(--color-positive);
  font-weight: 500;
}
.compare-side ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.compare-side ul li::before {
  content: '·';
  color: var(--color-positive);
  margin-right: var(--s-2);
  font-weight: bold;
}

.compare-connector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  text-align: center;
  min-width: 130px;
  box-shadow: var(--shadow-sm);
}
.compare-connector .cc-title {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 2px;
}
.compare-connector .cc-sub {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}

/* Three-aspect reasoning row (for non-symmetric dimensions: 3 sequential boxes) */
.reason-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
}
@media (max-width: 720px) {
  .reason-trio { grid-template-columns: 1fr; }
}

/* Feature block (single emphasized box, for 最强领域) */
.feature-block {
  background: #E8F1EB;
  border: 1px solid rgba(120, 170, 145, 0.4);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
}
.feature-block .fb-title {
  text-align: center;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--color-positive);
  font-size: 1.2rem;
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid rgba(120, 170, 145, 0.4);
}
.feature-block .fb-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--s-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  justify-content: center;
  text-align: center;
}
.feature-block .fb-bullets li::before {
  content: '·';
  color: var(--color-positive);
  margin-right: var(--s-2);
  font-weight: bold;
}
.feature-block .fb-conclusion {
  text-align: center;
  font-family: var(--font-serif);
  color: var(--text);
  font-size: var(--fs-body);
  font-style: italic;
}
.feature-block .fb-conclusion::before {
  content: '→ ';
  color: var(--color-positive);
  font-style: normal;
}

/* Implication pair (strength + blind spot side by side) */
.imp-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
@media (max-width: 720px) { .imp-pair { grid-template-columns: 1fr; } }
.imp-card {
  border-radius: var(--r-lg);
  padding: var(--s-5);
  border: 1px solid;
}
.imp-card .ic-label {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-3);
  border-bottom: 1px dashed;
}
.imp-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.imp-card ul li {
  padding-left: var(--s-4);
  position: relative;
}
.imp-card ul li::before {
  content: '·';
  position: absolute;
  left: 0;
  font-weight: bold;
}

.imp-card.imp-positive {
  background: var(--theme-tint);
  border-color: var(--theme-border);
}
.imp-card.imp-positive .ic-label {
  color: var(--theme-accent);
  border-color: var(--theme-border-soft);
}
.imp-card.imp-positive ul li::before { color: var(--theme-accent); }

.imp-card.imp-negative {
  background: #FBEAEA;
  border-color: rgba(196, 130, 130, 0.4);
}
.imp-card.imp-negative .ic-label {
  color: #B25555;
  border-color: rgba(196, 130, 130, 0.3);
}
.imp-card.imp-negative ul li::before { color: #B25555; }

/* AI implication pair (with arrow between) */
.ai-imp-block {
  margin-top: var(--s-6);
  padding-top: var(--s-6);
  border-top: 1px dashed var(--border);
}
.ai-imp-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-3);
  align-items: stretch;
}
@media (max-width: 720px) {
  .ai-imp-pair { grid-template-columns: 1fr; }
  .ai-imp-pair .ai-imp-arrow { display: none; }
}
.ai-imp-card {
  border-radius: var(--r-lg);
  padding: var(--s-5);
  border: 1px solid;
}
.ai-imp-card .aic-label {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-3);
  border-bottom: 1px dashed;
}
.ai-imp-card p {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  text-align: center;
}
.ai-imp-card.reinforce {
  background: #E8F1EB;
  border-color: rgba(120, 170, 145, 0.4);
}
.ai-imp-card.reinforce .aic-label { color: var(--color-positive); border-color: rgba(120, 170, 145, 0.4); }

.ai-imp-card.补足, .ai-imp-card.cover {
  background: #FBEAEA;
  border-color: rgba(196, 130, 130, 0.4);
}
.ai-imp-card.cover .aic-label { color: #B25555; border-color: rgba(196, 130, 130, 0.3); }

.ai-imp-arrow {
  display: flex;
  align-items: center;
  color: var(--text-tertiary);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.4rem;
  padding: 0 var(--s-2);
}

/* ============================================================
   ★ Next-Step Card — strong CTA shown after analyze() completes
   Uses --next-color (set inline) to preview the next dimension's tint.
   ============================================================ */
.next-step-card {
  margin: var(--s-7) 0 var(--s-5);
  padding: var(--s-7) var(--s-6) var(--s-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.next-step-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 4px;
  background: var(--next-color, var(--accent));
}
.ns-completion {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.ns-check {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--color-positive-bg);
  color: var(--color-positive);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  flex-shrink: 0;
  border: 1px solid rgba(90, 157, 126, 0.3);
}
.ns-completion-text { display: flex; flex-direction: column; }
.ns-completion-line {
  font-family: var(--font-serif);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.3;
}
.ns-progress-text {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-top: 2px;
}
.ns-progress {
  display: flex;
  gap: 5px;
  margin-bottom: var(--s-5);
}
.ns-seg {
  flex: 1;
  height: 5px;
  background: var(--border-subtle);
  border-radius: 3px;
  transition: background var(--t-base) var(--ease-out);
}
.ns-seg.is-done { background: var(--color-positive); }
.ns-seg.is-next { background: var(--next-color, var(--accent)); opacity: 0.4; }
.ns-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--s-5) 0;
}
.ns-next-label {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-tertiary);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  margin-bottom: var(--s-2);
}
.ns-next-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: var(--s-1);
  line-height: 1.25;
}
.ns-next-en {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--next-color, var(--text-tertiary));
  font-size: 0.95rem;
  margin-bottom: var(--s-3);
}
.ns-next-desc {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--s-5);
  max-width: 32rem;
}
.ns-actions {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  flex-wrap: wrap;
}
.ns-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-7);
  min-height: 52px;
  font-family: var(--font-sans);
  font-size: var(--fs-body-lg);
  font-weight: 500;
  border-radius: var(--r-md);
  background: var(--next-color, var(--accent));
  color: #fff;
  border: 1px solid var(--next-color, var(--accent));
  text-decoration: none;
  transition: all var(--t-base) var(--ease-out);
  cursor: pointer;
}
.ns-cta:hover {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  transform: translateY(-1px);
}
.ns-cta:focus-visible { outline: 2px solid var(--next-color, var(--accent)); outline-offset: 3px; }
.ns-secondary {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--s-2) var(--s-3);
  transition: color var(--t-fast) var(--ease-out);
}
.ns-secondary:hover { color: var(--text); }
@media (max-width: 520px) {
  .next-step-card { padding: var(--s-5) var(--s-4); }
  .ns-next-title { font-size: 1.35rem; }
  .ns-actions { flex-direction: column; align-items: stretch; }
  .ns-cta { width: 100%; }
  .ns-secondary { text-align: center; }
}

/* ============================================================
   Bottom Navigation
   ============================================================ */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-6) 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--s-7);
}
.page-nav a {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.page-nav a:hover { color: var(--text); }
.page-nav .next { font-family: var(--font-serif); color: var(--theme-accent); }
.page-nav .next:hover { color: var(--text); }

/* ============================================================
   Tooltip
   ============================================================ */
.tooltip { position: relative; display: inline-flex; }
.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-caption);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out);
  box-shadow: var(--shadow-md);
}
.tooltip:hover .tooltip-content { opacity: 1; }

/* ============================================================
   Animation
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn var(--t-slow) var(--ease-out) both; }
.slide-up { animation: slideUp var(--t-slow) var(--ease-out) both; }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-slower) var(--ease-out),
              transform var(--t-slower) var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.stagger-children > * { opacity: 0; transform: translateY(12px); }
.stagger-children.is-visible > * {
  animation: slideUp var(--t-slow) var(--ease-out) both;
}
.stagger-children.is-visible > *:nth-child(1) { animation-delay: 0.00s; }
.stagger-children.is-visible > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-children.is-visible > *:nth-child(3) { animation-delay: 0.16s; }
.stagger-children.is-visible > *:nth-child(4) { animation-delay: 0.24s; }
.stagger-children.is-visible > *:nth-child(5) { animation-delay: 0.32s; }
.stagger-children.is-visible > *:nth-child(6) { animation-delay: 0.40s; }
.stagger-children.is-visible > *:nth-child(7) { animation-delay: 0.48s; }
.stagger-children.is-visible > *:nth-child(8) { animation-delay: 0.56s; }

/* ============================================================
   Forms
   ============================================================ */
.input, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font: inherit;
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease-out);
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
}
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--theme-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out);
}
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--theme-accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ============================================================
   Code block
   ============================================================ */
.codeblock {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-5);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  line-height: var(--lh-normal);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topnav-inner { grid-template-columns: auto 1fr auto; }
  .topnav-center { display: none; }
  .question-card { padding: var(--s-5) var(--s-4); }
  .section { padding: var(--s-7) 0; }
  .section-lg { padding: var(--s-7) 0; }
  .container, .container-narrow, .container-wide { padding: 0 var(--s-4); }
}
@media (max-width: 420px) {
  .btn { padding: var(--s-3) var(--s-4); }
  .btn-lg { padding: var(--s-3) var(--s-5); min-height: 48px; }
  .question-card .q-text { font-size: 1.075rem; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  body { background: #fff; color: #111; }
  .topnav, .page-nav, .no-print { display: none !important; }
  .card, .result-card, .question-card, .diagram, .diagram-box {
    box-shadow: none;
    page-break-inside: avoid;
  }
  a { color: #111; text-decoration: underline; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
