:root {
  --bg: #f6f7fb;
  --surface: #fff;
  --ink: #1b2033;
  --muted: #697186;
  --faint: #98a0b3;
  --line: #e9ebf2;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --radius: 20px;
  --shadow: 0 16px 44px rgba(31, 41, 80, 0.07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.page { max-width: 1000px; margin: 0 auto; padding: 0 20px 60px; }
.view[hidden] { display: none !important; }
.view { animation: fade 0.3s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; padding: 48px 0 34px; }
.pill {
  display: inline-block; padding: 6px 13px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.hero h1 { font-size: 32px; margin: 18px 0 12px; letter-spacing: -0.03em; }
.hero p { max-width: 620px; margin: 0 auto; color: var(--muted); font-size: 14px; }
.apk-link { display: inline-block; margin-top: 14px; padding: 7px 16px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; text-decoration: none; }
.apk-link:hover { background: var(--primary); color: #fff; }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); cursor: pointer;
  font: inherit; color: inherit; transition: transform .2s, border-color .2s;
}
.mode-card:hover { transform: translateY(-4px); border-color: #cdd0f5; }
.mode-tag { background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.mode-count { font-size: 36px; font-weight: 800; margin: 16px 0 2px; line-height: 1; }
.mode-count span { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 5px; }
.mode-name { font-weight: 700; font-size: 16px; margin-top: 10px; }
.mode-desc { color: var(--muted); font-size: 13px; margin: 6px 0 0; min-height: 40px; }
.mode-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; }

.btn {
  border: 1px solid transparent; border-radius: 12px; padding: 11px 20px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--muted); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 16px; }
.link-btn { background: none; border: 0; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.foot-note { text-align: center; color: var(--faint); font-size: 12px; margin-top: 28px; }

.quiz-top { display: flex; justify-content: space-between; align-items: center; margin: 22px 0; }
.quiz-mode { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--muted); }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.progress-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #4f46e5, #7c3aed); transition: width .25s; }
.question-card { background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 32px; margin-top: 22px; min-height: 280px; }
.q-index { display: inline-block; background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.q-text { font-size: 22px; line-height: 1.5; margin: 16px 0 24px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option {
  min-height: 66px; text-align: left; font: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.option .letter { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; background: #f1f2f7; color: var(--muted); display: grid; place-items: center; font-weight: 700; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.selected .letter { background: var(--primary); color: #fff; }
.quiz-bottom { display: flex; justify-content: space-between; margin-top: 20px; }
.quiz-bottom .btn { transition: background .18s, border-color .18s, color .18s; }
.quiz-bottom .btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.quiz-bottom .btn:disabled { opacity: .45; cursor: default; }
.quiz-bottom .btn:disabled:hover { background: #fff; border-color: var(--line); color: var(--muted); }

.result-top { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin-top: 24px; }
.avatar-host { width: 180px; height: 200px; flex: 0 0 auto; }
.avatar-host img { width: 100%; height: 100%; object-fit: contain; display: block; }
.result-badge { display: inline-block; background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 4px 12px; font-weight: 800; margin-right: 12px; }
.result-title { width: 100%; }
.result-title > div:first-child { text-align: center; }
.result-title strong { font-size: 24px; }
.desc { color: var(--muted); font-size: 14px; margin: 10px auto 0; max-width: 640px; text-align: center; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel h3 { margin: 0 0 8px; font-size: 15px; }
.dim-row { margin-top: 14px; }
.dim-head, .dim-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.dim-head b { color: var(--ink); }
.bar-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0 3px; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--primary); }
.dim-desc { color: var(--faint); font-size: 11px; margin: 4px 0 0; }
.detail-item { margin-top: 14px; }
.detail-item span { color: var(--primary); font-size: 12px; font-weight: 700; }
.detail-item p { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.result-actions { display: flex; justify-content: center; gap: 12px; margin-top: 22px; }
.result-actions[hidden] { display: none; }

/* 图鉴详情：隐藏维度面板后提示卡单栏居中 */
.view.is-gallery .result-grid { grid-template-columns: minmax(0, 640px); justify-content: center; margin-top: 20px; }

.gallery-title { font-size: 24px; margin: 28px 0 18px; text-align: center; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gallery-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; cursor: pointer; box-shadow: var(--shadow); }
.gallery-card img { width: 100%; max-width: 150px; height: auto; display: block; margin: 0 auto; }
.gallery-card strong { display: block; font-size: 15px; margin-top: 2px; }
.gallery-card span { display: block; font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translate(-50%, 20px);
  background: #1b2033; color: #fff; border-radius: 10px; padding: 10px 18px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .mode-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .options { grid-template-columns: 1fr; }
}
