/* ===================================================================
   MUN Courseware — UNESCO World Heritage Committee
   暖金古典风 · Heritage Gold Theme
   =================================================================== */
:root {
  /* ---- Color Palette: Warm Gold Classical ---- */
  --bg-deep: #1a1410;
  --bg-dark: #2d2015;
  --bg-card: rgba(45,32,21,0.85);
  --aged-paper: #e8d5b0;
  --muted-gold: #c9a227;
  --faded-blue: #8b6914;
  --cream: #faf3e0;
  --text-primary: #e8d5b0;
  --text-secondary: #c4b08a;
  --text-muted: #8a7555;
  --accent-red: #a63d40;
  --accent-green: #5d8a68;
  --border-subtle: rgba(201,162,39,0.25);
  --shadow-deep: rgba(0,0,0,0.5);
  --overlay-dark: rgba(26,20,16,0.88);
  --player-height: 64px;

  /* ---- Typography ---- */
  --font-heading: 'Georgia', 'Noto Serif SC', serif;
  --font-body-cn: 'Noto Serif SC', 'STSong', serif;
  --font-body-en: 'Georgia', 'Times New Roman', serif;
  --font-ui: 'Noto Sans SC', 'PingFang SC', sans-serif;

  /* ---- Spacing ---- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;

  /* ---- Radii ---- */
  --radius-sm: 4px; --radius-md: 8px;
  --radius-lg: 12px; --radius-xl: 16px;

  /* ---- Transitions ---- */
  --transition-fast: 150ms ease;
  --transition-smooth: 300ms cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 16px; overflow: hidden; height: 100%; }

body {
  font-family: var(--font-body-cn);
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
  /* Stone texture overlay */
  position: relative;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,162,39,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139,105,20,0.06) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

/* ========== Pages ========== */
.page {
  position: absolute; inset: 0;
  padding-bottom: calc(var(--player-height) + 12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(20px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
  pointer-events: none; z-index: 1;
  overflow-y: auto;
  /* Parchment texture */
  background:
    linear-gradient(180deg, rgba(26,20,16,1) 0%, rgba(35,26,18,1) 100%);
}
.page::after {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(201,162,39,0.015) 2px, rgba(201,162,39,0.015) 4px
  );
  pointer-events: none; z-index: 0;
}
.page.active {
  opacity: 1; transform: translateY(0); pointer-events: auto; z-index: 2;
}

/* ========== Chapter Watermark (大编号水印) ========== */
.chapter-watermark {
  position: absolute;
  top: 40px; right: 40px;
  font-family: 'Georgia', serif;
  font-size: 8rem; font-weight: 700;
  color: rgba(201,162,39,0.06);
  line-height: 1;
  letter-spacing: -4px;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}
.chapter-watermark::after {
  content: '';
  display: block;
  width: 60px; height: 2px;
  background: linear-gradient(90deg, rgba(201,162,39,0.4), transparent);
  margin-top: 12px;
}

/* ========== Page Header Strip (顶部小标) ========== */
.page-header {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 18px 40px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-ui);
  font-size: 0.7rem; color: var(--text-muted);
  letter-spacing: 2px; text-transform: uppercase;
  border-bottom: 1px solid rgba(201,162,39,0.08);
  z-index: 2;
  pointer-events: none;
}
.page-header-left { color: var(--muted-gold); font-weight: 500; }
.page-header-right { color: var(--text-muted); }

