/* ══════════════════════════════════════════════════════════════════════
   Lyrian Chronicles — Adventure & Library Styles
   Welcome screen, academy gates, and interactive library experience
   ══════════════════════════════════════════════════════════════════════ */
/* Shared styles (tokens, reset, nav) loaded via CSS imports in HTML */

/* ─── Lore Page Overrides ─────────────────────────────────────────── */
body {
  background-color: var(--lib-bg-deep);
  color: var(--lib-text);
}
a:hover { color: var(--lib-blue); }

/* Lore navbar — always opaque (overrides shared nav.css transparent default) */
.navbar {
  background-color: rgba(10, 12, 20, 0.9);
  backdrop-filter: blur(20px);
  box-shadow: 0 2px 30px rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--lib-border);
}
.nav-logo-img { height: 32px; width: auto; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6)); }
.nav-links li a { color: var(--lib-text-muted); }
.nav-links li a:hover,
.nav-links li a.active-link {
  color: var(--lib-text-bright);
  background-color: rgba(223, 184, 88, 0.1);
}
.nav-cta {
  background: linear-gradient(135deg, #c4a04e, var(--lib-gold));
  color: var(--lib-bg-deep) !important;
  box-shadow: 0 4px 20px var(--lib-gold-glow);
}
.mobile-toggle span { background: var(--lib-gold); }

/* ══════════════════════════════════════════════════════════════════════
   WELCOME SCREEN — Adventure Entry Point
   ══════════════════════════════════════════════════════════════════════ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #050608 0%, #0a0c14 40%, #12141f 100%);
  transition: opacity 0.8s var(--ease-out-expo), visibility 0.8s;
}

.welcome-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-content {
  text-align: center;
  max-width: 700px;
  padding: 2rem;
  opacity: 0;
  transform: translateY(30px);
  animation: welcomeFadeIn 1.5s var(--ease-out-expo) 0.5s forwards;
}

@keyframes welcomeFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-ornament {
  font-family: var(--font-heading);
  color: var(--lib-gold);
  font-size: 1rem;
  letter-spacing: 0.4em;
  margin-bottom: 2rem;
  opacity: 0.7;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--lib-parchment);
  line-height: 1.3;
  margin-bottom: 1rem;
  text-shadow: 0 0 40px rgba(223, 184, 88, 0.15);
}

.welcome-genre {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  color: var(--lib-gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px rgba(223, 184, 88, 0.3);
}

.welcome-subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  font-weight: 400;
  color: var(--lib-text-muted);
  letter-spacing: 0.02em;
  line-height: 1.7;
  margin: 0 auto 2.5rem auto;
  max-width: 520px;
  opacity: 0.8;
}

.welcome-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 2.8rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--lib-bg-deep);
  background: linear-gradient(135deg, var(--lib-gold), #c9a044);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.3s var(--ease-out-expo);
  box-shadow: 0 4px 20px rgba(223, 184, 88, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
  opacity: 0;
  animation: welcomeFadeIn 1s var(--ease-out-expo) 1.8s forwards;
}

.welcome-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(223, 184, 88, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.welcome-btn:active {
  transform: translateY(0);
}

.welcome-divider {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lib-gold), transparent);
  margin: 0 auto 2rem;
  opacity: 0.5;
}

/* ══════════════════════════════════════════════════════════════════════
   ACADEMY GATES — Location Selection Screen
   ══════════════════════════════════════════════════════════════════════ */
.gates-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #080a12 0%, #0e1018 50%, #12141f 100%);
  transition: opacity 0.8s var(--ease-out-expo), visibility 0.8s;
  overflow-y: auto;
  padding: 2rem;
}

.gates-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gates-content {
  text-align: center;
  max-width: 900px;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.gates-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.gates-crest {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(223, 184, 88, 0.3));
}

.gates-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: var(--lib-parchment);
  margin-bottom: 0.4rem;
  text-shadow: 0 0 30px rgba(223, 184, 88, 0.12);
}

.gates-subtitle {
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  color: var(--lib-text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 2.5rem;
}

.gates-divider {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lib-gold), transparent);
  margin: 0 auto 2.5rem;
  opacity: 0.4;
}

.gates-section-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--lib-gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  opacity: 0.7;
}

.gates-locations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.gates-location-card {
  position: relative;
  background: var(--lib-bg-card);
  border: 1px solid var(--lib-border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  cursor: pointer;
  transition: all 0.4s var(--ease-out-expo);
  overflow: hidden;
}

.gates-location-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(223, 184, 88, 0.05), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}

.gates-location-card:hover {
  border-color: var(--lib-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(223, 184, 88, 0.12), 0 0 0 1px rgba(223, 184, 88, 0.1);
}

.gates-location-card:hover::before {
  opacity: 1;
}

.gates-location-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.gates-card-icon {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.gates-card-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--lib-parchment);
  margin-bottom: 0.4rem;
}

.gates-card-desc {
  font-size: 0.85rem;
  color: var(--lib-text-muted);
  line-height: 1.5;
}

.gates-card-badge {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.25rem 0.7rem;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 20px;
  background: rgba(223, 184, 88, 0.15);
  color: var(--lib-gold);
  border: 1px solid rgba(223, 184, 88, 0.2);
}

.gates-card-badge.locked-badge {
  background: rgba(100, 100, 100, 0.15);
  color: var(--lib-text-dim);
  border-color: rgba(100, 100, 100, 0.2);
}

.gates-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2.5rem;
  padding: 0.6rem 1.4rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--lib-text-muted);
  background: transparent;
  border: 1px solid var(--lib-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 0.04em;
}

.gates-back-btn:hover {
  color: var(--lib-parchment);
  border-color: var(--lib-border-hover);
  background: rgba(223, 184, 88, 0.05);
}

/* Gates responsive */
@media (max-width: 600px) {
  .gates-locations {
    grid-template-columns: 1fr;
  }
  .gates-crest {
    font-size: 2.5rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   CITY GATES — Immersive Guard VN Scene
   ══════════════════════════════════════════════════════════════════════ */
.city-gates-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: opacity 0.8s var(--ease-out-expo), visibility 0.8s;
}

.city-gates-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.city-gates-bg {
  position: absolute;
  inset: 0;
  background-image: url('img/city_square_bg.jpg');
  background-size: cover;
  background-position: center;
  filter: brightness(0.55) saturate(1.1);
}

.city-gates-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 14, 26, 0.3) 0%,
    rgba(10, 14, 26, 0.15) 40%,
    rgba(10, 14, 26, 0.6) 75%,
    rgba(10, 14, 26, 0.95) 100%
  );
}

/* ─── Location Header (shared across scenes) ─────────────────────── */
.location-header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  background: linear-gradient(180deg, rgba(26, 22, 16, 0.92), rgba(18, 14, 10, 0.85));
  border-bottom: 1px solid rgba(223, 184, 88, 0.15);
  padding: 24px 0;
  backdrop-filter: blur(12px);
}

.location-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.location-crest {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 12px rgba(223, 184, 88, 0.4));
  animation: crestPulseGold 3s ease-in-out infinite;
}

@keyframes crestPulseGold {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(223, 184, 88, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(223, 184, 88, 0.6)); }
}

.location-name {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: var(--lib-gold);
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 16px rgba(0, 0, 0, 0.6);
}

.location-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--lib-text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 3px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 0, 0, 0.5);
}

