/* ============================================
   交互式剧情表白网站 - 全局样式与动画
   "从初见、相识到校园相知的心动历程"
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-deep: #0a0a1a;
  --bg-dark: #12122a;
  --bg-card: rgba(20, 20, 50, 0.85);
  --accent: #ff6b9d;
  --accent-glow: #ff8ab3;
  --accent-soft: #ffb3cc;
  --gold: #f0c060;
  --text: #e8e0f0;
  --text-dim: #9890b8;
  --text-bright: #ffffff;
  --danger: #ff4060;
  --heal: #40d890;
  --border-glow: rgba(255, 107, 157, 0.3);

  --font-cn: "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --font-display: "Noto Serif SC", serif;
  --font-mono: "Courier New", monospace;

  --transition-normal: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-cn);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255, 107, 157, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(240, 192, 96, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 80%, rgba(64, 216, 144, 0.04) 0%, transparent 60%),
    var(--bg-deep);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-normal);
}
a:hover {
  color: var(--accent-glow);
  text-shadow: 0 0 12px var(--border-glow);
}

/* ---------- Starfield Background ---------- */
.stars-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Typing Effect ---------- */
.typing-text {
  border-right: 2px solid var(--accent);
  animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: transparent; }
}

/* ---------- Heartbeat Animation ---------- */
@keyframes heartbeat {
  0%   { transform: scale(1);   }
  14%  { transform: scale(1.12); }
  28%  { transform: scale(1);   }
  42%  { transform: scale(1.12); }
  56%  { transform: scale(1);   }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1);   }
}

.heartbeat {
  display: inline-block;
  animation: heartbeat 1.2s ease-in-out infinite;
  color: var(--accent);
}

/* ---------- Scene Transitions ---------- */
.scene-container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.scene {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.scene.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
}

/* Fade transition overlay */
.scene-transition-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg-deep);
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.scene-transition-overlay.show {
  opacity: 1;
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 36px 32px;
  margin-bottom: 28px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all var(--transition-normal);
}

.glass-card:hover {
  border-color: rgba(255, 107, 157, 0.5);
  box-shadow:
    0 8px 40px rgba(255, 107, 157, 0.15),
    0 0 80px rgba(255, 107, 157, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 14px 32px;
  border: none;
  border-radius: 50px;
  font-family: var(--font-cn);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  letter-spacing: 1px;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 400px; height: 400px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff4080);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 107, 157, 0.6);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-ghost:hover {
  background: rgba(255, 107, 157, 0.1);
  box-shadow: 0 0 20px rgba(255, 107, 157, 0.2);
}

.btn-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 24px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-choice:hover {
  border-color: var(--accent);
  background: rgba(255, 107, 157, 0.1);
  transform: translateX(6px);
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.15);
}

.btn-choice .choice-icon {
  margin-right: 10px;
  font-size: 1.2rem;
}

/* ---------- Title Styles ---------- */
.title-main {
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-glow), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  line-height: 1.4;
}

.title-sub {
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: 4px;
  margin-bottom: 24px;
}

.title-chapter {
  font-size: 1rem;
  color: var(--accent-soft);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ---------- Narrative Text ---------- */
.narrative {
  font-size: 1.1rem;
  line-height: 2;
  color: var(--text);
  margin-bottom: 20px;
}

.narrative em {
  color: var(--accent-soft);
  font-style: normal;
}

/* ---------- Character Portrait Placeholder ---------- */
.portrait-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 3rem;
  box-shadow: 0 0 30px rgba(255, 107, 157, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.2);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin: 20px 0;
  overflow: hidden;
}

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

/* ---------- Mood Indicator ---------- */
.mood-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.mood-heart {
  font-size: 1.2rem;
  transition: all var(--transition-normal);
}

/* ---------- Pulse Ring ---------- */
.pulse-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring::before,
.pulse-ring::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulse-ring 2s ease-out infinite;
}

.pulse-ring::after {
  animation-delay: 1s;
}

@keyframes pulse-ring {
  0% {
    width: 100%; height: 100%;
    opacity: 0.8;
  }
  100% {
    width: 200%; height: 200%;
    opacity: 0;
  }
}

/* ---------- Floating Particles ---------- */
@keyframes float-up {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-120px) scale(0);
    opacity: 0;
  }
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  animation: float-up 3s ease-out forwards;
}

/* ---------- Ending Card ---------- */
.ending-card {
  text-align: center;
  padding: 48px 32px;
}

.ending-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: heartbeat 1.2s ease-in-out infinite;
}

.ending-title {
  font-size: 1.8rem;
  color: var(--accent-glow);
  margin-bottom: 12px;
}

.ending-desc {
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.8;
}

/* ---------- About Page Specific ---------- */
.about-hero {
  text-align: center;
  padding: 60px 0 40px;
}

.about-hero h1 {
  font-size: 2.6rem;
  background: linear-gradient(135deg, var(--accent-glow), var(--gold), var(--heal));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.about-hero p {
  color: var(--text-dim);
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.character-card {
  text-align: center;
}

.character-card .portrait-placeholder {
  width: 100px;
  height: 100px;
  font-size: 2.5rem;
}

.character-card h3 {
  font-size: 1.3rem;
  color: var(--accent-glow);
  margin-bottom: 8px;
}

.character-card .role-tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: rgba(255, 107, 157, 0.15);
  color: var(--accent-soft);
  margin-bottom: 12px;
}

.character-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.7;
}

.ending-list {
  margin: 40px 0;
}

.ending-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ending-item:last-child {
  border-bottom: none;
}

.ending-item .ending-badge {
  font-size: 2rem;
  flex-shrink: 0;
}

.ending-item h4 {
  color: var(--accent-glow);
  margin-bottom: 6px;
}

.ending-item p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ---------- Navigation ---------- */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 40px;
}

.nav-bar a {
  color: var(--text-dim);
  font-size: 0.95rem;
  letter-spacing: 2px;
  padding: 6px 0;
  position: relative;
  transition: color var(--transition-normal);
}

.nav-bar a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width var(--transition-normal);
}

.nav-bar a:hover,
.nav-bar a.active {
  color: var(--accent-glow);
}

.nav-bar a:hover::after,
.nav-bar a.active::after {
  width: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .scene-container {
    padding: 24px 16px 40px;
  }

  .title-main {
    font-size: 1.6rem;
  }

  .glass-card {
    padding: 24px 20px;
  }

  .btn {
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .character-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 157, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 157, 0.5);
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
