/* ========== Page 0: 开场视频页 ========== */
#page-intro { background: #000; }
#intro-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
#intro-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
#intro-content { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
#intro-start-btn { font-size: 1.2rem; padding: 0.9rem 2.5rem; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); color: #fff; border-radius: 50px; cursor: pointer; backdrop-filter: blur(8px); letter-spacing: 0.15em; transition: all 0.3s ease; }
#intro-start-btn:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.5); transform: scale(1.05); }

/* ========== Page 1: 首页 ========== */
#page-home { background: linear-gradient(to bottom, #0a1628 0%, #0d1f3c 40%, #081020 70%, #05080f 100%); }
#home-scene { position: relative; width: 100%; height: 100%; overflow: hidden; }
#sky-container { position: absolute; top: 0; left: 0; width: 100%; height: 55%; z-index: 2; }

.star { position: absolute; border-radius: 50%; background: #fff; }
.star-far { width: 2px; height: 2px; animation: twinkle 3s ease-in-out infinite; box-shadow: 0 0 3px rgba(255,255,255,0.5); }
.star-mid { width: 3px; height: 3px; animation: twinkle 2.5s ease-in-out infinite; box-shadow: 0 0 5px rgba(255,255,255,0.6); }
.star-near {
  width: 5px; height: 5px;
  animation: twinkle-bright 2s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 8px rgba(255,255,255,0.7);
}
.star-near:hover {
  transform: scale(2);
  box-shadow: 0 0 12px 4px rgba(136, 221, 255, 0.6);
}
.shooting-star {
  position: absolute; height: 1px;
  background: linear-gradient(to right, rgba(255,255,255,0.8), transparent);
  border-radius: 1px; animation: shooting-star 1.5s linear forwards; pointer-events: none;
}

/* 背景插画覆盖层 */
#home-bg-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: url('../assets/images/home-bg.webp') center center / cover no-repeat;
  opacity: 0.92;
  transition: opacity 0.8s ease;
}

/* 灯塔 */
#lighthouse-area {
  position: absolute; bottom: 48%; right: 30%;
  width: 80px; height: 300px; cursor: pointer; z-index: 10;
}
.lighthouse-body, .lighthouse-top, .lighthouse-light { display: none; }
.lighthouse-beam {
  position: absolute; top: 0; right: 30px;
  width: 600px; height: 120px;
  background: linear-gradient(to left, rgba(240, 192, 64, 0.2), rgba(240, 192, 64, 0.06) 35%, transparent);
  transform-origin: 100% 50%;
  animation: beam-sweep 7s ease-in-out infinite;
  clip-path: polygon(100% 40%, 0% 10%, 0% 90%, 100% 60%);
  pointer-events: none;
  filter: blur(8px);
}

/* 海面 */
#sea-container {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 45%;
  z-index: 3; pointer-events: none; overflow: hidden;
}
.wave-svg {
  position: absolute; left: 0; width: 200%; height: 120px;
  pointer-events: none;
}
.wave-layer-1 { animation: wave-drift-1 12s ease-in-out infinite; opacity: 0.9; bottom: 60%; }
.wave-layer-2 { animation: wave-drift-2 9s ease-in-out infinite; opacity: 0.65; bottom: 45%; }
.wave-layer-3 { animation: wave-drift-3 15s ease-in-out infinite; opacity: 0.4; bottom: 30%; }

/* 游轮 */
#ship-area {
  position: absolute; bottom: 24%; left: 10%;
  width: 140px; height: 80px; cursor: pointer; z-index: 10;
  animation: ship-bob 6s ease-in-out infinite;
  transform-origin: center bottom;
}
.seagull {
  position: absolute; font-size: 0.8rem; color: rgba(200, 210, 220, 0.6); pointer-events: none;
}

/* 引导提示 */
#guide-hint {
  position: absolute; bottom: 8%; left: 50%; transform: translateX(-50%);
  font-family: var(--font-body); font-size: 0.8rem; color: #ffffff;
  opacity: 1; animation: breathe 3s ease-in-out infinite; pointer-events: none; z-index: 10;
}

/* ========== Page 2: 粒子页 ========== */
#page-particles { background: #000; }
#particle-canvas { display: block; width: 100%; height: 100%; }
#particle-dialogue {
  position: absolute; left: 50%; top: 72%;
  transform: translateX(-50%); z-index: 10; text-align: center;
}
.dialogue-en {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.6rem); color: var(--warm-white);
  margin-bottom: 1rem; text-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}
.dialogue-zh {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 2vw, 1.1rem); color: var(--silver-blue);
}

/* ========== Page 3: 黑屏 ========== */
#page-silence { background: #000; display: flex; align-items: center; justify-content: center; }
#silence-text { text-align: center; max-width: 80%; }
#silence-text p {
  font-family: var(--font-heading); font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.8rem); color: var(--pure-white);
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
  letter-spacing: 0.1em; line-height: 1.8;
}