/* ========== Content Container ========== */
.content-container {
  position: relative; z-index: 1;
  max-width: 900px; width: 100%;
  padding: var(--space-10) var(--space-10);
  margin: 0 auto;
}
.content-container h1 {
  font-family: var(--font-heading);
  font-size: 2.2rem; font-weight: 700;
  color: var(--muted-gold);
  margin-bottom: var(--space-4);
  line-height: 1.35;
  letter-spacing: 1px;
  border-bottom: 2px solid rgba(201,162,39,0.3);
  padding-bottom: var(--space-3);
}
.content-container h2 {
  font-family: var(--font-heading);
  font-size: 1.65rem; font-weight: 700;
  color: var(--muted-gold);
  margin-bottom: var(--space-5);
  line-height: 1.4;
  letter-spacing: 0.5px;
}
.content-container h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem; font-weight: 600;
  color: var(--aged-paper);
  margin: var(--space-5) 0 var(--space-3);
}
.content-container p {
  font-size: 1.05rem; line-height: 1.9;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

/* ========== Title Page ========== */
.title-page { text-align: center; }
.title-page h1 {
  font-size: 2.6rem; border-bottom: none;
  background: linear-gradient(180deg, #faf3e0 0%, #c9a227 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-3);
}
.title-subtitle {
  font-size: 1.1rem !important;
  color: var(--text-secondary) !important;
  font-style: italic;
}

/* ========== Objectives Box ========== */
.objectives {
  text-align: left; display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin-top: var(--space-8);
  min-width: 400px; max-width: 650px;
}
.objectives h3 {
  color: var(--muted-gold); margin-top: 0;
  font-size: 1rem; text-transform: uppercase;
  letter-spacing: 2px;
}
.objectives ul { padding-left: var(--space-5); }
.objectives li {
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  line-height: 1.7; font-size: 0.95rem;
}
.objectives li::marker { color: var(--muted-gold); }

/* ========== Timestamp ========== */
.timestamp {
  font-family: var(--font-ui);
  font-size: 0.8rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 2px;
  margin-bottom: var(--space-3);
}

/* ========== Split Layout ========== */
.split-layout {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-8); align-items: start;
  margin-bottom: var(--space-5);
}
.split-layout.split-reverse {
  direction: rtl;
}
.split-layout.split-reverse > * {
  direction: ltr;
}

/* ========== Image Styles ========== */
.image-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(201,162,39,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 4px rgba(26,20,16,0.6), 0 0 0 5px rgba(201,162,39,0.15);
  background: var(--bg-dark);
  position: relative;
}
.image-container::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(201,162,39,0.05) 0%, transparent 40%);
  pointer-events: none; z-index: 1;
}
.image-container img,
.lecture-image {
  width: 100%; height: auto; display: block;
  object-fit: cover;
}
.image-caption {
  font-family: var(--font-ui);
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  text-align: center;
  padding: var(--space-2) var(--space-3);
  margin: 0 !important;
  background: rgba(0,0,0,0.3);
}

.image-banner {
  margin-bottom: var(--space-6);
}

.image-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

/* ========== Info Card ========== */
.info-card {
  background: linear-gradient(135deg, rgba(45,32,21,0.7) 0%, rgba(35,26,18,0.7) 100%);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--muted-gold);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
  position: relative;
  backdrop-filter: blur(4px);
}
.info-card::after {
  content: ''; position: absolute;
  top: 0; right: 0; width: 80px; height: 100%;
  background: linear-gradient(135deg, transparent 0%, rgba(201,162,39,0.05) 100%);
  pointer-events: none;
}
.info-card h4 {
  color: var(--muted-gold);
  font-size: 0.95rem; margin-bottom: var(--space-2);
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
}
.info-card p {
  font-size: 0.95rem !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0 !important;
  line-height: 1.85 !important;
}

/* ========== Data Card ========== */
.data-card {
  background: linear-gradient(160deg, rgba(45,32,21,0.9) 0%, rgba(26,20,16,0.9) 100%);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  margin-bottom: var(--space-4);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.data-card::before {
  content: ''; position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 40px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--muted-gold), transparent);
}
.data-card .data-value {
  font-size: 2.2rem; font-weight: 700;
  color: var(--muted-gold);
  font-family: 'Georgia', serif;
  text-shadow: 0 0 16px rgba(201,162,39,0.3);
  letter-spacing: 1px;
}
.data-card .data-label {
  font-size: 0.75rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-top: var(--space-2);
}
.data-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

/* ========== Quote ========== */
.quote {
  background: var(--bg-card);
  border-left: 4px solid var(--muted-gold);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-6) 0;
  font-style: italic;
  font-size: 1.05rem !important;
  color: var(--aged-paper) !important;
  line-height: 1.8 !important;
}
.quote::before { content: '\201C'; font-size: 2rem; color: var(--muted-gold); line-height: 0; vertical-align: -0.3em; margin-right: 4px; }

/* ========== Highlight / Key Term ========== */
.highlight {
  background: linear-gradient(180deg, transparent 60%, rgba(201,162,39,0.25) 60%);
  padding: 0 4px;
}
.key-term {
  color: var(--muted-gold);
  font-weight: 600;
}

