:root {
  --bg: #f7f1ea;
  --bg-deep: #efe6db;
  --card: #fffaf5;
  --ink: #2b2420;
  --muted: #6f645c;
  --faint: #9a8c82;
  --line: #e6d8cc;
  --line-strong: #d7c6b7;
  --blush: #c45c6a;
  --blush-deep: #9e3f4d;
  --blush-soft: #f4dce0;
  --sage: #6e7d6b;
  --gold: #a16207;
  --ivory: #fffaf5;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --display: "Playfair Display", "Noto Serif SC", serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(196, 92, 106, 0.12), transparent 58%),
    radial-gradient(720px 480px at 100% 0%, rgba(110, 125, 107, 0.12), transparent 52%),
    var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.7;
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blush);
  outline-offset: 3px;
}

.silk {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(180deg, rgba(255,250,245,0.35), transparent 28%),
    repeating-linear-gradient(90deg, rgba(43,36,32,0.03) 0 1px, transparent 1px 28px);
}
.silk-bloom {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(18px);
}
.silk-bloom-a {
  width: 220px;
  height: 220px;
  top: 8%;
  right: -60px;
  background: rgba(196, 92, 106, 0.16);
}
.silk-bloom-b {
  width: 260px;
  height: 260px;
  bottom: 6%;
  left: -80px;
  background: rgba(110, 125, 107, 0.14);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 20px 72px;
}
.site-masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin: 0 0 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
}
.masthead-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--blush-deep);
}
.masthead-copy { display: grid; gap: 1px; }
.masthead-copy span {
  color: var(--sage);
  font: 500 10px var(--mono);
  letter-spacing: .24em;
}
.masthead-copy b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.masthead-edition {
  margin-left: auto;
  color: var(--gold);
  font: 500 10px var(--mono);
  letter-spacing: .16em;
}

