:root {
  --bg: #f7f4ef;
  --paper: #fffdfa;
  --ink: #23201c;
  --muted: #8a8178;
  --line: #e7e0d6;
  --accent: #d97757;
  --accent-soft: #f6e3da;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
  min-height: 100vh;
}

/* ---------------------------------------------------------- 屏幕切换 */

.screen {
  display: none;
  min-height: 100vh;
  padding: 48px 24px 64px;
  max-width: 560px;
  margin: 0 auto;
  flex-direction: column;
  justify-content: center;
}

.screen.active { display: flex; }

/* ---------------------------------------------------------- 入口 */

.brand {
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 40px;
}

.entry-title {
  font-size: 28px;
  line-height: 1.35;
  margin: 0 0 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.entry-sub {
  color: var(--muted);
  margin: 0 0 36px;
  font-size: 15px;
}

#code-form { display: flex; flex-direction: column; gap: 14px; }

#code {
  width: 100%;
  padding: 20px 22px;
  font-size: 22px;
  letter-spacing: 0.22em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  text-transform: uppercase;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

#code:focus { border-color: var(--accent); }
#code::placeholder { letter-spacing: 0.08em; font-size: 17px; color: #c3bbb2; }

button, .btn-primary, .btn-ghost {
  font-family: inherit;
  font-size: 16px;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 18px 24px;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: transform 0.12s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

button:active, .btn-primary:active, .btn-ghost:active { transform: scale(0.985); }

.btn-primary, #start-btn {
  background: var(--ink);
  color: #fff;
  font-weight: 500;
}

.btn-primary:disabled, #start-btn:disabled { opacity: 0.45; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 12px;
}

.btn-ghost.small, .btn-primary.small { padding: 12px 18px; font-size: 14px; }

.error {
  color: #b8452f;
  font-size: 14px;
  min-height: 20px;
  margin: 16px 0 0;
}

.hint {
  color: #a9a096;
  font-size: 13px;
  margin-top: 28px;
}

/* ---------------------------------------------------------- 上次报告 */

.resume-title { font-size: 24px; margin: 0 0 10px; font-weight: 600; }
.resume-sub { color: var(--muted); margin: 0 0 32px; }

/* ---------------------------------------------------------- 答题 */

#quiz { justify-content: flex-start; padding-top: 40px; }

.progress-wrap { margin-bottom: 48px; }

.progress {
  height: 3px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.28s ease;
}

.progress-text {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.question-wrap { flex: 1; }

.question {
  font-size: 22px;
  line-height: 1.55;
  font-weight: 500;
  margin: 0 0 36px;
  min-height: 3em;
  letter-spacing: -0.005em;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  width: 100%;
  padding: 17px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font-size: 16px;
  text-align: left;
}

.option.chosen {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-foot { padding-top: 28px; }
.quiz-foot .btn-ghost { width: auto; display: inline-block; margin: 0; }

/* ---------------------------------------------------------- 加载 */

#loading { align-items: center; text-align: center; }

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 24px;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.6); opacity: 1; }
}

.loading-text { color: var(--muted); }

/* ---------------------------------------------------------- 报告 */

.report-body { background: #efe9e1; }

.report {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 120px;
}

.paper {
  background: var(--paper);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 24px rgba(60, 46, 30, 0.08);
}

.cover {
  background: var(--ink);
  color: #f7f2ea;
  padding: 56px 32px 44px;
  position: relative;
}

.cover-brand {
  font-size: 12px;
  letter-spacing: 0.22em;
  opacity: 0.6;
  margin-bottom: 44px;
}

.cover-kicker {
  font-size: 13px;
  letter-spacing: 0.16em;
  opacity: 0.55;
  margin-bottom: 14px;
}

.cover-type {
  font-size: 40px;
  line-height: 1.2;
  margin: 0 0 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cover-hook {
  font-size: 16px;
  line-height: 1.75;
  opacity: 0.82;
  margin: 0;
  max-width: 30em;
}

.cover-meta {
  margin-top: 40px;
  font-size: 12px;
  opacity: 0.45;
  letter-spacing: 0.04em;
}

.block {
  padding: 34px 32px;
  border-bottom: 1px solid var(--line);
}

.block:last-of-type { border-bottom: none; }

.block-title {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 18px;
  font-weight: 600;
}

.block-body {
  font-size: 15.5px;
  line-height: 1.85;
  margin: 0;
  color: #3a352e;
}

.block-note {
  font-size: 13px;
  color: var(--muted);
  margin: 22px 0 0;
}

.bars { display: flex; flex-direction: column; gap: 16px; }

.bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 34px;
  align-items: center;
  gap: 12px;
}

.bar-label { font-size: 14px; color: #4a453d; }

.bar-track {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

.bar-num {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.advice {
  margin: 0;
  padding-left: 20px;
  font-size: 15.5px;
  line-height: 1.9;
  color: #3a352e;
}

.advice li { margin-bottom: 10px; }

.paper-foot {
  padding: 28px 32px 34px;
  background: #faf6f0;
  border-top: 1px solid var(--line);
}

.disclaimer {
  font-size: 12px;
  line-height: 1.7;
  color: #9a9187;
  margin: 0 0 10px;
}

.brand-line {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 120px 20px;
}

/* ---------------------------------------------------------- 底部操作条 */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.actionbar .btn-primary { flex: 1; margin: 0; }
.actionbar .btn-ghost { flex: 0 0 auto; margin: 0; }

/* ---------------------------------------------------------- 打印 / PDF */

@page {
  size: A4;
  margin: 14mm 12mm;
}

@media print {
  body { background: #fff; }

  .report { max-width: none; padding: 0; margin: 0; }
  .actionbar { display: none !important; }

  .paper {
    box-shadow: none;
    border-radius: 0;
    background: #fff;
  }

  .cover {
    background: #23201c !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 40px 28px 32px;
    border-radius: 6px;
    margin-bottom: 4px;
  }

  .cover-type { font-size: 34px; }

  .block { padding: 24px 8px; }

  .paper-foot { background: #faf6f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .bar-fill, .cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  section, .paper-foot { break-inside: avoid; page-break-inside: avoid; }
}
