/* ==========================================================================
   身入帛中 · INTO THE SILK — 主展陈壳层样式
   统一漆帛美学：深漆墨底、鎏金细线、朱砂方印、无干扰沉浸构图
   ========================================================================== */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--silk-bg);
  color: var(--silk-ink);
  font-family: var(--silk-sans);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* ---------- 章节主舞台 ---------- */
#silk-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--silk-bg);
}

#chapter-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--silk-bg);
}

/* ---------- 顶部常驻极简展陈导航栏 ---------- */
#silk-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(8, 7, 6, 0.90) 0%, rgba(8, 7, 6, 0.58) 72%, rgba(8, 7, 6, 0) 100%);
  border-bottom: 1px solid rgba(216, 190, 140, 0.14);
  transition: opacity 0.35s ease, transform 0.35s var(--silk-ease);
}

body[data-view="landing"] #silk-topbar {
  background: transparent;
  border-bottom-color: transparent;
}

body.pure-mode #silk-topbar {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 4px 2px;
  text-align: left;
}

.brand-btn:focus-visible {
  outline: 1px solid var(--silk-gold);
  outline-offset: 4px;
}

.brand-seal {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  font-family: var(--silk-serif);
  font-size: 13px;
  color: #f6e7cb;
  background: linear-gradient(150deg, #c2412d, #8d2518);
  border: 1px solid rgba(243, 219, 167, 0.45);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(184, 59, 40, 0.36);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-text b {
  font-family: var(--silk-serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--silk-ink);
}

.brand-text small {
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--silk-muted);
}

/* 四境横轴进度导航 */
.chapter-rail {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.chapter-list {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rail-connector {
  width: 26px;
  height: 1px;
  background: rgba(216, 190, 140, 0.22);
  position: relative;
  overflow: hidden;
}

.rail-connector span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--silk-gold), var(--silk-cinnabar-bright));
  transition: width 0.55s var(--silk-ease);
}

.rail-connector.lit span {
  width: 100%;
}

.chapter-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: var(--silk-radius);
  background: transparent;
  color: var(--silk-muted);
  cursor: pointer;
  font-family: var(--silk-sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  transition: color 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
}

.chapter-step .step-index {
  font-family: var(--silk-serif);
  font-size: 12px;
  color: var(--silk-gold);
  opacity: 0.72;
}

.chapter-step .step-check {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(216, 190, 140, 0.35);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.chapter-step:hover {
  color: var(--silk-ink);
  background: rgba(216, 190, 140, 0.08);
  border-color: rgba(216, 190, 140, 0.2);
}

.chapter-step.active {
  color: var(--silk-gold-bright);
  background: rgba(216, 190, 140, 0.09);
  border-color: rgba(216, 190, 140, 0.38);
}

.chapter-step.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--silk-cinnabar-bright), var(--silk-gold-bright), transparent);
}

.chapter-step.active .step-index {
  opacity: 1;
  color: var(--silk-gold-bright);
}

.chapter-step.active .step-check {
  background: var(--silk-cinnabar-bright);
  border-color: var(--silk-gold-bright);
  box-shadow: 0 0 8px var(--silk-cinnabar-glow);
}

.chapter-step.done .step-check {
  background: var(--silk-gold);
  border-color: var(--silk-gold-bright);
  box-shadow: 0 0 6px rgba(216, 190, 140, 0.55);
}

/* 右侧统一控制栏 */
.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-arrows {
  display: inline-flex;
  border: 1px solid rgba(216, 190, 140, 0.2);
  border-radius: var(--silk-radius);
  overflow: hidden;
  background: rgba(14, 12, 10, 0.55);
}

.nav-arrows .top-btn {
  border: 0;
  border-radius: 0;
  padding: 5px 10px;
  font-size: 14px;
  line-height: 1;
}

.nav-arrows .top-btn + .top-btn {
  border-left: 1px solid rgba(216, 190, 140, 0.16);
}

