:root {
  --bg: #f6faf6;
  --panel: #ffffff;
  --text: #1e2a22;
  --muted: #6a786f;
  --line: #dbe8dd;
  --soft: #edf6ef;
  --accent: #6c8d71;
  --accent-strong: #4d6a53;
  --shadow: 0 16px 40px rgba(47, 73, 55, 0.08);
  --radius: 22px;
  --option-bg: #fff;
  --option-hover-border: #bcd0c1;
  --option-hover-bg: #f8fcf9;
  --progress-track: #edf3ee;
  --mini-panel-bg: linear-gradient(180deg, #fbfefb, #f3f8f4);
  --lb-btn-border: rgba(180, 130, 0, 0.45);
  --lb-btn-bg: rgba(212, 165, 32, 0.07);
  --lb-btn-text: #9a6e00;
  --lb-glow: rgba(192, 148, 20, 0.22);
  --lb-shimmer: rgba(230, 185, 50, 0.25);
  --question-bg: linear-gradient(180deg, #ffffff, #fbfdfb);
  --btn-secondary-bg: #fff;
  --analysis-text: #304034;
  --author-text: #304034;
  --hero-circle: rgba(127, 165, 134, 0.18);
  --poster-gradient: linear-gradient(180deg, #ffffff, #f7fbf8);
  --poster-circle: rgba(127,165,134,0.12);
  --body-gradient: radial-gradient(circle at top left, #f8fff8 0, #f6faf6 36%, #f2f7f3 100%);
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --bg: #0a0f0c;
  --panel: #131a15;
  --text: #e2ece5;
  --muted: #8fa396;
  --line: #243028;
  --soft: #182019;
  --accent: #7daa84;
  --accent-strong: #5eff7b;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --option-bg: #131a15;
  --option-hover-border: #3d5545;
  --option-hover-bg: #1c281e;
  --progress-track: #1c281e;
  --mini-panel-bg: linear-gradient(180deg, #131a15, #0f150f);
  --question-bg: linear-gradient(180deg, #131a15, #0f150f);
  --btn-secondary-bg: #131a15;
  --analysis-text: #c8dbd0;
  --author-text: #c8dbd0;
  --hero-circle: rgba(94, 255, 123, 0.08);
  --poster-gradient: linear-gradient(180deg, #131a15, #0f150f);
  --poster-circle: rgba(94,255,123,0.06);
  --body-gradient: radial-gradient(ellipse at 50% 0%, #0f1a12 0%, #0a0f0c 50%, #060a07 100%);
  --lb-btn-border: rgba(245, 200, 66, 0.4);
  --lb-btn-bg: rgba(245, 200, 66, 0.08);
  --lb-btn-text: #f5c842;
  --lb-glow: rgba(245, 200, 66, 0.25);
  --lb-shimmer: rgba(255, 220, 100, 0.22);
}

/* ── Dark Theme Hero V2 Overrides ── */
[data-theme="dark"] .scanline {
  background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
  opacity: 0.35;
  box-shadow: 0 0 12px var(--accent-strong);
}
[data-theme="dark"] .glitch::before {
  color: #ff4444;
}
[data-theme="dark"] .glitch::after {
  color: #44ffff;
}
[data-theme="dark"] .btn-cta {
  background: linear-gradient(135deg, #1a3d22, #0d2613);
  border: 1px solid rgba(94, 255, 123, 0.4);
  box-shadow:
    0 0 20px rgba(94, 255, 123, 0.25),
    0 0 60px rgba(94, 255, 123, 0.1),
    inset 0 1px 0 rgba(94, 255, 123, 0.15);
  color: var(--accent-strong);
}
[data-theme="dark"] .btn-cta:hover {
  box-shadow:
    0 0 30px rgba(94, 255, 123, 0.4),
    0 0 80px rgba(94, 255, 123, 0.2),
    inset 0 1px 0 rgba(94, 255, 123, 0.2);
}
@keyframes pulseGlowDark {
  0%, 100% { box-shadow: 0 0 20px rgba(94,255,123,0.25), 0 0 60px rgba(94,255,123,0.1), inset 0 1px 0 rgba(94,255,123,0.15); }
  50%      { box-shadow: 0 0 32px rgba(94,255,123,0.4), 0 0 80px rgba(94,255,123,0.18), inset 0 1px 0 rgba(94,255,123,0.2); }
}
[data-theme="dark"] .btn-cta {
  animation: pulseGlowDark 2.5s ease-in-out infinite;
}
[data-theme="dark"] .stat-num {
  text-shadow: 0 0 12px rgba(94,255,123,0.4);
}
[data-theme="dark"] .preview-card {
  background: #0f150f;
  border-color: #1c281e;
}
[data-theme="dark"] .preview-card:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 24px rgba(94,255,123,0.12);
}
[data-theme="dark"] .hero-badge {
  border-color: rgba(94,255,123,0.25);
  background: rgba(94,255,123,0.06);
  color: var(--accent-strong);
}

/* ── Language toggle ── */
.lang-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: var(--panel);
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(47, 73, 55, 0.10);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  -webkit-user-select: none;
  user-select: none;
}
.lang-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(47, 73, 55, 0.14);
  background: var(--soft);
}
.lang-toggle:active {
  transform: translateY(0);
}

/* ── Theme toggle ── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 72px;
  z-index: 1000;
  background: var(--panel);
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(47, 73, 55, 0.10);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  -webkit-user-select: none;
  user-select: none;
}
.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(47, 73, 55, 0.14);
  background: var(--soft);
}
.theme-toggle:active {
  transform: translateY(0);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--body-gradient);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.ad-container {
  max-width: 728px;
  margin: 16px auto 0;
  min-height: 90px;
  text-align: center;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

/* ── Hero V2: Particle Canvas ── */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Scanline Effect ── */
.scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
  z-index: 1;
  pointer-events: none;
  animation: scanMove 4s ease-in-out infinite;
  opacity: 0.5;
}
@keyframes scanMove {
  0%   { top: -3px; opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.5; }
  100% { top: 100vh; opacity: 0; }
}

/* ── Hero V2 Layout ── */
.hero-v2 {
  position: relative;
  z-index: 2;
  min-height: 94vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 60px 24px 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 999px;
  padding: 8px 16px;
  margin-bottom: 28px;
  letter-spacing: 0.08em;
  animation: fadeInDown 0.6s ease-out both;
}

.hero-title {
  font-size: clamp(32px, 7vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 900;
  margin: 0;
  animation: fadeInUp 0.7s ease-out 0.15s both;
}

/* ── Glitch Text Effect ── */
.glitch {
  position: relative;
  display: inline-block;
  color: var(--accent-strong);
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.glitch::before {
  color: #ff6b6b;
  animation: glitch1 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}
.glitch::after {
  color: #6bfff0;
  animation: glitch2 2s infinite linear alternate-reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}
@keyframes glitch1 {
  0%   { transform: translate(0); }
  20%  { transform: translate(-2px, 1px); }
  40%  { transform: translate(2px, -1px); }
  60%  { transform: translate(-1px, 2px); }
  80%  { transform: translate(1px, -2px); }
  100% { transform: translate(0); }
}
@keyframes glitch2 {
  0%   { transform: translate(0); }
  25%  { transform: translate(2px, -1px); }
  50%  { transform: translate(-1px, 2px); }
  75%  { transform: translate(-2px, -1px); }
  100% { transform: translate(0); }
}

/* ── Hero Subtitle ── */
.hero-sub {
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(14px, 2.5vw, 17px);
  line-height: 1.6;
  letter-spacing: 0.04em;
  animation: fadeInUp 0.7s ease-out 0.3s both;
}

/* ── Stats Row ── */
.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
  animation: fadeInUp 0.7s ease-out 0.45s both;
}
.stat-item {
  text-align: center;
}
.stat-num {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 900;
  color: var(--accent-strong);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.06em;
}
.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--line);
}

/* ── CTA Button V2 ── */
.hero-actions-v2 {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  animation: fadeInUp 0.7s ease-out 0.6s both;
}
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 44px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 24px rgba(108, 141, 113, 0.35),
    0 0 60px rgba(108, 141, 113, 0.15);
  animation: pulseGlow 2.5s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-cta:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 0 32px rgba(108, 141, 113, 0.5),
    0 0 80px rgba(108, 141, 113, 0.25);
}
.btn-cta:active {
  transform: translateY(0) scale(0.98);
}
.btn-cta-icon {
  font-size: 20px;
  animation: rotateIcon 6s linear infinite;
}
@keyframes rotateIcon {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 24px rgba(108, 141, 113, 0.35), 0 0 60px rgba(108, 141, 113, 0.15); }
  50%      { box-shadow: 0 0 36px rgba(108, 141, 113, 0.5), 0 0 90px rgba(108, 141, 113, 0.25); }
}
/* CTA shimmer effect */
.btn-cta::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { left: -60%; }
  100% { left: 120%; }
}

/* ── Preview Cards Marquee ── */
.hero-preview {
  margin-top: 48px;
  width: 100%;
  max-width: 800px;
  overflow: hidden;
  animation: fadeInUp 0.7s ease-out 0.75s both;
  mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
}
.preview-track {
  display: flex;
  gap: 16px;
  animation: marquee 20s linear infinite;
  width: max-content;
}
.preview-track:hover {
  animation-play-state: paused;
}
@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.preview-card {
  flex-shrink: 0;
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}
.preview-card:hover {
  transform: translateY(-4px) scale(1.06);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 24px rgba(47, 73, 55, 0.15);
}
.preview-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
}
.preview-card span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ── Hero Bottom Hint ── */
.hero-hint {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  opacity: 0.6;
  animation: fadeInUp 0.7s ease-out 0.9s both;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

button {
  border: 0;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  font: inherit;
}

button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #3e6b47 0%, #2a4a32 100%);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(42, 74, 50, 0.35);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--accent-strong);
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-weight: 700;
}