.city-gates-scene {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1000px;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Guard Sprite ────────────────────────────────────────────────── */
.city-gates-sprite-container {
  position: absolute;
  bottom: -330px;
  left: 50%;
  transform: translateX(-50%) translateX(-60px);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
  pointer-events: none;
}

.city-gates-sprite-container.visible {
  opacity: 1;
  transform: translateX(-50%) translateX(0);
}

.city-gates-sprite {
  height: 1100px;
  width: auto;
  image-rendering: auto;
  filter: drop-shadow(0 10px 40px rgba(0,0,0,0.6));
  animation: spriteBreath 4s ease-in-out infinite;
}

/* ─── Guard Dialogue Box ──────────────────────────────────────────── */
.city-gates-dialogue-box {
  width: 100%;
  background: rgba(10, 12, 20, 0.92);
  border: 2px solid var(--lib-blue-deep);
  border-radius: 16px;
  padding: 0;
  position: relative;
  z-index: 2;
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(91, 155, 213, 0.2);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out-expo) 0.3s, transform 0.6s var(--ease-out-expo) 0.3s;
}

.city-gates-dialogue-box.visible {
  opacity: 1;
  transform: translateY(0);
}

.city-gates-speaker-plate {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  padding: 8px 24px;
  display: inline-block;
  border-radius: 0 0 12px 0;
}

.city-gates-speaker-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-cream);
  letter-spacing: 1px;
}

.city-gates-text-area {
  padding: 20px 28px 24px;
  min-height: 100px;
  position: relative;
}

.city-gates-text {
  font-family: var(--font-reading);
  font-size: 1.15rem;
  color: var(--lib-cream);
  line-height: 1.8;
  min-height: 2.5em;
  margin: 0;
}

.city-gates-next-indicator {
  position: absolute;
  bottom: 12px;
  right: 20px;
  color: var(--lib-blue);
  font-size: 1rem;
  animation: vnBounce 1s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.city-gates-next-indicator.visible {
  opacity: 1;
}

/* ─── Guard Action Buttons ────────────────────────────────────────── */
.city-gates-actions {
  margin-top: 24px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  position: relative;
  z-index: 3;
}

.city-gates-actions.visible {
  opacity: 1;
  transform: translateY(0);
}

.city-gates-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 36px;
  border-radius: 50px;
  cursor: pointer;
  border: none;
  position: relative;
  transition: all 0.4s var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.4);
}

.city-gates-btn-icon {
  font-size: 1.2rem;
}

.city-gates-btn-talk {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  color: white;
  box-shadow: 0 4px 24px var(--lib-blue-glow);
}

.city-gates-btn-talk:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px var(--lib-blue-glow);
}

.city-gates-btn-navigate {
  background: linear-gradient(135deg, rgba(223, 184, 88, 0.2), rgba(223, 184, 88, 0.1));
  color: var(--lib-gold);
  border: 2px solid rgba(223, 184, 88, 0.3);
  box-shadow: 0 4px 24px rgba(223, 184, 88, 0.1);
}

.city-gates-btn-navigate:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px rgba(223, 184, 88, 0.2);
  border-color: rgba(223, 184, 88, 0.5);
}

.city-gates-btn-back {
  background: transparent;
  color: var(--lib-text-muted);
  border: 2px solid var(--lib-border-hover);
  padding: 12px 28px;
  font-size: 0.9rem;
}

.city-gates-btn-back:hover {
  color: var(--lib-parchment);
  border-color: var(--lib-border-hover);
  background: rgba(255, 255, 255, 0.05);
}

/* City Gates responsive */
@media (max-width: 768px) {
  .city-gates-sprite {
    height: 750px;
  }
  .city-gates-sprite-container {
    bottom: -230px;
    transform: translateX(-50%) translateX(-40px);
  }
  .city-gates-sprite-container.visible {
    transform: translateX(-50%) translateX(0);
  }
  .city-gates-text-area {
    padding: 16px 20px 20px;
  }
  .city-gates-text {
    font-size: 1rem;
  }
  .city-gates-actions {
    gap: 10px;
  }
  .city-gates-btn {
    padding: 12px 24px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .city-gates-sprite {
    height: 550px;
  }
  .city-gates-sprite-container {
    bottom: -180px;
  }
  .city-gates-actions {
    flex-direction: column;
    align-items: center;
  }
}


/* ══════════════════════════════════════════════════════════════════════
   SHARED SCENE OVERLAYS — Airship Docks, Mirane, Combat School
   ══════════════════════════════════════════════════════════════════════ */
.scene-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: opacity 0.6s var(--ease-out-expo), visibility 0.6s;
}

.scene-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ─── Scene Backgrounds ───────────────────────────────────────────── */
.scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.scene-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 14, 26, 0.3) 0%,
    rgba(10, 14, 26, 0.15) 40%,
    rgba(10, 14, 26, 0.6) 75%,
    rgba(10, 14, 26, 0.95) 100%
  );
}

.airship-docks-bg {
  background-image: url('img/Docks.jpg');
  filter: brightness(0.5) saturate(1.1);
}

.mirane-bg {
  background-image: url('img/mirane.jpeg');
  filter: brightness(0.55) saturate(1.1);
}

.combat-school-bg {
  background-image: url('img/combat-school.png');
  filter: brightness(0.5) saturate(1.1);
}

.mea-hq-bg {
  background-image: url('img/mea.jpg');
  filter: brightness(0.45) saturate(1.2);
}

.tavern-bg-day {
  background-image: url('img/no_pain_no_mirane-background.jpg');
  filter: brightness(0.5) saturate(1.1);
}

.tavern-bg-night {
  background-image: url('img/no_pain_no_mirane-background-night.jpg');
  filter: brightness(0.4) saturate(1.2);
}

/* ─── Scene Content ───────────────────────────────────────────────── */
.scene-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1000px;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Scene Sprite ────────────────────────────────────────────────── */
.scene-sprite-container {
  position: absolute;
  bottom: -330px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}

.scene-sprite {
  height: 1100px;
  width: auto;
  image-rendering: auto;
  filter: drop-shadow(0 10px 40px rgba(0,0,0,0.6));
  animation: spriteBreath 4s ease-in-out infinite;
}

/* ─── Scene Dialogue Box ──────────────────────────────────────────── */
.scene-dialogue-box {
  width: 100%;
  background: rgba(10, 12, 20, 0.92);
  border: 2px solid var(--lib-blue-deep);
  border-radius: 16px;
  position: relative;
  z-index: 2;
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(91, 155, 213, 0.2);
  overflow: hidden;
}

.scene-speaker-plate {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  padding: 8px 24px;
  display: inline-block;
  border-radius: 0 0 12px 0;
}

.scene-speaker-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-cream);
  letter-spacing: 1px;
}

.scene-text-area {
  padding: 20px 28px 24px;
  min-height: 80px;
  position: relative;
}

.scene-text {
  font-family: var(--font-reading);
  font-size: 1.15rem;
  color: var(--lib-cream);
  line-height: 1.8;
  min-height: 2em;
  margin: 0;
}

/* ─── Scene Action Buttons ────────────────────────────────────────── */
.scene-actions {
  margin-top: 24px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 3;
}

.scene-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 36px;
  border-radius: 50px;
  cursor: pointer;
  border: none;
  position: relative;
  transition: all 0.4s var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.4);
}

.scene-btn-icon {
  font-size: 1.2rem;
}

.scene-btn-navigate {
  background: linear-gradient(135deg, rgba(223, 184, 88, 0.2), rgba(223, 184, 88, 0.1));
  color: var(--lib-gold);
  border: 2px solid rgba(223, 184, 88, 0.3);
  box-shadow: 0 4px 24px rgba(223, 184, 88, 0.1);
}

.scene-btn-navigate:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px rgba(223, 184, 88, 0.2);
  border-color: rgba(223, 184, 88, 0.5);
}

