/* ========== Base ========== */
:root {
  --bg: #0f1419;
  --bg-2: #1a2028;
  --bg-3: #232b36;
  --bg-4: #2d3744;
  --fg: #e8e6e3;
  --fg-dim: #a8a39c;
  --fg-faint: #6e6962;
  --accent: #7dd3c0;
  --accent-2: #c8a8e9;
  --warn: #f0b97a;
  --danger: #e88b8b;
  --ok: #9ed992;
  --border: #2d3744;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(0,0,0,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  font-size: 15px;
}

.container { max-width: 980px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { line-height: 1.3; }
h1 { font-size: 38px; }
h2 { font-size: 24px; margin-bottom: 8px; }
h3 { font-size: 18px; margin-bottom: 8px; }
h4 { font-size: 15px; }

a { color: var(--accent); }
.hidden { display: none !important; }
.tiny { font-size: 12px; color: var(--fg-dim); }
.center { text-align: center; }
.section-sub { color: var(--fg-dim); margin-bottom: 18px; font-size: 14px; }

/* ========== Hero ========== */
.hero {
  padding: 80px 0 60px;
  background: radial-gradient(ellipse at top, rgba(125,211,192,.08), transparent 60%);
  text-align: center;
  transition: padding .3s;
}
.hero.compact { padding: 40px 0 30px; }
.hero.compact h1 { font-size: 24px; }
.hero.compact .subtitle, .hero.compact .cta { display: none; }
.badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(125,211,192,.12);
  color: var(--accent);
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 22px;
}
.hero h1 { margin-bottom: 18px; }
.hl { color: var(--accent); }
.subtitle {
  color: var(--fg-dim);
  font-size: 17px;
  margin-bottom: 32px;
  max-width: 580px;
  margin-left: auto;
  margin-right: auto;
}
.cta {
  display: inline-block;
  padding: 14px 32px;
  background: var(--accent);
  color: #0f1419;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 16px;
  transition: transform .15s;
}
.cta:hover { transform: translateY(-2px); }