/* 答题页返回按钮 — fixed 悬浮，左侧（与右侧 lang/theme 对称） */
.btn-back {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(47, 73, 55, 0.10);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}
.btn-back::before {
  content: '← ';
}
.btn-back:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(47, 73, 55, 0.14);
  background: var(--soft);
  color: var(--text);
}
.btn-back:active {
  transform: translateY(0);
}

/* 移动端全宽按钮 */
@media (max-width: 600px) {
  .btn-wide {
    width: 100%;
  }
}

.screen { display: none; }
.screen.active { display: block; }

.test-wrap,
.result-wrap {
  margin-top: 22px;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.progress {
  flex: 1;
  min-width: 240px;
  height: 10px;
  background: var(--progress-track);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #97b59c, #5b7a62);
  border-radius: inherit;
  transition: width .22s ease;
}

.progress-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.question-list {
  display: grid;
  gap: 16px;
}

.question {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--question-bg);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.question-title {
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--option-bg);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.option:hover {
  border-color: var(--option-hover-border);
  background: var(--option-hover-bg);
}

.option.selected {
  border-color: var(--accent-strong);
  background: var(--soft);
  box-shadow: 0 0 0 1px var(--accent-strong);
}

.option.selected .option-code {
  color: var(--accent-strong);
}

.option input {
  margin-top: 3px;
  accent-color: var(--accent-strong);
  transform: scale(1.1);
  flex-shrink: 0;
}

.option-code {
  font-weight: 800;
  color: var(--accent-strong);
  min-width: 22px;
}

.actions-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  background: transparent;
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 7px 0;
}

