/* 《一文一武，回家》明亮贴纸插画风：舞台坐标 1080 宽，整体等比缩放 */

@font-face {
  font-family: "Source Han Sans CN";
  src: url("https://static.hntv.tv/total/lwt/project/spg/font/siyuan/SourceHanSansCN-VF.ttf.woff2") format("woff2");
  font-style: normal;
  font-weight: 250 900;
  font-display: swap;
}

:root {
  --ink: #2B2D42;
  --ink-60: rgba(43, 45, 66, 0.6);
  --ink-40: rgba(43, 45, 66, 0.4);
  --shadow: rgba(43, 45, 66, 0.14);
  --cream: #FFF7EC;
  --coral: #FF6B6B;
  --yellow: #FFD166;
  --mint: #06D6A0;
  --purple: #7B4DFF;
  --sky: #4CC9F0;
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

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

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button { font: inherit; color: inherit; }

:focus { outline: none; }
html.kbd :focus-visible { outline: 6px dashed var(--purple); outline-offset: 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 加载页 ---------- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--cream);
  transition: opacity 0.35s ease;
}
.loading.is-done { opacity: 0; pointer-events: none; }
.loading-title {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 7vw, 38px);
  font-weight: 800;
  line-height: 1.35;
}
.loading-title span { color: #FF7A45; }
.loading-tip { margin: 0; font-size: 16px; color: var(--ink-60); }

/* ---------- 画布与舞台 ---------- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#ui {
  position: fixed;
  left: 0;
  top: 0;
  width: 1080px;
  transform-origin: 0 0;
  pointer-events: none;
  touch-action: none;
}
#ui button,
#ui [role="slider"],
#ui .match-box,
#ui .ending-ui {
  pointer-events: auto;
}

.brand {
  position: absolute;
  left: 60px;
  top: 58px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 0 14px;
  border-radius: 36px;
  background: var(--cream);
  border: 3px solid rgba(43, 45, 66, 0.22);
  box-shadow: 0 5px 0 rgba(43, 45, 66, 0.08);
  font-size: 28px;
  font-weight: 700;
}
.brand img { width: 44px; height: 44px; display: block; }
.top-title {
  position: absolute;
  left: 390px;
  top: 58px;
  margin: 0;
  line-height: 72px;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink-60);
}

.vol-btn {
  position: absolute;
  right: 60px;
  top: 36px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 5px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 9px 0 var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.vol-btn svg { width: 56px; height: 56px; }
.vol-btn .vol-off { display: none; }
.vol-btn[aria-pressed="true"] .vol-on { display: none; }
.vol-btn[aria-pressed="true"] .vol-off { display: block; }

.skip-btn {
  position: absolute;
  right: 60px;
  top: 220px;
  height: 68px;
  padding: 0 30px;
  border-radius: 34px;
  border: 4px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 6px 0 var(--shadow);
  font-size: 32px;
  font-weight: 700;
  cursor: pointer;
  animation: pop-in 0.3s cubic-bezier(.34, 1.56, .64, 1);
}

.playback-controls {
  position: absolute;
  left: 60px;
  top: 214px;
  display: flex;
  gap: 18px;
}
.playback-controls .btn { min-height: 100px; padding: 12px 28px; font-size: 34px; }

.hint {
  position: absolute;
  left: 50%;
  margin: 0;
  max-width: 980px;
  padding: 12px 32px;
  border-radius: 999px;
  border: 4px solid var(--ink);
  background: var(--yellow);
  box-shadow: 0 6px 0 var(--shadow);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: hint-in 0.35s cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 9px 0 var(--shadow);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:active { transform: translateY(5px); box-shadow: 0 4px 0 var(--shadow); }
.btn-coral { background: var(--coral); color: #FFFFFF; }
.btn-white { background: #FFFFFF; color: var(--ink); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-launch { min-height: 88px; padding: 12px 38px; font-size: 32px; }

.cover-ui {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--cover) + 435px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.btn-start { padding: 18px 72px; font-size: 52px; }
.cover-tip {
  margin: 0;
  padding: 2px 12px;
  font-size: 28px;
  font-weight: 500;
  color: var(--ink-60);
}

/* ---------- 互动 ①：32 年追索时间轴 ---------- */
.slider {
  position: absolute;
  left: 140px;
  top: calc(var(--ops) - 65px);
  width: 800px;
  height: 130px;
  cursor: pointer;
  touch-action: none;
}
.slider-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 47px;
  height: 36px;
  border-radius: 18px;
  border: 5px solid var(--ink);
  background: #FFFFFF;
}
.slider-fill {
  height: 100%;
  width: calc(var(--v, 0) * 1%);
  border-radius: 12px;
  background: linear-gradient(90deg, #7BD389, #FFD166 55%, #FF6B6B);
}
.slider-tick {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.35;
}
.slider-thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--v, 0) * 1%);
  width: 92px;
  height: 92px;
  margin-left: -46px;
  margin-top: -46px;
  border-radius: 50%;
  border: 6px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 7px 0 var(--shadow);
}
.slider-thumb::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--coral);
}
.slider.is-idle .slider-thumb { animation: nudge 1.1s ease-in-out infinite; }

