/* ============================================================
   怪奇人格研究所 · 纸墨档案风 v3
   纸 #f4efe6 / 墨 #211d17 / 印章红 #b91c1c
   ============================================================ */

:root {
  --paper: #f4efe6;
  --paper-soft: #faf7f0;
  --paper-card: #fbf8f1;
  --ink: #211d17;
  --ink-soft: #4a443b;
  --ink-faint: #8a8172;
  --seal: #b91c1c;
  --line: #d8d0c0;
  --line-dark: #211d17;
  --accent: #92400e;           /* 由 JS 按测试注入，纸墨间点缀用 */
  --serif: Georgia, "Times New Roman", "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --radius: 4px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

/* 报头顶部红条 */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 5px;
  background: var(--seal);
  z-index: 10;
}

/* 旧背景装饰元素退役 */
.bg-grid, .bg-glow { display: none; }

::selection { background: var(--seal); color: var(--paper); }

/* ---------- 顶栏 ---------- */

.site-head {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px clamp(20px, 5vw, 64px) 22px;
  border-bottom: 1.5px solid var(--line-dark);
}

.logo {
  display: flex; align-items: baseline; gap: 10px;
  text-decoration: none; color: var(--ink);
}

.logo-mark { color: var(--seal); font-size: 18px; }

.logo-text {
  font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: 3px;
}

.logo-sub {
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  letter-spacing: 1.5px; text-transform: uppercase;
}

.head-record {
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
}

.head-record b { color: var(--seal); font-weight: 700; }

.head-right {
  display: flex; align-items: center; gap: 14px;
}

.lang-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 1px;
  padding: 5px 12px; cursor: pointer;
  border: 1.5px solid var(--line-dark); border-radius: 2px;
  background: var(--paper-card); color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}

.lang-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 rgba(33, 29, 23, 0.85);
}

/* ---------- 首页 hero ---------- */

.home { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }

.hero { padding: clamp(44px, 8vw, 96px) 0 36px; text-align: center; }

.hero-tag {
  font-family: var(--mono); font-size: 12.5px; color: var(--seal);
  letter-spacing: 2px; margin-bottom: 22px;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(32px, 6vw, 58px);
  font-weight: 900; line-height: 1.35; letter-spacing: 4px;
}

.hero-title em {
  font-style: normal; color: var(--seal);
  border-bottom: 3px solid var(--seal);
  padding: 0 2px;
}

.hero-desc {
  margin-top: 24px; color: var(--ink-soft); font-size: 15px;
}

/* 公告栏：报纸中缝跑马灯 */

.marquee {
  margin: 42px auto 0; max-width: 720px; overflow: hidden;
  border-top: 1.5px solid var(--line-dark);
  border-bottom: 1.5px solid var(--line-dark);
  padding: 9px 0;
}

.marquee-track {
  display: inline-flex; white-space: nowrap;
  font-family: var(--serif); font-size: 13px; color: var(--ink-soft);
  animation: marquee 30s linear infinite;
}

@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- 测试卡片 ---------- */

.test-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 22px; padding-bottom: 44px;
}

.test-card {
  position: relative; overflow: hidden;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--paper-card);
  padding: 24px 24px 20px 28px;
  text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 9px;
  box-shadow: 4px 4px 0 rgba(33, 29, 23, 0.85);
  transition: transform .18s ease, box-shadow .18s ease;
}

.test-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px; background: var(--card-accent, var(--seal));
}

.test-card:hover {
  transform: translate(-2px, -3px);
  box-shadow: 7px 7px 0 rgba(33, 29, 23, 0.85);
}

.card-top {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint); letter-spacing: 1px;
}

.card-top .card-no { color: var(--seal); font-weight: 700; }

.card-emoji { font-size: 38px; line-height: 1.2; margin-top: 4px; }

.card-title {
  font-family: var(--serif); font-size: 21px; font-weight: 900; letter-spacing: 1.5px;
}

.card-sub { color: var(--ink-soft); font-size: 13.5px; min-height: 44px; }

.card-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.tag {
  font-family: var(--mono); font-size: 11px; padding: 2px 10px;
  border: 1px solid var(--line-dark); border-radius: 2px;
  color: var(--ink-soft); background: var(--paper);
}

.tag.new-tag {
  background: var(--seal); color: var(--paper); border-color: var(--seal);
}

