/* 楼兰回响 · 羊皮卷 / 考古笔记风（与作品01深色工具台刻意区分） */
:root {
  --parchment: #e8d9b8;
  --parchment-dark: #d4c19a;
  --ink: #2c2416;
  --ink-soft: #5a4a32;
  --sepia: #6b4f2a;
  --ochre: #a67c3d;
  --rust: #8b4518;
  --dust: #9a8b6e;
  --line: #c4b08a;
  --seal: #7a2e1f;
  --panel: #f3e6c8;
  --shadow: rgba(44, 36, 22, 0.18);
  --font-display: "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
  --font-ui: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "KaiTi", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: #3d3428;
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.7;
}

body {
  background-image:
    radial-gradient(ellipse 100% 80% at 50% 0%, #4a3f30, #2a241c);
  padding: 24px 12px 48px;
}

.paper {
  max-width: 920px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.25), transparent 40%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(106, 79, 42, 0.06) 28px
    ),
    var(--parchment);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.35) inset,
    0 20px 60px var(--shadow),
    0 0 0 8px #2f281f;
  border-radius: 2px;
  padding: 28px 28px 36px;
  position: relative;
}
.paper::before,
.paper::after {
  content: "";
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(122, 46, 31, 0.35);
  pointer-events: none;
}
.paper::before { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.paper::after { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* Masthead */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 2px double var(--sepia);
  margin-bottom: 18px;
}
.seal {
  width: 56px;
  height: 56px;
  border: 3px solid var(--seal);
  color: var(--seal);
  font-family: var(--font-display);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
  opacity: 0.85;
  background: rgba(122, 46, 31, 0.06);
}
.series {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--dust);
  text-transform: uppercase;
}
.masthead h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.28em;
  color: var(--ink);
  font-weight: 600;
}
.en {
  font-size: 0.8rem;
  color: var(--sepia);
  letter-spacing: 0.12em;
  margin-top: 4px;
}
.badge-soft {
  font-size: 0.7rem;
  color: var(--rust);
  border: 1px dashed var(--ochre);
  padding: 6px 10px;
  max-width: 9em;
  text-align: center;
  line-height: 1.35;
  background: rgba(166, 124, 61, 0.1);
}

/* Timeline */
.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.tl-btn {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tl-btn:hover {
  border-color: var(--sepia);
  color: var(--ink);
}
.tl-btn.active {
  background: var(--sepia);
  border-color: var(--sepia);
  color: var(--parchment);
}
.tl-btn .tl-idx {
  display: block;
  font-size: 0.65rem;
  opacity: 0.75;
  letter-spacing: 0.15em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 2px 2px 0 rgba(106, 79, 42, 0.08);
}

.chapter-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ch-no {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--seal);
  line-height: 1;
  min-width: 1.5em;
}
.chapter-head h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
}
.ch-sub {
  font-size: 0.82rem;
  color: var(--dust);
  margin-top: 4px;
}

.chapter-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 700px) {
  .chapter-body { grid-template-columns: 1fr; }
  .masthead { grid-template-columns: auto 1fr; }
  .badge-soft { grid-column: 1 / -1; }
}

.illus {
  width: 100%;
  aspect-ratio: 1;
  background: var(--parchment-dark);
  border: 1px solid var(--sepia);
  position: relative;
  overflow: hidden;
}
.illus svg { width: 100%; height: 100%; display: block; }

.prose p {
  font-size: 0.95rem;
  color: var(--ink);
  text-indent: 2em;
}
.margin-note {
  margin-top: 14px !important;
  text-indent: 0 !important;
  font-size: 0.78rem !important;
  color: var(--rust) !important;
  border-left: 3px solid var(--ochre);
  padding-left: 12px;
  font-style: italic;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  gap: 10px;
}

.btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  padding: 9px 16px;
  background: var(--parchment);
  border: 1px solid var(--sepia);
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
}
.btn:hover { background: #efe0bc; }
.btn:active { transform: translateY(1px); }
.btn-ink {
  background: var(--sepia);
  color: var(--parchment);
  border-color: var(--ink);
}
.btn-ink:hover { filter: brightness(1.08); }

/* Cocreate */
.co-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}
@media (max-width: 700px) {
  .co-grid { grid-template-columns: 1fr; }
}
.co-ctrl label {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 10px 0 4px;
  letter-spacing: 0.06em;
}
.co-ctrl input[type="color"] {
  display: block;
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--parchment);
  cursor: pointer;
  margin-top: 4px;
}
.co-ctrl input[type="range"] {
  width: 100%;
  accent-color: var(--sepia);
}
.co-ctrl select {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-ui);
}
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.fineprint {
  margin-top: 12px;
  font-size: 0.7rem;
  color: var(--dust);
  line-height: 1.5;
  text-indent: 0 !important;
}
.co-stage {
  text-align: center;
}
#echoCanvas {
  max-width: 100%;
  border: 1px solid var(--sepia);
  box-shadow: 4px 4px 0 rgba(106, 79, 42, 0.12);
  background: #e8d9b8;
}
.stamp {
  margin-top: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--seal);
}

