/* ===== 基础重置与变量 ===== */
:root {
  --bg-primary: #1A2E2E;
  --bg-dark: #0D1B1E;
  --gold: #F2D06B;
  --cinnabar: #C84B31;
  --teal: #5B8C7F;
  --paper: #E8E1D1;
  --paper-warm: #F5F0E6;
  --glass: rgba(26, 46, 46, 0.75);
  --glass-light: rgba(232, 225, 209, 0.12);
  --gold-glow: 0 0 20px rgba(242, 208, 107, 0.4), 0 0 60px rgba(242, 208, 107, 0.15);
  --cinnabar-glow: 0 0 20px rgba(200, 75, 49, 0.4);
  --teal-glow: 0 0 20px rgba(91, 140, 127, 0.4);
  --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'SimSun', serif;
  --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
img { max-width: 100%; display: block; }

/* ===== 全屏布局 ===== */
.page {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ===== 卷轴导航（剪纸卷轴风格） ===== */
/* 状态机：默认隐藏 → 鼠标悬停滑出(显示合并.png) → 点击展开(显示展开.png+菜单) */
.scroll-nav {
  position: fixed;
  left: 0;
  top: 50%;
  /* 默认隐藏：只露出卷轴右侧的一小部分（卷轴的角） */
  transform: translateY(-50%) translateX(calc(-290px + 36px));
  z-index: 1000;
  display: block;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(4px 10px 20px rgba(80, 0, 0, 0.3));
  cursor: pointer;
}

/* 鼠标悬停时：完整滑出，显示合并图片 */
.scroll-nav:hover {
  filter: drop-shadow(8px 12px 30px rgba(216, 30, 30, 0.55)) drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
  transform: translateY(-50%) translateX(0);
}

/* slid-out状态：完整滑出（通过JS激活） */
.scroll-nav.slid-out {
  transform: translateY(-50%) translateX(0);
}

/* 收起状态图片：默认显示 */
.scroll-closed-img {
  display: block;
  width: 290px;
  height: auto;
  cursor: pointer;
}

/* 展开状态图片：默认隐藏 */
.scroll-open-img {
  display: none;
  width: 290px;
  height: auto;
}

/* open状态：隐藏收起图，显示展开图 */
.scroll-nav.open .scroll-closed-img {
  display: none;
}

.scroll-nav.open .scroll-open-img {
  display: block;
}

/* 导航按钮区域（叠加在展开图片上） */
.nav-buttons {
  position: absolute;
  top: 50%;
  left: 14%;
  right: 14%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 5;
}

/* open状态下显示按钮 */
.scroll-nav.open .nav-buttons {
  display: flex;
}

.nav-btn {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  color: #8b1a1a;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 4px;
  background: transparent;
  position: relative;
}

.nav-btn:hover {
  background: linear-gradient(90deg, rgba(216, 30, 30, 0.18) 0%, rgba(216, 30, 30, 0.02) 100%);
  border-color: rgba(216, 30, 30, 0.5);
  color: #d81e1e;
  padding-left: 28px;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.35);
}

.nav-btn::before {
  content: '▸';
  position: absolute;
  right: 20px;
  color: #b8860b;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.nav-btn:hover::before {
  opacity: 1;
  transform: translateX(4px);
}

.nav-btn.active {
  background: linear-gradient(90deg, rgba(216, 30, 30, 0.25) 0%, rgba(216, 30, 30, 0.05) 100%);
  border-color: rgba(216, 30, 30, 0.7);
  color: #8b0000;
}

.nav-icon {
  min-width: 26px;
  width: 26px;
  height: 26px;
  margin-right: 16px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(139, 0, 0, 0.4));
}

.home-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d61616" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12 L12 3 L21 12"/><path d="M5 10 V21 H19 V10"/><path d="M10 21 V14 H14 V21"/></svg>');
}

.history-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d61616" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="3" width="14" height="18" rx="1"/><path d="M9 7 H15"/><path d="M9 11 H15"/><path d="M9 15 H14"/></svg>');
}

.tutorial-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d61616" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="9" r="5"/><path d="M8.5 13 L7 21 L12 18 L17 21 L15.5 13"/></svg>');
}

