/* IQ 测试 · 全局样式（v3：洞穴篝火主题，与猿人实验室主页同源协调）
   主色 = 主页 CSS 变量：cave-bg #0d0d14 / ember #e8923a / fire #e05a2a
   / gold #d4a853 / parchment #f5e6d0 / smoke #94a3b8 / moss #5b8c5a
   图形区（矩阵题 SVG 为深色线条）保留羊皮纸亮底 = 火光照亮的岩画 */
:root {
  --brand: #e8923a;
  --brand-2: #e05a2a;
  --brand-grad: linear-gradient(135deg, #e8923a, #e05a2a);
  --bg: #0d0d14;
  --card: #1c1917;
  --card-2: #211d19;
  --text: #f5e6d0;
  --text-2: #94a3b8;
  --border: rgba(232, 146, 58, .16);
  --ember-soft: rgba(232, 146, 58, .08);
  --gold: #d4a853;
  --parchment: #f5e6d0;
  --ok: #4ade80;
  --err: #f87171;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(232,146,58,.07) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 100%, rgba(224,90,42,.05) 0%, transparent 60%),
    radial-gradient(circle at 20% 30%, rgba(212,168,83,.03) 0%, transparent 40%),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,255,255,.005) 3px, rgba(255,255,255,.005) 4px),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

.container { max-width: 860px; margin: 0 auto; padding: 24px 16px 96px; }

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 3px 10px rgba(224, 90, 42, .35);
}
.brand small { color: var(--text-2); font-weight: 500; font-size: 13px; margin-left: 2px; }