.colophon {
  margin-top: 8px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--dust);
  letter-spacing: 0.06em;
  line-height: 1.6;
}

label.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin: 8px 0 4px;
  cursor: pointer;
}
label.chk input { width: auto; accent-color: #7a2e1f; }

.read-tip {
  font-size: 0.78rem;
  color: var(--dust);
  letter-spacing: 0.06em;
  margin: -4px 0 16px;
  padding-left: 2px;
}
.masthead .seal {
  transition: transform 0.25s ease;
}
.masthead:hover .seal {
  transform: rotate(-6deg) scale(1.04);
}
.chapter-nav .btn:focus-visible,
.co-ctrl .btn:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

/* —— 叙事/共创动效加深 2026-10-14 —— */
.chapter-panel {
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.chapter-panel.is-enter {
  opacity: 0;
  transform: translateY(12px);
}
.chapter-panel.is-active {
  opacity: 1;
  transform: none;
}
.timeline-dot {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.timeline-dot.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(140, 59, 42, 0.25);
}
#cocreateCanvas, .cocreate-stage canvas {
  transition: filter 0.35s ease;
}
.cocreate-stage.is-weaving canvas {
  filter: contrast(1.05) saturate(1.08);
}
@keyframes stampPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.btn-stamp:active, button#btnStamp:active {
  animation: stampPulse 0.35s ease;
}

/* —— overnight v3.2 —— */
.echo-guide {
  position: sticky; top: 0; z-index: 40;
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  margin: 0 0 14px; padding: 8px 14px;
  background: rgba(107,79,42,0.12); border: 1px solid rgba(107,79,42,0.35);
  border-radius: 8px; font-size: 0.82rem; color: #3a2e1c;
}
.echo-guide kbd {
  border: 1px solid #6b4f2a; border-radius: 3px; padding: 0 5px; background: #f3e6c8; font-size: 0.75rem;
}
.echo-dismiss { border: none; background: transparent; color: #7a2e1f; cursor: pointer; text-decoration: underline; font-size: 0.78rem; }
.progress-track {
  height: 3px; background: rgba(107,79,42,0.15); border-radius: 2px; margin: -6px 0 16px; overflow: hidden;
}
.progress-track i {
  display: block; height: 100%; background: linear-gradient(90deg, #6b4f2a, #a67c3d);
  transition: width 0.35s ease;
}
.echo-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(70px);
  background: #2c2416; color: #f3e6c8; padding: 10px 18px; border-radius: 999px;
  border: 1px solid #a67c3d; font-size: 0.85rem; opacity: 0; transition: all 0.3s; z-index: 120;
  pointer-events: none;
}
.echo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.echo-help {
  position: fixed; inset: 0; background: rgba(40,30,18,0.55); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.echo-help[hidden] { display: none !important; }
.echo-help-card {
  max-width: 480px; width: 90%; background: #e8d9b8; border: 1px solid #6b4f2a;
  border-radius: 10px; padding: 24px; color: #2c2416;
}
.echo-help-card h2 { margin: 0 0 10px; font-family: "Songti SC","Noto Serif SC",serif; }
.echo-help-card ul { line-height: 1.65; margin: 0 0 14px; padding-left: 1.2em; font-size: 0.9rem; }
#echoCanvas { transition: box-shadow 0.35s, filter 0.35s; }
#echoCanvas.flash {
  box-shadow: 0 0 0 3px #7a2e1f, 0 8px 28px rgba(122,46,31,0.25);
  filter: brightness(1.06);
}
.chapter.is-enter { animation: chIn 0.45s ease; }
@keyframes chIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid #7a2e1f; outline-offset: 2px;
}
.co-stage.empty-hint::after {
  content: "调左侧参数，「重织预览」刷新拓印";
  display: block; text-align: center; font-size: 0.78rem; color: #6b4f2a; margin-top: 6px; opacity: 0.7;
}