.competition-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d61616" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M5 5 H8 L9 11"/><path d="M19 5 H16 L15 11"/><path d="M8 21 H16"/><path d="M12 12 V21"/></svg>');
}

.scroll-nav.open {
  filter: drop-shadow(8px 12px 30px rgba(216, 30, 30, 0.6)) drop-shadow(0 0 15px rgba(212, 175, 55, 0.4));
}

/* ===== 对话框系统 ===== */
.dialog-box {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, 92vw);
  min-height: 150px;
  background: url('../images/对话框.png') center center/100% 100% no-repeat;
  padding: 32px 80px 32px 80px;
  z-index: 500;
  animation: dialogSlideUp 0.6s ease-out;
}

.dialog-box::after {
  content: '';
  display: block;
  clear: both;
}

@keyframes dialogSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(40px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.dialog-speaker {
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 20px;
  font-weight: bold;
  color: #8b1a1a;
  margin-bottom: 10px;
  letter-spacing: 3px;
}

.dialog-text {
  font-size: 17px;
  font-weight: bold;
  line-height: 1.9;
  color: #4a3628;
  min-height: 60px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  letter-spacing: 2px;
}

.dialog-text-big {
  font-size: 34px;
  font-weight: bold;
  line-height: 1.5;
}

.dialog-text-bigger {
  font-size: 19px;
  font-weight: bold;
  line-height: 1.9;
  color: #4a3628;
  min-height: 60px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  letter-spacing: 2px;
}

.dialog-options {
  margin-top: 16px;
}

.dialog-btn {
  float: right;
  margin-top: 8px;
  margin-right: 20px;
  padding: 8px 25px;
  background: #8b1a1a;
  color: #fff8e0;
  border: 2px solid #d4af37;
  border-radius: 20px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.dialog-btn:hover {
  background: #d4af37;
  color: #8b1a1a;
  border-color: #8b1a1a;
  box-shadow: 0 6px 20px rgba(200, 75, 49, 0.45);
}

.dialog-next {
  float: right;
  margin-top: 8px;
  margin-right: 20px;
  background: #8b1a1a;
  color: #fff8e0;
  border: 2px solid #d4af37;
  padding: 8px 25px;
  border-radius: 20px;
  cursor: pointer;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 18px;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
}

.dialog-next span {
  display: inline;
  transform: none;
}

.dialog-next::after {
  display: none;
}

.dialog-next:hover {
  background: #d4af37;
  color: #8b1a1a;
  border-color: #8b1a1a;
  box-shadow: 0 6px 20px rgba(200, 75, 49, 0.45);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ===== 通用按钮 ===== */
.btn-primary {
  display: inline-block;
  padding: 14px 48px;
  background: linear-gradient(135deg, var(--teal), #4A7A6E);
  border: 2px solid rgba(242, 208, 107, 0.3);
  border-radius: 32px;
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 4px;
  cursor: pointer;
  transition: var(--transition-bounce);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--cinnabar), #A83A25);
  border-color: var(--cinnabar);
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--cinnabar-glow);
}

.btn-gold {
  display: inline-block;
  padding: 12px 36px;
  background: linear-gradient(135deg, rgba(242,208,107,0.2), rgba(242,208,107,0.05));
  border: 1px solid var(--gold);
  border-radius: 24px;
  color: var(--gold);
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: var(--transition-bounce);
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold), rgba(242,208,107,0.8));
  color: var(--bg-dark);
  transform: translateY(-3px);
  box-shadow: var(--gold-glow);
}

/* ===== 标题样式 ===== */
.title-main {
  font-family: var(--font-serif);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 20px rgba(242, 208, 107, 0.3), 0 0 60px rgba(242, 208, 107, 0.15);
  letter-spacing: 8px;
  line-height: 1.2;
}

.title-section {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 4px;
  margin-bottom: 16px;
}

/* ===== 粒子效果容器 ===== */
.particle-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat linear forwards;
}

@keyframes particleFloat {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-100vh) scale(0); opacity: 0; }
}