/* ========== Page 4: 西西弗斯 ========== */
#page-sisyphus { background: linear-gradient(to bottom, #2b0a0a, #110404); }
#sisyphus-canvas { display: block; width: 100%; height: 100%; }
#sisyphus-quote {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; z-index: 10;
}
.quote-text {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.5rem); color: var(--pure-white);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.4); margin-bottom: 1.5rem;
}

/* ========== Page 5: 角色大厅 ========== */
#page-hall { background: linear-gradient(to bottom, #0a0a1a, #0d1f3c); }
#hall-bg {
  position: absolute; inset: 0;
  background: url('../assets/images/hall-bg.webp') center center / cover no-repeat;
  opacity: 0.5;
  transition: opacity 0.8s ease;
}
#hall-list {
  position: relative; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; height: 100%;
  gap: 1.2rem; padding: 3rem 1rem;
}
.character-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.8rem 1.5rem; background: var(--glass-bg);
  border: 1px solid var(--glass-border); border-radius: 12px;
  cursor: pointer; backdrop-filter: blur(8px);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  width: 90%; max-width: 400px;
}
.character-card:hover {
  transform: scale(1.03); border-color: var(--electron-blue); box-shadow: var(--glow-blue);
}
.character-card:active { transform: scale(0.97); }
.char-avatar {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--dark-gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700;
  color: var(--warm-white); background: rgba(255, 255, 255, 0.05); flex-shrink: 0;
}
.char-info { flex: 1; }
.char-name {
  font-family: var(--font-heading); font-weight: 700; font-size: 1rem;
  color: var(--pure-white); text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}
.char-tagline {
  font-family: var(--font-body); font-size: 0.75rem; color: var(--silver-blue); margin-top: 0.2rem;
}
.char-btn {
  font-family: var(--font-heading); font-weight: 700; font-size: 0.75rem;
  color: var(--pure-white); background: transparent;
  border: 1px solid var(--electron-blue); border-radius: 6px;
  padding: 0.4rem 1rem; cursor: pointer;
  text-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.char-btn:hover { transform: scale(1.05); box-shadow: var(--glow-blue); }
.char-btn:active { transform: scale(0.95); }

/* ========== Page 6: 剧本页 ========== */
#page-script {
  background: linear-gradient(to bottom, #0a0a1a, #0d1f3c);
  display: flex; flex-direction: column; align-items: center;
}
#script-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center center; background-repeat: no-repeat;
  opacity: 0.5;
  transition: opacity 0.8s ease;
}
#script-header { margin-top: 4rem; text-align: center; z-index: 2; }
#script-char-name {
  font-family: var(--font-heading); font-weight: 700;
  font-size: clamp(1.2rem, 3vw, 1.8rem); color: var(--pure-white);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
#script-char-title {
  display: block; font-family: var(--font-display); font-style: italic;
  font-size: 0.85rem; color: var(--silver-blue); margin-top: 0.3rem;
}
#script-progress-bar {
  margin-top: 1rem; width: 80%; max-width: 360px; height: 4px;
  background: rgba(255, 255, 255, 0.1); border-radius: 2px; position: relative;
}
#script-progress-fill {
  height: 100%; background: var(--electron-blue); border-radius: 2px;
  width: 33.3%; transition: width 0.5s ease;
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
}
#script-progress-label {
  position: absolute; right: 0; top: -1.2rem;
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--silver-blue);
}
#script-content {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1.5rem; padding: 1rem; width: 100%; max-width: 500px; z-index: 2;
}
#script-actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 100%; }
#script-upload-area { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
#script-file-input { display: none; }
.upload-label {
  font-family: var(--font-heading); font-size: 0.7rem; color: var(--silver-blue);
  border: 1px dashed var(--glass-border); border-radius: 6px;
  padding: 0.4rem 1rem; cursor: pointer; transition: border-color 0.2s;
}
.upload-label:hover { border-color: var(--electron-blue); }
#script-file-name { font-size: 0.7rem; color: var(--silver-blue); opacity: 0.7; }
#script-wait-hint {
  font-family: var(--font-body); font-size: 0.8rem;
  color: var(--silver-blue); opacity: 0.5; font-style: italic;
}
#script-branch-btns { display: flex; gap: 0.8rem; flex-wrap: wrap; justify-content: center; }

/* ========== 明信片弹窗 ========== */
#postcard-modal .modal-content {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 1.5rem; text-align: center;
}
#postcard-canvas { max-width: 100%; border-radius: 6px; margin-bottom: 1rem; }