/* —— 冲奖加深 · 章间动手 / 卷轴转场 / 拓印墙 —— */
.chapter.is-enter {
  animation: scrollReveal 0.55s ease both;
}
@keyframes scrollReveal {
  from { opacity: 0; filter: blur(2px); transform: translateY(10px); }
  to { opacity: 1; filter: none; transform: none; }
}
.chapter-interact {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed rgba(122,46,31,0.35);
  border-radius: 12px;
  background: rgba(232,217,184,0.35);
}
.ix-title {
  font-family: "Songti SC", "Noto Serif SC", serif;
  color: #7a2e1f;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.ix-hint { color: #6b5a45; font-size: 0.85rem; margin-top: 10px; }

.sand-dig {
  position: relative; height: 180px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, #c4b08a, #a89070);
  touch-action: none; user-select: none;
}
.sand-layer {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(212,193,154,0.9), transparent 45%),
    radial-gradient(circle at 70% 60%, rgba(168,144,112,0.85), transparent 40%),
    repeating-linear-gradient(90deg, rgba(90,74,50,0.08) 0 2px, transparent 2px 6px);
  opacity: 0.85; transition: opacity 0.2s; pointer-events: none;
}
.shard {
  position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%);
  width: 86px; height: 64px; border-radius: 8px;
  background: #e8d9b8; border: 2px solid #6b4f2a;
  display: grid; place-items: center;
  font-family: "Songti SC", serif; color: #7a2e1f; letter-spacing: 0.06em;
  box-shadow: 0 6px 16px rgba(44,36,22,0.25);
  cursor: grab; z-index: 2;
}
.shard.unearthed { box-shadow: 0 0 0 3px rgba(122,46,31,0.35); }

.parts-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.part-card {
  border: 1px solid #c4b08a; background: #f3e6c8; border-radius: 10px;
  padding: 12px 8px; cursor: pointer; font: inherit; color: #5a4a32;
  opacity: 0.55; transition: 0.25s ease;
}
.part-card b { display: block; color: #7a2e1f; margin-bottom: 4px; }
.part-card span { font-size: 0.78rem; }
.part-card.revealed, .part-card:hover, .part-card:focus {
  opacity: 1; border-color: #7a2e1f; background: #efe0bc;
}

.weave-board {
  position: relative; height: 170px; border-radius: 10px; overflow: hidden;
  background: #dcc9a0; border: 1px solid #b8a078; touch-action: none;
}
.weave-board .warp {
  position: absolute; inset: 12px;
  background: repeating-linear-gradient(90deg, #5a4a32 0 2px, transparent 2px 14px);
  opacity: 0.35;
}
.weft {
  position: absolute; left: 8%; right: 8%; height: 10px;
  background: #7a2e1f; border-radius: 4px; cursor: ns-resize;
  box-shadow: 0 2px 0 rgba(0,0,0,0.15); z-index: 2;
}
.shard-ghost {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 70px; height: 52px; border: 2px dashed #6b4f2a; border-radius: 8px;
  display: grid; place-items: center; color: #6b4f2a; opacity: 0.35;
  font-family: "Songti SC", serif; transition: 0.3s;
}
.shard-ghost.complete {
  opacity: 1; background: rgba(232,217,184,0.9); border-style: solid;
}

.stamp-pad {
  position: relative; width: 100%; min-height: 120px; border-radius: 12px;
  border: 2px solid #7a2e1f; background: #e8d9b8; cursor: pointer;
  display: grid; place-items: center; overflow: hidden; font: inherit;
  color: #7a2e1f; letter-spacing: 0.12em;
}
.stamp-ink {
  position: absolute; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(122,46,31,0.85), rgba(122,46,31,0.15));
  transform: scale(0.4); opacity: 0.25; transition: transform 0.05s linear, opacity 0.05s linear;
  pointer-events: none;
}
.stamp-pad.pressing { border-color: #5a2010; }
.stamp-label { position: relative; z-index: 1; font-family: "Songti SC", serif; }

.stamp-wall-wrap {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(107,79,42,0.25);
}
.stamp-wall-wrap h3 {
  font-family: "Songti SC", serif; font-size: 1.05rem; color: #5a4a32; margin-bottom: 10px;
}
.stamp-wall {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px;
}
.stamp-wall-item {
  border: 1px solid #c4b08a; background: #f3e6c8; border-radius: 8px;
  padding: 10px 8px; text-align: center; font-family: "Songti SC", serif; color: #7a2e1f;
  animation: none;
}
.stamp-wall-item.is-new { animation: stampDrop 0.65s ease; }
.stamp-wall-item img { width: 100%; height: auto; border-radius: 4px; display: block; margin-bottom: 4px; }
.stamp-wall-item small { display: block; color: #6b5a45; font-size: 0.7rem; margin-top: 4px; }
@keyframes stampDrop {
  from { opacity: 0; transform: translateY(-12px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 720px) {
  .parts-grid { grid-template-columns: repeat(2, 1fr); }
}