/* ===== 纸屑飘落 ===== */
.paper-shred {
  position: absolute;
  pointer-events: none;
  animation: paperFall linear forwards;
}

@keyframes paperFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== 角色立绘 ===== */
.character-display {
  position: fixed;
  bottom: 0;
  right: 10%;
  height: 75vh;
  z-index: 10;
  filter: drop-shadow(0 0 30px rgba(91, 140, 127, 0.3));
  animation: charFadeIn 1s ease-out;
}

@keyframes charFadeIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== 墨水晕染文字效果 ===== */
.ink-bleed {
  opacity: 0;
  filter: blur(8px);
  animation: inkBleedIn 1.5s ease-out forwards;
}

@keyframes inkBleedIn {
  0% { opacity: 0; filter: blur(8px); }
  60% { opacity: 0.8; filter: blur(2px); }
  100% { opacity: 1; filter: blur(0); }
}

/* ===== 全屏过场 ===== */
.scene-transition {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease;
}

.scene-transition.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ===== 扫光特效 ===== */
.sweep-light {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: linear-gradient(90deg, transparent, rgba(242,208,107,0.15), transparent);
  transform: translateX(-100%);
  pointer-events: none;
}

.sweep-light.active {
  animation: sweep 1.2s ease-in-out forwards;
}

@keyframes sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(200%); }
}

/* ===== 毛玻璃面板 ===== */
.glass-panel {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(242, 208, 107, 0.15);
  border-radius: 16px;
  padding: 24px;
}

/* ===== 闪光节点 ===== */
.glow-node {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold), rgba(242,208,107,0.3));
  border: 2px solid var(--gold);
  box-shadow: var(--gold-glow);
  cursor: pointer;
  transition: var(--transition-bounce);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--bg-dark);
  font-weight: bold;
}

.glow-node:hover {
  transform: scale(1.3);
  box-shadow: 0 0 40px rgba(242, 208, 107, 0.6);
}

/* ===== 进度条 ===== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(232, 225, 209, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .scroll-nav { transform: translateY(-50%) translateX(calc(-240px + 30px)); }
  .scroll-nav:hover { transform: translateY(-50%) translateX(0); }
  .scroll-nav.slid-out { transform: translateY(-50%) translateX(0); }
  .scroll-closed-img, .scroll-open-img { width: 240px; }
  .nav-buttons { gap: 8px; }
  .nav-btn { font-size: 15px; padding: 10px 14px; letter-spacing: 3px; }
  .nav-icon { width: 22px; height: 22px; min-width: 22px; margin-right: 12px; }
  .dialog-box { width: 95vw; padding: 20px 40px 20px 40px; bottom: 12px; min-height: 110px; }
  .dialog-text { font-size: 14px; letter-spacing: 1px; }
  .dialog-text-big { font-size: 28px; }
  .dialog-speaker { font-size: 15px; letter-spacing: 2px; }
  .dialog-next { right: auto; margin-right: 12px; padding: 6px 18px; font-size: 14px; border-radius: 15px; }
  .title-main { font-size: 32px; letter-spacing: 4px; }
  .character-display { right: 5%; height: 50vh; }
}

/* ===== 淡入动画类 ===== */
.fade-in { animation: fadeIn 1s ease-out forwards; }
.fade-in-delay-1 { animation: fadeIn 1s ease-out 0.5s both; }
.fade-in-delay-2 { animation: fadeIn 1s ease-out 1s both; }
.fade-in-delay-3 { animation: fadeIn 1s ease-out 1.5s both; }
.fade-in-delay-4 { animation: fadeIn 1s ease-out 2s both; }

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

/* ===== 浮动动画 ===== */
.float { animation: float 3s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ===== 旋转动画 ===== */
.spin-slow { animation: spinSlow 8s linear infinite; }
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== 发光脉冲 ===== */
.glow-pulse { animation: glowPulse 2s ease-in-out infinite; }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(242, 208, 107, 0.3); }
  50% { box-shadow: 0 0 40px rgba(242, 208, 107, 0.6); }
}

/* ===== 光标闪烁 ===== */
.cursor-blink::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--gold);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