/* ========== Safety ========== */
.safety { padding: 32px 0; }
.safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.safety-card {
  background: var(--bg-2);
  padding: 20px 22px;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.safety-card h3 { color: var(--accent); }
.safety-card p { color: var(--fg-dim); font-size: 14px; }
.safety-card.urgent { border-left-color: var(--warn); }
.safety-card.urgent h3 { color: var(--warn); }
.safety-card.urgent strong { color: var(--fg); }

/* ========== Scales Intro ========== */
.scales-intro { padding: 40px 0; }
.scales-intro h2 { text-align: center; margin-bottom: 8px; }
.scales-intro .section-sub { text-align: center; max-width: 700px; margin: 0 auto 24px; }
.scales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.scale-card {
  background: var(--bg-2);
  padding: 18px;
  border-radius: 10px;
  border-top: 3px solid var(--accent);
}
.scale-card h4 { margin-bottom: 6px; }
.scale-card .ref {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 4px;
  font-family: ui-monospace, monospace;
}
.scale-card .ref-author {
  font-size: 11px;
  color: var(--fg-faint);
  margin-bottom: 8px;
  font-style: italic;
}
.scale-card .type { font-size: 12px; color: var(--fg-faint); line-height: 1.6; }

/* ========== Wizard ========== */
.wizard { padding: 50px 0; background: var(--bg-2); }
.wizard-head { margin-bottom: 24px; }
.step-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.step {
  flex: 1;
  min-width: 80px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-dim);
  transition: all .2s;
}
.step.active { background: var(--accent); color: #0f1419; font-weight: 600; }
.step.done { background: var(--bg-3); color: var(--accent); }
.progress {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 25%;
  transition: width .3s;
}

.form-area {
  background: var(--bg-3);
  padding: 28px;
  border-radius: var(--radius);
}
.step-head { margin-bottom: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.step-num { font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.step-head h2 { margin-bottom: 8px; }
.q-hint { color: var(--fg-dim); font-size: 14px; }

.form-question {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.form-question:last-child { border-bottom: none; }
.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.q-window {
  background: var(--bg-2);
  padding: 2px 10px;
  border-radius: 12px;
  color: var(--fg-dim);
}
.q-dim {
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg-2);
  font-weight: 600;
}
.safety-tag {
  background: rgba(232,139,139,.15);
  color: var(--danger);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.q-stem {
  font-size: 16px;
  margin-bottom: 14px;
  font-weight: 500;
}
.likert-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.likert {
  padding: 14px 10px;
  background: var(--bg-2);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--fg);
  font: inherit;
}
.likert:hover { border-color: var(--accent); }
.likert.selected {
  background: rgba(125,211,192,.15);
  border-color: var(--accent);
  color: var(--accent);
}
.likert-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.likert.selected .likert-num { background: var(--accent); color: #0f1419; }
.likert-label { font-size: 13px; }

.form-actions {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.btn-primary, .btn-secondary {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #0f1419; }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--bg-2); color: var(--fg); }
.btn-secondary:hover { background: var(--bg); }

/* ========== Report ========== */
.report { padding: 40px 0 80px; }
.report-card {
  background: var(--bg-2);
  padding: 28px 32px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.report-card h3 { margin-bottom: 6px; }
.report-card.center { text-align: center; padding: 24px; }

.report-headline .overall-badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 14px;
}
.report-headline .headline {
  font-size: 22px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.summary-text p { margin-bottom: 10px; color: var(--fg); }
.summary-text strong { color: var(--accent); }

/* Clinical impression */
.clinical-text p {
  margin-bottom: 12px;
  line-height: 1.8;
  font-size: 14px;
  color: var(--fg);
}
.clinical-text strong { color: var(--accent); }

/* Intervention card */
.intervention-card {
  background: var(--bg-3);
  padding: 18px 22px;
  border-radius: 10px;
  border-left: 4px solid var(--accent);
}
.int-label {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.int-desc { font-size: 14px; line-height: 1.7; color: var(--fg); }
.int-desc strong { color: var(--accent); }

/* Radar */
.radar-wrap {
  text-align: center;
  margin: 16px 0;
}
#radar-canvas { max-width: 100%; height: auto; }

/* Dim card */
.dim-card {
  background: var(--bg-3);
  padding: 18px 20px;
  border-radius: 10px;
  border-left: 4px solid var(--accent);
  margin-bottom: 14px;
}
.dim-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.dim-head h3 { margin: 0; font-size: 17px; }
.level-badge {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid;
}
.dim-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 10px;
  font-family: ui-monospace, monospace;
}
.dim-bar {
  height: 6px;
  background: var(--bg-4);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.dim-fill { height: 100%; transition: width .3s; }
.dim-clinical {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--fg);
}
.dim-why {
  font-size: 13px;
  color: var(--fg-dim);
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 6px;
}
.dim-why strong { color: var(--fg); }

/* Pattern card */
.pattern-card {
  background: linear-gradient(135deg, rgba(200,168,233,.08), rgba(125,211,192,.05));
  padding: 14px 18px;
  border-radius: 10px;
  border-left: 3px solid var(--accent-2);
  margin-bottom: 10px;
  font-size: 14px;
}
.pattern-card strong { color: var(--accent-2); }

/* Selfhelp */
.selfhelp-block {
  background: var(--bg-3);
  padding: 18px 20px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.selfhelp-block h4 { margin-bottom: 12px; font-size: 16px; }
.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.practice-btn {
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.practice-btn:hover {
  border-color: var(--accent);
  background: var(--bg-4);
}
.practice-btn .hint { font-size: 11px; color: var(--fg-dim); }

/* 腦圖容器 */
.mermaid-wrap {
  background: var(--bg);
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  text-align: center;
}
.mermaid-wrap .mermaid {
  display: inline-block;
  min-width: 100%;
  font-size: 14px;
}
.mermaid-wrap svg { max-width: 100%; height: auto; }

/* Cautions */
.caution {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  border-left: 3px solid;
}
.caution-danger {
  background: rgba(232,139,139,.08);
  border-left-color: var(--danger);
  color: var(--fg);
}
.caution-danger strong { color: var(--danger); }
.caution-warning {
  background: rgba(240,185,122,.08);
  border-left-color: var(--warn);
}
.caution-warning strong { color: var(--warn); }
.caution-info {
  background: var(--bg-3);
  border-left-color: var(--fg-dim);
  font-size: 13px;
  color: var(--fg-dim);
}

/* ========== Modal ========== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 30px 32px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--bg-3);
  color: var(--fg);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  font-family: inherit;
}
.modal-close:hover { background: var(--bg-4); }
.modal-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.modal-card h2 { margin-bottom: 14px; }
.modal-card h4 { margin: 16px 0 10px; }
.modal-why {
  background: var(--bg-3);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg-dim);
  margin-bottom: 8px;
  line-height: 1.7;
}
.modal-why strong { color: var(--fg); }
.modal-steps {
  padding-left: 20px;
}
.modal-steps li { margin-bottom: 8px; }
.modal-tail {
  margin-top: 16px;
  font-size: 13px;
  color: var(--fg-dim);
  font-style: italic;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ========== Contact ========== */
.contact {
  padding: 60px 0 40px;
  background: linear-gradient(180deg, transparent, rgba(125,211,192,.04));
}
.contact-head { text-align: center; max-width: 720px; margin: 0 auto 32px; }
.contact-eyebrow {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(125,211,192,.12);
  color: var(--accent);
  border-radius: 14px;
  font-size: 12px;
  letter-spacing: .08em;
  margin-bottom: 14px;
}
.contact-head h2 { margin-bottom: 12px; }
.contact-head .section-sub { margin: 0 auto; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.contact-card {
  background: var(--bg-2);
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  display: block;
  transition: all .15s;
}
a.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.contact-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border-radius: 50%;
  font-size: 18px;
  margin-bottom: 10px;
}
.contact-card h3 { font-size: 15px; color: var(--accent); margin-bottom: 6px; }
.contact-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  word-break: break-word;
}
.contact-hint { font-size: 12px; color: var(--fg-dim); line-height: 1.6; }

/* ========== Footer ========== */
.footer {
  padding: 36px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 13px;
}
.footer p { margin-bottom: 6px; }
.footer-links {
  margin-bottom: 12px;
  font-size: 13px;
}
.footer-links a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 4px;
}
.footer-links a:hover { text-decoration: underline; }

/* ========== Mobile ========== */
@media (max-width: 760px) {
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  .hero { padding: 50px 0 40px; }
  .safety-grid { grid-template-columns: 1fr; }
  .step { font-size: 12px; padding: 8px 6px; }
  .form-area { padding: 18px; }
  .report-card { padding: 20px 18px; }
  .likert-row { grid-template-columns: 1fr 1fr; }
  .practice-grid { grid-template-columns: 1fr; }
}