.hint--incomplete {
  color: #7a4200;
  background: #fff3e0;
  padding: 7px 12px;
  border-left-color: #f5a623;
}

[data-theme="dark"] .hint--incomplete {
  color: #ffe0a0;
  background: rgba(122, 66, 0, 0.35);
  border-left-color: #f5a623;
}

.result-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: stretch;
}

.type-box,
.score-box,
.dim-box,
.top3-box,
.about-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--question-bg);
}

.score-box h3,
.dim-box h3,
.top3-box h3,
.about-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.score-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--option-bg);
}

.score-item .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.score-item .v {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-strong);
}

.dim-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dim-pill {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--option-bg);
}

.dim-pill .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.dim-pill .value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-strong);
}

.top3-list {
  display: grid;
  gap: 10px;
}

.top3-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--option-bg);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.top3-item strong {
  display: block;
  margin-bottom: 4px;
}

.top3-item span {
  color: var(--muted);
  font-size: 13px;
}

.top3-score {
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.about-box p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.result-layout {
  display: grid;
  gap: 18px;
}
.result-top {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
  align-items: stretch;
}
.poster-box, .type-box, .analysis-box, .dim-box, .note-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--question-bg);
}
.poster-box {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 280px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at top right, var(--hero-circle), rgba(127,165,134,0) 40%),
    var(--poster-gradient);
}
.poster-box::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -46px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--poster-circle), rgba(127,165,134,0.01));
  pointer-events: none;
}
.poster-image {
  width: 100%;
  min-height: 220px;
  max-height: 460px;
  object-fit: contain;
  border-radius: 18px;
  background: var(--option-bg);
  position: relative;
  z-index: 1;
}
.poster-box.no-image .poster-image {
  display: none;
}
.poster-caption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  position: relative;
  z-index: 1;
}
.type-kicker {
  font-size: 12px;
  color: var(--accent-strong);
  margin-bottom: 8px;
  letter-spacing: .06em;
}
.type-name {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.type-subname {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.match {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}
.analysis-box h3, .dim-box h3, .note-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
}
.analysis-box p {
  margin: 0;
  color: var(--analysis-text);
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.dim-list {
  display: grid;
  gap: 12px;
}
.dim-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--option-bg);
}
.dim-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.dim-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.dim-item-score {
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}
.dim-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.note-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

