@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --parchment: #f4e4c1;
  --dark-brown: #3e2723;
  --crimson: #8b0000;
  --gold: #daa520;
  --warm-coral: #cd5c5c;
}

.reveal {
  font-family: 'Lora', Georgia, serif;
  color: var(--dark-brown);
}

.reveal .slides {
  background: linear-gradient(135deg, #f4e4c1 0%, #e8d5a3 50%, #f0dfb8 100%);
}

.reveal .slides section {
  padding: 0;
  height: 100%;
}

.reveal h1, .reveal h2, .reveal h3 {
  font-family: 'IM Fell English', 'Georgia', serif;
  color: var(--crimson);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.reveal h1 { font-size: 2.8em; }
.reveal h2 { font-size: 1.6em; color: var(--dark-brown); }

.scene-slide {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.scene-image {
  max-height: 70vh;
  max-width: 90vw;
  object-fit: contain;
  border: 4px solid var(--dark-brown);
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.play-btn {
  position: fixed;
  top: 12px;
  right: 108px;
  z-index: 210;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.85em;
  background: var(--crimson);
  color: #f4e4c1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.play-btn:hover { background: #a00000; }

.theme-toggle {
  position: fixed;
  top: 12px;
  right: 60px;
  z-index: 210;
  background: rgba(62, 39, 35, 0.7);
  color: #f4e4c1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { background: rgba(62, 39, 35, 0.95); }

.music-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 210;
  background: rgba(62, 39, 35, 0.7);
  color: #f4e4c1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.music-toggle:hover { background: rgba(62, 39, 35, 0.95); }

.caption-overlay {
  position: absolute;
  bottom: 7%;
  left: 5%;
  right: 5%;
  z-index: 80;
  background: rgba(0, 0, 0, 0.78);
  color: #f4e4c1;
  padding: 8px 0;
  min-height: 28px;
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

body.caption-off .caption-overlay {
  display: none;
}

.caption-inner {
  overflow: hidden;
  white-space: nowrap;
  padding: 0 60px;
}

.caption-text {
  display: inline-block;
  font-size: 1.05em;
  font-family: 'Lora', Georgia, serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.caption-text .word {
  display: inline;
  transition: color 0.15s, background 0.15s;
  padding: 1px 3px;
  border-radius: 2px;
}

.caption-text .word.highlighted {
  color: var(--gold);
  background: rgba(218, 165, 32, 0.25);
  font-weight: 600;
}

body.multiline .caption-inner {
  overflow: visible !important;
  white-space: normal !important;
  padding: 4px 60px;
}
body.multiline .caption-text {
  display: block !important;
  white-space: normal !important;
  text-align: center;
  font-size: 1em;
  line-height: 1.6;
}
body.multiline .caption-overlay {
  padding: 4px 0 6px;
}

.caption-toggle {
  position: fixed;
  top: 12px;
  right: 156px;
  z-index: 210;
  background: rgba(62, 39, 35, 0.7);
  color: #f4e4c1;
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 0.85em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.caption-toggle:hover { background: rgba(62, 39, 35, 0.95); }

body.dark .caption-toggle {
  background: rgba(218, 165, 32, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

.progress-bar {
  position: fixed;
  bottom: 5px;
  left: 0;
  height: 4px;
  z-index: 90;
  background: var(--gold);
  transition: width 0.1s linear;
}

.caption-text {
  font-size: 1.1em;
  line-height: 1.8;
  font-family: 'Lora', Georgia, serif;
  letter-spacing: 0.02em;
}

.caption-text .word {
  display: inline;
  transition: color 0.15s, background 0.15s;
  padding: 1px 2px;
  border-radius: 2px;
}

.caption-text .word.highlighted {
  color: var(--gold);
  background: rgba(218, 165, 32, 0.2);
  font-weight: 600;
}

.first-load-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.first-load-overlay p {
  font-family: 'IM Fell English', serif;
  font-size: 2em;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(0,0,0,0.5);
  animation: pulse 2s ease-in-out infinite;
}

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

body.dark, body.dark html { background: #111; }
body.dark .reveal .slides { background: #111; }

.reveal .progress {
  background: rgba(0,0,0,0.15) !important;
}
.reveal .progress span {
  background: var(--dark-brown) !important;
}
body.dark .reveal .progress {
  background: rgba(255,255,255,0.1) !important;
}
body.dark .reveal .progress span {
  background: var(--gold) !important;
}
body.dark .reveal { color: #eee; }
body.dark .reveal h1,
body.dark .reveal h2,
body.dark .reveal h3 { color: var(--gold); }
body.dark .scene-image {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(218, 165, 32, 0.3);
}
body.dark .caption-overlay { background: rgba(0, 0, 0, 0.8); }
body.dark .play-btn {
  background: var(--gold);
  color: #111;
  border-color: #eee;
}
body.dark .play-btn:hover { background: #c8941e; }
body.dark .music-toggle,
body.dark .theme-toggle {
  background: rgba(218, 165, 32, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

@media (max-width: 768px) {
  .caption-text { font-size: 0.9em; }
  .caption-inner { padding: 0 40px; }
  .scene-image { max-height: 60vh; }
  .play-btn, .music-toggle, .theme-toggle, .caption-toggle { width: 34px; height: 34px; font-size: 0.85em; }
}

@media (max-width: 375px) {
  .caption-text { font-size: 0.75em; }
  .caption-inner { padding: 0 24px; }
  .caption-overlay { padding: 4px 0; }
}