.card-go {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-weight: 700; font-size: 14.5px;
  color: var(--seal); letter-spacing: 2px;
  transition: gap .2s;
}

.test-card:hover .card-go { gap: 15px; }

/* ---------- 首页尾注 / 页脚 ---------- */

.home-note {
  text-align: center; padding: 28px 0 54px;
  color: var(--ink-soft); font-size: 13.5px;
}
.home-note .fine { margin-top: 8px; font-size: 12px; color: var(--ink-faint); }

.site-foot {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 20px clamp(20px, 5vw, 64px);
  border-top: 1.5px solid var(--line-dark);
  color: var(--ink-faint); font-size: 12.5px; font-family: var(--mono);
}

.fine { font-size: 12px; color: var(--ink-faint); }

/* ============================================================
   测试页
   ============================================================ */

.quiz-body { display: flex; flex-direction: column; }

.quiz-root {
  position: relative; z-index: 1; flex: 1;
  width: 100%; max-width: 740px; margin: 0 auto;
  padding: clamp(26px, 6vh, 60px) clamp(20px, 5vw, 40px) 70px;
}

/* 进度条 */

.progress-wrap { margin-bottom: 36px; }

.progress-bar {
  height: 4px; background: var(--line); overflow: hidden;
  border-radius: 2px;
}

.progress-fill {
  height: 100%; width: 0%;
  background: var(--seal);
  transition: width .45s cubic-bezier(.3,.8,.3,1);
}

.progress-label {
  display: flex; justify-content: space-between; margin-top: 10px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
}

/* 题目 */

.stage { animation: fadeUp .4s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.q-index {
  font-family: var(--mono); font-size: 13px; color: var(--seal);
  letter-spacing: 3px; margin-bottom: 14px;
}

.q-text {
  font-family: var(--serif);
  font-size: clamp(20px, 3.4vw, 27px); font-weight: 900;
  line-height: 1.6; letter-spacing: 1px; margin-bottom: 30px;
}

.opts { display: flex; flex-direction: column; gap: 12px; }

.quiz-nav { margin-top: 16px; }

.btn-back {
  font-family: var(--mono); font-size: 13px; letter-spacing: 1px;
  color: var(--ink-faint); background: none; border: none;
  cursor: pointer; padding: 6px 2px;
  transition: color .15s;
}

.btn-back:hover { color: var(--seal); }

.opt {
  display: flex; align-items: center; gap: 15px; text-align: left;
  padding: 15px 17px; border-radius: var(--radius);
  border: 1.5px solid var(--line-dark);
  background: var(--paper-card);
  color: var(--ink); font-size: 15.5px; font-family: var(--sans);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}

.opt:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(33, 29, 23, 0.85);
}

.opt-key {
  flex: none; width: 30px; height: 30px;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 14px; font-weight: 700;
  border: 1.5px solid var(--line-dark);
  background: var(--paper);
  transition: all .15s;
}

.opt.selected {
  background: var(--ink); color: var(--paper);
  box-shadow: 4px 4px 0 rgba(185, 28, 28, 0.55);
}

.opt.selected .opt-key {
  background: var(--seal); color: var(--paper); border-color: var(--seal);
}

/* 按钮通用 */

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 13px 30px; border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  font-family: var(--serif); font-size: 15.5px; font-weight: 700; letter-spacing: 2px;
  border: 1.5px solid var(--line-dark);
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 rgba(33,29,23,.85); }

.btn-primary {
  background: var(--ink); color: var(--paper);
}

.btn-ghost {
  background: var(--paper-card); color: var(--ink);
}

/* intro */

.intro { text-align: center; padding-top: 3vh; }

.intro-emoji { font-size: 60px; }

.intro-no {
  font-family: var(--mono); font-size: 13px; color: var(--seal);
  letter-spacing: 4px; margin: 18px 0 8px;
}

.intro-title {
  font-family: var(--serif); font-size: clamp(28px, 5vw, 40px);
  font-weight: 900; letter-spacing: 3px;
}

.intro-sub { margin-top: 12px; color: var(--ink-soft); font-size: 15.5px; }

.intro-specs {
  margin: 26px auto 0; display: inline-flex; flex-wrap: wrap; gap: 9px; justify-content: center;
}

.intro-specs .tag { font-size: 12px; padding: 4px 13px; }