/* ---------- 卡片 ---------- */
.card {
  background: linear-gradient(135deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px;
}

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 44px 30px 36px; }
.hero h1 { font-size: 31px; letter-spacing: .5px; margin-bottom: 12px; }
.hero h1 .hl { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-2); font-size: 15px; line-height: 1.75; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0 30px; }
.feature { background: var(--ember-soft); border: 1px solid rgba(232,146,58,.08); border-radius: 12px; padding: 18px 14px; text-align: center; }
.feature .ico {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; background: rgba(232, 146, 58, .14);
  box-shadow: inset 0 0 0 1px rgba(232, 146, 58, .25);
  font-size: 21px; margin-bottom: 8px;
}
.feature .t { font-weight: 700; font-size: 14px; margin-top: 4px; color: var(--parchment); }
.feature .d { font-size: 12px; color: #a3b0c2; margin-top: 4px; line-height: 1.5; }

/* 年龄段选择 */
.section-title { font-size: 18px; font-weight: 800; margin: 34px 0 16px; color: var(--parchment); }
.section-title.center { text-align: center; }
.band-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0 30px; }
.band-card {
  border: 2px solid rgba(232,146,58,.28); border-radius: 14px;
  background: linear-gradient(180deg, #1e1a16, #161310);
  padding: 18px 12px; cursor: pointer; text-align: center;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.band-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.band-card.sel {
  border-color: var(--brand); background: rgba(232, 146, 58, .10);
  box-shadow: 0 0 0 3px rgba(232, 146, 58, .16), 0 4px 18px rgba(224, 90, 42, .18);
  position: relative;
}
.band-card.sel::after {
  content: "✓"; position: absolute; top: 8px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-grad); color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center;
}
.band-age { font-size: 19px; font-weight: 800; color: var(--brand); }
.band-name { font-size: 14px; font-weight: 700; margin-top: 4px; }
.band-desc { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.diff-pill {
  display: inline-block; background: rgba(232, 146, 58, .12); color: var(--brand);
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin: 0 1px;
}

.btn {
  display: inline-block; border: none; cursor: pointer; font-size: 17px; font-weight: 700;
  padding: 15px 44px; border-radius: 999px; color: #fff;
  background: var(--brand-grad); box-shadow: 0 5px 18px rgba(224, 90, 42, .38);
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(224, 90, 42, .5); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: none; border: 1.5px solid var(--brand); }
.notice { font-size: 12.5px; color: var(--text-2); text-align: center; margin-top: 20px; line-height: 1.7; }

/* ---------- 答题页 ---------- */
.progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress-info { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.progress-info b { color: var(--brand); font-size: 15px; }
.timer-wrap {
  margin-left: auto; background: rgba(232, 146, 58, .08); border-radius: 999px;
  padding: 6px 16px; border: 1px solid rgba(232, 146, 58, .2);
}
.timer { font-weight: 900; font-variant-numeric: tabular-nums; font-size: 15px; color: #f0a050; }
.timer.warn { color: var(--err); }
.timer-wrap:has(.timer.warn) { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .3); }
.progress-bar { flex: 1; height: 10px; background: rgba(255, 255, 255, .08); border-radius: 99px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--brand-grad); border-radius: 99px; transition: width .3s; }

.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.q-no { font-weight: 800; font-size: 15px; }
.badge { font-size: 11.5px; padding: 3px 10px; border-radius: 99px; color: #fff; font-weight: 600; }
/* 难度徽章：火焰由金至红 */
.badge.d1 { background: #d4a853; } .badge.d2 { background: #e8923a; }
.badge.d3 { background: #e05a2a; } .badge.d4 { background: #c2410c; }
.badge.d5 { background: #b91c1c; }

.q-body { display: flex; flex-direction: column; align-items: center; gap: 22px; }
/* 图形区 = 羊皮纸亮底（SVG 深色线条可读，火光照亮的岩画） */
.matrix-box { padding: 10px; border: 1px solid rgba(212, 168, 83, .3); border-radius: 12px; background: var(--parchment); }
.options-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 580px; }
.option {
  border: 2px solid rgba(232, 146, 58, .2); border-radius: 12px; background: var(--parchment);
  padding: 10px 8px 6px; display: grid; place-items: center; cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .1s;
}
.option:hover { border-color: var(--brand); transform: translateY(-2px); }
.option.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232, 146, 58, .25); background: #fdf1dc; }
.option svg { width: 100%; height: auto; display: block; }
.option .opt-label { font-size: 11px; color: #7c5a2e; font-weight: 700; margin-top: 3px; }
.option.sel .opt-label { color: #b45309; }

/* 点阵导航 */
.dots { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 24px 0 14px; }
.dot {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid rgba(232, 146, 58, .18);
  background: #211d19; font-size: 10.5px; font-weight: 700; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; transition: all .12s;
}
.dot.answered { background: var(--brand); border-color: var(--brand); color: #fff; }
.dot.current { outline: 3px solid rgba(232, 146, 58, .3); transform: scale(1.12); }
.dot:hover { border-color: var(--brand); }

.nav-row { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.btn.sm { padding: 11px 24px; font-size: 14px; }

/* ---------- 结果页 ---------- */
.score-hero { text-align: center; padding: 40px 30px; }
.score-hero .label { color: var(--text-2); font-size: 14px; }
.big-iq {
  font-size: 76px; font-weight: 900; line-height: 1.1; letter-spacing: 1px;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ci { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.band-chip { display: inline-block; margin-top: 12px; padding: 5px 18px; border-radius: 99px; background: rgba(232, 146, 58, .12); color: var(--brand); font-weight: 700; font-size: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.stat { background: var(--ember-soft); border: 1px solid rgba(232,146,58,.08); border-radius: 12px; padding: 15px 8px; }
.stat .v { font-size: 20px; font-weight: 800; color: var(--brand); }
.stat .k { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* 难度剖面 */
.profile-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.pbar { height: 7px; background: rgba(255, 255, 255, .08); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.pbar i { display: block; height: 100%; background: var(--brand-grad); }

/* 回顾列表 */
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item { background: linear-gradient(135deg, var(--card) 0%, var(--card-2) 100%); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.verdict { font-weight: 800; font-size: 13px; }
.verdict.ok { color: var(--ok); } .verdict.no { color: var(--err); }
.review-body { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.review-body .matrix-box { padding: 6px; }
.review-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 1; min-width: 300px; }
.ropt {
  border: 1.5px solid rgba(212, 168, 83, .35); border-radius: 8px; padding: 4px;
  position: relative; background: var(--parchment);
}
.ropt.sel-user { border-color: var(--brand); }
.ropt.is-ans { border-color: var(--ok); background: rgba(74, 222, 128, .16); }
.ropt.both { border-color: var(--ok); background: rgba(74, 222, 128, .2); box-shadow: 0 0 0 2px rgba(74, 222, 128, .3); }
.ropt.wrong-sel { border-color: var(--err); background: rgba(248, 113, 113, .18); }
.ropt svg { width: 100%; height: auto; display: block; }
.ropt .mark { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.mark.ok { background: var(--ok); } .mark.no { background: var(--err); }

.disclaimer { font-size: 12px; color: var(--text-2); text-align: center; margin-top: 24px; line-height: 1.7; }

.hidden { display: none !important; }
.center { text-align: center; }
.loading { text-align: center; padding: 60px 0; color: var(--text-2); }

@media (max-width: 640px) {
  .features { grid-template-columns: 1fr; }
  .band-picker { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: repeat(4, 1fr); }
  .profile-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
}

/* MST 阶段提示 */
.stage-banner { margin: 10px 0 2px; }
.stage-pill {
  display: inline-block; padding: 6px 16px; border-radius: 20px;
  background: rgba(99, 102, 241, .12); color: #6366f1;
  font-size: 13px; font-weight: 600;
}
.stage-pill.main { background: rgba(16, 185, 129, .12); color: #10b981; }

/* ---------- 留言板 ---------- */
.comments-card { margin-top: 20px; }
.comments-title { font-size: 18px; color: var(--text); font-weight: 700; }
.comments-sub { font-size: 13px; color: var(--text-2); margin: 4px 0 18px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form input,
.comment-form textarea {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--brand); }
.comment-form textarea { min-height: 80px; }
.comment-form .btn { align-self: flex-end; min-width: 120px; }
.comment-list { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.comment-item {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.comment-name { font-weight: 700; font-size: 13px; color: var(--gold); }
.comment-time { font-size: 11px; color: var(--text-2); }
.comment-text { font-size: 14px; color: var(--text); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.comment-empty { text-align: center; color: var(--text-2); font-size: 13px; padding: 16px 0; }