/* ========== Table ========== */
.table-wrapper {
  overflow-x: auto; margin-bottom: var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.table-wrapper table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem;
}
.table-wrapper th {
  background: rgba(201,162,39,0.15);
  color: var(--muted-gold);
  font-weight: 600; text-align: left;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-heading);
  border-bottom: 1px solid var(--border-subtle);
}
.table-wrapper td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(201,162,39,0.08);
  color: var(--text-secondary);
}
.table-wrapper tr:last-child td { border-bottom: none; }

/* ========== Back to Home Button ========== */
.back-home {
  position: fixed; top: 20px; left: 84px; z-index: 100;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: rgba(26,20,16,0.7); border: 1px solid rgba(201,162,39,0.25);
  border-radius: 22px;
  color: var(--text-secondary);
  text-decoration: none; font-family: var(--font-ui);
  font-size: 0.8rem; letter-spacing: 1px;
  backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
}
.back-home svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.back-home:hover {
  color: var(--muted-gold);
  border-color: rgba(201,162,39,0.5);
  background: rgba(201,162,39,0.08);
  transform: translateX(-2px);
}
@media (max-width: 768px) {
  .back-home { top: 12px; left: 12px; padding: 6px 12px; font-size: 0.7rem; }
}

/* ========== Navigation Arrows ========== */
.nav-arrow {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  border: 1px solid rgba(201,162,39,0.2);
  border-radius: 50%;
  background: rgba(26,20,16,0.7);
  color: var(--muted-gold);
  cursor: pointer; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
}
.nav-arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav-arrow:hover {
  border-color: var(--muted-gold);
  background: rgba(201,162,39,0.15);
  box-shadow: 0 0 24px rgba(201,162,39,0.15);
}
.nav-arrow.prev { left: 20px; }
.nav-arrow.next { right: 20px; }

/* ========== Page Indicator ========== */
.page-indicator {
  position: fixed; bottom: calc(var(--player-height) + 12px + 12px);
  left: 50%; transform: translateX(-50%);
  display: flex; gap: var(--space-2);
  z-index: 100;
}
.page-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(201,162,39,0.2);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.page-dot.active { background: var(--muted-gold); box-shadow: 0 0 8px rgba(201,162,39,0.4); }

/* ========== Audio Player ========== */
.audio-player {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--player-height);
  background: rgba(26,20,16,0.95);
  border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center;
  padding: 0 var(--space-5);
  gap: var(--space-3);
  z-index: 200;
  backdrop-filter: blur(16px);
}
.play-btn {
  width: 40px; height: 40px; border: none;
  border-radius: 50%;
  background: rgba(201,162,39,0.15);
  color: var(--muted-gold);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.play-btn:hover { background: rgba(201,162,39,0.25); }
.play-btn svg { width: 18px; height: 18px; fill: currentColor; }

.progress-container {
  flex: 1; display: flex; flex-direction: column;
  gap: 4px; min-width: 0;
  padding: 8px 0;
}
.progress-bar {
  position: relative; height: 8px;
  background: rgba(201,162,39,0.12);
  border-radius: 4px; cursor: pointer;
  overflow: hidden;
  margin: 4px 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.progress-bar::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: rgba(201,162,39,0.15);
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, #c9a227 0%, #faf3e0 100%);
  border-radius: 4px; transition: width 100ms linear;
  box-shadow: 0 0 8px rgba(201,162,39,0.4);
  position: relative;
}
.progress-markers {
  position: absolute; top: 0; bottom: 0; left: 0; right: 0;
  pointer-events: none;
  z-index: 2;
}
.progress-markers .marker {
  position: absolute; top: 0; bottom: 0;
  width: 2px;
  background: rgba(250,243,224,0.95);
  box-shadow: 0 0 6px rgba(250,243,224,0.6);
  transition: all 200ms ease;
  pointer-events: auto;
  cursor: pointer;
  transform: translateX(-50%);
}
.progress-markers .marker::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 10px; transform: translateX(-50%);
  background: transparent;
}
.progress-markers .marker.passed {
  background: #c9a227;
  width: 3px;
  box-shadow: 0 0 10px rgba(201,162,39,0.9);
}
.progress-markers .marker:hover {
  background: #fff;
  width: 3px;
  box-shadow: 0 0 12px rgba(255,255,255,0.9);
}
.progress-markers .marker::after {
  content: attr(data-title);
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  padding: 4px 10px; background: rgba(26,20,16,0.95);
  border: 1px solid rgba(201,162,39,0.4); border-radius: 4px;
  color: var(--aged-paper); font-family: var(--font-ui);
  font-size: 0.7rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease;
  z-index: 10;
}
.progress-markers .marker:hover::after { opacity: 1; }
.time-display {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem; color: var(--text-muted);
}