/* ── Leaderboard ── */
.leaderboard-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--question-bg);
}
.leaderboard-box h3 {
  font-size: 16px;
  margin-bottom: 4px;
}
.leaderboard-total {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.leaderboard-list {
  display: grid;
  gap: 8px;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--option-bg);
  transition: border-color .16s ease, background .16s ease;
  cursor: pointer;
}
.leaderboard-item:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.leaderboard-item.is-self {
  border-color: var(--accent-strong);
  background: var(--soft);
}
.leaderboard-rank {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.leaderboard-item.is-self .leaderboard-rank {
  color: var(--accent-strong);
}
.leaderboard-rank.top3 {
  font-size: 16px;
}
.leaderboard-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}
.leaderboard-info {
  flex: 1;
  min-width: 0;
}
.leaderboard-code {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leaderboard-item.is-self .leaderboard-code {
  color: var(--accent-strong);
}
.leaderboard-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.leaderboard-cn {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leaderboard-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
  white-space: nowrap;
  flex-shrink: 0;
}
.leaderboard-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--progress-track);
  border-radius: 999px;
  margin-top: 4px;
  overflow: hidden;
}
.leaderboard-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
  transition: width .4s ease;
}

/* ── Leaderboard Button on Homepage ── */
.btn-leaderboard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 44px;
  border: 1.5px solid var(--lb-btn-border);
  border-radius: 16px;
  background: var(--lb-btn-bg);
  color: var(--lb-btn-text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 18px var(--lb-glow), 0 0 50px transparent;
  animation: lbPulseGlow 3s ease-in-out infinite 0.5s;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn-leaderboard:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 30px var(--lb-glow), 0 0 70px var(--lb-glow);
  border-color: var(--lb-btn-text);
}
.btn-leaderboard:active {
  transform: translateY(0) scale(0.98);
}
.btn-leaderboard::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -80%;
  width: 45%;
  height: 200%;
  background: linear-gradient(90deg, transparent, var(--lb-shimmer), transparent);
  transform: skewX(-20deg);
  animation: lbShimmer 2.8s ease-in-out infinite 1.2s;
}
.btn-lb-icon {
  font-size: 20px;
  animation: lbIconBounce 2.2s ease-in-out infinite;
  display: inline-block;
}
@keyframes lbPulseGlow {
  0%, 100% { box-shadow: 0 0 18px var(--lb-glow), 0 0 40px transparent; }
  50%       { box-shadow: 0 0 30px var(--lb-glow), 0 0 70px var(--lb-glow); }
}
@keyframes lbShimmer {
  0%   { left: -80%; }
  100% { left: 130%; }
}
@keyframes lbIconBounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  30%      { transform: translateY(-5px) scaleY(1.1); }
  55%      { transform: translateY(-2px) scaleY(1.02); }
  70%      { transform: translateY(0) scaleY(1); }
}