.intro-desc {
  max-width: 560px; margin: 26px auto 0;
  color: var(--ink-soft); font-size: 14.5px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 20px 24px; background: var(--paper-card);
  text-align: left;
  box-shadow: 4px 4px 0 rgba(33,29,23,.12);
}

.intro-btn-row { margin-top: 34px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* analyzing：打印报告 */

.analyzing { text-align: center; padding-top: 10vh; }

.stamp-loader {
  width: 84px; height: 84px; margin: 0 auto 28px;
  border: 3px solid var(--seal); border-radius: 50%;
  display: grid; place-items: center;
  color: var(--seal); font-family: var(--serif);
  font-size: 15px; font-weight: 900; letter-spacing: 2px;
  transform: rotate(-10deg);
  animation: stampPulse 1.4s ease-in-out infinite;
}

@keyframes stampPulse {
  0%, 100% { transform: rotate(-10deg) scale(1); opacity: .55; }
  50% { transform: rotate(-10deg) scale(1.06); opacity: 1; }
}

.log-panel {
  font-family: var(--mono); font-size: 13px; color: var(--ink-soft);
  border: 1.5px solid var(--line-dark); border-radius: var(--radius);
  background: var(--paper-card); padding: 18px 22px;
  min-height: 180px; width: min(430px, 100%); margin: 0 auto;
  text-align: left;
  box-shadow: 4px 4px 0 rgba(33,29,23,.12);
}

.log-line { opacity: 0; animation: logIn .3s ease forwards; }
.log-line::before { content: '▸ '; color: var(--seal); }
.log-line b { color: var(--seal); }

@keyframes logIn { to { opacity: 1; } }

/* ---------- 结果页：检出报告 ---------- */

.result { position: relative; text-align: center; }

.stamp {
  position: absolute; top: -14px; right: 0;
  width: 108px; height: 108px;
  border: 3px solid var(--seal); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--seal);
  transform: rotate(-12deg);
  mix-blend-mode: multiply;
  opacity: .88;
  animation: stampIn .5s cubic-bezier(.2, 1.4, .4, 1) both;
  animation-delay: .5s;
  pointer-events: none;
}

.stamp span {
  font-size: 10.5px; letter-spacing: 1px;
  border-bottom: 1.5px solid var(--seal); padding: 0 8px 3px; margin-bottom: 4px;
}

.stamp b { font-family: var(--serif); font-size: 21px; letter-spacing: 4px; font-weight: 900; }

@keyframes stampIn {
  from { transform: rotate(-12deg) scale(2.2); opacity: 0; }
  to   { transform: rotate(-12deg) scale(1); opacity: .88; }
}

.result-badge {
  display: inline-block; font-family: var(--mono); font-size: 12px;
  letter-spacing: 3px; color: var(--seal);
  border: 1.5px solid var(--seal);
  border-radius: 2px; padding: 5px 16px; margin-bottom: 28px;
  background: var(--paper);
}

.result-emoji { font-size: 72px; line-height: 1; }

.result-name {
  font-family: var(--serif);
  font-size: clamp(28px, 5.6vw, 44px); font-weight: 900;
  letter-spacing: 3px; margin-top: 14px; color: var(--ink);
}

.result-slogan {
  margin-top: 12px; color: var(--ink-soft); font-size: 16px;
  font-family: var(--serif); letter-spacing: .5px;
}

.result-rarity {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft);
  border: 1.5px dashed var(--line-dark); border-radius: 2px;
  padding: 6px 16px; background: var(--paper-card);
}

.result-rarity b { color: var(--seal); font-size: 14px; }

.result-desc {
  max-width: 620px; margin: 32px auto 0; text-align: left;
  font-size: 15.5px; color: var(--ink);
  background: var(--paper-card); border: 1.5px solid var(--line-dark);
  border-radius: var(--radius); padding: 26px 28px;
  box-shadow: 4px 4px 0 rgba(33,29,23,.12);
  white-space: pre-line;
}

/* 得分条 */

.result-chart {
  max-width: 620px; margin: 22px auto 0; text-align: left;
  border: 1.5px solid var(--line-dark); border-radius: var(--radius);
  background: var(--paper-card); padding: 24px 28px;
  box-shadow: 4px 4px 0 rgba(33,29,23,.12);
}

.chart-title {
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px;
  color: var(--seal); margin-bottom: 18px;
}