.scene-btn-back {
  background: transparent;
  color: var(--lib-text-muted);
  border: 2px solid var(--lib-border-hover);
  padding: 12px 28px;
  font-size: 0.9rem;
}

.scene-btn-back:hover {
  color: var(--lib-parchment);
  border-color: var(--lib-border-hover);
  background: rgba(255, 255, 255, 0.05);
}

/* Talk Button */
.scene-btn-talk {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  color: white;
  box-shadow: 0 4px 24px var(--lib-blue-glow);
}

.scene-btn-talk:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px var(--lib-blue-glow);
}

/* Replay Video Button */
.scene-btn-replay {
  background: transparent;
  color: var(--lib-text-muted);
  border: 2px solid var(--lib-border);
  padding: 12px 28px;
  font-size: 0.9rem;
}

.scene-btn-replay:hover {
  color: var(--lib-gold);
  border-color: rgba(223, 184, 88, 0.3);
  background: rgba(223, 184, 88, 0.05);
}

/* Disabled / Coming Soon Button */
.scene-btn-disabled {
  background: transparent;
  color: var(--lib-text-muted);
  border: 2px solid var(--lib-border);
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.coming-soon-tag {
  font-size: 0.75rem;
  opacity: 0.7;
  font-style: italic;
}

/* Scene Next Indicator */
.scene-next-indicator {
  position: absolute;
  bottom: 12px;
  right: 20px;
  color: var(--lib-blue);
  font-size: 1rem;
  animation: vnBounce 1s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scene-next-indicator.visible {
  opacity: 1;
}

/* ─── Sign Up CTA Button ─────────────────────────────────────────── */
.scene-btn-signup {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  color: white;
  border: 2px solid rgba(76, 175, 80, 0.4);
  box-shadow: 0 4px 24px rgba(76, 175, 80, 0.2);
  font-size: 1.05rem;
}

.scene-btn-signup:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px rgba(76, 175, 80, 0.35);
  border-color: rgba(76, 175, 80, 0.6);
  color: white;
}

/* ─── Video Player ────────────────────────────────────────────────── */
.scene-video-container {
  width: 100%;
  max-width: 640px;
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(223, 184, 88, 0.2);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 2;
}

.scene-video {
  width: 100%;
  display: block;
  border-radius: 10px;
}

/* Video should be centered on screen, not at the bottom */
#combat-school-overlay.video-playing .scene-content {
  flex: 1;
  justify-content: center;
}

#combat-school-overlay.video-playing .scene-video-container {
  margin-top: auto;
  margin-bottom: auto;
}

/* Skip Video Button */
.scene-btn-skip {
  display: block;
  margin: 16px auto 0;
  background: transparent;
  color: var(--lib-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 32px;
  border-radius: 24px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.scene-btn-skip:hover {
  color: var(--lib-cream);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

/* ─── Scene Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .scene-sprite {
    height: 750px;
  }
  .scene-sprite-container {
    bottom: -230px;
  }
  .scene-text-area {
    padding: 16px 20px 20px;
  }
  .scene-text {
    font-size: 1rem;
  }
  .scene-actions {
    gap: 10px;
  }
  .scene-btn {
    padding: 12px 24px;
    font-size: 0.9rem;
  }
  .scene-video-container {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .scene-sprite {
    height: 550px;
  }
  .scene-sprite-container {
    bottom: -180px;
  }
  .scene-actions {
    flex-direction: column;
    align-items: center;
  }
}


/* ══════════════════════════════════════════════════════════════════════
   VISUAL NOVEL OVERLAY — Welcome Scene with Philomel
   ══════════════════════════════════════════════════════════════════════ */
.vn-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.vn-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.vn-bg {
  position: absolute;
  inset: 0;
  background-image: url('img/library_bg.png');
  background-size: cover;
  background-position: center;
  filter: brightness(0.6) saturate(1.2);
}

.vn-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 12, 20, 0.2) 0%,
    rgba(10, 12, 20, 0.1) 40%,
    rgba(10, 12, 20, 0.6) 80%,
    rgba(10, 12, 20, 0.95) 100%
  );
}

.vn-scene {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1000px;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Sprite ──────────────────────────────────────────────────────── */
.vn-sprite-container {
  position: absolute;
  bottom: -330px;
  left: 50%;
  transform: translateX(-50%) translateX(-60px);
  z-index: 1; /* Behind dialogue box */
  opacity: 0;
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
  pointer-events: none; /* Click-through so it doesn't block dialogue progression clicks */
}

.vn-sprite-container.visible {
  opacity: 1;
  transform: translateX(-50%) translateX(0);
}

.vn-sprite {
  height: 1100px; /* Twice as big on screen (full body asset scaled up) */
  width: auto;
  image-rendering: auto;
  filter: drop-shadow(0 10px 40px rgba(0,0,0,0.6));
  animation: spriteBreath 4s ease-in-out infinite;
}

@keyframes spriteBreath {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ─── Dialogue Box ────────────────────────────────────────────────── */
.vn-dialogue-box {
  width: 100%;
  background: rgba(10, 12, 20, 0.92);
  border: 2px solid var(--lib-blue-deep);
  border-radius: 16px;
  padding: 0;
  position: relative;
  z-index: 2; /* Layered in front of the character sprite */
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(91, 155, 213, 0.2);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out-expo) 0.3s, transform 0.6s var(--ease-out-expo) 0.3s;
}

.vn-dialogue-box.visible {
  opacity: 1;
  transform: translateY(0);
}

.vn-speaker-plate {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  padding: 8px 24px;
  display: inline-block;
  border-radius: 0 0 12px 0;
}

.vn-speaker-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-cream);
  letter-spacing: 1px;
}

.vn-text-area {
  padding: 20px 28px 24px;
  min-height: 100px;
  position: relative;
}

.vn-text {
  font-family: var(--font-reading);
  font-size: 1.15rem;
  color: var(--lib-cream);
  line-height: 1.8;
  min-height: 2.5em;
}

.vn-next-indicator {
  position: absolute;
  bottom: 12px;
  right: 20px;
  color: var(--lib-blue);
  font-size: 1rem;
  animation: vnBounce 1s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.vn-next-indicator.visible {
  opacity: 1;
}

@keyframes vnBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* ─── VN Action Buttons ───────────────────────────────────────────── */
.vn-actions {
  margin-top: 24px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  position: relative;
  z-index: 3; /* In front of dialogue box (z-index 2) and character sprite (z-index 1) */
}

.vn-actions.visible {
  opacity: 1;
  transform: translateY(0);
}

.vn-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 36px;
  border-radius: 50px;
  cursor: pointer;
  border: none;
  position: relative;
  transition: all 0.4s var(--ease-spring);
}

.vn-btn-primary {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  color: white;
  box-shadow: 0 4px 24px var(--lib-blue-glow);
}
.vn-btn-primary:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px var(--lib-blue-glow);
}

.vn-btn-secondary {
  background: transparent;
  color: var(--lib-text-muted);
  border: 2px solid var(--lib-border-hover);
  display: flex;
  align-items: center;
  gap: 10px;
}
.vn-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vn-btn-icon { font-size: 1.2rem; }

.vn-coming-soon {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: var(--lib-gold);
  color: var(--lib-bg-deep);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   LIBRARY MAIN VIEW
   ══════════════════════════════════════════════════════════════════════ */
.library-main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding-top: var(--nav-height);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.library-main.visible {
  opacity: 1;
}

/* ─── Library Header ──────────────────────────────────────────────── */
.library-header {
  background: linear-gradient(180deg, rgba(26, 22, 16, 0.95), rgba(18, 14, 10, 0.9));
  border-bottom: 1px solid var(--lib-border);
  padding: 32px 0;
  backdrop-filter: blur(12px);
}

.library-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.institute-crest {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 12px var(--lib-blue-glow));
  animation: crestPulse 3s ease-in-out infinite;
}