.screen { display: none; }
.screen-active { display: block; animation: rise 0.32s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero-card, .question-card, .result-card, .access-panel {
  background: var(--card);
  border: 1px solid var(--line);
}
.hero-card { padding: 36px 28px 28px; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--blush-deep);
  font: 500 11px var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow.small { font-size: 10px; margin-bottom: 4px; }
.hero-card h1 {
  margin: 0 0 16px;
  max-width: 540px;
  font-family: var(--display);
  font-size: clamp(38px, 8vw, 62px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.12;
}
.hero-card h1 em {
  font-style: italic;
  color: var(--blush-deep);
}
.hero-lead {
  margin: 0 0 28px;
  max-width: 460px;
  color: var(--muted);
  font-size: 15px;
}

.crest-index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.crest-index li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  letter-spacing: 0.06em;
}
.crest-index li:nth-child(odd) { padding-right: 16px; }
.crest-index li:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.crest-index span {
  color: var(--sage);
  font: 500 11px var(--mono);
  letter-spacing: 0.08em;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric-row div {
  padding: 12px 8px 10px;
  border-top: 1px solid var(--line-strong);
  text-align: left;
}
.metric-row strong {
  display: block;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
.metric-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.access-panel { margin-top: 18px; padding: 22px 20px; }
.access-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-kicker { margin: 0; color: var(--blush-deep); font: 500 11px var(--mono); letter-spacing: 0.16em; }
.panel-desc { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.pill {
  flex: 0 0 auto;
  font: 500 10px var(--mono);
  color: var(--gold);
  letter-spacing: 0.12em;
  border: 1px solid var(--line-strong);
  padding: 5px 9px;
}
.warning-box {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 16px;
}
.warning-box strong { display: block; font-size: 12.5px; color: var(--ink); margin-bottom: 4px; }
.warning-box p { margin: 3px 0; font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.input-label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.access-form { display: grid; grid-template-columns: minmax(0, 1fr) 148px; gap: 8px; }
.code-input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  letter-spacing: 0.08em;
  outline: none;
  text-transform: uppercase;
}
.code-input:focus { border-color: var(--blush); box-shadow: 0 0 0 3px rgba(196, 92, 106, 0.12); }
.primary-btn {
  min-height: 48px;
  border: 0;
  border-radius: 0;
  padding: 0 16px;
  background: var(--blush-deep);
  color: #fffaf5;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.primary-btn:hover { background: var(--blush); }
.primary-btn:disabled { opacity: 0.6; cursor: wait; }
.ghost-btn {
  min-height: 44px;
  border-radius: 0;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.ghost-btn:hover { border-color: var(--blush); color: var(--blush-deep); }
.ghost-btn:disabled { opacity: 0.4; cursor: default; }
.form-message { min-height: 20px; margin: 10px 0 0; font-size: 13px; color: var(--sage); }
.form-message.error { color: var(--blush-deep); }
.form-message.center { text-align: center; }
.disclaimer { margin-top: 16px; font-size: 11.5px; color: var(--faint); line-height: 1.6; }

.claim-panel { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.claim-divider { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.claim-divider::before, .claim-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.claim-divider span { font: 500 10px var(--mono); color: var(--muted); letter-spacing: 0.14em; }
.claim-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.claim-desc { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.claim-result {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.claim-result[hidden] { display: none; }
.claim-result span { font-size: 12px; color: var(--muted); }
.claim-result strong { font: 500 14px var(--mono); color: var(--blush-deep); letter-spacing: 0.08em; flex: 1; }
.mini-btn { min-height: 40px; padding: 0 11px; font-size: 12px; }

.quiz-topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.phase-text { margin: 0; color: var(--muted); font-size: 13px; }
.counter { font: 500 12px var(--mono); color: var(--blush-deep); }
.progress-wrap {
  height: 2px;
  background: var(--line);
  margin-bottom: 18px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--blush);
  transition: width 0.3s ease;
}
.scene-label {
  margin: 0 0 8px;
  color: var(--sage);
  font: 500 11px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.question-card { padding: 28px 22px; }
.question-card h2 {
  font-family: var(--display);
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 500;
  line-height: 1.28;
  margin: 0 0 22px;
  letter-spacing: -0.02em;
}
.option-list { display: grid; gap: 8px; }
.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 15px 16px;
  background: #fff;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.option-btn:hover, .option-btn.option-picked {
  border-color: var(--blush);
  background: var(--blush-soft);
}
.option-title { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.option-desc { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.quiz-actions { display: flex; gap: 8px; margin-top: 16px; }

.result-card { padding: 32px 22px; }
.result-hero {
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 22px;
  margin-bottom: 22px;
}
.result-seal {
  width: 56px;
  height: 56px;
  margin: 0 0 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--blush);
  color: var(--blush-deep);
  background: var(--blush-soft);
  font-family: var(--display);
  font-size: 26px;
  font-style: italic;
}
.serial { margin: 0 0 8px; font: 500 12px var(--mono); color: var(--sage); }
.result-house {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(34px, 8vw, 48px);
  font-weight: 500;
  font-style: italic;
  color: var(--blush-deep);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.result-hero h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 10px;
}
.result-subtitle { margin: 0; max-width: 460px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.result-quote {
  margin: 0 0 22px;
  padding: 8px 0 8px 18px;
  border: 0;
  border-left: 2px solid var(--blush);
  background: none;
}
.result-quote p {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
}

.score-grid { display: grid; gap: 12px; margin: 0 0 26px; }
.score-item { padding: 0; }
.score-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 6px; }
.score-top b { font: 500 12px var(--mono); color: var(--blush-deep); }
.score-track { height: 2px; background: var(--line); overflow: hidden; }
.score-track i { display: block; height: 100%; background: var(--blush); }

.result-section { margin: 0 0 22px; }
.result-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--sage);
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-section h3 span {
  font: 500 11px var(--mono);
  color: var(--blush-deep);
}
.result-section p { margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.9; }
.result-section ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.result-section li {
  font-size: 14px;
  color: var(--ink);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.keyword-list { display: flex; flex-wrap: wrap; gap: 8px; }
.keyword-list span {
  font: 500 12px var(--mono);
  color: var(--blush-deep);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--blush-soft);
  padding: 2px 0;
}
.epithet { margin-top: 10px !important; color: var(--muted) !important; }
.note-section { border-top: 1px solid var(--line); padding-top: 18px; }
.note-section p { color: var(--muted); }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.result-actions .primary-btn { grid-column: 1 / -1; }

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(43, 36, 32, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.image-overlay[hidden] { display: none; }
.image-overlay-inner {
  width: 100%;
  max-width: 520px;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.image-overlay-tip {
  margin: 0;
  text-align: center;
  color: #fffaf5;
  font-size: 14px;
  letter-spacing: 0.08em;
}
.image-overlay-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.image-overlay-scroll img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-touch-callout: default;
  user-select: auto;
}
.overlay-close { background: #fffaf5; border-color: transparent; }

@media (max-width: 420px) {
  .app-shell { padding: 16px 14px 56px; }
  .hero-card { padding: 28px 18px 22px; }
  .hero-card h1 { font-size: 36px; }
  .access-panel, .question-card, .result-card { padding: 22px 16px; }
  .access-form { grid-template-columns: 1fr; }
  .access-form .primary-btn { width: 100%; }
  .crest-index { grid-template-columns: 1fr; }
  .crest-index li:nth-child(odd),
  .crest-index li:nth-child(even) { padding-left: 0; padding-right: 0; border-left: 0; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions .primary-btn { grid-column: auto; }
  .claim-result { align-items: stretch; flex-direction: column; }
  .mini-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .screen-active, .option-btn, .progress-bar { animation: none; transition: none; }
}
