/* ==========================================================================
   法理心镜 · 古典法治美学 × 现代手机端优先样式表
   ========================================================================== */

:root {
  --bg-parchment: #FAF7F0;
  --bg-warm: #F2ECE0;
  --surface: #FFFDF8;
  --surface-elevated: #FFFFFF;
  --ink: #1C232D;
  --ink-soft: #4B5565;
  --ink-muted: #7C8594;
  --navy: #162636;
  --navy-light: #243B52;
  --gold: #B88A44;
  --gold-bright: #D5AF6B;
  --gold-soft: rgba(184, 138, 68, 0.14);
  --gold-border: rgba(184, 138, 68, 0.30);
  --seal: #9B3A33;
  --seal-soft: rgba(155, 58, 51, 0.10);
  --sage: #2C6A5A;
  --sage-soft: rgba(44, 106, 90, 0.10);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 32px rgba(22, 38, 54, 0.06), 0 1px 3px rgba(22, 38, 54, 0.05);
  --shadow-soft: 0 4px 16px rgba(22, 38, 54, 0.05);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--bg-parchment);
  line-height: 1.68;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

/* 细腻古典羊皮纸光晕底纹 */
.paper-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 15% 0%, rgba(213, 175, 107, 0.14), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(22, 38, 54, 0.06), transparent 60%),
    linear-gradient(180deg, #FAF7F0 0%, #F4EFE3 100%);
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
  background: var(--gold-soft);
  color: var(--navy);
  padding: 1px 6px;
  border-radius: 5px;
}

.muted {
  color: var(--ink-muted);
}

/* ==================== 顶部导航栏 ==================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 240, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gold-border);
}

.topbar-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--navy);
  text-align: left;
}

.brand-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-sub {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 600;
}

.quiz-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(22, 38, 54, 0.08);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--gold));
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==================== 主容器与按钮 ==================== */
.app-shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--navy) 0%, #233C54 100%);
  color: #FAF7F0;
  border: 1px solid rgba(213, 175, 107, 0.45);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 18px rgba(22, 38, 54, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(22, 38, 54, 0.24);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.18s ease, transform 0.18s ease;
}

.btn-secondary:hover {
  background: var(--gold-soft);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.18s ease;
}

.btn-ghost:hover {
  background: var(--gold-soft);
}

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-xs { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 14px 30px; font-size: 1rem; }

.btn-text-sm {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 6px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 0.88rem;
  padding: 4px 6px;
  transition: color 0.15s;
}

.link-btn:hover { color: var(--navy); text-decoration: underline; }
.dot-sep { color: var(--gold); margin: 0 4px; }

/* ==================== 首页视图 ==================== */
.hero-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 32px 22px 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(184, 138, 68, 0.16);
  border-radius: 14px;
  pointer-events: none;
}

.hero-svg {
  width: min(210px, 58vw);
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  line-height: 1.3;
  color: var(--navy);
  margin: 0 0 14px;
  letter-spacing: 0.03em;
}

.hero-desc {
  max-width: 660px;
  margin: 0 auto 24px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 600px;
  margin: 0 auto 26px;
}

.stat-pill {
  background: var(--bg-parchment);
  border: 1px solid rgba(184, 138, 68, 0.22);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-top: 3px;
}

/* 首页测前性别选择器 */
.gender-picker-box {
  max-width: 440px;
  margin: 0 auto 22px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-parchment);
  border: 1px solid var(--gold-border);
}

.gender-picker-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
  font-weight: 600;
}

.gender-picker-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gender-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(184, 138, 68, 0.35);
  background: var(--surface);
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.16s ease;
}

.gender-pill-btn:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.gender-pill-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #FAF7F0;
  box-shadow: 0 4px 12px rgba(22, 38, 54, 0.18);
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.hero-secondary-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid rgba(184, 138, 68, 0.22);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  box-shadow: var(--shadow-soft);
}

.feature-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
}

.feature-card h3 {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.feature-card p {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ==================== 答题视图（手机端极致手感） ==================== */
.view-quiz {
  max-width: 680px;
  margin: 0 auto;
}

.quiz-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}

.quiz-counter {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--navy);
}

