/*
 * [INPUT]: 依赖 partials/fonts 引入的 Fraunces 700 / Inter 400·600
 * [OUTPUT]: 全站唯一样式表：令牌 → 基础 → 页头页脚 → 首页 → 正文/FAQ/留言 → 内页 → 游戏（.gd-*，供 embed-play.html）
 * [POS]: theme 的视觉层；设计说明「野外地图册」：暖纸底 + 赤陶主色，记忆点只有一处——指南针与点阵地图
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

/* ============================================================
   令牌
   ============================================================ */
:root {
  --bg: #f7f1e8;
  --card: #fffaf2;
  --ink: #2b2118;
  --muted: #6b5b4b;
  --primary: #c2562f;
  --primary-dark: #a3441f;
  --accent: #e0a03a;
  --good: #2f7d4f;
  --line: #e7dccb;
  --line-strong: #d9cbb5;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ============================================================
   基础
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 16px; }
h1 { font-size: 48px; letter-spacing: -.01em; }
h2 { font-size: 36px; }
h3 { font-size: 18px; font-family: var(--sans); font-weight: 600; }
p { margin: 0 0 16px; }
a { color: var(--primary-dark); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 24px; border: 0; border-radius: var(--radius);
  background: var(--primary); color: #fff; font: 600 16px/1 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn:disabled { background: var(--line); color: #5a4a3b; cursor: default; }
.btn-lg { min-height: 56px; padding: 0 32px; font-size: 18px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line-strong); }
.btn-ghost:hover { background: var(--card); color: var(--ink); }
.btn-soft {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card);
  color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer;
}
.btn-soft:hover { border-color: var(--muted); }
.btn-soft[aria-pressed="true"] { color: var(--primary); border-color: var(--primary); }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary-dark); font: 600 14px var(--sans); cursor: pointer; }

/* ============================================================
   页头 / 页脚
   ============================================================ */
.site-head { border-bottom: 1px solid var(--line); }
.site-head-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 700 22px/1 var(--serif); }
.site-nav { display: flex; gap: 24px; }
.site-nav a { color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.site-foot { margin-top: 64px; border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: 14px; }
.site-foot-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-foot p { margin: 0; }
.site-foot nav { display: flex; gap: 16px; }
.site-foot a { color: var(--muted); }

/* ============================================================
   首页：首屏 = 文案栏 + 播放器（不等宽两栏）
   ============================================================ */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: center; padding-top: 48px; padding-bottom: 48px; }
.eyebrow { color: var(--primary-dark); font-weight: 600; font-size: 14px; letter-spacing: .04em; margin-bottom: 12px; }
.lede { font-size: 18px; color: var(--muted); max-width: 46ch; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }
.actions .count:empty { display: none; }
.share-msg { color: var(--good); font-size: 14px; font-weight: 600; }