.bar-row { margin-bottom: 14px; }
.bar-row:last-child { margin-bottom: 0; }

.bar-label {
  display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px;
  gap: 10px;
}
.bar-label .pct { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }

.bar-track {
  height: 12px; border-radius: 2px;
  background: repeating-linear-gradient(-45deg, var(--line) 0 4px, transparent 4px 8px);
  border: 1px solid var(--line);
}

.bar-fill {
  height: 100%; width: 0; border-radius: 1px;
  background: var(--seal);
  transition: width 1s cubic-bezier(.2,.8,.2,1);
}

/* 配置单（LAB-001 专用） */

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td {
  padding: 12px 4px; border-bottom: 1px dashed var(--line); font-size: 14.5px;
}
.spec-table tr:last-child td { border-bottom: none; }
.spec-table td:first-child {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  letter-spacing: 1px; width: 96px; padding-right: 12px; vertical-align: top; padding-top: 14px;
}
.spec-table td:last-child { color: var(--ink); }

/* 彩蛋模块 */

.result-extra {
  max-width: 620px; margin: 20px auto 0; text-align: left;
  border: 1.5px solid var(--seal);
  border-radius: var(--radius);
  background: var(--paper-soft);
  padding: 22px 26px;
  box-shadow: 4px 4px 0 rgba(185, 28, 28, 0.18);
}

.result-extra h3 {
  font-family: var(--mono); font-size: 13px; letter-spacing: 2px;
  color: var(--seal); margin-bottom: 12px; font-weight: 700;
}

.result-extra p { font-size: 14.5px; color: var(--ink); white-space: pre-line; }

.result-actions {
  margin-top: 38px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}

.result-note { margin-top: 26px; }

/* ---------- 检出海报 ---------- */

.result-poster {
  max-width: 620px; margin: 34px auto 0; text-align: center;
  border-top: 1.5px dashed var(--line-dark); padding-top: 26px;
}

.poster-head {
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  letter-spacing: 2px; color: var(--seal); margin-bottom: 18px;
}

.poster-stage { display: flex; justify-content: center; }

.poster-canvas {
  width: min(340px, 86vw); height: auto;
  border: 1.5px solid var(--line-dark);
  box-shadow: 6px 6px 0 rgba(33, 29, 23, 0.18);
  background: var(--paper);
}

.poster-actions {
  margin-top: 20px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

.poster-actions .btn { padding: 11px 24px; font-size: 14px; }

.poster-tip { margin-top: 12px; }

/* toast */

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper);
  font-size: 14px; font-weight: 700; letter-spacing: 1px;
  padding: 11px 24px; border-radius: var(--radius);
  border: 1.5px solid var(--ink);
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; z-index: 50;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 小屏适配 */

@media (max-width: 560px) {
  .logo-sub { display: none; }
  .head-record { font-size: 11px; }
  .site-head { padding: 18px 16px 14px; }
  .head-right { gap: 10px; }
  .lang-btn { padding: 4px 10px; font-size: 11px; }
  .home { padding: 0 16px; }
  .hero { padding-top: 34px; }
  .hero-title { letter-spacing: 2px; }
  .marquee { margin-top: 26px; }
  .stamp { width: 88px; height: 88px; top: -8px; }
  .stamp b { font-size: 17px; letter-spacing: 3px; }
  .q-text { margin-bottom: 22px; letter-spacing: 0; font-size: 20px; }
  .opt { padding: 13px 13px; font-size: 14.5px; gap: 11px; }
  .result-desc, .result-chart, .result-extra { padding: 20px 18px; }
  .result-actions { gap: 10px; }
  .btn { padding: 12px 22px; font-size: 14px; letter-spacing: 1px; }
  .bar-label { flex-wrap: wrap; row-gap: 2px; }
  .bar-label .pct { flex-basis: 100%; }
}

/* 触屏设备：关闭位移类 hover，避免“粘住”的按压效果 */
@media (hover: none) {
  .test-card:hover,
  .opt:hover,
  .btn:hover,
  .lang-btn:hover {
    transform: none;
    box-shadow: 4px 4px 0 rgba(33, 29, 23, 0.85);
  }
  .test-card:hover { box-shadow: 4px 4px 0 rgba(33, 29, 23, 0.85); }
  .lang-btn:hover { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}