.scenario-chip {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 4px 12px;
  border-radius: 999px;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 28px 22px 26px;
  box-shadow: var(--shadow-card);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.question-card.switching {
  opacity: 0.35;
  transform: translateY(6px);
}

.question-instruction {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0 0 12px;
}

.question-text {
  font-family: var(--font-serif);
  font-size: clamp(1.12rem, 4.2vw, 1.38rem);
  line-height: 1.65;
  color: var(--navy);
  margin: 0 0 30px;
  min-height: 4.5em;
  font-weight: 600;
}

/* 五点是非中立圆环选择器 */
.likert-wrap {
  user-select: none;
}

.likert-poles {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.pole-left { color: var(--seal); }
.pole-mid { color: var(--ink-muted); }
.pole-right { color: var(--sage); }

.likert-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  justify-items: center;
  gap: 6px;
  padding: 6px 0 12px;
}

.likert-btn {
  position: relative;
  border-radius: 50%;
  background: var(--bg-parchment);
  border: 2.5px solid #C6BEAF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--ink-soft);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.16s, border-color 0.16s, color 0.16s, box-shadow 0.16s;
}

/* 经典对称阶梯大小（外侧大、中立适中，手机手指极易点准） */
.likert-btn[data-val="1"], .likert-btn[data-val="5"] { width: 58px; height: 58px; font-size: 1rem; }
.likert-btn[data-val="2"], .likert-btn[data-val="4"] { width: 50px; height: 50px; font-size: 0.92rem; }
.likert-btn[data-val="3"] { width: 44px; height: 44px; font-size: 0.85rem; }

.likert-btn[data-val="1"], .likert-btn[data-val="2"] { border-color: rgba(155, 58, 51, 0.55); color: var(--seal); }
.likert-btn[data-val="3"] { border-color: rgba(184, 138, 68, 0.65); color: var(--gold); }
.likert-btn[data-val="4"], .likert-btn[data-val="5"] { border-color: rgba(44, 106, 90, 0.55); color: var(--sage); }

.likert-btn:hover { transform: scale(1.08); }
.likert-btn:active { transform: scale(0.94); }

.likert-btn.selected[data-val="1"],
.likert-btn.selected[data-val="2"] {
  background: var(--seal);
  border-color: var(--seal);
  color: #FFF;
  box-shadow: 0 6px 16px rgba(155, 58, 51, 0.30);
  transform: scale(1.08);
}

.likert-btn.selected[data-val="3"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #FFF;
  box-shadow: 0 6px 16px rgba(184, 138, 68, 0.32);
  transform: scale(1.08);
}

.likert-btn.selected[data-val="4"],
.likert-btn.selected[data-val="5"] {
  background: var(--sage);
  border-color: var(--sage);
  color: #FFF;
  box-shadow: 0 6px 16px rgba(44, 106, 90, 0.30);
  transform: scale(1.08);
}

.likert-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  text-align: center;
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.quiz-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.auto-advance-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  cursor: pointer;
}

.auto-advance-toggle input {
  accent-color: var(--navy);
  width: 15px;
  height: 15px;
}

/* ==================== 结果报告页 ==================== */
.view-result {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.banner-notice {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.banner-notice.info {
  background: rgba(22, 38, 54, 0.06);
  border: 1px solid rgba(22, 38, 54, 0.16);
  color: var(--navy);
}

.banner-notice.warn {
  background: var(--seal-soft);
  border: 1px solid rgba(155, 58, 51, 0.32);
  color: var(--seal);
  flex-direction: column;
  align-items: flex-start;
}

/* 顶部主角结果卡 */
.result-hero-card {
  position: relative;
  background: linear-gradient(155deg, #FFFDF8 0%, #F7F1E4 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.result-hero-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--gold), var(--seal));
}

.result-hero-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
  align-items: center;
}

/* 小人画像画框 + 多画风切换器 */
.portrait-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 248px;
  margin: 0 auto;
}

.portrait-stage {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #FFFDF8 0%, #EDE4D2 100%);
  border: 1.5px solid var(--gold-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 24px rgba(184, 138, 68, 0.12), 0 10px 24px rgba(22, 38, 54, 0.10);
}

.portrait-stage.has-image {
  background: #FAF5EC;
  border-color: var(--gold);
  box-shadow: 0 12px 28px rgba(22, 38, 54, 0.14), 0 0 0 1px rgba(184, 138, 68, 0.35);
}

.portrait-stage.has-image .portrait-frame-border {
  border-style: solid;
  border-color: rgba(184, 138, 68, 0.32);
  inset: 6px;
}

.portrait-frame-border {
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(184, 138, 68, 0.42);
  border-radius: 11px;
  pointer-events: none;
  z-index: 2;
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  padding: 12px 10px 44px;
  display: block;
  z-index: 1;
}

/* 36型图鉴卡片内 Q版小人缩略图 */
.gallery-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gallery-thumb {
  width: 72px;
  height: 84px;
  object-fit: contain;
  margin-bottom: 6px;
  border-radius: 10px;
  background: #FAF5EC;
  padding: 4px;
  border: 1px solid rgba(184, 138, 68, 0.24);
}

.portrait-style-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(22, 38, 54, 0.06);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
}

.portrait-style-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.portrait-style-btn:hover {
  color: var(--navy);
}

.portrait-style-btn.active {
  background: var(--navy);
  color: #FAF7F0;
  box-shadow: 0 2px 8px rgba(22, 38, 54, 0.22);
}

/* 拍档小头像缩略图 */
.partner-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 1.5px solid var(--gold);
  background: var(--bg-parchment);
  flex-shrink: 0;
}

