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

: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); }

/* 等级紧凑行（今日页专用）：完整等级卡在「我的」页 */
.level-compact { padding: 13px 16px 15px; }
.level-compact .level-bar { margin-top: 9px; }
.level-compact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.level-compact-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.level-compact-note { font-size: 11.5px; color: var(--muted); text-align: right; }

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

.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;
}

/* ---------- 教练形象 ---------- */
.coach-avatar {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 44px;
  height: 44px;
}
.coach-avatar svg { width: 100%; height: 100%; display: block; }
/* 真人形象：有图时覆盖立绘（放图即生效），朱砂小印叠右下角 */
.coach-avatar .portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 25%;
  border: 1px solid rgba(201, 168, 106, 0.35);
}
.portrait-seal {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 32%;
  height: 32%;
  display: grid;
  place-items: center;
  background: rgba(224, 82, 79, 0.92);
  color: #faf0e5;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  border-radius: 22%;
  transform: rotate(6deg);
  pointer-events: none;
}

.coach-reply-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.coach-reply-head .coach-avatar { width: 46px; height: 46px; }
.coach-reply-name {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.coach-reply-name em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}
.coach-reply-head .theory-more { margin-left: auto; }

.coach-me-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.coach-me-row:hover { border-color: var(--gold); }
.coach-share-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.coach-share-btn:hover { background: rgba(201, 168, 106, 0.14); }
.coach-share-btn .icon { width: 13px; height: 13px; }
.coach-vip-badge {
  display: inline-block;
  font-style: normal;
  font-size: 10px;
  line-height: 1;
  color: #14110a;
  background: linear-gradient(135deg, #d9bc82, #c9a86a);
  border-radius: 4px;
  padding: 2.5px 5px;
  margin-left: 6px;
  vertical-align: 2px;
  letter-spacing: 0.08em;
}

/* ---------- 教练常驻问候条（今日页顶部） ---------- */
.coach-strip {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.coach-strip-avatar {
  flex: none;
  display: inline-flex;
  padding: 0;
  border-radius: 12px;
}
.coach-strip-avatar .coach-avatar { width: 36px; height: 36px; }
.coach-strip-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.coach-strip-body b {
  font-family: var(--font-display);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.coach-strip-body span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coach-strip-cta {
  flex: none;
  font-size: 12.5px;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: 999px;
  padding: 5px 12px;
  transition: background 0.15s ease;
}
.coach-strip-cta:hover { background: rgba(201, 168, 106, 0.12); }

/* 问诊入口并入教练条：细胶囊（原独立大虚线条已移除） */
.coach-strip-ask {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.coach-strip-ask .icon { width: 14px; height: 14px; }
.coach-strip-ask:active { color: var(--gold); border-color: rgba(201, 168, 106, 0.5); }

/* 新手引导：教练亮相卡 */
.ob-coach {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
}
.ob-coach .coach-avatar { width: 44px; height: 44px; }
.ob-coach-info { display: flex; flex-direction: column; gap: 2px; }
.ob-coach-info b {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
}
.ob-coach-info span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.coach-me-row .coach-avatar { width: 50px; height: 50px; }
/* 设置弹层的教练选择网格：两列紧凑卡，选中态学派色描边 + 角标对勾 */
.coach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coach-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.coach-cell[aria-pressed="true"] {
  border-color: var(--sc);
  background: color-mix(in srgb, var(--sc) 10%, transparent);
}
.coach-cell[aria-pressed="false"] { opacity: 0.62; }
.coach-cell .coach-avatar { width: 42px; height: 42px; }
.coach-cell-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.coach-cell-name { font-size: 14px; font-weight: 600; line-height: 1.35; }
.coach-cell-desc { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.coach-cell-check {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sc);
  color: #14110a;
  box-shadow: 0 0 0 2px var(--panel);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.coach-cell-check .icon { width: 12px; height: 12px; }
.coach-cell[aria-pressed="true"] .coach-cell-check { opacity: 1; }
.coach-me-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.coach-me-name {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.coach-me-hint { font-size: 12px; color: var(--muted); }
.coach-me-arrow { flex: none; width: 15px; height: 15px; color: var(--muted); opacity: 0.7; }

/* 推送提醒时间选择 */
.push-hour-sel {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ---------- 事例分析 ---------- */
.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));
  /* 保险丝：width 里的 min() 被第三方 CSS 改写（暗色模式扩展等）破坏时，
   * max-width 仍能兜住弹层宽度，避免 X 按钮漂到窗口角落点不中 */
  max-width: calc(100vw - 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: 84vh; /* 旧引擎回退（不支持 dvh/min 时保住滚动约束） */
  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;
  /* 必须置顶：内容 .detail-body 的入场动画 fill:both 会永久保留 transform，
   * 形成层叠上下文且 DOM 在后，滚动后会整个盖住吸顶的关闭按钮——看得见、点不中 */
  z-index: 1;
  padding: 6px 0 8px;
  background: linear-gradient(var(--panel) 70%, rgba(20, 22, 28, 0));
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  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; }

/* 入门测评（首次启动：讲清自己 → 测起点 → 定流派） */
.ob-seal {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border: 1.5px solid rgba(201, 168, 106, 0.55);
  border-radius: 15px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 700;
  background: rgba(201, 168, 106, 0.06);
}
.ob-tagline {
  text-align: center;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin: 2px 0 14px;
}
.ob-intro-note {
  font-size: 13px;
  line-height: 2;
  color: #c6cad6;
  text-align: center;
  margin: 0 0 20px;
}
.ob-intro-note b { color: var(--gold); font-weight: 600; }
.ob-mini {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin: 10px 0 0;
}
.ob-quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ob-quit { margin-top: 14px; }
.ob-result { text-align: center; padding: 20px 16px 18px; }
.ob-score b {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.ob-score span { font-size: 16px; color: var(--muted); margin-left: 4px; }
.ob-tier {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-top: 10px;
}
.ob-tier-note { font-size: 13px; color: #a0a5b5; margin-top: 6px; }
.ob-weak {
  font-size: 12.5px;
  line-height: 1.8;
  color: #c6cad6;
  background: rgba(201, 168, 106, 0.07);
  border: 1px solid rgba(201, 168, 106, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 14px 0 0;
  text-align: left;
}
.ob-weak b { color: var(--gold); font-weight: 600; }
.gap-badge {
  display: inline-block;
  vertical-align: 1px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 106, 0.5);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 8px;
  letter-spacing: 0.05em;
}

/* ---------- 学派横幅插图（一学派一意境） ---------- */

.school-art {
  margin: -20px -20px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: #101218;
  line-height: 0;
}
.school-art svg { width: 100%; height: 86px; display: block; }
.school-art.in-detail { margin: 0 -20px 18px; border-radius: 0; }
@media (prefers-reduced-motion: no-preference) {
  .school-art { animation: art-in 0.5s ease both; }
  @keyframes art-in { from { opacity: 0; } to { 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;
  /* 必须高于降级弹层（.no-dialog：遮罩 39 / 弹层 40），否则老 WebView 里提示同样被挡 */
  z-index: 100;
  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;
  }
}

/* ---------- 桌面端适配（≥900px）：加宽画布、导航上提、弹层放大 ----------
 * 必须放在文件末尾：与 .tabbar / .dialog 基础规则同特异性，靠层叠顺序取胜。 */
@media (min-width: 900px) {
  .app { max-width: 760px; }
  .topbar-inner { padding: 0 32px; }

  /* 底部 tab 栏上提为顶栏下的横向导航（DOM 在 main 之后，用 order 提到前面） */
  .tabbar {
    order: 1;
    position: sticky;
    top: calc(54px + env(safe-area-inset-top));
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    height: 52px;
    padding-bottom: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    border-top: none;
    border-bottom: 1px solid var(--line);
  }
  .main { order: 2; }
  .tab {
    flex-direction: row;
    gap: 7px;
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 13px;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .tab:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
  .tab .icon { width: 17px; height: 17px; }
  .tab[aria-current="page"] { background: rgba(201, 168, 106, 0.12); }

  .view { padding: 28px 40px 64px; }

  .dialog { width: min(680px, calc(100% - 48px)); max-width: calc(100vw - 48px); }
  .onboard-schools { grid-template-columns: 1fr 1fr; }
  .coach-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 教练推荐 */
.coach-rec {
  margin-top: 10px;
  min-height: 0;
}
.coach-rec-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.coach-rec-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6fae8f;
}
.coach-rec-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid rgba(201, 168, 106, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 106, 0.06);
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.coach-rec-btn:active { border-color: var(--gold); }
.coach-rec-btn .person-seal { --sc: var(--gold); }
.goal-match-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6fae8f;
  border: 1px solid rgba(111, 174, 143, 0.4);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* 成就印谱 */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px 8px;
  padding: 4px 0;
}
.ach-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: default;
}
.ach-glyph {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: rgba(255,255,255,0.15);
  transition: all 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.ach-stamp.on .ach-glyph {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,106,0.08);
  transform: rotate(-3deg);
  text-shadow: 0 0 12px rgba(201,168,106,0.3);
}
.ach-name {
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}
.ach-stamp.on .ach-name { color: #b9b4a8; }

/* 目标常驻横幅（今日页顶部） */
.goal-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid rgba(111, 174, 143, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(111, 174, 143, 0.08), rgba(201, 168, 106, 0.04));
}
.goal-banner-label {
  flex: none;
  font-size: 12px;
  color: #6fae8f;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.goal-banner-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: #d5cfc2;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.goal-banner-edit {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.goal-banner-edit:active { color: var(--gold); border-color: var(--gold); }

/* ---------- 今日快讯 ---------- */

.digest-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.digest-head .practice-label { flex: 1; min-width: 0; }
.digest-count { flex: none; font-size: 11.5px; color: var(--muted); letter-spacing: 0.03em; }
.digest-list { list-style: none; }
.digest-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color 0.15s ease;
}
.digest-row:active { border-color: color-mix(in srgb, var(--sc, var(--gold)) 55%, transparent); }
.digest-row + .digest-row { margin-top: 9px; }
.digest-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.digest-row-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.digest-arrow { flex: none; width: 14px; height: 14px; color: var(--sc, var(--gold)); opacity: 0.8; }
.digest-row-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.digest-school { color: var(--sc, var(--muted)); }
.digest-card .theory-more { margin-top: 12px; }

/* 快讯弹层（digestDialog） */
.digest-dialog-head { margin-bottom: 14px; }
.digest-dialog-date { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-top: 2px; }
.digest-dialog-note { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.digest-item {
  border: 1px solid var(--line);
  border-left: 2px solid var(--sc, var(--gold));
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 14px 16px;
  margin-bottom: 12px;
  scroll-margin-top: 8px;
}
.digest-item-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.digest-item-meta .digest-src { font-size: 12px; color: var(--muted); }
.digest-item-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.5; }
.digest-item-essence { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--ink); }
.digest-item-reason { margin-top: 8px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.digest-link { display: inline-flex; text-decoration: none; }

/* ---------- 今日页密度收紧：让「今日实践 + 打卡」完整进首屏（430×900 实测校准，只作用于今日页） ---------- */
#view-home .today-meta { margin-bottom: 10px; }
#view-home .coach-strip { margin-top: 10px; padding-top: 9px; padding-bottom: 9px; }
#view-home .card + .card { margin-top: 12px; }
#view-home .theory-card { padding-top: 16px; }
#view-home .school-art { margin-bottom: 10px; }
#view-home .theory-name { margin: 10px 0 8px; }
#view-home .theory-essence { line-height: 1.6; }
#view-home .theory-card .theory-more { margin-top: 10px; }
#view-home .practice-label { margin-bottom: 8px; }
#view-home .practice-how { line-height: 1.65; }
#view-home .field { margin-top: 12px; }
#view-home .field textarea { min-height: 60px; padding-top: 9px; padding-bottom: 9px; }
#view-home .btn-primary { margin-top: 12px; }

/* 快讯弹层底部动作行：阅读原文 + 分享 */
.digest-item-foot { display: flex; align-items: center; gap: 20px; margin-top: 10px; }
.digest-item-foot .digest-link { margin-top: 0; }
.digest-share { margin-top: 0; color: var(--muted); }
.digest-share:active { color: var(--gold); }

/* ---------- 新手七步 ---------- */

.newbie-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(201, 168, 106, 0.05);
  border: 1px dashed rgba(201, 168, 106, 0.32);
  border-radius: var(--radius-sm);
  text-align: left;
}
.newbie-strip:active { background: rgba(201, 168, 106, 0.12); }
.newbie-strip-label { flex: none; font-size: 13px; font-weight: 600; color: var(--gold); letter-spacing: 0.04em; }
.newbie-dots { flex: 1; display: flex; gap: 5px; }
.newbie-dots i {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}
.newbie-dots i.on { background: var(--gold); }
.newbie-strip-count { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.newbie-arrow { flex: none; width: 13px; height: 13px; color: var(--muted); }

/* 新手七步弹层清单 */
.newbie-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.newbie-row:last-child { border-bottom: none; }
.newbie-row-dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.newbie-row.done .newbie-row-dot { border-color: var(--gold); color: var(--gold); }
.newbie-row.done .newbie-row-dot .icon { width: 15px; height: 15px; }
.newbie-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.newbie-row-body b { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.newbie-row.done .newbie-row-body b { color: var(--muted); }
.newbie-row-body span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.newbie-ok { flex: none; font-size: 12px; color: var(--gold); opacity: 0.85; }
.newbie-row .theory-more { margin-top: 0; flex: none; }

/* ---------- AI 深度问诊 ---------- */

.diag-ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}
.diag-ai-loading .icon { width: 17px; height: 17px; color: var(--gold); }
.diag-ai-empathy {
  margin: 4px 0 12px;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.7;
  color: var(--gold);
}
.diag-ai-read { font-size: 14.5px; line-height: 1.8; color: var(--ink); }
.digest-related { color: var(--muted); }
.digest-related:active { color: var(--gold); }

/* ---------- 打卡完成仪式（全屏印章落下） ---------- */

.ritual-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(12, 13, 17, 0.9);
  cursor: pointer;
  animation: ritual-fade 0.3s ease both;
}
.ritual-box { text-align: center; padding: 24px; }
.ritual-seal {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 0 auto;
  border-radius: 14px;
  background: rgba(224, 82, 79, 0.93);
  box-shadow: 0 0 0 3px rgba(249, 239, 228, 0.22), 0 18px 44px rgba(224, 82, 79, 0.28);
  transform: rotate(-4deg);
  animation: seal-drop 0.6s cubic-bezier(0.2, 1.25, 0.36, 1) both;
}
.ritual-seal span {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: #faf0e5;
  line-height: 1.15;
}
.ritual-xp {
  margin-top: 22px;
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--gold);
}
.ritual-streak { margin-top: 8px; font-size: 14px; color: var(--ink); }
.ritual-levelup {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0.1em;
}
.ritual-coach { margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.ritual-hint { margin-top: 22px; font-size: 11px; color: rgba(139, 143, 160, 0.55); letter-spacing: 0.12em; }
@keyframes seal-drop {
  0% { transform: scale(2.1) rotate(5deg); opacity: 0; }
  55% { transform: scale(0.94) rotate(-5deg); opacity: 1; }
  100% { transform: scale(1) rotate(-4deg); }
}
@keyframes ritual-fade { from { opacity: 0; } to { opacity: 1; } }
.ritual-out { animation: ritual-fade-out 0.26s ease both; }
@keyframes ritual-fade-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ritual-seal { animation: none; }
  .ritual-overlay, .ritual-out { animation: none; }
}

/* ---------- 推演 AI 追问 ---------- */

.rh-probe-card {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 168, 106, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 106, 0.05);
}
.rh-probe-card .detail-points { margin: 4px 0 0; }
.rh-probe-next { margin-top: 10px; font-size: 13px; color: var(--gold); line-height: 1.6; }

/* ---------- 认知年报 ---------- */

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.report-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 8px;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.report-cell b {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.report-cell span { font-size: 11.5px; color: var(--muted); }

/* ---------- 教我说话 ---------- */

.speak-version { position: relative; padding-top: 18px; }
.speak-style-tag {
  position: absolute;
  top: -9px;
  left: 16px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: var(--panel);
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: 999px;
  padding: 2px 10px;
}
.speak-script {
  font-family: var(--font-display);
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink);
}
.speak-why { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.speak-pitfall { border-color: rgba(224, 82, 79, 0.4); }
.speak-pitfall .practice-label { color: var(--cinnabar); }
.speak-pitfall-line {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.7;
  color: #d99391;
  text-decoration: line-through;
  text-decoration-color: rgba(224, 82, 79, 0.55);
}

/* ---------- 场景演练对话 ---------- */

.dlg-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 10px;
}
.dlg-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 320px;
  max-height: 46vh;
  overflow-y: auto;
}
.dlg-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
}
.dlg-bubble .dlg-who {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 3px;
}
.dlg-bubble.coach {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.dlg-bubble.user {
  align-self: flex-end;
  background: rgba(201, 168, 106, 0.1);
  border: 1px solid rgba(201, 168, 106, 0.3);
  border-bottom-right-radius: 4px;
}
.dlg-whisper {
  margin-top: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--gold);
  background: rgba(201, 168, 106, 0.07);
  border-left: 2px solid rgba(201, 168, 106, 0.5);
  border-radius: 6px;
}
.dlg-typing p { color: var(--muted); }

/* ---------- 实时语音对练（长在场景演练页里：输入行换成语音控制栏） ---------- */
.voice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.voice-bar[hidden] { display: none; }
/* 全宽主按钮在栏内改为行内自适应，别挤塌状态文字 */
.voice-bar .btn-primary {
  width: auto;
  flex: none;
  height: auto;
  margin-top: 0;
  padding: 9px 14px;
  white-space: nowrap;
}
.voice-bar .chip-btn { flex: none; }
.voice-bar-text { flex: 1; min-width: 0; }
.voice-status {
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: 0.06em;
}
.voice-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}
.voice-orb {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  position: relative;
}
.voice-orb::after {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 106, 0.35);
  animation: voice-ring 2.4s ease-out infinite;
}
@keyframes voice-ring {
  0% { transform: scale(0.86); opacity: 0.7; }
  100% { transform: scale(1.22); opacity: 0; }
}
.voice-bar.is-listen .voice-orb { border-color: rgba(201, 168, 106, 0.6); }
.voice-bar.is-speak .voice-orb::after { animation-duration: 1.1s; border-color: rgba(201, 168, 106, 0.6); }
/* 教练耳语进聊天流：跟在你那条气泡下面，与文字演练同款 */
.dlg-chat .voice-whisper-item {
  align-self: flex-end;
  max-width: 86%;
  margin: -4px 0 2px;
  animation: voice-whisper-in 0.35s ease both;
}
@keyframes voice-whisper-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.dlg-input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.dlg-input-row input {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.dlg-mic, .dlg-send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 18px;
  display: grid;
  place-items: center;
}
.dlg-send { background: var(--gold); color: #14161c; border-color: var(--gold); font-size: 13px; }
.dlg-mic.rec {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  animation: mic-pulse 1.2s ease infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 82, 79, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(224, 82, 79, 0); }
}
.dlg-transcript {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.dlg-transcript summary { cursor: pointer; color: var(--gold); font-size: 13px; }
.dlg-transcript p { margin: 4px 0; }

/* ---------- 开口七日营 ---------- */

.camp-card { margin-bottom: 14px; }
.camp-days {
  display: flex;
  gap: 7px;
  margin: 14px 0 12px;
}
.camp-day-dot {
  flex: 1;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.camp-day-dot.on {
  border-color: rgba(201, 168, 106, 0.5);
  color: var(--gold);
  background: rgba(201, 168, 106, 0.08);
}
.camp-day-dot.now { border-color: var(--gold); color: var(--ink); }
.camp-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.camp-actions .btn-primary { width: auto; padding: 0 22px; }
.camp-done-tag {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 106, 0.5);
  color: var(--gold);
  font-size: 13.5px;
}