/* ── Leaderboard Modal ── */
#lbModalOverlay {
  z-index: 1900;
}

.lb-modal-card {
  max-width: 520px;
  width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.lb-modal-body {
  padding: 28px 28px 24px;
  overflow-y: auto;
  flex: 1;
}

.lb-modal-body h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
}

.author-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--question-bg);
  overflow: hidden;
}
.author-box summary {
  list-style: none;
  cursor: pointer;
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.author-box summary::-webkit-details-marker { display: none; }
.author-box summary::after {
  content: '展开';
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 6px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.author-box[open] summary::after {
  content: '收起';
}
.author-content {
  border-top: 1px solid var(--line);
  padding: 0 18px 18px;
}
.author-content p {
  margin: 14px 0 0;
  color: var(--author-text);
  font-size: 14px;
  line-height: 1.9;
}

.result-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* ── Tablet (≤860px) ── */
@media (max-width: 860px) {
  .result-top { grid-template-columns: 1fr; }
  .result-hero {
    grid-template-columns: 1fr;
  }
  .dim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Mobile (≤600px) ── */
@media (max-width: 600px) {
  :root {
    --radius: 16px;
  }

  .lang-toggle {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .theme-toggle {
    top: 10px;
    right: 62px;
    padding: 6px 12px;
    font-size: 14px;
  }

  .shell {
    padding: 10px 10px 36px;
  }

  .test-wrap,
  .result-wrap {
    padding: 14px;
    margin-top: 10px;
  }

  .hero-v2 {
    min-height: 92vh;
    padding: 50px 14px 28px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 6px 12px;
  }

  .hero-sub {
    font-size: 13px;
  }

  .hero-stats {
    gap: 14px;
    margin-top: 24px;
  }

  .stat-num {
    font-size: clamp(20px, 5vw, 28px);
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-divider {
    height: 28px;
  }

  .btn-cta {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 14px;
  }

  .hero-preview {
    margin-top: 32px;
  }

  .preview-card {
    width: 72px;
    padding: 10px 6px;
  }

  .preview-card img {
    width: 36px;
    height: 36px;
  }

  .preview-card span {
    font-size: 10px;
  }

  .hero-hint {
    margin-top: 20px;
    font-size: 11px;
  }

  .question-title {
    font-size: 15px;
    line-height: 1.8;
  }

  .dim-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

  /* 进度条 */
  .progress {
    min-width: 0;
  }

  .topbar {
    gap: 8px;
  }

  .btn-back {
    top: 10px;
    left: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* 选项卡片加大触摸区 */
  .option {
    padding: 12px 10px;
    gap: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .option input {
    transform: scale(1.25);
    margin-top: 2px;
  }

  .option-code {
    min-width: 20px;
    font-size: 14px;
  }

  /* 按钮 */
  .btn-primary,
  .btn-secondary {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    min-height: 48px;          /* 48px 触摸安全区 */
  }

  /* 底部提交区：sticky 固定在底部，方便拇指操作 */
  .actions-bottom {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--panel);
    border-top: 1px solid var(--line);
    margin-top: 18px;
    /* 延伸到卡片边缘 */
    margin-left: -22px;
    margin-right: -22px;
    margin-bottom: -22px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .actions-bottom #submitBtn {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
    border-radius: 14px;
  }

  .actions-bottom .hint {
    text-align: center;
    font-size: 12px;
    margin-bottom: 0;
  }

  .result-actions > div {
    flex-direction: column;
    width: 100%;
  }

  .result-actions .btn-primary,
  .result-actions .btn-secondary {
    width: 100%;
  }

  /* 结果页 */
  .result-top {
    grid-template-columns: 1fr;
  }

  .poster-box {
    min-height: 200px;
  }

  .poster-image {
    min-height: 160px;
    max-height: 320px;
  }

  .type-name {
    font-size: clamp(26px, 7vw, 40px);
  }

  .match {
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .analysis-box p {
    font-size: 14px;
    line-height: 1.85;
  }

  /* 维度评分条 */
  .dim-item {
    padding: 12px;
    border-radius: 14px;
  }

  .dim-item-name {
    font-size: 13px;
  }

  .dim-item p {
    font-size: 12px;
    line-height: 1.7;
  }

  /* 排行榜 */
  .leaderboard-item {
    padding: 8px 10px;
    gap: 8px;
  }
  .leaderboard-icon {
    width: 26px;
    height: 26px;
  }
  .leaderboard-code {
    font-size: 13px;
  }
  .leaderboard-cn {
    font-size: 11px;
  }
  .leaderboard-count {
    font-size: 12px;
  }

  /* 作者区 */
  .author-box summary {
    padding: 14px;
    font-size: 15px;
  }

  .author-content {
    padding: 0 14px 14px;
  }

  .author-content p {
    font-size: 13px;
    line-height: 1.8;
  }

  /* 问题卡 */
  .question {
    padding: 14px;
    border-radius: 14px;
  }

  .question-meta {
    font-size: 11px;
    gap: 8px;
  }

  .badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .options {
    gap: 8px;
    margin-top: 10px;
  }

  /* 提示文字 */
  .hint {
    font-size: 12px;
  }

  /* 禁止文字选中（移动端防误触长按） */
  .option,
  .btn-primary,
  .btn-secondary,
  .btn-cta {
    -webkit-user-select: none;
    user-select: none;
  }
}

/* ── Very small phones (≤380px) ── */
@media (max-width: 380px) {
  .shell {
    padding: 8px 6px 28px;
  }

  .test-wrap,
  .result-wrap {
    padding: 12px;
  }

  .hero-v2 {
    min-height: 88vh;
    padding: 40px 10px 20px;
  }

  .hero-title {
    font-size: clamp(24px, 8vw, 32px);
  }

  .hero-stats {
    gap: 10px;
  }

  .stat-num {
    font-size: 22px;
  }

  .btn-cta {
    padding: 14px 28px;
    font-size: 15px;
  }

  .preview-card {
    width: 64px;
    padding: 8px 4px;
  }

  .preview-card img {
    width: 32px;
    height: 32px;
  }

  .poster-image {
    min-height: 140px;
    max-height: 260px;
  }

  .type-name {
    font-size: 24px;
  }

  .option {
    padding: 10px 8px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 12px 14px;
    font-size: 14px;
  }

  /* 小屏下 actions-bottom 的负边距匹配更小的 padding */
  .actions-bottom {
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ── Landscape phone ── */
@media (max-width: 860px) and (orientation: landscape) {
  .hero-v2 {
    min-height: 80vh;
    padding: 30px 20px 20px;
  }

  .hero-preview {
    margin-top: 24px;
  }

  .poster-image {
    max-height: 240px;
  }
}

/* ── Theme transition ── */
[data-theme],
[data-theme] * {
  transition: background-color .32s ease, color .32s ease, border-color .32s ease, box-shadow .32s ease;
}

/* ── Dark theme extra tweaks ── */
[data-theme="dark"] .poster-image {
  opacity: 0.92;
}

[data-theme="dark"] .option input[type="radio"] {
  accent-color: var(--accent-strong);
}

[data-theme="dark"] ::selection {
  background: rgba(143, 196, 151, 0.3);
  color: var(--text);
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #5eff7b 0%, #3dd65e 100%);
  color: #0a1f0e;
  box-shadow: 0 8px 24px rgba(61, 214, 94, 0.28);
}

[data-theme="dark"] .btn-back {
  background: var(--panel);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .btn-back:hover {
  background: var(--soft);
  color: var(--text);
}

[data-theme="dark"] .actions-bottom {
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
}

/* ── Confirm Leave Modal ── */
.confirm-card {
  max-width: 360px;
  padding: 28px 24px 22px;
  text-align: center;
}
.confirm-msg {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  margin: 0 0 22px;
}
.confirm-actions {
  display: flex;
  gap: 12px;
}
.confirm-actions .btn-secondary,
.confirm-actions .btn-primary {
  flex: 1;
  min-height: 46px;
}

[data-theme="dark"] details[open] summary {
  border-bottom: 1px solid var(--line);
}

/* ── Dark Theme: deeper background for hero ── */
[data-theme="dark"] .hero-v2 {
  background: radial-gradient(ellipse at 50% 40%, rgba(94,255,123,0.03) 0%, transparent 60%);
}

/* ── Light Theme: subtle glow for hero ── */
[data-theme="light"] .hero-v2 {
  background: radial-gradient(ellipse at 50% 40%, rgba(108,141,113,0.06) 0%, transparent 60%);
}

/* ═══════════════════════════════════════════
   Personality Preview Modal
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  pointer-events: none;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, -webkit-backdrop-filter 0.35s ease;
}
.modal-overlay.open {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  transform: translateY(32px) scale(0.94);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.modal-close:hover {
  background: var(--soft);
  color: var(--accent-strong);
  transform: scale(1.08);
}

.modal-image-box {
  width: 100%;
  min-height: 200px;
  max-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, var(--hero-circle), rgba(127,165,134,0) 40%),
              var(--poster-gradient);
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  padding: 24px;
}
.modal-image {
  max-width: 180px;
  max-height: 260px;
  object-fit: contain;
  border-radius: 14px;
}

.modal-body {
  padding: 22px 24px 26px;
}

.modal-kicker {
  font-size: 11px;
  color: var(--accent-strong);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.modal-title {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}

.modal-intro {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  font-style: italic;
}

.modal-divider {
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-strong);
  margin: 18px 0;
  opacity: 0.5;
}

.modal-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.85;
  white-space: pre-wrap;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: #7a3e00;
  color: #fff;
  border: 1px solid rgba(255, 160, 30, 0.5);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Modal Dark Theme ── */
[data-theme="dark"] .modal-overlay.open {
  background: rgba(0, 0, 0, 0.7);
}
[data-theme="dark"] .modal-card {
  border-color: #1c281e;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(94,255,123,0.08);
}
[data-theme="dark"] .modal-close {
  background: #0f150f;
  border-color: #1c281e;
}
[data-theme="dark"] .modal-close:hover {
  border-color: rgba(94,255,123,0.3);
}
[data-theme="dark"] .modal-kicker {
  text-shadow: 0 0 8px rgba(94,255,123,0.3);
}
[data-theme="dark"] .modal-desc {
  color: var(--author-text);
}

/* ── Modal Mobile ── */
@media (max-width: 600px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-card {
    max-width: none;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal-card {
    transform: translateY(0);
  }
  .modal-image-box {
    min-height: 160px;
    max-height: 220px;
    padding: 18px;
    border-radius: 20px 20px 0 0;
  }
  .modal-image {
    max-width: 140px;
    max-height: 190px;
  }
  .modal-body {
    padding: 18px 18px 22px;
  }
  .modal-title {
    font-size: clamp(22px, 6vw, 30px);
  }
  .modal-desc {
    font-size: 13px;
    line-height: 1.8;
  }
}

@media (max-width: 380px) {
  .modal-overlay {
    padding: 10px;
  }
  .modal-image-box {
    min-height: 140px;
    padding: 14px;
  }
  .modal-image {
    max-width: 110px;
    max-height: 160px;
  }
  .modal-body {
    padding: 14px 14px 18px;
  }
}
