/* 顶级认知 · 墨与金
 * 单一深色主题（品牌：深夜书房），金色为唯一强调色，朱砂仅用于警示与印章 */

:root {
  --bg: #0c0d11;
  --panel: #14161c;
  --panel-2: #1a1d24;
  --ink: #e9e4d8;
  --muted: #8b8fa0;
  --gold: #c9a86a;
  --gold-deep: #a8874c;
  --cinnabar: #e0524f;
  --line: #262a34;
  --font-display: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
  --tabbar-h: 62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: radial-gradient(1100px 700px at 50% -12%, #15171e 0%, var(--bg) 52%, #08090c 100%) fixed, #08090c;
  min-height: 100vh; /* 旧 WebView 回退 */
  min-height: 100dvh;
}

::selection { background: var(--gold); color: #14110a; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- 应用画布 ---------- */

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh; /* 旧 WebView 回退 */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 480px) {
  .app { border-inline: 1px solid var(--line); }
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 13, 17, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 20px;
}
.brand {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-indent: 0.34em; /* 平衡字距造成的偏移 */
}
.level-chip {
  font-size: 12px;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: 999px;
  padding: 2px 10px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ---------- 视图 ---------- */

.main { flex: 1; }
.view {
  padding: 22px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  animation: view-in 0.24s ease both;
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-head { margin-bottom: 18px; }
.view-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}
.view-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }

/* ---------- 卡片 ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 14px; }

/* ---------- 视觉层：意境字水印 ---------- */
.glyph-bg { position: relative; }
.glyph-bg > * { position: relative; }
.glyph-bg::before {
  content: attr(data-glyph);
  position: absolute;
  top: -16px;
  right: -4px;
  z-index: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(92px, 30vw, 132px);
  line-height: 1;
  color: rgba(201, 168, 106, 0.13); /* color-mix 回退 */
  color: color-mix(in srgb, var(--sc, var(--gold)) 13%, transparent);
  pointer-events: none;
  user-select: none;
}
.detail-body { overflow: hidden; }

/* ---------- 视觉层：人物姓氏印 ---------- */
.person-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.person-seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9px;
  border-color: color-mix(in srgb, var(--sc, #8b8fa0) 65%, transparent);
  background: color-mix(in srgb, var(--sc, #8b8fa0) 9%, transparent);
  color: var(--sc, var(--muted));
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  font-style: normal;
}
.person-seal .icon { width: 19px; height: 19px; }
.person-seal.small .icon { width: 13px; height: 13px; }
.person-seal.small {
  width: 24px;
  height: 24px;
  font-size: 12px;
  border-radius: 7px;
  border-width: 1px;
}
.theory-row-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* 今日页日期行 */
.today-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.today-date { font-size: 13px; color: var(--muted); letter-spacing: 0.06em; }
.today-streak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--gold);
}

/* 学派标签（color-mix 前先铺 rgba 回退，iOS<16.2 保底可读） */
.school-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--sc, var(--muted));
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  border-color: color-mix(in srgb, var(--sc, #8b8fa0) 55%, transparent);
  background: color-mix(in srgb, var(--sc, #8b8fa0) 12%, transparent);
  letter-spacing: 0.04em;
}
.school-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sc, var(--muted));
}

/* 今日理论卡 */
.theory-card {
  position: relative;
  overflow: hidden;
  background: var(--panel); /* color-mix 回退 */
  background:
    radial-gradient(170px 140px at 88% 6%, color-mix(in srgb, var(--sc) 12%, transparent), transparent 70%),
    var(--panel);
}
.theory-card .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.theory-person { font-size: 13px; color: var(--muted); }
.theory-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.3;
  margin: 14px 0 10px;
  letter-spacing: 0.02em;
}
.theory-essence {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.9;
  color: #cfc9bc;
}
.theory-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--gold);
}
.theory-more .icon { width: 14px; height: 14px; }
.theory-more:active { opacity: 0.7; }

.stamp {
  position: absolute;
  bottom: 20px;
  right: 18px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--cinnabar);
  border: 2px solid var(--cinnabar);
  border-radius: 8px;
  padding: 6px 10px;
  transform: rotate(-8deg);
  background: rgba(12, 13, 17, 0.85);
  animation: stamp-in 0.38s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-8deg) scale(1.7); }
  to { opacity: 1; transform: rotate(-8deg) scale(1); }
}