.stage {
  position: relative; width: 100%; aspect-ratio: 6 / 7; max-height: 760px;
  border-radius: var(--radius); overflow: hidden; background: var(--card);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-2);
}
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cover { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; cursor: pointer; background: var(--bg); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.cover-card { position: relative; margin: 24px; padding: 24px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.cover-kicker { margin: 0 0 4px; color: var(--primary-dark); font-weight: 600; font-size: 14px; }
.cover-title { margin: 0 0 16px; font: 700 28px/1.2 var(--serif); }
.cover-fine { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.loader { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--card); color: var(--muted); }
.stage[data-gf-state="loading"] .loader { display: flex; }
.needle path { transform-origin: 32px 32px; animation: swing 1.6s ease-in-out infinite; }
@keyframes swing { 0% { transform: rotate(-50deg); } 50% { transform: rotate(40deg); } 100% { transform: rotate(-50deg); } }
@media (prefers-reduced-motion: reduce) { .needle path { animation: none; } }

/* 线索图例：编号列表，左边是游戏里真实出现的样子 */
.clues { padding-top: 48px; padding-bottom: 48px; border-top: 1px solid var(--line); }
.section-lede { color: var(--muted); max-width: 70ch; }
.clue-list { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 48px; }
.clue { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: start; padding: 16px 0; border-bottom: 1px dashed var(--line-strong); }
.clue h3 { margin: 0 0 4px; }
.clue p { margin: 0; color: var(--muted); }
.clue-sample { display: inline-flex; justify-content: center; padding: 8px 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line-strong); font: 600 16px/1.2 var(--sans); white-space: nowrap; }

/* ============================================================
   正文 / FAQ / 留言
   ============================================================ */
.prose { padding-top: 48px; padding-bottom: 16px; }
.prose > * { max-width: 70ch; }
.prose h2 { font-size: 28px; margin-top: 48px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 24px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose table { border-collapse: collapse; margin: 0 0 24px; font-size: 14px; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; }

.faq { padding-top: 48px; }
.faq-list { margin: 24px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.faq-item { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.faq-item dt { font-weight: 600; margin-bottom: 8px; }
.faq-item dd { margin: 0; color: var(--muted); }

.notes { padding-top: 64px; }
.note-form { display: grid; gap: 12px; max-width: 640px; margin-top: 16px; }
.note-form input, .note-form textarea, .gd-input {
  width: 100%; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font: 400 16px/1.4 var(--sans);
}
.note-form .btn { justify-self: start; }
.note-form [data-gf-reply-to]:empty, .note-form:not([data-gf-replying]) [data-gf-reply-cancel] { display: none; }
.replying { margin: 0; font-size: 14px; color: var(--muted); }
.note-msg { margin: 0; font-size: 14px; color: var(--good); }
.note-list { list-style: none; margin: 32px 0 0; padding: 0; max-width: 720px; }
.note { padding: 16px 0; border-top: 1px solid var(--line); }
.note-meta { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.note-meta b { color: var(--ink); }
.note-text { margin: 0 0 8px; }
.note-to { color: var(--primary-dark); font-weight: 600; }
.note-to:empty { display: none; }
.owner-tag { display: none; }
.note[data-gf-owner] > .note-meta .owner-tag { display: inline; padding: 2px 8px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; }
.note[data-gf-owner] { border-left: 3px solid var(--primary); padding-left: 16px; }
.note-replies { list-style: none; margin: 8px 0 0 24px; padding: 0; }
.note-empty { display: none; color: var(--muted); }
[data-gf-comments][data-gf-empty] + .note-empty { display: block; }
[data-gf-comments][data-gf-off] ~ .note-empty, .notes:has([data-gf-off]) .note-form { display: none; }

/* ============================================================
   内页 / 法务 / 404
   ============================================================ */
.page { padding-top: 48px; }
.page .prose { padding-top: 8px; }
.updated { color: var(--muted); font-size: 14px; }
.back { margin-top: 32px; }
.lost { text-align: left; }
.lost-code { font: 700 48px/1 var(--serif); color: var(--primary); margin-bottom: 8px; }

/* ============================================================
   游戏（embed-play.html）：iframe 内部，满高单列
   ============================================================ */
body.embed { background: var(--card); height: 100vh; overflow: hidden; }
.gd { height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; overflow-y: auto; position: relative; }
.gd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gd-title { display: flex; flex-direction: column; line-height: 1.2; }
.gd-title strong { font: 700 18px/1.2 var(--serif); }
.gd-date { font-size: 12px; color: var(--muted); }
.gd-tools { display: flex; gap: 8px; align-items: center; }
.gd-archive { max-width: 168px; height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); color: var(--ink); font: 400 14px var(--sans); }
.gd-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); color: var(--ink); font: 600 16px var(--sans); cursor: pointer; }

.gd-map { flex: 0 0 auto; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.gd-map svg { display: block; width: 100%; height: auto; max-height: 30vh; }
.gd-grat line { stroke: var(--line-strong); stroke-width: .3; }
.gd-grat line.eq { stroke: var(--primary); stroke-dasharray: 2 2; opacity: .5; }
.gd-dots circle { fill: var(--muted); opacity: .35; }
.gd-marks circle { stroke: var(--card); stroke-width: .6; }
.m-cold { fill: #9c8b77; }
.m-warm { fill: var(--accent); }
.m-hot { fill: var(--primary); }
.m-win { fill: var(--good); }
.m-last { stroke: var(--ink) !important; stroke-width: .8 !important; }
.m-ring { fill: none !important; stroke: var(--good) !important; stroke-width: 1.4 !important; }
.gd-label { font: 600 5px var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 1.2px; }
.gd-label.is-answer { fill: var(--good); }

.gd-entry { display: flex; gap: 8px; }
.gd-combo { position: relative; flex: 1; }
.gd-input { height: 44px; }
.gd-input:disabled { background: var(--bg); color: var(--muted); }
.gd-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 4px; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.gd-list li { padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.gd-list li[aria-selected="true"], .gd-list li:hover { background: var(--bg); }
.gd-msg { min-height: 22px; margin: 0; font-size: 14px; color: var(--muted); }

.gd-hints { display: flex; gap: 8px; flex-wrap: wrap; }
.gd-hints:empty { display: none; }
.gd-hint { min-height: 32px; padding: 4px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--muted); font: 600 12px var(--sans); cursor: pointer; }
.gd-hint:disabled { cursor: default; }
.gd-hint:not(:disabled) { border-style: solid; border-color: var(--accent); color: var(--ink); }
.gd-hint.is-open { border-style: solid; border-color: var(--accent); background: #fbecd0; color: var(--ink); }

.gd-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gd-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 28px 48px; grid-template-areas: "name km arrow prox" "chips chips chips chips";
  align-items: center; gap: 4px 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--bg); border-left: 4px solid #9c8b77;
}
.gd-row.is-warm { border-left-color: var(--accent); }
.gd-row.is-hot { border-left-color: var(--primary); }
.gd-row.is-win { border-left-color: var(--good); background: #e5f0e8; }
.gd-name { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-km { grid-area: km; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gd-arrow { grid-area: arrow; font-size: 22px; line-height: 1; text-align: center; color: var(--primary-dark); }
.gd-prox { grid-area: prox; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.gd-chips { grid-area: chips; display: flex; gap: 4px; flex-wrap: wrap; }
.gd-chips:empty { display: none; }
.gd-chip { padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--card); color: var(--muted); }
.gd-chip.is-yes { color: var(--good); }
.gd-chip.is-no { color: #9c8b77; }

.gd-end { padding: 16px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line-strong); }
.gd-verdict { font: 700 22px/1.2 var(--serif); margin-bottom: 8px; }
.gd-rank { color: var(--good); font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.gd-end-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gd-sharebox { width: 100%; min-height: 120px; margin-top: 12px; padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: 400 14px/1.4 var(--sans); background: var(--card); }
.gd-next { margin: 12px 0 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.gd-sheet { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(43, 33, 24, .35); }
.gd-sheet-card { width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; padding: 24px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-2); }
.gd-sheet-card h2 { font-size: 28px; }
.gd-sheet-card h3 { font-size: 16px; margin-top: 16px; }
.gd-sheet-card ul { padding-left: 20px; margin: 0 0 16px; }
.gd-sheet-card li { margin-bottom: 4px; }
.gd-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.gd-stats div { text-align: center; }
.gd-stats dd { margin: 0; font: 700 28px/1.2 var(--serif); }
.gd-stats dt { font-size: 12px; color: var(--muted); }
.gd-dist { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; }
.gd-dist li { display: grid; grid-template-columns: 16px 1fr 32px; gap: 8px; align-items: center; font-size: 14px; }
.gd-dist .bar { height: 16px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.gd-dist i { display: block; height: 100%; background: var(--primary); }
.gd-dist .v { text-align: right; font-variant-numeric: tabular-nums; }
.gd-fine { font-size: 12px; color: var(--muted); }

/* ============================================================
   手机
   ============================================================ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .stage { aspect-ratio: 3 / 4; max-height: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 32px; }
  h2 { font-size: 28px; }
  .site-nav { gap: 16px; }
  .site-nav a:first-child { display: none; }
  .hero { display: flex; flex-direction: column; }
  .hero-copy { display: contents; }
  .eyebrow { order: 1; margin: 0; }
  .hero h1 { order: 2; margin: 0; }
  .stage { order: 3; aspect-ratio: auto; height: min(82vh, 720px); margin: 0 -16px; width: calc(100% + 32px); border-radius: 0; border-left: 0; border-right: 0; }
  .lede { order: 4; margin: 0; }
  .actions { order: 5; margin: 0; }
  .cover-card { margin: 16px; padding: 16px; }
  .cover-title { font-size: 22px; }
  .btn-lg { width: 100%; }
  .clue-list, .faq-list { grid-template-columns: 1fr; }
  .clue { grid-template-columns: 96px 1fr; }
  .note-form .btn { justify-self: stretch; }
  .gd { padding: 8px 12px; }
  .gd-archive { max-width: 120px; }
}