@keyframes crestPulse {
  0%, 100% { filter: drop-shadow(0 0 12px var(--lib-blue-glow)); }
  50% { filter: drop-shadow(0 0 20px rgba(91, 155, 213, 0.6)); }
}

.institute-name {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  color: var(--lib-blue-soft);
  letter-spacing: 1px;
}

.institute-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--lib-text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 4px;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.header-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--lib-border-hover);
  background: var(--lib-bg-card);
  color: var(--lib-text);
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-btn:hover {
  background: rgba(91, 155, 213, 0.15);
  border-color: var(--lib-blue);
  color: var(--lib-blue-soft);
}

.header-btn-ghost {
  background: transparent;
  border: 1px solid var(--lib-border);
}

/* ─── Library Room ────────────────────────────────────────────────── */
.library-room {
  position: relative;
  min-height: calc(100vh - var(--nav-height));
  padding: 48px 0 80px;
}

.library-bg {
  position: fixed;
  inset: 0;
  background-image: url('img/library_bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: brightness(0.2) saturate(0.8) blur(3px);
  z-index: -2;
}

.library-ambient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(91, 155, 213, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 60%, rgba(223, 184, 88, 0.04) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}

/* ─── Shelves Container ───────────────────────────────────────────── */
.shelves-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* ─── Individual Bookshelf ────────────────────────────────────────── */
.bookshelf {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}

.bookshelf.revealed {
  opacity: 1;
  transform: translateY(0);
}

.shelf-header {
  margin-bottom: 20px;
}

.shelf-label-plate {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shelf-icon {
  font-size: 1.5rem;
}

.shelf-label {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--lib-parchment);
  letter-spacing: 1px;
}

.shelf-desc {
  font-size: 0.85rem;
  color: var(--lib-text-dim);
  margin-top: 4px;
  padding-left: 40px;
}

/* ─── Shelf Rack (Wood + Books) ───────────────────────────────────── */
.shelf-rack {
  position: relative;
  background: linear-gradient(180deg, var(--lib-wood-dark), rgba(26, 22, 16, 0.6));
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(140, 111, 78, 0.2);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.3),
    inset 0 2px 0 rgba(140, 111, 78, 0.15);
}

.shelf-wood {
  height: 16px;
  background: linear-gradient(180deg, var(--lib-wood-light), var(--lib-wood-mid), var(--lib-wood-dark));
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
}

.shelf-wood-top {
  border-radius: 12px 12px 0 0;
  border-bottom: 2px solid rgba(0,0,0,0.2);
}

.shelf-wood-bottom {
  border-radius: 0 0 12px 12px;
  border-top: 1px solid rgba(168, 135, 95, 0.3);
  height: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ─── Books Row ───────────────────────────────────────────────────── */
.books-row {
  display: flex;
  gap: 0;
  padding: 24px 32px 16px;
  min-height: 200px;
  align-items: flex-end;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--lib-wood-mid) transparent;
}

/* ─── Individual Book Spine ───────────────────────────────────────── */
.book-spine {
  flex-shrink: 0;
  width: 56px;
  height: 180px;
  border-radius: 4px 6px 6px 4px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s ease;
  transform-origin: bottom center;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.4), inset -2px 0 4px rgba(0,0,0,0.2);
}

.book-spine:hover {
  transform: translateY(-20px) rotate(-2deg);
  box-shadow: 4px 8px 20px rgba(0,0,0,0.5), 0 0 20px var(--lib-gold-glow);
  z-index: 10;
}

.book-spine::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
}

.book-spine-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--lib-cream);
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 150px;
  padding: 8px 2px;
}

.book-spine-decoration {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--lib-gold);
  opacity: 0.5;
  border-radius: 1px;
}

.book-spine-decoration::after {
  content: '';
  position: absolute;
  bottom: -170px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--lib-gold);
  opacity: 0.5;
  border-radius: 1px;
}

/* Book color variations */
.book-color-red     { background: linear-gradient(135deg, #8b3a3a, #6b2020); }
.book-color-blue    { background: linear-gradient(135deg, #3a5a8b, #1e3a5c); }
.book-color-green   { background: linear-gradient(135deg, #3a6b3a, #1e4a2a); }
.book-color-brown   { background: linear-gradient(135deg, #6b5530, #4a3a1e); }
.book-color-purple  { background: linear-gradient(135deg, #5a3a7a, #3a1e5a); }
.book-color-gold    { background: linear-gradient(135deg, #8b7a3a, #6b5a20); }
.book-color-teal    { background: linear-gradient(135deg, #3a7b7b, #1e5a5a); }
.book-color-navy    { background: linear-gradient(135deg, #2a3a6b, #1a2a4a); }

/* ─── Book Placeholder (Coming Soon) ──────────────────────────────── */
.book-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 160px;
  color: var(--lib-text-dim);
  font-size: 0.85rem;
  font-style: italic;
}

.placeholder-icon {
  font-size: 2rem;
  opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════════════
   BOOK READER OVERLAY
   ══════════════════════════════════════════════════════════════════════ */
.book-reader {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(5, 5, 10, 0.92);
  backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.book-reader.visible {
  opacity: 1;
}

.reader-chrome {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1e1a14, #16120c);
  border: 1px solid var(--lib-border-hover);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6), 0 0 60px var(--lib-gold-glow);
  transform: scale(0.95);
  transition: transform 0.4s var(--ease-spring);
}

.book-reader.visible .reader-chrome {
  transform: scale(1);
}

.reader-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(26, 22, 16, 0.95);
  border-bottom: 1px solid var(--lib-border);
}

.reader-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--lib-border);
  background: transparent;
  color: var(--lib-text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}
.reader-close:hover {
  background: rgba(199, 80, 80, 0.2);
  border-color: var(--lib-red);
  color: var(--lib-red);
}

.reader-title-bar {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reader-book-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--lib-parchment);
}

.reader-page-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lib-text-dim);
}

.reader-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.reader-nav {
  display: none !important; /* Hide navigation buttons in vertical scroll view */
}

.reader-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 40px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--lib-wood-mid) transparent;
}
.reader-content-area:focus {
  outline: none;
}

.reader-page {
  max-width: 640px;
  margin: 0 auto;
  animation: pageFlip 0.4s var(--ease-out-expo);
}

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

/* ─── Reader Typography ───────────────────────────────────────────── */
.reader-page h2,
.reader-page h3 {
  font-family: var(--font-heading);
  color: var(--lib-gold);
  margin: 32px 0 16px;
}

.reader-page h2 {
  font-size: 1.6rem;
  text-align: center;
}

.reader-page h3 {
  font-size: 1.2rem;
}

.reader-page p {
  font-family: var(--font-reading);
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--lib-parchment-dark);
  margin-bottom: 20px;
  text-indent: 2em;
}

.reader-page p:first-child {
  text-indent: 0;
}

.reader-page .scene-break {
  border: none;
  text-align: center;
  margin: 32px auto;
  max-width: 200px;
  height: auto;
}

.reader-page .scene-break::before {
  content: '✦ ✦ ✦';
  display: block;
  color: var(--lib-gold);
  font-size: 1rem;
  letter-spacing: 8px;
  opacity: 0.5;
}

.reader-page strong {
  color: var(--lib-text-bright);
  font-weight: 600;
}

/* Title page styling */
.reader-page .book-title-page {
  text-align: center;
  padding: 40px 0;
}

.reader-page .book-title-page h2 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.reader-page .book-title-page .book-series {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lib-text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.reader-page .book-title-page .book-meta {
  font-size: 0.9rem;
  color: var(--lib-text-muted);
  margin-bottom: 8px;
  text-indent: 0;
}

.reader-page .book-title-page .book-note {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--lib-text-dim);
  margin-top: 24px;
  text-indent: 0;
  border-top: 1px solid var(--lib-border);
  padding-top: 20px;
}

/* Cast page styling */
.reader-page .cast-list {
  list-style: none;
  padding: 0;
}

.reader-page .cast-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--lib-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reader-page .cast-list li:last-child {
  border-bottom: none;
}

.reader-page .cast-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--lib-gold);
}

.reader-page .cast-title {
  font-size: 0.9rem;
  color: var(--lib-text);
  font-style: italic;
}

.reader-page .cast-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--lib-text-dim);
}

/* ─── Book Illustrations (inline images) ─────────────────────────── */
.reader-page .book-illustration {
  margin: 1.8rem 0;
  text-align: center;
}

.reader-page .book-illustration img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), border-color 0.3s ease, box-shadow 0.3s ease;
}

.reader-page .book-illustration img:hover {
  transform: scale(1.015);
  border-color: var(--lib-gold);
  box-shadow: 0 12px 36px rgba(223, 184, 88, 0.15), 0 10px 30px rgba(0,0,0,0.6);
}

.reader-page .book-illustration-caption {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--lib-text-dim);
  line-height: 1.4;
}

/* ─── Reader Footer / Progress ────────────────────────────────────── */
.reader-footer {
  padding: 0 24px 12px;
}

.reader-progress {
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

.reader-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--lib-blue-deep), var(--lib-blue));
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ─── BGM Controls ────────────────────────────────────────────────── */
.bgm-player-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid rgba(91, 155, 213, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  margin-right: 12px;
  transition: all 0.3s ease;
}