/* ---------- 互动 ②：文武礼制档案归位 ---------- */
.match-box {
  position: absolute;
  left: 70px;
  right: 70px;
  top: calc(var(--ops) - 65px);
  display: flex;
  justify-content: center;
  gap: 28px;
}
.pick-btn {
  flex: 1;
  min-height: 126px;
  padding: 14px 22px;
  border-radius: 34px;
  border: 5px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 8px 0 var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.15s ease;
}
.pick-btn:active { transform: translateY(4px); }
.pick-wen { background: #FFF5D6; }
.pick-wu { background: #E3F4FF; }
.pick-btn strong { font-size: 33px; font-weight: 800; }
.pick-btn span { font-size: 25px; font-weight: 600; color: var(--ink-60); }

/* ---------- 字幕卡 ---------- */
.subtitle {
  position: absolute;
  left: 38px;
  right: 38px;
  top: var(--sub);
  min-height: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 38px;
  border-radius: 40px;
  border: 5px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 10px 0 var(--shadow);
  opacity: 0;
  transform: translateY(-50%) scale(0.85);
  transition: opacity 0.15s ease, transform 0.35s cubic-bezier(.34, 1.56, .64, 1);
}
.subtitle.is-in { opacity: 1; transform: translateY(-50%) scale(1); }
.subtitle p { margin: 0; font-size: 46px; line-height: 68px; font-weight: 700; text-align: center; }
.subtitle mark { color: inherit; padding: 0 6px; border-radius: 10px; }
.subtitle .hl-y { background: #FFE066; }
.subtitle .hl-c { background: #C8F1FF; }

/* ---------- 结尾 ---------- */
.ending-ui {
  position: absolute;
  left: 64px;
  right: 64px;
  top: calc(var(--cy) + 170px);
  max-height: calc(var(--H) - var(--cy) - 250px);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: pop-in 0.5s cubic-bezier(.34, 1.56, .64, 1);
}
.ending-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px 24px;
  width: 100%;
}
.ending-actions .btn { padding: 16px 38px; font-size: 36px; }
.share-notice { width: 100%; margin: 4px 0 0; text-align: center; font-size: 26px; color: #E0473F; }
.share-notice:empty { display: none; }

.spot-panel {
  width: 100%;
  min-height: 0;
  max-height: calc(var(--H) - var(--cy) - 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  margin-top: 26px;
  padding: 22px 32px 24px;
  border-radius: 28px;
  border: 4px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 7px 0 var(--shadow);
}
.spot-heading { margin: 0 0 14px; font-size: 30px; color: var(--purple); }
.more-article {
  display: block;
  padding: 20px 24px;
  border-radius: 22px;
  border: 3.5px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 5px 0 var(--shadow);
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.more-article:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--shadow); }
.spot-name { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 33px; font-weight: 800; line-height: 1.35; }
.spot-name small { flex: none; padding: 3px 12px; border-radius: 999px; background: #FFE3DE; font-size: 22px; font-weight: 800; color: #E0473F; }
.more-cta { margin-left: auto; flex: none; font-size: 25px; font-weight: 700; color: var(--purple); }
.spot-meta { margin: 10px 0 0; font-size: 26px; line-height: 1.48; color: var(--ink-60); }

.footnote {
  position: absolute;
  left: 40px;
  right: 40px;
  top: calc(var(--H) - 56px);
  margin: 0;
  text-align: right;
  font-size: 23px;
  color: var(--ink-40);
}

/* ---------- 宽屏侧栏 ---------- */
.sidebar { display: none; }
body.is-wide {
  background: var(--cream) radial-gradient(circle at 0 0, rgba(255, 209, 102, 0.35), transparent 55%) no-repeat;
}
body.is-wide .sidebar {
  position: fixed;
  right: 28px;
  top: 50%;
  display: block;
  width: 380px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
  border-radius: 24px;
  border: 3px solid var(--ink);
  background: #FFFFFF;
  box-shadow: 0 8px 0 var(--shadow);
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1.7;
}
.side-title { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.3; text-align: center; }
.side-title span { color: #E8642C; }
.side-lead { margin: 12px 0 16px; color: var(--ink-60); }
.side-chapters { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: chapter; }
.side-chapters li { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink-60); counter-increment: chapter; }
.side-chapters li::before {
  content: counter(chapter);
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #FFFFFF;
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  color: var(--ink);
}
.side-chapters li.is-done { color: var(--ink); }
.side-chapters li.is-current { color: var(--ink); }
.side-chapters li.is-current::before { background: var(--coral); color: #FFFFFF; }
.side-howto { margin: 0 0 10px; }
.side-source { margin: 0; font-size: 13px; color: var(--ink-60); }

.gesture-notice {
  position: absolute;
  left: 60px;
  right: 60px;
  top: 250px;
  margin: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  color: #E0473F;
}
.gesture-notice:empty { display: none; }

/* ---------- 暂停层与纪念卡 ---------- */
.pause-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 247, 236, 0.72);
}
.pause-layer .btn { padding: 12px 34px; font-size: 22px; border-width: 3px; box-shadow: 0 5px 0 var(--shadow); }

.card-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 45, 66, 0.55);
}
.memo-card {
  width: min(100%, 440px, calc((100vh - 140px) * 750 / 1334));
  width: min(100%, 440px, calc((100dvh - 140px) * 750 / 1334));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
  border-radius: 24px;
  border: 3px solid var(--ink);
  background: #FFF4D8;
  box-shadow: 0 8px 0 var(--shadow);
  text-align: center;
}
.memo-poster {
  aspect-ratio: 750 / 1334;
  background: linear-gradient(145deg, #FFF9E9, #F5D799);
}
#memo-img {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}
.memo-tip { margin: 0 0 8px; min-height: 18px; font-size: 13px; line-height: 18px; color: var(--ink-60); }
.memo-controls {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(150, 100, 30, 0.22);
  background: #FFF7E8;
}
.btn-small { padding: 8px 30px; font-size: 16px; border-width: 3px; box-shadow: 0 5px 0 var(--shadow); }

/* ---------- 动效 ---------- */
@keyframes pop-in { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes hint-in { from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes hit-pulse {
  0%, 100% { transform: scale(1); border-color: rgba(43, 45, 66, 0.85); }
  50% { transform: scale(1.04); border-color: rgba(255, 107, 107, 0.95); }
}
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(26px); } }

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