.top-btn {
  padding: 6px 11px;
  border: 1px solid rgba(216, 190, 140, 0.2);
  border-radius: var(--silk-radius);
  background: rgba(14, 12, 10, 0.56);
  color: rgba(239, 230, 212, 0.82);
  font-family: var(--silk-sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.top-btn:hover:not(:disabled) {
  color: var(--silk-gold-bright);
  border-color: var(--silk-line-strong);
  background: rgba(34, 27, 20, 0.78);
}

.top-btn[aria-pressed="true"],
.top-btn[aria-expanded="true"] {
  color: var(--silk-gold-bright);
  border-color: rgba(216, 190, 140, 0.55);
  background: rgba(184, 59, 40, 0.22);
}

.top-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* 纯净模式微弱恢复按钮 */
#silk-restore-pure {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 45;
  padding: 6px 12px;
  border-radius: var(--silk-radius);
  border: 1px solid rgba(216, 190, 140, 0.32);
  background: rgba(12, 10, 9, 0.65);
  color: var(--silk-gold);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  opacity: 0.18;
  transition: opacity 0.25s ease, border-color 0.25s ease;
}

#silk-restore-pure:hover {
  opacity: 0.95;
  border-color: var(--silk-gold-bright);
}

/* ---------- 开篇启卷页 ---------- */
#silk-landing {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 76px 24px 32px;
  background: radial-gradient(ellipse at 50% 42%, #1d120c 0%, #0b0908 55%, #060505 100%);
  transition: opacity 0.85s var(--silk-ease), visibility 0.85s ease;
}

body[data-view="chapter"] #silk-landing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#landing-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.landing-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, transparent 32%, rgba(5, 4, 4, 0.72) 100%);
}

.landing-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  width: 100%;
  text-align: center;
}

.landing-seal-wrap {
  margin-bottom: 24px;
}

.landing-title {
  font-family: var(--silk-serif);
  font-size: clamp(44px, 7.2vw, 84px);
  font-weight: 400;
  letter-spacing: 0.34em;
  padding-left: 0.34em;
  color: #f6ecd7;
  text-shadow: 0 0 38px rgba(208, 128, 66, 0.28), 0 4px 18px rgba(0, 0, 0, 0.75);
}

.landing-en {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.44em;
  padding-left: 0.44em;
  color: var(--silk-gold);
  opacity: 0.85;
}

.landing-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 24px auto 22px;
  max-width: 340px;
  color: var(--silk-muted);
  font-family: var(--silk-serif);
  font-size: 12px;
  letter-spacing: 0.34em;
}

.landing-divider i {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 190, 140, 0.45), transparent);
}

.landing-poem {
  font-family: var(--silk-serif);
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 2.05;
  letter-spacing: 0.16em;
  color: rgba(239, 230, 212, 0.82);
  margin-bottom: 34px;
}

.landing-route {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 34px;
}

.route-card {
  flex: 1;
  max-width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 15px 12px;
  border: 1px solid rgba(216, 190, 140, 0.22);
  border-radius: var(--silk-radius);
  background: rgba(15, 12, 10, 0.68);
  color: var(--silk-ink);
  cursor: pointer;
  transition: transform 0.22s var(--silk-ease), border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.25s ease;
}

.route-card:hover {
  transform: translateY(-3px);
  border-color: rgba(236, 194, 122, 0.65);
  background: rgba(30, 22, 16, 0.85);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.route-num {
  font-family: var(--silk-serif);
  font-size: 11px;
  color: #e06d58;
  letter-spacing: 0.2em;
}

.route-card strong {
  font-family: var(--silk-serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  color: var(--silk-gold-bright);
}

.route-card small {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--silk-muted);
}

.route-arrow {
  color: rgba(216, 190, 140, 0.42);
  font-size: 13px;
  flex-shrink: 0;
}

.landing-cta {
  margin-bottom: 24px;
}

.landing-start-btn {
  padding: 14px 36px;
  font-size: 14px;
  letter-spacing: 0.22em;
}

.landing-meta {
  font-size: 11px;
  line-height: 1.85;
  letter-spacing: 0.06em;
  color: rgba(162, 150, 130, 0.74);
}

/* ---------- 丝帛章节转场幕 ---------- */
#silk-curtain {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 45%, rgba(28, 16, 11, 0.96), rgba(7, 6, 6, 0.99) 70%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s var(--silk-ease), visibility 0.45s ease;
}

#silk-curtain.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.curtain-inner {
  text-align: center;
  padding: 24px;
  max-width: 540px;
}

.curtain-num {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  font-family: var(--silk-serif);
  font-size: 18px;
  color: var(--silk-gold-bright);
  border: 1px solid rgba(196, 72, 54, 0.72);
  background: rgba(184, 59, 40, 0.14);
  border-radius: 2px;
}