.partner-avatar.is-pixel {
  image-rendering: pixelated;
}

.portrait-svg-fallback {
  width: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 26px;
}

.portrait-slot-caption {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(22, 38, 54, 0.86);
  backdrop-filter: blur(6px);
  color: #FAF7F0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.portrait-code-chip {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
}

.portrait-hint {
  opacity: 0.85;
  font-size: 0.68rem;
}

.result-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.school-pill {
  background: var(--navy);
  color: #FAF7F0;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.mbti-pill {
  background: var(--gold-soft);
  color: var(--navy);
  border: 1px solid var(--gold-border);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
}

/* 中式朱砂法治小印章 */
.vermilion-seal {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 2px solid var(--seal);
  border-radius: 6px;
  color: var(--seal);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(155, 58, 51, 0.05);
  transform: rotate(-4deg);
}

.result-title {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  color: var(--navy);
  margin: 2px 0 6px;
  letter-spacing: 0.04em;
}

.result-bodenheimer {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 0 0 14px;
}

.result-tagline {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-left: 3px solid var(--gold);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 0 10px 10px 0;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  color: var(--navy);
  line-height: 1.6;
}

.match-meter-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(184, 138, 68, 0.28);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.match-ring-wrap {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.match-meter-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy);
}

.match-meter-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ==================== 面板与图表 ==================== */
.panel-card {
  background: var(--surface);
  border: 1px solid rgba(184, 138, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.panel-head {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(184, 138, 68, 0.16);
  padding-bottom: 10px;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  color: var(--navy);
  margin: 0 0 3px;
}

.panel-sub {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0;
}

.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.radar-container {
  width: 100%;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.radar-container svg {
  width: 100%;
  max-width: 390px;
  height: auto;
  display: block;
}

/* 博登海默 3×3 九宫格坐标图 */
.matrix-wrapper {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-gold-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(184, 138, 68, 0.16), rgba(213, 175, 107, 0.24));
  color: var(--navy);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.16s, transform 0.16s;
}

.btn-gold-pill strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--seal);
  letter-spacing: 0.04em;
}

.btn-gold-pill:hover {
  background: var(--gold-soft);
  transform: translateY(-1px);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================== 突出特色：超大四位法律人格代码铭牌 ==================== */
.code-hero-banner {
  margin: 10px 0 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #162636 0%, #20374D 100%);
  border: 1.5px solid rgba(213, 175, 107, 0.55);
  box-shadow: 0 8px 20px rgba(22, 38, 54, 0.14);
}

.code-letters {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  margin-bottom: 10px;
}

.code-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 48px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(250, 247, 240, 0.10);
  border: 1px solid rgba(213, 175, 107, 0.45);
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 5vw, 2.25rem);
  font-weight: 800;
  color: #FAF7F0;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.code-char.accent {
  background: linear-gradient(145deg, rgba(213, 175, 107, 0.28), rgba(184, 138, 68, 0.16));
  border-color: var(--gold-bright);
  color: #F4DCAA;
}

.code-dash {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold-bright);
  padding: 0 2px;
}