/* ========== 登船邀请函 ========== */
.invitation-card {
  position: relative;
  width: 320px;
  max-height: 85vh;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 30px rgba(0, 100, 180, 0.3), 0 0 60px rgba(0, 60, 120, 0.15);
}
.invitation-bg {
  position: absolute; inset: 0;
  background: url('../assets/images/invitation-bg.webp') center center / cover no-repeat;
  opacity: 0.85;
}
.invitation-content {
  position: relative; z-index: 1;
  padding: 2.5rem 2rem 2rem;
  display: flex; flex-direction: column; align-items: center;
  min-height: 420px;
}
.invitation-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--silver-blue);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  opacity: 0.7;
}
.invitation-ship-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--warm-white);
  text-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
  margin-bottom: 1.8rem;
  letter-spacing: 0.1em;
}
.invitation-divider {
  width: 60px; height: 1px;
  background: linear-gradient(to right, transparent, var(--electron-blue), transparent);
  margin-bottom: 1.8rem;
}
.invitation-body {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--moon-silver);
  line-height: 2.2;
  text-align: center;
  margin-bottom: 2rem;
}
.invitation-info {
  width: 100%;
  display: flex; flex-direction: column; gap: 0.6rem;
  margin-bottom: 2rem;
}
.invitation-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 212, 255, 0.08);
}
.invitation-info-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--silver-blue);
  opacity: 0.6;
  letter-spacing: 0.05em;
}
.invitation-info-value {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--warm-white);
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}
.invitation-captain {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--dark-gold);
  text-align: right;
  align-self: flex-end;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}
.invitation-btn-wrap {
  margin-top: auto;
}

/* ========== 水母 ========== */
#jellyfish-container {
  position: fixed; bottom: 0; right: 2rem; width: 40px; height: 40px; z-index: 50; pointer-events: none;
}
.jellyfish {
  position: absolute; bottom: 0; width: 20px; height: 25px;
  background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.6), rgba(170, 136, 255, 0.3));
  border-radius: 50% 50% 40% 40%;
  animation: jellyfish-float 8s ease-in-out infinite;
  pointer-events: auto; cursor: pointer;
}
.jellyfish::before, .jellyfish::after {
  content: ''; position: absolute; bottom: -12px;
  width: 1px; height: 14px; background: rgba(0, 212, 255, 0.4);
  animation: breathe 2s ease-in-out infinite;
}
.jellyfish::before { left: 5px; animation-delay: 0.3s; }
.jellyfish::after { right: 5px; animation-delay: 0.6s; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .glass-panel { padding: 1.2rem; max-width: 92%; }
  .glow-btn { padding: 0.6rem 1.2rem; font-size: 0.8rem; }
  .character-card { padding: 0.6rem 1rem; }
  .char-avatar { width: 44px; height: 44px; font-size: 0.9rem; }
  .char-name { font-size: 0.85rem; }
  #global-nav { bottom: 0.8rem; left: 0.8rem; }
  #audio-panel { top: 0.8rem; right: 0.8rem; }
  #lighthouse-area { right: 6%; width: 50px; height: 160px; }
  .lighthouse-beam { width: 200px; height: 80px; filter: blur(6px); }
  .modal-close { top: 0.5rem; right: 0.5rem; font-size: 1rem; }

  /* Intro */
  #intro-start-btn { font-size: 1rem; padding: 0.8rem 2rem; }

  /* 首页 */
  #sky-container { height: 50%; }
  #sea-container { height: 50%; }
  #ship-area { width: 100px; height: 60px; bottom: 20%; left: 5%; }
  .wave-svg { height: 80px; }
  #guide-hint { font-size: 0.7rem; bottom: 5%; }

  /* 邀请函 */
  .invitation-card { width: 280px; min-height: auto; }
  .invitation-content { padding: 1.8rem 1.5rem 1.5rem; min-height: 360px; }
  .invitation-ship-name { font-size: 1.2rem; margin-bottom: 1.2rem; }
  .invitation-body { font-size: 0.8rem; margin-bottom: 1.5rem; }
  .invitation-captain { margin-bottom: 1rem; }

  /* 角色大厅 */
  #hall-list { gap: 0.8rem; padding: 2rem 0.8rem; }
  .character-card { width: 94%; padding: 0.5rem 0.8rem; gap: 0.7rem; }
  .char-btn { font-size: 0.7rem; padding: 0.35rem 0.8rem; }

  /* 剧本页 */
  #script-header { margin-top: 3rem; }
  #script-content { padding: 0.8rem; gap: 1rem; }
  #script-branch-btns { gap: 0.5rem; }

  /* 导航按钮 */
  .nav-btn { font-size: 0.65rem; padding: 0.4rem 0.6rem; }

  /* 水母 */
  #jellyfish-container { right: 1rem; width: 30px; height: 30px; }
  .jellyfish { width: 16px; height: 20px; }
}

@media (max-width: 480px) {
  #lighthouse-area { right: 4%; width: 40px; height: 120px; }
  .lighthouse-beam { width: 150px; height: 60px; }
  #ship-area { width: 80px; height: 50px; bottom: 18%; left: 3%; }
  #guide-hint { font-size: 0.65rem; bottom: 4%; }
  .invitation-card { width: 260px; }
  .invitation-content { padding: 1.5rem 1.2rem 1.2rem; min-height: 320px; }
  .invitation-ship-name { font-size: 1.1rem; }
  .invitation-body { font-size: 0.75rem; line-height: 2; }
  .character-card { width: 96%; }
  .char-avatar { width: 38px; height: 38px; font-size: 0.8rem; }
  #script-char-name { font-size: 1.1rem; }
  #hall-list { padding: 1.5rem 0.6rem; gap: 0.6rem; }
}