.bgm-player-container:hover {
  border-color: rgba(91, 155, 213, 0.5);
  background: rgba(10, 12, 20, 0.85);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bgm-btn {
  background: none;
  border: none;
  color: var(--lib-blue-soft);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

.bgm-btn:hover {
  color: var(--lib-cream);
  transform: scale(1.1);
}

.bgm-slider-wrapper {
  display: flex;
  align-items: center;
  width: 80px;
  transition: width 0.3s ease;
}

.bgm-volume-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(223, 184, 88, 0.2);
  outline: none;
  cursor: pointer;
  transition: background 0.3s;
}

.bgm-volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: transparent;
}

.bgm-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--lib-gold);
  cursor: pointer;
  margin-top: -4px;
  box-shadow: 0 0 6px rgba(223, 184, 88, 0.8);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.bgm-volume-slider::-webkit-slider-thumb:hover {
  background: var(--lib-cream);
  transform: scale(1.2);
}

.bgm-volume-slider::-moz-range-thumb {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--lib-gold);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px rgba(223, 184, 88, 0.8);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.bgm-volume-slider::-moz-range-thumb:hover {
  background: var(--lib-cream);
  transform: scale(1.2);
}

/* ─── Table of Contents Panel ─────────────────────────────────────── */
.reader-toc-btn {
  background: transparent;
  border: 1px solid var(--lib-border);
  color: var(--lib-text-muted);
  font-size: 1.1rem;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reader-toc-btn:hover {
  color: var(--lib-gold);
  border-color: var(--lib-gold);
  background: rgba(223, 184, 88, 0.08);
}

.reader-toc-btn.active {
  color: var(--lib-gold);
  border-color: var(--lib-gold);
  background: rgba(223, 184, 88, 0.12);
}

.reader-toc-panel {
  position: absolute;
  top: 56px;
  right: 12px;
  width: 320px;
  max-height: 60vh;
  background: var(--lib-bg-dark);
  border: 1px solid var(--lib-border-hover);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 100;
  overflow: hidden;
  animation: tocSlideIn 0.25s var(--ease-out-expo);
}

@keyframes tocSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reader-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--lib-border);
}

.reader-toc-header h3 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-parchment);
  margin: 0;
}

.reader-toc-close {
  background: transparent;
  border: none;
  color: var(--lib-text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.reader-toc-close:hover {
  color: var(--lib-parchment);
}

.reader-toc-list {
  overflow-y: auto;
  max-height: calc(60vh - 50px);
  padding: 8px;
}

.reader-toc-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.reader-toc-item:hover {
  background: rgba(223, 184, 88, 0.08);
}

.reader-toc-item.active {
  background: rgba(223, 184, 88, 0.12);
  border-left: 3px solid var(--lib-gold);
}

.reader-toc-chapter-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--lib-gold);
  opacity: 0.7;
  min-width: 28px;
}

.reader-toc-chapter-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--lib-text);
  line-height: 1.4;
}

.reader-toc-sections {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--lib-text-dim);
  margin-left: auto;
  white-space: nowrap;
}

/* ─── Chapter Heading Dividers ────────────────────────────────────── */
.chapter-heading {
  text-align: center;
  padding: 3rem 1rem 2rem;
  margin: 2rem 0;
  border-top: 1px solid var(--lib-border);
}

.chapter-heading:first-child {
  border-top: none;
  padding-top: 1rem;
}

.chapter-heading-num {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--lib-gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.4rem;
}

.chapter-heading-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--lib-parchment);
}

.chapter-heading-ornament {
  color: var(--lib-gold);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  margin-top: 0.8rem;
  opacity: 0.5;
}

/* ToC responsive */
@media (max-width: 600px) {
  .reader-toc-panel {
    width: calc(100vw - 24px);
    right: 12px;
    left: 12px;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   ROOM SYSTEM — Multi-room navigation
   ══════════════════════════════════════════════════════════════════════ */

/* Room base — hidden by default */
.room {
  position: relative;
  min-height: calc(100vh - var(--nav-height) - 120px);
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
  display: none;
}

.room.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Room breadcrumb in header */
.room-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lib-blue-soft);
  background: rgba(91, 155, 213, 0.1);
  border: 1px solid rgba(91, 155, 213, 0.2);
  padding: 8px 16px;
  border-radius: 8px;
  letter-spacing: 1px;
}

.breadcrumb-icon {
  font-size: 1rem;
}

/* ─── Front Desk Room ─────────────────────────────────────────────── */
.front-desk-scene {
  position: relative;
  min-height: calc(100vh - var(--nav-height) - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 48px 24px 48px;
  overflow: hidden;
}

/* Philomel Sprite at Desk */
.desk-sprite-container {
  position: absolute;
  bottom: -250px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: deskSpriteEnter 1s var(--ease-out-expo) 0.3s forwards;
}

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

.desk-sprite {
  height: 1100px;
  width: auto;
  image-rendering: auto;
  filter: drop-shadow(0 10px 40px rgba(0,0,0,0.6));
  animation: spriteBreath 4s ease-in-out infinite;
}

/* Desk Counter — horizontal wood bar */
.desk-counter {
  position: absolute;
  bottom: 120px;
  left: 0;
  right: 0;
  z-index: 2;
  height: 80px;
  pointer-events: none;
}

.desk-counter-surface {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg,
    var(--lib-wood-highlight) 0%,
    var(--lib-wood-light) 15%,
    var(--lib-wood-mid) 40%,
    var(--lib-wood-dark) 100%
  );
  border-top: 3px solid rgba(168, 135, 95, 0.5);
  border-bottom: 4px solid rgba(0, 0, 0, 0.4);
  box-shadow:
    0 -4px 20px rgba(0, 0, 0, 0.3),
    0 8px 30px rgba(0, 0, 0, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.08);
}