.subtitle-toggle, .volume-control { flex-shrink: 0; }
.volume-control { display: flex; align-items: center; gap: 6px; }
.volume-slider {
  width: 60px; height: 4px; -webkit-appearance: none;
  background: rgba(201,162,39,0.15); border-radius: 2px;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--muted-gold); cursor: pointer;
}

/* ========== Subtitle Overlay ========== */
.subtitle-container {
  position: fixed; bottom: calc(var(--player-height) + 20px);
  left: 50%; transform: translateX(-50%);
  text-align: center; z-index: 150;
  max-width: 700px; pointer-events: none;
}
.subtitle-en, .subtitle-zh {
  font-size: 1.1rem; padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}
.subtitle-zh { color: var(--cream); text-shadow: 0 1px 4px rgba(0,0,0,0.6); }

/* ========== SVG in content ========== */
.content-container svg { max-width: 100%; height: auto; }

/* ========== Collapsible info (for overflow content) ========== */
.page-overflow-indicator {
  display: none;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  html { font-size: 15px; }
  .split-layout, .image-grid-2, .data-row {
    grid-template-columns: 1fr;
  }
  .content-container {
    padding: var(--space-6) var(--space-4);
  }
  .content-container h1 { font-size: 1.45rem; letter-spacing: 0.5px; }
  .content-container h2 { font-size: 1.2rem; }
  .content-container h3 { font-size: 1.05rem; }
  .content-container p { font-size: 0.98rem; line-height: 1.8; }
  .objectives { min-width: auto; padding: var(--space-5); }
  .objectives li { font-size: 0.9rem; }

  /* Mobile chapter watermark/header */
  .chapter-watermark {
    top: 10px; right: 12px;
    font-size: 5rem;
    opacity: 0.04;
  }
  .chapter-watermark::after { display: none; }
  .page-header { display: none; }

  /* Mobile nav arrows */
  .nav-arrow {
    width: 40px; height: 40px;
    top: auto; bottom: calc(var(--player-height) + 16px);
    transform: none;
  }
  .nav-arrow.prev { left: 12px; }
  .nav-arrow.next { right: 12px; }
  .nav-arrow svg { width: 20px; height: 20px; }

  /* Back home button */
  .back-home {
    top: 12px; left: 12px;
    padding: 6px 12px;
    font-size: 0.7rem;
  }
  .back-home span { display: none; }
  .back-home svg { margin: 0; }

  /* Page indicator */
  .page-indicator {
    bottom: calc(var(--player-height) + 8px);
    gap: var(--space-1);
  }
  .page-dot { width: 6px; height: 6px; }

  /* Audio player */
  .audio-player {
    padding: 6px 12px;
    gap: var(--space-2);
  }
  .play-btn { width: 36px; height: 36px; }
  .play-btn svg { width: 16px; height: 16px; }
  .progress-container { padding: 2px 0; }
  .progress-bar { height: 8px; margin: 3px 0; }
  .volume-control { display: none; }
  .subtitle-toggle { display: none !important; }
  .time-display { font-size: 0.65rem; }

  /* Image */
  .image-container {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 0 2px rgba(201,162,39,0.1);
  }
  .image-caption { font-size: 0.65rem !important; }

  /* Title page */
  .title-page h1 { font-size: 1.8rem; }
  .title-subtitle { font-size: 1rem !important; }
}

/* ========== Blockquote ========== */
.content-container blockquote {
  border-left: 3px solid var(--muted-gold);
  padding-left: var(--space-4);
  margin: var(--space-5) 0;
  color: var(--text-secondary);
  font-style: italic;
}
