/* ==========================================================
   红途故境 · H5 演示版
   暗红底 / 烫金字 / 残页纸张质感 / 移动端竖屏优先
   ========================================================== */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  font-family: "PingFang SC", "Songti SC", "STSong", "Hiragino Sans GB",
               "Microsoft YaHei", "宋体", serif;
  color: #F4E8D0;
  letter-spacing: 0.5px;
  line-height: 1.7;
  background:
    radial-gradient(ellipse at top, rgba(139, 0, 0, 0.35) 0%, transparent 60%),
    linear-gradient(180deg, #1F0303 0%, #0E0202 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 64px 20px;
  min-height: 100vh;
}

/* ===== 启动 loading ===== */
.loading {
  text-align: center;
  margin-top: 35vh;
  animation: fadeIn 0.6s ease-out;
}
.loading-cn {
  font-size: 40px;
  color: #D4AF37;
  letter-spacing: 12px;
  font-weight: 700;
}
.loading-tag {
  font-size: 13px;
  color: #C9A961;
  letter-spacing: 6px;
  margin-top: 16px;
  opacity: 0.7;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 通用页样式 ===== */
.view {
  animation: fadeIn 0.5s ease-out;
  padding-bottom: 20px;
}

/* 烫金标题 */
.title-gold {
  font-size: 30px;
  font-weight: 600;
  color: #D4AF37;
  letter-spacing: 6px;
  text-shadow: 0 2px 5px rgba(0,0,0,0.6), 0 0 18px rgba(212, 175, 55, 0.2);
  text-align: center;
  font-family: "Songti SC", "STSong", serif;
}

.subtitle {
  text-align: center;
  color: #C9A961;
  font-size: 12px;
  letter-spacing: 5px;
  margin-top: 6px;
  opacity: 0.85;
}

.divider-gold {
  width: 60%;
  height: 1px;
  margin: 18px auto;
  background: linear-gradient(to right, transparent, #C9A961 20%, #D4AF37 50%, #C9A961 80%, transparent);
  opacity: 0.7;
}

.section-label {
  display: inline-block;
  color: #D4AF37;
  font-size: 14px;
  letter-spacing: 3px;
  border-left: 3px solid #D4AF37;
  padding-left: 9px;
  margin-bottom: 12px;
}

.chapter-no {
  text-align: center;
  color: #8B0000;
  font-size: 12px;
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.text-center { text-align: center; }
.text-dim { color: rgba(244, 232, 208, 0.55); font-size: 13px; }
.text-quote {
  font-size: 15px;
  line-height: 1.95;
  color: #E8D4A8;
  letter-spacing: 0.5px;
  font-family: "Songti SC", "STSong", serif;
}
.text-narration {
  font-size: 14px;
  color: #C9A961;
  font-style: italic;
  letter-spacing: 1px;
  line-height: 1.85;
}
.line { margin-bottom: 6px; }
.mt-s { margin-top: 8px; }
.mt-m { margin-top: 18px; }
.mt-l { margin-top: 32px; }
.mb-m { margin-bottom: 16px; }

/* ===== 暗色卡片 ===== */
.card {
  background: linear-gradient(160deg, rgba(36, 8, 8, 0.95) 0%, rgba(20, 4, 4, 0.95) 100%);
  border: 1px solid rgba(201, 169, 97, 0.45);
  border-radius: 4px;
  padding: 20px 18px;
  margin: 16px 0;
  box-shadow:
    0 3px 14px rgba(0, 0, 0, 0.5),
    inset 0 0 30px rgba(139, 0, 0, 0.08);
  position: relative;
}
.card::before, .card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-color: #D4AF37;
  opacity: 0.7;
}
.card::before { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.card::after  { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }

/* ===== 残页纸张 ===== */
.paper {
  background:
    repeating-linear-gradient(45deg,
      rgba(212, 175, 55, 0.025) 0px,
      rgba(212, 175, 55, 0.025) 2px,
      transparent 2px, transparent 6px),
    linear-gradient(160deg, #F4E8D0 0%, #E2CFA8 60%, #C9B077 100%);
  color: #3A1A0A;
  padding: 22px 18px;
  border-radius: 3px;
  font-family: "Songti SC", "STSong", serif;
  position: relative;
  box-shadow:
    inset 0 0 24px rgba(139, 90, 30, 0.4),
    0 4px 14px rgba(0,0,0,0.55);
  clip-path: polygon(
    0 4%, 4% 0, 18% 3%, 35% 0, 60% 4%, 78% 1%, 96% 3%, 100% 8%,
    98% 28%, 100% 50%, 97% 72%, 100% 92%, 92% 100%, 70% 97%,
    45% 100%, 22% 96%, 6% 100%, 0 90%, 3% 70%, 0 50%, 2% 30%
  );
}

.paper-text {
  font-size: 16px;
  line-height: 1.95;
  color: #2A0F05;
  letter-spacing: 1px;
  font-weight: 500;
}

.paper-tag {
  font-size: 11px;
  color: #6B3A18;
  letter-spacing: 2px;
  margin-bottom: 8px;
  border-bottom: 1px dashed rgba(139, 90, 30, 0.5);
  padding-bottom: 5px;
}

.paper-sign {
  text-align: right;
  font-size: 12px;
  color: #6B3A18;
  letter-spacing: 1px;
  margin-top: 14px;
  font-style: italic;
}

/* ===== 按钮 ===== */
.btn {
  display: block;
  width: 100%;
  padding: 13px 0;
  margin: 12px 0;
  border-radius: 3px;
  text-align: center;
  font-size: 16px;
  letter-spacing: 4px;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  border: none;
  outline: none;
  transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: translateY(1px); opacity: 0.92; }

.btn-primary {
  background: linear-gradient(180deg, #B91C1C 0%, #7A1010 100%);
  color: #FBE9C2;
  border: 1px solid #D4AF37;
  box-shadow: 0 3px 10px rgba(139, 0, 0, 0.4),
              inset 0 1px 0 rgba(255,220,150,0.25);
}

.btn-ghost {
  background: transparent;
  color: #D4AF37;
  border: 1px solid rgba(212, 175, 55, 0.5);
  font-size: 14px;
}
.btn-ghost:active { background: rgba(212, 175, 55, 0.08); }

.btn-danger {
  background: transparent;
  color: #EF6A6A;
  border: 1px dashed rgba(239, 106, 106, 0.5);
  font-size: 14px;
}

/* ===== 输入区 ===== */
.answer-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(20, 4, 4, 0.6);
  color: #F4E8D0;
  border: 1px solid rgba(201, 169, 97, 0.5);
  border-radius: 3px;
  font-size: 16px;
  letter-spacing: 1px;
  margin: 10px 0;
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
}
.answer-input::placeholder { color: rgba(244, 232, 208, 0.35); }
.answer-input:focus { border-color: #D4AF37; box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.18); }

textarea.answer-input { min-height: 90px; resize: vertical; line-height: 1.6; }

/* ===== 反馈 ===== */
.feedback-correct, .feedback-wrong {
  padding: 12px 14px;
  margin: 14px 0;
  border-radius: 3px;
}
.feedback-correct {
  border-left: 3px solid #D4AF37;
  background: rgba(212, 175, 55, 0.08);
  color: #E8D4A8;
}
.feedback-wrong {
  border-left: 3px solid #EF6A6A;
  background: rgba(139, 0, 0, 0.18);
  color: #F4E8D0;
}
.feedback-title {
  font-size: 16px;
  letter-spacing: 2px;
  margin-bottom: 4px;
  color: #D4AF37;
}
.feedback-wrong .feedback-title { color: #EF6A6A; }
.feedback-line {
  font-size: 12px;
  color: rgba(244, 232, 208, 0.6);
  letter-spacing: 1px;
  margin-top: 8px;
}
.feedback-body { font-size: 15px; color: #E8D4A8; line-height: 1.7; margin-top: 4px; }
.feedback-body.emph { color: #D4AF37; font-size: 17px; letter-spacing: 1px; }

/* ===== 章节编号位置徽章 ===== */
.location-badge {
  display: inline-block;
  font-size: 11px;
  color: #D4AF37;
  letter-spacing: 2px;
  padding: 4px 12px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 999px;
}

/* ===== 进度条 ===== */
.progress-bar {
  height: 4px;
  background: rgba(244, 232, 208, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 4px 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, #8B0000, #D4AF37);
  transition: width 0.4s ease-out;
}
.progress-label { font-size: 12px; color: rgba(244, 232, 208, 0.6); letter-spacing: 1px; }

/* ===== 顶部小工具条 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.2);
}
.topbar-left {
  font-size: 12px;
  color: #C9A961;
  letter-spacing: 2px;
}
.topbar-right { display: flex; gap: 10px; }
.topbar-link {
  font-size: 11px;
  color: rgba(212, 175, 55, 0.75);
  letter-spacing: 1px;
  padding: 4px 10px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 3px;
  text-decoration: none;
}
.topbar-link:active { background: rgba(212, 175, 55, 0.08); }

/* ============================================================
   首页
   ============================================================ */
.cover {
  position: relative;
  padding: 60px 12px 40px 12px;
}
.seal {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 46px; height: 46px;
  background: #8B0000;
  color: #F4E8D0;
  font-size: 20px;
  font-weight: 700;
  font-family: "Songti SC", "STSong", serif;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #D4AF37;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
  transform: rotate(-6deg);
}

.brand { text-align: center; margin: 30px 0; }
.brand-cn {
  font-size: 46px;
  color: #D4AF37;
  letter-spacing: 10px;
  font-weight: 700;
  font-family: "Songti SC", "STSong", serif;
  text-shadow: 0 3px 8px rgba(0,0,0,0.7), 0 0 22px rgba(212, 175, 55, 0.25);
}
.brand-en {
  font-size: 11px;
  color: rgba(212, 175, 55, 0.65);
  letter-spacing: 7px;
  margin-top: 10px;
}
.brand-divider {
  width: 110px;
  height: 1px;
  background: linear-gradient(to right, transparent, #D4AF37, transparent);
  margin: 14px auto;
}
.brand-tag {
  font-size: 12px;
  color: #C9A961;
  letter-spacing: 3px;
  opacity: 0.85;
}

.poster {
  margin: 28px 4px;
  padding: 30px 22px;
  text-align: center;
}
.poster-title {
  font-size: 38px;
  letter-spacing: 12px;
  margin-bottom: 4px;
}
.poster-sub {
  font-size: 14px;
  color: #C9A961;
  letter-spacing: 8px;
  margin-top: 4px;
}
.poster-line { color: #E8D4A8; font-size: 13px; letter-spacing: 2px; margin-top: 10px; }
.poster-dim { color: rgba(232, 212, 168, 0.6); font-size: 12px; letter-spacing: 4px; margin-top: 5px; }

.footer {
  margin-top: 40px;
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 1.85;
  text-align: center;
  color: rgba(244, 232, 208, 0.5);
}

/* ============================================================
   剧本库
   ============================================================ */
.script-card { position: relative; padding: 26px 20px; margin-top: 22px; }
.script-card.disabled { opacity: 0.4; filter: grayscale(0.5); }

.ribbon {
  position: absolute;
  top: 9px;
  right: -4px;
  background: #8B0000;
  color: #FBE9C2;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 3px 12px;
  border: 1px solid #D4AF37;
}

.script-title {
  font-size: 32px;
  letter-spacing: 10px;
  margin-top: 4px;
}
.script-title-dim {
  text-align: center;
  font-size: 22px;
  color: rgba(212, 175, 55, 0.4);
  letter-spacing: 8px;
  font-family: "Songti SC", "STSong", serif;
  margin-top: 14px;
}
.script-sub {
  text-align: center;
  font-size: 13px;
  color: #C9A961;
  letter-spacing: 6px;
  margin-top: 5px;
}

.meta-row { display: flex; justify-content: space-around; margin: 14px 0; }
.meta-item { text-align: center; padding: 0 12px; border-right: 1px solid rgba(212, 175, 55, 0.3); }
.meta-item:last-child { border-right: none; }
.meta-label { font-size: 11px; color: rgba(244, 232, 208, 0.55); letter-spacing: 2px; margin-bottom: 3px; }
.meta-value { font-size: 18px; color: #D4AF37; font-family: "Songti SC", "STSong", serif; letter-spacing: 2px; }

.script-desc {
  margin: 14px 0;
  padding: 14px 10px;
  border-top: 1px dashed rgba(201, 169, 97, 0.4);
  border-bottom: 1px dashed rgba(201, 169, 97, 0.4);
}

.tag-row { display: flex; flex-wrap: wrap; margin-top: 10px; }
.tag {
  font-size: 11px;
  color: #D4AF37;
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: 3px 10px;
  margin: 4px 6px 4px 0;
  letter-spacing: 1px;
  border-radius: 2px;
}

.enter-line {
  text-align: right;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  color: #D4AF37;
  font-size: 14px;
  letter-spacing: 3px;
}

/* ============================================================
   序章 · speaker
   ============================================================ */
.speaker {
  display: flex;
  align-items: center;
  margin: 20px 0 12px 0;
  padding: 12px 14px;
  background: rgba(20, 4, 4, 0.6);
  border-left: 2px solid #D4AF37;
  border-radius: 2px;
}
.speaker-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B0000, #4A0000);
  border: 1px solid #D4AF37;
  color: #F4E8D0;
  font-size: 20px;
  font-family: "Songti SC", "STSong", serif;
  display: flex; align-items: center; justify-content: center;
  margin-right: 14px;
  flex-shrink: 0;
}
.speaker-name { color: #D4AF37; font-size: 16px; letter-spacing: 2px; }
.speaker-role { color: rgba(244, 232, 208, 0.65); font-size: 11px; letter-spacing: 1px; margin-top: 2px; }

.mission-row {
  display: flex;
  margin: 8px 0;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(201, 169, 97, 0.25);
}
.mission-label {
  width: 60px;
  color: #D4AF37;
  font-size: 13px;
  letter-spacing: 2px;
  flex-shrink: 0;
}
.mission-value { flex: 1; color: #E8D4A8; font-size: 14px; }

/* ============================================================
   节点页
   ============================================================ */
.node-title { font-size: 24px; letter-spacing: 4px; margin-top: 4px; }

.question-card { border-color: rgba(212, 175, 55, 0.6); }
.question-text { font-size: 16px; color: #F4E8D0; line-height: 1.7; margin: 8px 0; }

.clue-reveal { margin: 22px 0; }
.clue-title {
  text-align: center;
  color: #C9A961;
  font-size: 11px;
  letter-spacing: 4px;
  margin-bottom: 12px;
}

.next-card { border-color: rgba(139, 0, 0, 0.6); }

/* ============================================================
   残页页
   ============================================================ */
.paper-list { margin-top: 18px; }
.paper-slot { margin: 16px 0; }

.empty-paper {
  background: rgba(20, 4, 4, 0.5);
  border: 1px dashed rgba(201, 169, 97, 0.35);
  padding: 22px 16px;
  border-radius: 3px;
  text-align: center;
}
.empty-no {
  font-size: 26px;
  color: rgba(212, 175, 55, 0.4);
  font-family: "Songti SC", "STSong", serif;
  letter-spacing: 2px;
}
.empty-text { font-size: 13px; color: rgba(244, 232, 208, 0.4); letter-spacing: 2px; margin-top: 4px; }
.empty-loc { font-size: 11px; color: rgba(244, 232, 208, 0.3); letter-spacing: 1px; margin-top: 3px; }

/* ============================================================
   终章
   ============================================================ */
.final-title { font-size: 32px; letter-spacing: 10px; }

.full-letter-wrap { margin: 22px 0; }
.full-letter-title { text-align: center; color: #C9A961; font-size: 12px; letter-spacing: 4px; margin-bottom: 10px; }

.full-letter { padding: 32px 22px 36px 22px; }
.letter-line { margin-bottom: 10px; font-size: 16px; }

.user-echo-card { border-color: rgba(201, 169, 97, 0.4); }
.user-echo {
  font-size: 16px;
  color: #E8D4A8;
  font-family: "Songti SC", "STSong", serif;
  font-style: italic;
  letter-spacing: 1px;
  line-height: 1.8;
  padding: 6px 0;
}

.reveal-stage {
  margin: 32px 0;
  padding: 30px 0;
  text-align: center;
  position: relative;
  background: radial-gradient(ellipse at center, rgba(139, 0, 0, 0.5) 0%, transparent 70%);
}
.reveal-prefix { font-size: 14px; color: #C9A961; letter-spacing: 5px; margin-bottom: 14px; }
.reveal-line {
  font-size: 18px;
  color: #E8D4A8;
  letter-spacing: 8px;
  margin: 4px 0;
  font-family: "Songti SC", "STSong", serif;
}
.reveal-final {
  margin-top: 22px;
  font-size: 50px;
  color: #D4AF37;
  font-weight: 700;
  letter-spacing: 14px;
  font-family: "Songti SC", "STSong", serif;
  text-shadow: 0 4px 14px rgba(0,0,0,0.7), 0 0 28px rgba(212, 175, 55, 0.45);
  animation: revealIn 1.2s ease-out;
}
.reveal-seal {
  margin: 22px auto 0 auto;
  width: 110px; height: 110px;
  background: #8B0000;
  color: #F4E8D0;
  font-size: 30px;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #D4AF37;
  line-height: 1.1;
  padding: 6px;
  text-align: center;
  transform: rotate(-3deg);
  box-shadow: 0 0 22px rgba(212, 175, 55, 0.3);
  animation: sealIn 1.4s 0.4s both ease-out;
}
@keyframes revealIn {
  0%   { opacity: 0; transform: scale(0.4); letter-spacing: 50px; }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); letter-spacing: 14px; }
}
@keyframes sealIn {
  0%   { opacity: 0; transform: rotate(-30deg) scale(2); }
  100% { opacity: 1; transform: rotate(-3deg) scale(1); }
}
.outro-card { border-color: rgba(201, 169, 97, 0.4); margin-top: 22px; }

/* ============================================================
   扫描入口（Web 版用作 Hub 页）
   ============================================================ */
.hub-card { padding: 22px 18px; }
.progress-row { display: flex; align-items: center; justify-content: space-around; margin: 12px 0; }
.progress-item { text-align: center; flex: 1; }
.progress-num {
  font-size: 28px;
  color: #D4AF37;
  font-family: "Songti SC", "STSong", serif;
  letter-spacing: 2px;
}
.progress-tag { font-size: 11px; color: rgba(244, 232, 208, 0.6); letter-spacing: 2px; margin-top: 3px; }
.progress-divider { width: 1px; height: 40px; background: rgba(212, 175, 55, 0.3); }

/* 调试 / 节点九宫格 */
.debug-zone { margin-top: 26px; padding-top: 14px; border-top: 1px dashed rgba(212, 175, 55, 0.25); }
.debug-title { text-align: center; font-size: 11px; color: rgba(244, 232, 208, 0.45); letter-spacing: 3px; margin-bottom: 12px; }
.debug-grid { display: flex; flex-wrap: wrap; }
.debug-cell {
  width: 23%;
  margin: 1%;
  padding: 10px 4px;
  background: rgba(36, 8, 8, 0.7);
  border: 1px solid rgba(201, 169, 97, 0.3);
  border-radius: 2px;
  text-align: center;
  cursor: pointer;
}
.debug-cell.done {
  background: rgba(139, 0, 0, 0.4);
  border-color: rgba(212, 175, 55, 0.7);
}
.debug-cell.done .debug-no { color: #D4AF37; }
.debug-no { font-size: 15px; color: #C9A961; font-family: "Songti SC", "STSong", serif; }
.debug-loc {
  font-size: 10px;
  color: rgba(244, 232, 208, 0.6);
  margin-top: 3px;
  line-height: 1.3;
  letter-spacing: 0.5px;
  word-break: break-all;
}

/* 调试块 */
.dbg-block {
  background: rgba(20, 4, 4, 0.6);
  border: 1px solid rgba(201, 169, 97, 0.3);
  padding: 12px;
  font-size: 11px;
  color: #C9A961;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
  border-radius: 2px;
  letter-spacing: 0;
  max-height: 240px;
  overflow: auto;
}

/* ============================================================
   Toast 简易实现
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #F4E8D0;
  font-size: 14px;
  padding: 10px 22px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 22px;
  letter-spacing: 1px;
  z-index: 9999;
  pointer-events: none;
  animation: toastIn 0.3s, toastOut 0.4s 1.6s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -10px); } }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  animation: fadeIn 0.2s;
  padding: 20px;
}
.modal-box {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(160deg, #2A0808 0%, #140404 100%);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 4px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7);
}
.modal-title { color: #D4AF37; font-size: 17px; letter-spacing: 2px; margin-bottom: 10px; }
.modal-content { color: #E8D4A8; font-size: 14px; line-height: 1.7; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { margin: 0; flex: 1; }