.code-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-legend-item {
  font-size: 0.74rem;
  color: rgba(250, 247, 240, 0.9);
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(213, 175, 107, 0.22);
}

.code-legend-item strong {
  color: var(--gold-bright);
  margin-right: 3px;
}

/* ==================== 黄金法律拍档卡片 ==================== */
.partners-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.partner-card {
  background: linear-gradient(160deg, #FAF7F0 0%, #F4EDE0 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.partner-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.partner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.partner-tag {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--seal);
  background: var(--seal-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.partner-identity {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.partner-code-badge {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1.08rem;
  font-weight: 800;
  color: #FAF7F0;
  background: var(--navy);
  border: 1px solid var(--gold);
  padding: 3px 10px;
  border-radius: 8px;
  letter-spacing: 0.06em;
}

.partner-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--navy);
}

.partner-quote {
  margin: 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.75);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  font-family: var(--font-serif);
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--navy);
}

.partner-reason {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.partner-footer {
  margin-top: auto;
  padding-top: 6px;
}

.matrix-y-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-align: center;
  letter-spacing: 0.12em;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-board-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.matrix-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.matrix-cell {
  position: relative;
  min-width: 0;
  min-height: 76px;
  background: var(--bg-parchment);
  border: 1px solid rgba(184, 138, 68, 0.22);
  border-radius: 10px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.matrix-cell:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.matrix-cell.active {
  background: linear-gradient(145deg, var(--navy) 0%, #243C54 100%);
  border-color: var(--gold);
  color: #FAF7F0;
  box-shadow: 0 6px 16px rgba(22, 38, 54, 0.22);
}

.matrix-cell-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}

.matrix-cell-name {
  font-family: var(--font-serif);
  font-size: 0.74rem;
  line-height: 1.2;
  font-weight: 600;
  word-break: keep-all;
}

.matrix-pin {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid #FFF;
  box-shadow: 0 0 0 4px rgba(213, 175, 107, 0.36), 0 2px 6px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), top 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.matrix-x-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  text-align: center;
  font-size: 0.68rem;
  color: var(--ink-muted);
  margin-top: 8px;
  padding-left: 20px;
  gap: 4px;
}

/* 四维光谱条 */
.spectrum-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.spectrum-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spectrum-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
}

.spectrum-name {
  font-weight: 700;
  color: var(--navy);
}

.spectrum-score {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 700;
  color: var(--gold);
}

.spectrum-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--bg-warm);
  border: 1px solid rgba(22, 38, 54, 0.08);
  overflow: visible;
}

.spectrum-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy), var(--gold));
}

.spectrum-tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 1.5px;
  background: rgba(22, 38, 54, 0.35);
}

.spectrum-dot {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFF;
  border: 3px solid var(--navy);
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(22, 38, 54, 0.25);
}

.spectrum-poles {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.neighbor-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  font-size: 0.86rem;
  color: var(--navy);
}

.neighbor-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 4px 6px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--gold);
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==================== 走心长文情绪价值板块 ==================== */
.narrative-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.narrative-block {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-parchment);
  border: 1px solid rgba(184, 138, 68, 0.18);
}

.narrative-block.blessing {
  background: linear-gradient(135deg, rgba(22, 38, 54, 0.96) 0%, #243C54 100%);
  color: #FAF7F0;
  border-color: var(--gold);
}

.narrative-block h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.narrative-block.blessing h3 {
  color: var(--gold-bright);
}

.narrative-block p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--ink);
  text-align: justify;
}

.narrative-block.blessing p {
  color: rgba(250, 247, 240, 0.94);
}

/* ==================== 灵魂法学家双星 ==================== */
.jurists-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.jurist-card {
  position: relative;
  background: var(--bg-parchment);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jurist-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.jurist-name {
  font-family: var(--font-serif);
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--navy);
}

.jurist-role {
  font-size: 0.76rem;
  color: var(--gold);
  font-weight: 600;
}

.jurist-quote-zh {
  font-family: var(--font-serif);
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--navy);
  margin: 0;
  padding-left: 12px;
  border-left: 2.5px solid var(--gold);
}

.jurist-quote-orig {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
}

.jurist-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed rgba(184, 138, 68, 0.28);
}

/* ==================== 职业赛道与避坑 ==================== */
.tracks-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.track-chip {
  background: var(--navy);
  color: #FAF7F0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
}