/* 今日实践卡 */
.practice-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 10px;
}
.practice-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(201, 168, 106, 0.4), transparent);
}
.practice-title { font-size: 17px; font-weight: 650; }
.practice-how { margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.8; }

.field { margin-top: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.field textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px; /* 防 iOS 聚焦缩放 */
  line-height: 1.7;
  color: var(--ink);
}
.field textarea::placeholder { color: #6d7284; }
.field input {
  width: 100%;
  height: 44px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 16px; /* 防 iOS 聚焦缩放 */
  color: var(--ink);
}
.field input::placeholder { color: #6d7284; }
.field input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0;
  border-color: transparent;
}
.field textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0;
  border-color: transparent;
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 16px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: #17120a;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.08em;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-primary:active { transform: scale(0.98); background: var(--gold-deep); }
.btn-primary[disabled] {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px dashed var(--line);
  cursor: default;
}
.btn-ghost {
  display: block;
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.btn-ghost:active { color: var(--cinnabar); border-color: var(--cinnabar); }

/* 等级进度 */
.level-bar {
  margin-top: 12px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.level-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.level-note { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- 认知库 ---------- */

.lib-group { margin-bottom: 22px; }
.lib-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 2px 10px;
}
.lib-group-name { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.lib-group-count { font-size: 12px; color: var(--muted); }
.lib-group-desc { margin-left: auto; font-size: 12px; color: var(--muted); }
.lib-risk-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.7;
  color: #d99391;
  background: rgba(224, 82, 79, 0.08);
  border: 1px solid rgba(224, 82, 79, 0.28);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.lib-risk-note .icon { flex: none; width: 15px; height: 15px; margin-top: 3px; color: var(--cinnabar); }

.theory-row {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s ease;
}
.theory-row + .theory-row { margin-top: 10px; }
.theory-row:active { border-color: rgba(201, 168, 106, 0.5); }
.theory-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.theory-row-name { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.theory-row-person { font-size: 12px; color: var(--muted); margin-top: 2px; }
.theory-row-essence {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.read-mark { flex: none; width: 16px; height: 16px; color: var(--gold); opacity: 0.9; }

/* ---------- 我的 ---------- */

.me-level { position: relative; text-align: center; padding: 26px 20px; }
.journey-svg {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 14px auto 4px;
}
.journey-svg text { font-family: var(--font-body); }
.radar-wrap { padding: 4px 0 2px; }
.radar-svg {
  display: block;
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
}
.radar-svg text { font-family: var(--font-body); }
.level-seal {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 2px solid var(--cinnabar);
  border-radius: 12px;
  background: rgba(224, 82, 79, 0.06);
  color: var(--cinnabar);
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  transform: rotate(6deg);
}
.me-level-name {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
}
.me-level-name em { font-style: normal; font-size: 14px; color: var(--muted); letter-spacing: 0.06em; display: block; margin-bottom: 6px; }
.me-level-xp { font-size: 13px; color: var(--muted); margin-top: 6px; }
.me-level .level-note { text-align: center; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
}
.stat-num { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.stat-num .icon { width: 15px; height: 15px; color: var(--gold); vertical-align: -1px; margin-right: 3px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.section-title {
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 24px 0 10px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.heatmap i {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
}
@supports not (aspect-ratio: 1) {
  .heatmap i { height: 12px; }
}
.heatmap i.on { background: var(--gold); }

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: none; }
.switch-row .school-dot { flex: none; }
.switch-row-name { font-size: 15px; }
.switch-row-desc { font-size: 12px; color: var(--muted); margin-left: auto; margin-right: 8px; }
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.2s ease;
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #c9cdd8;
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch:checked { background: var(--gold); }
.switch:checked::after { transform: translateX(16px); background: #17120a; }

.history-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: none; }
.history-meta { display: flex; gap: 8px; align-items: baseline; }
.history-date { font-size: 12px; color: var(--muted); flex: none; }
.history-theory { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.history-text { margin-top: 4px; font-size: 13px; color: #b9b4a8; line-height: 1.7; }
.empty-tip { font-size: 13px; color: var(--muted); text-align: center; padding: 18px 0; }

/* ---------- 问诊 ---------- */

.diag-input textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.diag-input textarea::placeholder { color: #6d7284; }
.diag-input textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0;
  border-color: transparent;
}

.diag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chip-btn {
  font-size: 13px;
  line-height: 1;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #b9bdc9;
  background: var(--panel-2);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chip-btn[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201, 168, 106, 0.1);
}

.diag-scenario {
  font-size: 12px;
  color: var(--muted);
  margin: 18px 2px 10px;
}
.diag-scenario:first-child { margin-top: 0; }

/* 落地三步：问诊结果里最先着陆的卡片 */
.path-card {
  border-color: rgba(201, 168, 106, 0.4);
  background:
    radial-gradient(150px 110px at 92% 4%, rgba(201, 168, 106, 0.1), transparent 70%),
    var(--panel);
  margin-bottom: 12px;
}
.path-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid rgba(38, 42, 52, 0.55);
}
.path-row:last-child { border-bottom: none; }
.path-when {
  flex: none;
  width: 64px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.5;
}
.path-when i {
  display: block;
  font-style: normal;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.path-row p {
  font-size: 14px;
  line-height: 1.8;
  color: #d5cfc2;
  margin: 0;
}

.diag-item .why {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.8;
  color: #d5cfc2;
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}
.diag-item .practice-how { margin-top: 4px; }
.diag-item .theory-more { margin-top: 10px; }

.diag-empty {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  padding: 22px 0 6px;
  line-height: 1.9;
}

/* 决策推演（庙算） */
.rh-theory {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
}
.rh-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.rh-row input { flex: 1; }
.rh-kind { flex: none; }
.rh-light {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  border: 2px solid;
  flex: none;
}
.rh-light.green { color: #6fae8f; border-color: #6fae8f; background: rgba(111, 174, 143, 0.1); }
.rh-light.yellow { color: var(--gold); border-color: var(--gold); background: rgba(201, 168, 106, 0.1); }
.rh-light.red { color: var(--cinnabar); border-color: var(--cinnabar); background: rgba(224, 82, 79, 0.1); }
.verdict-card { border-width: 1.5px; }
.verdict-card.v-green { border-color: rgba(111, 174, 143, 0.55); }
.verdict-card.v-yellow { border-color: rgba(201, 168, 106, 0.55); }
.verdict-card.v-red { border-color: rgba(224, 82, 79, 0.55); }
.verdict-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  margin-top: 12px;
}
.v-green .verdict-title { color: #8fc7ab; }
.v-yellow .verdict-title { color: var(--gold); }
.v-red .verdict-title { color: #e58a87; }
.verdict-note { margin-top: 8px; font-size: 14px; line-height: 1.85; color: #cfc9bc; }
.rh-sum { margin-top: 14px; }
.rh-sum-row {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(38, 42, 52, 0.6);
  font-size: 13.5px;
}
.rh-sum-row span { flex: none; width: 4.5em; color: var(--muted); }
.rh-sum-row p { margin: 0; color: #d5cfc2; line-height: 1.7; }

/* ---------- 练习（每日三题） ---------- */

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.quiz-dots { display: flex; gap: 5px; margin-left: auto; }
.quiz-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.quiz-dots i.cur { background: var(--gold); }
.quiz-dots i.ok { background: var(--gold); opacity: 0.55; }
.quiz-dots i.bad { background: var(--cinnabar); opacity: 0.75; }

.quiz-stem {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.75;
  margin: 14px 0 4px;
}

.quiz-type {
  display: inline-block;
  font-size: 11px;
  color: var(--sc, var(--gold));
  border: 1px solid color-mix(in srgb, var(--sc, var(--gold)) 45%, transparent);
  border-radius: 999px;
  padding: 2px 9px;
  margin-top: 10px;
}

.opt-btn {
  display: flex;
  width: 100%;
  text-align: left;
  gap: 10px;
  align-items: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 15px;
  line-height: 1.6;
  margin-top: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.opt-btn:active { border-color: rgba(201, 168, 106, 0.5); }
.opt-key {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.opt-btn.correct {
  border-color: var(--gold);
  background: rgba(201, 168, 106, 0.12);
}
.opt-btn.correct .opt-key { border-color: var(--gold); color: var(--gold); }
.opt-btn.wrong {
  border-color: var(--cinnabar);
  background: rgba(224, 82, 79, 0.1);
}
.opt-btn.wrong .opt-key { border-color: var(--cinnabar); color: var(--cinnabar); }
.opt-btn[disabled] { cursor: default; }

.quiz-explain {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 2px solid var(--gold);
  background: var(--panel-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px;
  line-height: 1.8;
  color: #cfc9bc;
  animation: view-in 0.24s ease both;
}

.quiz-sum-num {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  margin: 6px 0 2px;
}
.quiz-sum-sub {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.quiz-sum-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(38, 42, 52, 0.6);
}
.quiz-sum-row:last-of-type { border-bottom: none; }
.quiz-sum-mark { flex: none; width: 18px; height: 18px; }
.quiz-sum-mark.ok { color: var(--gold); }
.quiz-sum-mark.bad { color: var(--cinnabar); }

/* 教练点评 */
.coach-reply {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 2px solid var(--gold);
  background: var(--panel-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: view-in 0.24s ease both;
}
.coach-reply p {
  font-size: 14.5px;
  line-height: 1.9;
  color: #d5cfc2;
  white-space: pre-line;
}

/* ---------- 事例分析 ---------- */
.case-date {
  flex: none;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.case-origin {
  display: inline-block;
  font-size: 12px;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: 999px;
  padding: 4px 11px;
}
.case-block {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.case-block p,
.case-analysis p {
  font-size: 14.5px;
  line-height: 1.9;
  color: #c6c1b4;
}
.case-analysis {
  padding: 12px 0 12px 14px;
  border-left: 2px solid var(--sc, var(--gold));
  margin-bottom: 10px;
}
.case-analysis .school-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.case-teaser {
  border-color: rgba(201, 168, 106, 0.4);
}

/* 今日引用（日签卡） */
.quote-card {
  text-align: center;
  border-color: rgba(201, 168, 106, 0.35);
  background:
    radial-gradient(200px 140px at 50% -20%, rgba(201, 168, 106, 0.08), transparent 70%),
    var(--panel);
}
.quote-card .practice-label::after { display: none; }
.quote-card .practice-label::before {
  content: "";
  width: 24px;
  height: 1px;
  background: rgba(201, 168, 106, 0.5);
}
.quote-card .practice-label {
  gap: 10px;
}
.quote-text {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 2;
  color: #d8d2c4;
  margin: 6px 0 4px;
}
.quote-attr {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}
.quote-card .theory-more { margin-left: auto; margin-right: auto; }

/* ---------- 底部导航 ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100%);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(12, 13, 17, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  transition: color 0.15s ease;
}
.tab .icon { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--gold); }

.onboard-sub.compact { margin: 4px 0 12px; }
.onboard-sub-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-top: 22px;
}
.onboard-chips { margin-top: 0; }

/* 认知画像 */
.tendency-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.tendency-name { flex: none; width: 5.5em; font-size: 13px; color: #b9bdc9; }
.tendency-bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.tendency-fill { height: 100%; border-radius: 999px; background: var(--sc, var(--gold)); }
.tendency-count { flex: none; width: 2em; text-align: right; font-size: 12px; color: var(--muted); }
.tag-chip {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 106, 0.45);
  color: var(--gold);
  background: rgba(201, 168, 106, 0.08);
}

/* 原生 dialog 缺失时的降级弹层（老微信 WebView） */
.no-dialog dialog[open] {
  display: block;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  max-height: 86vh;
  overflow: hidden;
}
.no-dialog body.dlg-backdrop::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(4, 5, 8, 0.72);
}
.no-dialog .dialog-top {
  position: static;
  background: none;
}

/* 微信内提示条 */
.wechat-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 20px 0;
  padding: 12px 14px;
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 106, 0.08);
  font-size: 13px;
  line-height: 1.7;
  color: #d5cfc2;
}
.wechat-banner button {
  flex: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
}

/* ---------- 弹层 ---------- */

.dialog {
  width: min(430px, calc(100% - 28px));
  /* 原生 dialog 靠 UA 的 margin:auto 居中，顶部全局 * reset 会把它清零导致弹层贴左上角，这里必须加回 */
  margin: auto;
  border: none;
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.dialog::backdrop {
  background: rgba(4, 5, 8, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.dialog-scroll {
  max-height: min(84dvh, 720px);
  overflow-y: auto;
  padding: 12px 20px 24px;
  overscroll-behavior: contain;
}
.dialog-top {
  display: flex;
  justify-content: flex-end;
  position: sticky;
  top: 0;
  padding: 6px 0 8px;
  background: linear-gradient(var(--panel) 70%, rgba(20, 22, 28, 0));
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #b9bdc9;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:active { color: var(--ink); }

/* 详情内容 */
.detail-body { animation: view-in 0.24s ease both; }
.detail-source {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #a0a5b5;
  margin-top: 10px;
  line-height: 1.7;
}
.detail-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.35;
  margin: 10px 0 16px;
}
.detail-quote {
  position: relative;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--gold);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.9;
  color: #d8d2c4;
  margin-bottom: 20px;
}
.detail-h {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(201, 168, 106, 0.4), transparent);
}
/* 原文摘录：衬线短引 + 出处行 */
.source-quote {
  margin: 0 0 12px;
  padding: 12px 14px 10px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.source-quote blockquote {
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.9;
  color: #d8d2c4;
  margin: 0;
}
.source-quote figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.detail-points { list-style: none; counter-reset: point; }
.detail-points li {
  counter-increment: point;
  font-size: 14.5px;
  line-height: 1.85;
  color: #c6c1b4;
  padding: 8px 0 8px 34px;
  position: relative;
  border-bottom: 1px solid rgba(38, 42, 52, 0.6);
}
.detail-points li:last-child { border-bottom: none; }
.detail-points li::before {
  content: counter(point, cjk-ideographic) "、";
  position: absolute;
  left: 0;
  top: 8px;
  font-family: var(--font-display);
  color: var(--muted);
  font-size: 14px;
}
.detail-practice {
  background: rgba(201, 168, 106, 0.08);
  border: 1px solid rgba(201, 168, 106, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.detail-practice-title { font-size: 16px; font-weight: 650; color: var(--gold); }
.detail-practice-how { margin-top: 6px; font-size: 14px; line-height: 1.8; color: #cfc9bc; }
.detail-practice .btn-primary { margin-top: 14px; }
.detail-risk {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 18px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #d99391;
  background: rgba(224, 82, 79, 0.07);
  border: 1px solid rgba(224, 82, 79, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.detail-risk .icon { flex: none; width: 16px; height: 16px; margin-top: 4px; color: var(--cinnabar); }

/* 首次启动 */
.dialog-onboard .dialog-scroll { padding-top: 30px; }
.onboard-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}
.onboard-sub {
  font-size: 13px;
  color: #a0a5b5;
  text-align: center;
  margin: 8px 0 20px;
}
.onboard-schools { display: grid; gap: 10px; }
.onboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.onboard-item[aria-pressed="true"] {
  border-color: var(--sc);
  background: color-mix(in srgb, var(--sc) 10%, transparent);
}
.onboard-item[aria-pressed="false"] {
  opacity: 0.62;
}
.onboard-item-name { font-size: 15px; font-weight: 600; }
.onboard-item-desc { font-size: 12px; color: var(--muted); margin-left: auto; }
.onboard-check { flex: none; width: 18px; height: 18px; color: var(--sc); opacity: 0; transition: opacity 0.15s ease; }
.onboard-item[aria-pressed="true"] .onboard-check { opacity: 1; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  transform: translate(-50%, 8px);
  max-width: calc(min(430px, 100%) - 48px);
  background: var(--panel-2);
  border: 1px solid rgba(201, 168, 106, 0.5);
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 9px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 30;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 滚动条 ---------- */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #2a2e39; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 降级与可访问性 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