/* Interaction Area — in front of everything */
.desk-interaction {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 700px;
  margin-bottom: 20px;
}

/* Desk Dialogue Box */
.desk-dialogue-box {
  width: 100%;
  background: rgba(10, 12, 20, 0.92);
  border: 2px solid var(--lib-blue-deep);
  border-radius: 16px;
  padding: 0;
  position: relative;
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(91, 155, 213, 0.2);
  overflow: hidden;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
}

.desk-dialogue-box.visible {
  opacity: 1;
  transform: translateY(0);
}

.desk-speaker-plate {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  padding: 8px 24px;
  display: inline-block;
  border-radius: 0 0 12px 0;
}

.desk-speaker-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-cream);
  letter-spacing: 1px;
}

.desk-text-area {
  padding: 20px 28px 24px;
  min-height: 80px;
  position: relative;
}

.desk-text {
  font-family: var(--font-reading);
  font-size: 1.15rem;
  color: var(--lib-cream);
  line-height: 1.8;
  min-height: 2em;
}

.desk-next-indicator {
  position: absolute;
  bottom: 12px;
  right: 20px;
  color: var(--lib-blue);
  font-size: 1rem;
  animation: vnBounce 1s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.desk-next-indicator.visible {
  opacity: 1;
}

/* Desk Action Buttons */
.desk-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.desk-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: 50px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.4s var(--ease-spring);
  position: relative;
}

.desk-btn-icon {
  font-size: 1.2rem;
}

.desk-btn-talk {
  background: linear-gradient(135deg, var(--lib-blue-deep), var(--lib-blue));
  color: white;
  box-shadow: 0 4px 24px var(--lib-blue-glow);
}

.desk-btn-talk:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 40px var(--lib-blue-glow);
}

.desk-btn-navigate {
  background: linear-gradient(135deg, var(--lib-wood-dark), var(--lib-wood-mid));
  color: var(--lib-parchment);
  border: 1px solid rgba(168, 135, 95, 0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.desk-btn-navigate:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 20px var(--lib-gold-glow);
  border-color: var(--lib-gold);
}

.desk-btn-back {
  background: linear-gradient(135deg, #2b251e, #1a1612);
  color: #cbbba3;
  border: 1px solid rgba(203, 187, 163, 0.15);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.desk-btn-back:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 15px rgba(203, 187, 163, 0.2);
  border-color: rgba(203, 187, 163, 0.5);
  color: #e5dac9;
}

/* ─── Stacks Room Navigation ──────────────────────────────────────── */
.stacks-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 32px 0;
}

.stacks-back-btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--lib-border-hover);
  background: var(--lib-bg-card);
  color: var(--lib-text);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stacks-back-btn:hover {
  background: rgba(91, 155, 213, 0.15);
  border-color: var(--lib-blue);
  color: var(--lib-blue-soft);
  transform: translateX(-4px);
}

/* Stacks room keeps the existing library-room padding */
.room-stacks {
  padding: 0 0 80px;
}

.room-stacks .shelves-container {
  padding-top: 24px;
}

/* ══════════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════════ */
.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--lib-border);
  background: var(--lib-bg-deep);
  padding: 32px 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

.footer-bottom {
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--lib-text-dim);
}

.footer-made-with {
  color: var(--lib-blue) !important;
  opacity: 0.6;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    background: rgba(10, 12, 20, 0.96);
    backdrop-filter: blur(24px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 999;
  }
  .nav-links.open { display: flex; }
  .mobile-toggle { display: flex; }

  .vn-sprite-container { bottom: -175px; }
  .vn-sprite { height: 750px; }

  .vn-text { font-size: 1rem; }

  .vn-actions { flex-direction: column; align-items: center; }

  .library-header-inner {
    flex-direction: column;
    text-align: center;
  }

  .header-actions {
    margin-left: 0;
    justify-content: center;
  }

  .books-row {
    padding: 16px;
  }

  .book-spine {
    width: 48px;
    height: 150px;
  }

  .reader-chrome {
    width: 98%;
    max-height: 95vh;
    border-radius: 12px;
  }

  .reader-nav {
    width: 40px;
  }

  .reader-content-area {
    padding: 24px 12px;
  }

  .reader-page p {
    font-size: 0.95rem;
  }

  .desk-sprite { height: 750px; }
  .desk-sprite-container { bottom: -150px; }
  .desk-counter { bottom: 100px; height: 60px; }
  .desk-actions { flex-direction: column; align-items: center; }
  .desk-dialogue-box { margin: 0 8px 16px; }
  .front-desk-scene { padding: 24px 16px 32px; }
}

@media (max-width: 480px) {
  .vn-sprite-container { bottom: -115px; }
  .vn-sprite { height: 550px; }

  .shelf-label { font-size: 1.2rem; }

  .book-spine {
    width: 42px;
    height: 130px;
  }

  .book-spine-title {
    font-size: 0.55rem;
  }

  .desk-sprite { height: 550px; }
  .desk-sprite-container { bottom: -100px; }
  .desk-counter { bottom: 80px; height: 50px; }
  .desk-btn { padding: 14px 24px; font-size: 0.9rem; }
}

/* ─── Book Scroll Layout, Cover, and Illustration Styling ─────────── */

.reader-page-section {
  margin-bottom: 56px;
}

.book-cover-container {
  margin: 16px auto 32px;
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.book-cover-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(223, 184, 88, 0.35);
  transition: transform 0.5s ease, border-color 0.3s ease;
}

.book-cover-img:hover {
  transform: scale(1.03);
  border-color: var(--lib-gold);
}