.career-duo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.career-callout {
  border-radius: var(--radius-md);
  padding: 15px 16px;
  font-size: 0.9rem;
}

.career-callout.strength {
  background: var(--sage-soft);
  border: 1px solid rgba(44, 106, 90, 0.25);
}

.career-callout.warning {
  background: var(--seal-soft);
  border: 1px solid rgba(155, 58, 51, 0.24);
}

.callout-head {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--navy);
}

.career-callout p {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
}

.result-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding-top: 6px;
}

/* ==================== 弹窗：图鉴 & 题卡 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16, 26, 36, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-sheet {
  width: 100%;
  max-width: 860px;
  max-height: 86dvh;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--gold-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.modal-sheet-sm { max-width: 560px; }

.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gold-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--navy);
  margin: 0 0 4px;
}

.modal-header p { margin: 0; font-size: 0.8rem; }

.modal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-close {
  background: var(--bg-warm);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  color: var(--navy);
  flex-shrink: 0;
}

.modal-body {
  padding: 16px 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.gallery-school-group {
  margin-bottom: 20px;
}

.gallery-school-title {
  font-family: var(--font-serif);
  font-size: 0.96rem;
  color: var(--navy);
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--gold);
}

.gallery-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gallery-card {
  background: var(--bg-parchment);
  border: 1px solid rgba(184, 138, 68, 0.24);
  border-radius: 12px;
  padding: 11px 10px;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s, background 0.14s;
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.gallery-card-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold);
}

.gallery-card-title {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 3px;
}

.qnav-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
}

.qnav-btn {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid rgba(22, 38, 54, 0.16);
  background: var(--bg-parchment);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.qnav-btn.answered {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--navy);
}

.qnav-btn.current {
  background: var(--navy);
  border-color: var(--navy);
  color: #FFF;
}

.site-footer {
  text-align: center;
  padding: 12px 16px 28px;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(22, 38, 54, 0.94);
  color: #FAF7F0;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: opacity 0.25s, transform 0.25s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 手机端专项响应式适配（≤ 768px / ≤ 430px） ==================== */
@media (max-width: 780px) {
  .feature-grid,
  .charts-grid,
  .jurists-grid,
  .partners-grid,
  .career-duo-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .result-identity {
    min-width: 0;
  }

  .portrait-stage {
    max-width: 210px;
  }

  .gallery-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qnav-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal-sheet {
    max-height: 90dvh;
    border-radius: 20px 20px 0 0;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 14px 12px 36px;
  }

  .hero-card {
    padding: 24px 16px 22px;
  }

  .hero-secondary-links {
    flex-direction: column;
    gap: 6px;
  }

  .hero-secondary-links .dot-sep {
    display: none;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-cta-group {
    flex-direction: column;
  }

  .hero-cta-group .btn-lg {
    width: 100%;
  }

  .question-card {
    padding: 22px 16px 20px;
  }

  .likert-btn[data-val="1"], .likert-btn[data-val="5"] { width: 52px; height: 52px; }
  .likert-btn[data-val="2"], .likert-btn[data-val="4"] { width: 45px; height: 45px; }
  .likert-btn[data-val="3"] { width: 40px; height: 40px; }

  .quiz-nav-bar {
    flex-wrap: wrap;
  }

  .auto-advance-toggle {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }

  .result-hero-card,
  .panel-card {
    padding: 18px 14px;
  }

  .matrix-cell {
    min-height: 68px;
    padding: 6px 2px;
  }

  .code-char {
    min-width: 38px;
    height: 42px;
    font-size: 1.5rem;
  }

  .topbar-inner {
    padding: 10px 12px;
  }

  .btn-gold-pill {
    font-size: 0.74rem;
    padding: 5px 10px;
  }

  .matrix-cell-name {
    font-size: 0.7rem;
  }

  .spectrum-poles {
    font-size: 0.68rem;
  }

  .result-footer-actions {
    flex-direction: column;
  }

  .result-footer-actions button {
    width: 100%;
  }
}

/* 打印 / 导出 PDF 优化 */
@media print {
  .topbar, .no-print, .modal-backdrop, .toast {
    display: none !important;
  }
  body { background: #FFF; }
  .panel-card, .result-hero-card {
    box-shadow: none !important;
    break-inside: avoid;
  }
}