.curtain-title {
  font-family: var(--silk-serif);
  font-size: clamp(26px, 3.6vw, 40px);
  font-weight: 400;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  color: #f6ecd7;
  margin-bottom: 14px;
}

.curtain-poem {
  font-family: var(--silk-serif);
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--silk-gold);
  margin-bottom: 24px;
}

.curtain-line {
  width: 180px;
  height: 1px;
  margin: 0 auto 14px;
  background: rgba(216, 190, 140, 0.2);
  overflow: hidden;
  position: relative;
}

.curtain-line span {
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 45%;
  background: linear-gradient(90deg, transparent, var(--silk-gold-bright), transparent);
  animation: curtain-sweep 1.2s ease-in-out infinite;
}

@keyframes curtain-sweep {
  0% { transform: translateX(0); }
  100% { transform: translateX(340%); }
}

.curtain-status {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--silk-muted);
}

/* ---------- 统一章节完结与下一境衔接浮条 ---------- */
#silk-portal {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 48;
  width: min(640px, calc(100vw - 32px));
  padding: 16px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  animation: portal-rise 0.45s var(--silk-ease);
}

@keyframes portal-rise {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.portal-copy {
  min-width: 0;
}

.portal-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: #e4735e;
  margin-bottom: 4px;
}

.portal-copy strong {
  display: block;
  font-family: var(--silk-serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--silk-gold-bright);
  margin-bottom: 3px;
}

.portal-copy p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--silk-muted);
}

.portal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.portal-actions .silk-btn {
  padding: 9px 16px;
  font-size: 12px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.portal-timer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(216, 190, 140, 0.15);
  overflow: hidden;
}

#portal-timer-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--silk-cinnabar-bright), var(--silk-gold-bright));
}

/* ---------- 统一操作指南抽屉 ---------- */
#silk-help {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 52;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 20px 22px 18px;
}

.help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(216, 190, 140, 0.18);
  margin-bottom: 14px;
}

.help-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: #e4735e;
  margin-bottom: 4px;
}

.help-header h2 {
  font-family: var(--silk-serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--silk-gold-bright);
}

.help-lead {
  font-size: 12.5px;
  line-height: 1.75;
  color: rgba(239, 230, 212, 0.82);
  margin-bottom: 16px;
}

.help-section {
  margin-bottom: 15px;
}

.help-section h3 {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--silk-gold);
  margin-bottom: 8px;
}

.help-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.help-section li {
  font-size: 12px;
  line-height: 1.65;
  color: var(--silk-muted);
  padding-left: 12px;
  position: relative;
}

.help-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  background: var(--silk-gold);
  transform: rotate(45deg);
}

.help-section li b {
  color: var(--silk-ink);
  font-weight: 500;
}

.help-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(216, 190, 140, 0.15);
  font-size: 11px;
  line-height: 1.7;
  color: var(--silk-dim);
}

.help-footer kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid rgba(216, 190, 140, 0.3);
  border-radius: 2px;
  color: var(--silk-gold);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
}

/* ---------- 响应式适配 ---------- */
@media (max-width: 1040px) {
  .brand-text small { display: none; }
  .rail-connector { width: 12px; }
  .chapter-step { padding: 6px 8px; font-size: 11px; }
}

@media (max-width: 820px) {
  #silk-topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 12px;
    gap: 8px;
  }
  .brand-text b { font-size: 14px; letter-spacing: 0.12em; }
  .chapter-step .step-label { display: none; }
  .nav-arrows { display: none; }
  .top-btn { padding: 5px 8px; font-size: 10px; }
  .landing-route { flex-wrap: wrap; }
  .route-arrow { display: none; }
  .route-card { min-width: 135px; }
  #silk-portal {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .portal-actions { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* ---------- 全局常驻摄像头底层视频与顶栏视觉中枢指示 ---------- */
#silk-hub-video {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 2px;
  height: 2px;
  opacity: 0.001;
  pointer-events: none;
  z-index: -1;
}

.vision-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
}

.vision-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--silk-dim);
  flex-shrink: 0;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.vision-dot.live {
  background: var(--silk-jade);
  box-shadow: 0 0 8px rgba(141, 184, 162, 0.85);
}

.vision-dot.loading {
  background: var(--silk-gold-bright);
  box-shadow: 0 0 8px rgba(243, 219, 167, 0.75);
}

.vision-dot.warn {
  background: #e29662;
}

@media (max-width: 1120px) {
  .vision-pill { display: none; }
}