.book-author-meta {
  text-align: center;
  font-size: 0.9rem;
  color: var(--lib-text-dim);
  margin-top: 16px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* Book illustrations */
.book-img-container {
  margin: 36px auto;
  text-align: center;
  width: 100%;
}

.book-image {
  max-width: 100%;
  max-height: 520px;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(223, 184, 88, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s var(--ease-spring), border-color 0.3s ease, box-shadow 0.3s ease;
  display: inline-block;
}

.book-image:hover {
  transform: scale(1.015);
  border-color: var(--lib-gold);
  box-shadow: 0 12px 36px rgba(223, 184, 88, 0.15), 0 10px 30px rgba(0,0,0,0.6);
}

/* Cast Grid Page (Re-designed for Portraits) */
.cast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
  margin-bottom: 24px;
}

@media (max-width: 680px) {
  .cast-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.cast-card {
  background: rgba(20, 18, 15, 0.4);
  border: 1px solid rgba(223, 184, 88, 0.15);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.cast-card:hover {
  border-color: rgba(223, 184, 88, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.cast-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--lib-gold);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  background: rgba(0,0,0,0.2);
}

.cast-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cast-card h3 {
  margin: 0 !important;
  color: var(--lib-gold);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.cast-card .cast-title {
  font-size: 0.85rem;
  color: var(--lib-cream);
  font-style: italic;
  margin: 0 !important;
  text-indent: 0 !important;
}

.cast-card .cast-meta {
  font-size: 0.75rem;
  color: var(--lib-text-dim);
  font-family: var(--font-mono);
  margin-top: 4px;
  letter-spacing: 0.2px;
}

/* Style corrections for standard title page classes in JSON */
.title-page {
  text-align: center;
  padding: 20px 0;
}
.title-page h1 {
  font-family: var(--font-title);
  color: var(--lib-gold);
  font-size: 2.5rem;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.title-page h2 {
  font-family: var(--font-heading);
  color: var(--lib-cream);
  font-size: 1.3rem;
  margin-bottom: 24px;
}
.title-page hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lib-gold), transparent);
  margin: 24px auto;
  max-width: 80%;
}
.title-page p {
  text-indent: 0 !important;
  text-align: center;
  font-size: 0.95rem;
  color: var(--lib-text-muted);
}
.title-page a {
  color: var(--lib-blue);
  text-decoration: underline;
}

.cast-page h2 {
  font-family: var(--font-title);
  color: var(--lib-gold);
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 16px;
}

/* ─── Image Lightbox Modal ────────────────────────────────────────── */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 10000; /* Above book reader */
  background-color: rgba(10, 8, 7, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 24px;
}

.image-modal.visible {
  opacity: 1;
}

.image-modal-content {
  max-width: 90%;
  max-height: 80vh;
  border-radius: 8px;
  border: 1px solid rgba(223, 184, 88, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  object-fit: contain;
}

.image-modal.visible .image-modal-content {
  transform: scale(1);
}

.image-modal-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: var(--lib-cream);
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s, transform 0.3s;
}

.image-modal-close:hover {
  color: var(--lib-gold);
  transform: scale(1.1);
}

.image-modal-caption {
  margin-top: 16px;
  color: var(--lib-cream);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* ═══════════════════════════════════════════════════════════════════
   ARTIFACTS ROOM
   ═══════════════════════════════════════════════════════════════════ */
.artifacts-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.artifacts-header {
  text-align: center;
  margin-bottom: 40px;
}

.artifacts-title {
  font-family: var(--font-title);
  color: var(--lib-gold);
  font-size: 2rem;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.artifacts-subtitle {
  color: var(--lib-text-dim);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.artifacts-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.artifact-category-card {
  background: rgba(20, 18, 15, 0.6);
  border: 1px solid rgba(223, 184, 88, 0.2);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.artifact-category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(223, 184, 88, 0.08) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.artifact-category-card:hover:not(.locked) {
  border-color: rgba(223, 184, 88, 0.5);
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(223, 184, 88, 0.1);
}

.artifact-category-card:hover:not(.locked)::before {
  opacity: 1;
}

.artifact-category-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.artifact-card-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.artifact-card-name {
  font-family: var(--font-heading);
  color: var(--lib-cream);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.artifact-card-desc {
  color: var(--lib-text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.artifact-card-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--lib-gold), #c9a84c);
  color: #1a1610;
}

.artifact-card-badge.locked-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--lib-text-dim);
}

/* ═══════════════════════════════════════════════════════════════════
   SCROLL RACK — Map Tubes on Shelf
   ═══════════════════════════════════════════════════════════════════ */
.scrolls-row {
  display: flex;
  gap: 20px;
  padding: 24px 32px 16px;
  min-height: 220px;
  align-items: flex-end;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--lib-wood-mid) transparent;
}

/* ─── Individual Scroll Tube ──────────────────────────────────────── */
.scroll-tube {
  flex-shrink: 0;
  width: 48px;
  height: 190px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s ease, filter 0.4s ease;
  transform-origin: bottom center;
}

.scroll-tube:hover {
  transform: translateY(-22px) rotate(-3deg);
  filter: brightness(1.15);
  z-index: 10;
}

/* Endcaps — the wooden knobs at top and bottom of the scroll tube */
.scroll-tube-endcap {
  width: 44px;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(180deg, #c9a84c, #8b7233, #6b5520);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255, 220, 140, 0.3);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.scroll-tube-endcap-top {
  border-radius: 6px 6px 3px 3px;
  width: 46px;
}

.scroll-tube-endcap-bottom {
  border-radius: 3px 3px 6px 6px;
  width: 46px;
}

/* Tube body — the parchment/leather cylinder */
.scroll-tube-body {
  flex: 1;
  width: 36px;
  background: linear-gradient(135deg, #d4c4a0, #b8a57a, #9e8c64, #b8a57a);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    3px 3px 10px rgba(0,0,0,0.4),
    inset -3px 0 6px rgba(0,0,0,0.15),
    inset 3px 0 6px rgba(255,255,255,0.08);
  overflow: hidden;
}

/* Parchment texture overlay */
.scroll-tube-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 6px,
      rgba(0,0,0,0.03) 6px,
      rgba(0,0,0,0.03) 7px
    );
  border-radius: 4px;
}

/* Subtle highlight strip */
.scroll-tube-body::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}

.scroll-tube-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 600;
  color: #4a3a20;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.15);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 140px;
  padding: 4px 2px;
  position: relative;
  z-index: 1;
}

/* Hover glow on tube */
.scroll-tube:hover .scroll-tube-body {
  box-shadow:
    3px 3px 10px rgba(0,0,0,0.4),
    inset -3px 0 6px rgba(0,0,0,0.15),
    inset 3px 0 6px rgba(255,255,255,0.08),
    0 0 16px rgba(223, 184, 88, 0.25);
}

.scroll-tube:hover .scroll-tube-endcap {
  box-shadow:
    0 2px 6px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255, 220, 140, 0.3),
    0 0 12px rgba(223, 184, 88, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   MAP VIEWER OVERLAY
   ═══════════════════════════════════════════════════════════════════ */
.map-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.map-viewer.visible {
  opacity: 1;
}

.map-viewer-chrome {
  width: 95vw;
  max-width: 1400px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(26, 22, 16, 0.95);
  border: 1px solid rgba(223, 184, 88, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.map-viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(223, 184, 88, 0.15);
}

.map-viewer-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--lib-cream);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.map-viewer-close:hover {
  background: rgba(255, 80, 80, 0.3);
  border-color: rgba(255, 80, 80, 0.5);
}

.map-viewer-title {
  font-family: var(--font-heading);
  color: var(--lib-gold);
  font-size: 1.1rem;
  font-weight: 600;
}

.map-viewer-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 0;
}

.map-viewer-img {
  max-width: 100%;
  max-height: calc(95vh - 80px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease;
}

@media (max-width: 600px) {
  .scrolls-row {
    padding: 16px 20px 12px;
    gap: 14px;
    min-height: 180px;
  }
  .scroll-tube {
    width: 40px;
    height: 160px;
  }
  .scroll-tube-body {
    width: 30px;
  }
  .scroll-tube-endcap,
  .scroll-tube-endcap-top,
  .scroll-tube-endcap-bottom {
    width: 38px;
  }
  .artifacts-categories {
    grid-template-columns: 1fr;
  }
  .map-viewer-chrome {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RELIC SHELF — Fiend Artifact Jars
   ═══════════════════════════════════════════════════════════════════ */
.relics-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}

.relics-header {
  text-align: center;
  margin-bottom: 48px;
}

.relics-title {
  font-family: var(--font-title);
  color: var(--lib-gold);
  font-size: 2rem;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.relics-subtitle {
  color: var(--lib-text-dim);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-style: italic;
}

.relics-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px;
  justify-items: center;
}

/* ─── Individual Jar ──────────────────────────────────────────────── */
.relic-jar {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring);
  position: relative;
}

.relic-jar:hover {
  transform: translateY(-8px);
}

.relic-jar-glass {
  position: relative;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Jar Lid */
.relic-jar-lid {
  width: 90px;
  height: 18px;
  background: linear-gradient(180deg, #8b7355 0%, #6b5a42 40%, #4a3f2e 100%);
  border-radius: 6px 6px 2px 2px;
  border: 1px solid rgba(223, 184, 88, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 2;
}

.relic-jar-lid::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  width: 24px;
  height: 8px;
  background: linear-gradient(180deg, #9b8365, #6b5a42);
  border-radius: 4px 4px 0 0;
  border: 1px solid rgba(223, 184, 88, 0.2);
  border-bottom: none;
}

/* Jar Body */
.relic-jar-body {
  width: 84px;
  height: 130px;
  background: linear-gradient(135deg,
    rgba(180, 200, 220, 0.12) 0%,
    rgba(140, 160, 190, 0.08) 30%,
    rgba(100, 120, 150, 0.06) 70%,
    rgba(180, 200, 220, 0.1) 100%
  );
  border: 1px solid rgba(180, 200, 220, 0.2);
  border-radius: 4px 4px 12px 12px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Crystal inside jar */
.relic-jar-crystal {
  width: 36px;
  height: 48px;
  background: var(--crystal-color, #4a1a6b);
  clip-path: polygon(50% 0%, 85% 25%, 100% 60%, 80% 100%, 20% 100%, 0% 60%, 15% 25%);
  box-shadow: 0 0 20px var(--crystal-glow, rgba(120, 40, 180, 0.6));
  animation: crystalPulse 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.relic-jar:hover .relic-jar-crystal {
  animation: crystalPulseIntense 1.5s ease-in-out infinite;
}

@keyframes crystalPulse {
  0%, 100% {
    box-shadow: 0 0 15px var(--crystal-glow, rgba(120, 40, 180, 0.4));
    filter: brightness(0.9);
  }
  50% {
    box-shadow: 0 0 30px var(--crystal-glow, rgba(120, 40, 180, 0.7)), 0 0 60px var(--crystal-glow, rgba(120, 40, 180, 0.3));
    filter: brightness(1.2);
  }
}

@keyframes crystalPulseIntense {
  0%, 100% {
    box-shadow: 0 0 25px var(--crystal-glow, rgba(120, 40, 180, 0.7));
    filter: brightness(1.1);
  }
  50% {
    box-shadow: 0 0 45px var(--crystal-glow, rgba(120, 40, 180, 0.9)), 0 0 80px var(--crystal-glow, rgba(120, 40, 180, 0.4));
    filter: brightness(1.4);
  }
}

/* Glass shimmer effect */
.relic-jar-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.06) 45%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 55%,
    transparent 70%
  );
  pointer-events: none;
}

/* Jar Base */
.relic-jar-base {
  width: 96px;
  height: 12px;
  background: linear-gradient(180deg, #4a3f2e 0%, #3a2f1e 100%);
  border-radius: 0 0 8px 8px;
  border: 1px solid rgba(223, 184, 88, 0.15);
  border-top: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Lock icon */
.relic-jar-lock {
  font-size: 1.4rem;
  margin-top: 8px;
  filter: drop-shadow(0 2px 6px rgba(223, 184, 88, 0.4));
  transition: transform 0.3s ease;
}

.relic-jar:hover .relic-jar-lock {
  animation: lockShake 0.6s ease-in-out;
}

@keyframes lockShake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(5deg); }
}

/* Jar label */
.relic-jar-label {
  font-family: var(--font-heading);
  color: var(--lib-cream);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 10px;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Warning text */
.relic-jar-warning {
  font-family: var(--font-body);
  color: rgba(255, 160, 60, 0.6);
  font-size: 0.7rem;
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.relic-jar:hover .relic-jar-warning {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════
   RELIC VIEWER OVERLAY — Parchment Style
   ═══════════════════════════════════════════════════════════════════ */
.relic-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.relic-viewer.visible {
  opacity: 1;
}

.relic-viewer-chrome {
  width: 95vw;
  max-width: 800px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(26, 22, 16, 0.95);
  border: 1px solid rgba(223, 184, 88, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s var(--ease-out-expo);
}

.relic-viewer.visible .relic-viewer-chrome {
  transform: scale(1) translateY(0);
}

.relic-viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(223, 184, 88, 0.15);
}

.relic-viewer-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--lib-cream);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.relic-viewer-close:hover {
  background: rgba(255, 80, 80, 0.3);
  border-color: rgba(255, 80, 80, 0.5);
}

.relic-viewer-title {
  font-family: var(--font-heading);
  color: var(--lib-gold);
  font-size: 1.1rem;
  font-weight: 600;
}

.relic-viewer-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ─── Parchment Inner Content ─────────────────────────────────────── */
.relic-parchment {
  padding: 32px 28px 48px;
}

.relic-illustration-frame {
  text-align: center;
  margin-bottom: 32px;
}

.relic-illustration {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 8px;
  border: 3px solid rgba(160, 130, 80, 0.4);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.6),
    inset 0 0 40px rgba(160, 130, 80, 0.1);
  filter: sepia(0.15) contrast(1.05);
}

.relic-illustration-caption {
  font-family: var(--font-body);
  color: var(--lib-text-dim);
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 12px;
  letter-spacing: 0.3px;
}

.relic-lore-content {
  max-width: 640px;
  margin: 0 auto;
}

.relic-lore-title {
  font-family: var(--font-title);
  color: var(--lib-gold);
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.relic-lore-divider {
  text-align: center;
  color: rgba(223, 184, 88, 0.5);
  font-size: 0.9rem;
  margin: 16px 0 24px;
  letter-spacing: 4px;
}

.relic-lore-section {
  margin-bottom: 28px;
}

.relic-section-heading {
  font-family: var(--font-heading);
  color: rgba(223, 184, 88, 0.85);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(223, 184, 88, 0.15);
}

.relic-lore-section p {
  font-family: var(--font-reading);
  color: var(--lib-parchment);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 12px;
}

.relic-lore-section p:last-child {
  margin-bottom: 0;
}

/* Expedition Details Grid */
.relic-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.relic-detail-item {
  background: rgba(223, 184, 88, 0.05);
  border: 1px solid rgba(223, 184, 88, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
}

.relic-detail-label {
  display: block;
  font-family: var(--font-body);
  color: var(--lib-text-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.relic-detail-value {
  font-family: var(--font-heading);
  color: var(--lib-cream);
  font-size: 0.95rem;
  font-weight: 600;
}

.relic-squad-section {
  background: rgba(223, 184, 88, 0.05);
  border: 1px solid rgba(223, 184, 88, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
}

.relic-squad-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.relic-squad-list li {
  font-family: var(--font-heading);
  color: var(--lib-cream);
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(223, 184, 88, 0.08);
  border: 1px solid rgba(223, 184, 88, 0.15);
  padding: 4px 14px;
  border-radius: 20px;
}

/* Ability Badge */
.relic-ability-badge {
  display: inline-block;
  font-family: var(--font-heading);
  color: #e0d0ff;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(120, 40, 180, 0.25), rgba(80, 20, 140, 0.15));
  border: 1px solid rgba(120, 40, 180, 0.35);
  padding: 8px 24px;
  border-radius: 24px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px rgba(120, 40, 180, 0.15);
}

/* Danger Value */
.relic-danger-value {
  color: #ff6b6b !important;
  text-shadow: 0 0 8px rgba(255, 80, 80, 0.3);
}

.relic-detail-danger {
  border-color: rgba(255, 80, 80, 0.2) !important;
  background: rgba(255, 80, 80, 0.05) !important;
}

/* Footer */
.relic-lore-footer {
  text-align: center;
  font-family: var(--font-body);
  color: var(--lib-text-dim);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 12px 0;
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .relics-shelf {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
  }
  .relic-jar-body {
    width: 68px;
    height: 105px;
  }
  .relic-jar-lid { width: 74px; height: 15px; }
  .relic-jar-base { width: 80px; height: 10px; }
  .relic-jar-crystal {
    width: 28px;
    height: 38px;
  }
  .relic-viewer-chrome {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .relic-parchment {
    padding: 20px 16px 32px;
  }
  .relic-detail-grid {
    grid-template-columns: 1fr;
  }
  .relic-illustration {
    max-height: 280px;
  }
  .relic-lore-title {
    font-size: 1.4rem;
  }
}
