/**
 * Arcane Library Styles
 * 
 * Styling for The Grand Library - browsing Lore Master sites
 * like scrolls in an arcane library or video game inventory
 */

/* Arcane Library Container */
.arcane-library {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  padding: 40px 20px;
  padding-top: 40px;
  margin-top: 0;
  position: relative;
  overflow: hidden;
  /* LO-TECH: Desaturated with wobbling color palette */
  animation: libraryColorWobble 60s ease-in-out infinite;
}

.arcane-library::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Lab Fog Effects */
.arcane-library::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 60%, rgba(118, 75, 162, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
  animation: fogDrift 25s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes fogDrift {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }
  33% {
    transform: translate(20px, -15px) scale(1.1);
    opacity: 0.7;
  }
  66% {
    transform: translate(-15px, 10px) scale(0.95);
    opacity: 0.5;
  }
}

/* Tracers - Particle Effects */

/* Tracer Particles */
.tracer-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.tracer-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(102, 126, 234, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(102, 126, 234, 0.6),
              0 0 12px rgba(102, 126, 234, 0.4);
  animation: tracerFloat 15s ease-in-out infinite;
}

.tracer-particle:nth-child(2) {
  background: rgba(118, 75, 162, 0.8);
  box-shadow: 0 0 6px rgba(118, 75, 162, 0.6),
              0 0 12px rgba(118, 75, 162, 0.4);
  animation-delay: -3s;
  animation-duration: 18s;
}

.tracer-particle:nth-child(3) {
  background: rgba(102, 126, 234, 0.6);
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.5),
              0 0 16px rgba(102, 126, 234, 0.3);
  animation-delay: -6s;
  animation-duration: 20s;
}

.tracer-particle:nth-child(4) {
  background: rgba(118, 75, 162, 0.7);
  box-shadow: 0 0 6px rgba(118, 75, 162, 0.6),
              0 0 12px rgba(118, 75, 162, 0.4);
  animation-delay: -9s;
  animation-duration: 16s;
}

.tracer-particle:nth-child(5) {
  background: rgba(102, 126, 234, 0.5);
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.4),
              0 0 16px rgba(102, 126, 234, 0.2);
  animation-delay: -12s;
  animation-duration: 22s;
}

@keyframes tracerFloat {
  0% {
    transform: translate(0, 100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(var(--tracer-x, 0) * 1vw), -100px) scale(1.5);
    opacity: 0;
  }
}

/* Bubbling Chemical Effects */
.bubbling-chemicals {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
  margin: 0;
  padding: 0;
}

.chemical-bubble {
  position: absolute;
  bottom: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(102, 126, 234, 0.6), rgba(118, 75, 162, 0.4));
  border: 1px solid rgba(102, 126, 234, 0.3);
  box-shadow: 
    0 0 10px rgba(102, 126, 234, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
  animation: bubbleRise 12s ease-in infinite;
}

.chemical-bubble:nth-child(2) {
  left: 15%;
  width: 15px;
  height: 15px;
  animation-delay: -1.5s;
  animation-duration: 14s;
}

.chemical-bubble:nth-child(3) {
  left: 35%;
  width: 25px;
  height: 25px;
  animation-delay: -3s;
  animation-duration: 13s;
}

.chemical-bubble:nth-child(4) {
  left: 55%;
  width: 18px;
  height: 18px;
  animation-delay: -4.5s;
  animation-duration: 15s;
}

.chemical-bubble:nth-child(5) {
  left: 75%;
  width: 22px;
  height: 22px;
  animation-delay: -6s;
  animation-duration: 11.5s;
}

.chemical-bubble:nth-child(6) {
  left: 90%;
  width: 16px;
  height: 16px;
  animation-delay: -2s;
  animation-duration: 16s;
}

@keyframes bubbleRise {
  0% {
    transform: translateY(0) scale(0.5);
    opacity: 0.8;
  }
  10% {
    opacity: 1;
    transform: translateY(-10vh) scale(0.7);
  }
  50% {
    transform: translateY(-50vh) scale(1.2);
    opacity: 0.9;
  }
  90% {
    opacity: 0.7;
    transform: translateY(-90vh) scale(0.8);
  }
  100% {
    transform: translateY(-100vh) scale(0.4);
    opacity: 0;
  }
}

/* Additional Fog Layers */
.fog-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 60%);
  animation: fogMove1 30s ease-in-out infinite;
  opacity: 0.5;
}

.fog-layer:nth-child(2) {
  background: radial-gradient(ellipse at 50% 50%, rgba(118, 75, 162, 0.06) 0%, transparent 70%);
  animation: fogMove2 35s ease-in-out infinite;
  animation-delay: -10s;
}

@keyframes fogMove1 {
  0%, 100% {
    background: radial-gradient(ellipse at 50% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 60%);
    opacity: 0.5;
    transform: translate(0, 0);
  }
  25% {
    background: radial-gradient(ellipse at 60% 40%, rgba(102, 126, 234, 0.1) 0%, transparent 60%);
    opacity: 0.6;
    transform: translate(10px, -10px);
  }
  50% {
    background: radial-gradient(ellipse at 40% 60%, rgba(102, 126, 234, 0.06) 0%, transparent 60%);
    opacity: 0.4;
    transform: translate(-10px, 10px);
  }
  75% {
    background: radial-gradient(ellipse at 55% 45%, rgba(102, 126, 234, 0.09) 0%, transparent 60%);
    opacity: 0.55;
    transform: translate(5px, -5px);
  }
}

@keyframes fogMove2 {
  0%, 100% {
    background: radial-gradient(ellipse at 50% 50%, rgba(118, 75, 162, 0.06) 0%, transparent 70%);
    opacity: 0.5;
    transform: translate(0, 0);
  }
  25% {
    background: radial-gradient(ellipse at 45% 55%, rgba(118, 75, 162, 0.08) 0%, transparent 70%);
    opacity: 0.6;
    transform: translate(-8px, 8px);
  }
  50% {
    background: radial-gradient(ellipse at 55% 45%, rgba(118, 75, 162, 0.05) 0%, transparent 70%);
    opacity: 0.4;
    transform: translate(8px, -8px);
  }
  75% {
    background: radial-gradient(ellipse at 48% 52%, rgba(118, 75, 162, 0.07) 0%, transparent 70%);
    opacity: 0.55;
    transform: translate(-3px, 3px);
  }
}

.arcane-library > * {
  position: relative;
  z-index: 2;
}

/* Ensure library header and content are above bubbles */
.library-header,
.scrolls-shelf,
.library-filters {
  position: relative;
  z-index: 2;
}

/* Library Header */
.library-header {
  text-align: center;
  margin-top: 0;
  margin-bottom: 50px;
  padding-top: 0;
  color: #fff;
}

.library-header h1 {
  font-size: 3.5rem;
  margin: 0 0 20px 0;
  text-shadow: 0 0 20px rgba(102, 126, 234, 0.5),
               0 0 40px rgba(118, 75, 162, 0.3);
  background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.library-header p {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 700px;
  margin: 0 auto;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Scroll Cards (Tenant Cards) */
.scrolls-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 0;
  position: relative;
}

/* Lab Experiment Glow Reflections - Colored Bloom Effect */
.scrolls-shelf::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.8) 0%, rgba(102, 126, 234, 0.5) 30%, rgba(102, 126, 234, 0.2) 60%, transparent 80%);
  border-radius: 50%;
  filter: blur(60px) brightness(1.5);
  box-shadow: 
    0 0 80px rgba(102, 126, 234, 0.6),
    0 0 120px rgba(102, 126, 234, 0.4),
    inset 0 0 60px rgba(102, 126, 234, 0.3);
  left: -200px;
  top: 20%;
  z-index: 0;
  animation: glowPulse1 8s ease-in-out infinite;
  pointer-events: none;
}

.scrolls-shelf::after {
  content: '';
  position: absolute;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.75) 0%, rgba(118, 75, 162, 0.45) 30%, rgba(118, 75, 162, 0.2) 60%, transparent 80%);
  border-radius: 50%;
  filter: blur(55px) brightness(1.4);
  box-shadow: 
    0 0 70px rgba(118, 75, 162, 0.5),
    0 0 110px rgba(118, 75, 162, 0.3),
    inset 0 0 50px rgba(118, 75, 162, 0.25);
  right: -175px;
  bottom: 15%;
  z-index: 0;
  animation: glowPulse2 10s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse1 {
  0%, 100% {
    opacity: 0.7;
    transform: scale(1) translate(0, 0);
    filter: blur(60px) brightness(1.5);
  }
  50% {
    opacity: 1;
    transform: scale(1.3) translate(30px, -20px);
    filter: blur(70px) brightness(1.8);
  }
}

@keyframes glowPulse2 {
  0%, 100% {
    opacity: 0.65;
    transform: scale(1) translate(0, 0);
    filter: blur(55px) brightness(1.4);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.25) translate(-20px, 25px);
    filter: blur(65px) brightness(1.7);
  }
}

.scroll-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 16px;
  padding: 0;
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
              0 0 0 0 rgba(102, 126, 234, 0);
  transform: translateY(0) scale(1);
  z-index: 1;
}

/* Random glow reflections behind cards - Colored Bloom */
.scroll-card:nth-child(3n+1)::before {
  content: '';
  position: absolute;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.7) 0%, rgba(102, 126, 234, 0.4) 40%, rgba(102, 126, 234, 0.15) 70%, transparent 90%);
  border-radius: 50%;
  filter: blur(40px) brightness(1.6);
  box-shadow: 
    0 0 60px rgba(102, 126, 234, 0.5),
    0 0 100px rgba(102, 126, 234, 0.3),
    inset 0 0 40px rgba(102, 126, 234, 0.2);
  left: -125px;
  top: 50%;
  transform: translateY(-50%);
  z-index: -1;
  animation: cardGlow1 12s ease-in-out infinite;
  pointer-events: none;
}

.scroll-card:nth-child(3n+2)::before {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.65) 0%, rgba(118, 75, 162, 0.35) 40%, rgba(118, 75, 162, 0.15) 70%, transparent 90%);
  border-radius: 50%;
  filter: blur(35px) brightness(1.5);
  box-shadow: 
    0 0 50px rgba(118, 75, 162, 0.4),
    0 0 90px rgba(118, 75, 162, 0.25),
    inset 0 0 35px rgba(118, 75, 162, 0.15);
  right: -110px;
  top: 30%;
  z-index: -1;
  animation: cardGlow2 14s ease-in-out infinite;
  pointer-events: none;
}

/* Use a wrapper approach for cards that need both ::before glow and ::after border */
.scroll-card:nth-child(4n+3) {
  position: relative;
}

.scroll-card:nth-child(4n+3) .scroll-content::before {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.6) 0%, rgba(102, 126, 234, 0.3) 40%, rgba(102, 126, 234, 0.12) 70%, transparent 90%);
  border-radius: 50%;
  filter: blur(45px) brightness(1.5);
  box-shadow: 
    0 0 55px rgba(102, 126, 234, 0.45),
    0 0 95px rgba(102, 126, 234, 0.25),
    inset 0 0 38px rgba(102, 126, 234, 0.15);
  left: -140px;
  bottom: -50px;
  z-index: -1;
  animation: cardGlow3 11s ease-in-out infinite;
  pointer-events: none;
}

.scroll-card:nth-child(5n+4)::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.6) 0%, rgba(118, 75, 162, 0.3) 40%, rgba(118, 75, 162, 0.15) 70%, transparent 90%);
  border-radius: 50%;
  filter: blur(38px) brightness(1.5);
  box-shadow: 
    0 0 45px rgba(118, 75, 162, 0.4),
    0 0 85px rgba(118, 75, 162, 0.25),
    inset 0 0 32px rgba(118, 75, 162, 0.15);
  right: -100px;
  bottom: 20%;
  z-index: -1;
  animation: cardGlow4 13s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cardGlow1 {
  0%, 100% {
    opacity: 0.7;
    transform: translateY(-50%) scale(1);
    filter: blur(40px) brightness(1.6);
  }
  50% {
    opacity: 1;
    transform: translateY(-50%) scale(1.4) translateX(15px);
    filter: blur(50px) brightness(2);
  }
}

@keyframes cardGlow2 {
  0%, 100% {
    opacity: 0.65;
    transform: scale(1);
    filter: blur(35px) brightness(1.5);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.3) translateX(-15px) translateY(-8px);
    filter: blur(45px) brightness(1.9);
  }
}

@keyframes cardGlow3 {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
    filter: blur(45px) brightness(1.5);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.3) translateX(20px) translateY(-15px);
    filter: blur(55px) brightness(1.8);
  }
}

@keyframes cardGlow4 {
  0%, 100% {
    opacity: 0.65;
    transform: scale(1);
    filter: blur(38px) brightness(1.5);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.35) translateX(-20px) translateY(12px);
    filter: blur(48px) brightness(1.9);
  }
}

.scroll-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transform: scaleX(0);
  transition: transform 0.4s;
  z-index: 1;
}

.scroll-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(102, 126, 234, 0.6);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4),
              0 0 30px rgba(118, 75, 162, 0.3);
}

.scroll-card:hover::after {
  transform: scaleX(1);
}

.scroll-card.has-gradient {
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.scroll-card.has-gradient::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.3) 100%);
}

.scroll-card.has-gradient:hover {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5),
              0 0 30px rgba(255, 255, 255, 0.2);
}

/* Scroll Card Content */
.scroll-content {
  padding: 25px;
  position: relative;
  margin: 0;
  display: block;
}

.scroll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.scroll-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  animation: float 3s ease-in-out infinite;
}

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

.scroll-seal {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
  flex-shrink: 0;
}

.scroll-card.has-gradient .scroll-seal {
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.scroll-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0 0 10px 0;
  color: #333;
  line-height: 1.3;
}

.scroll-card.has-gradient .scroll-title {
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.scroll-description {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.scroll-card.has-gradient .scroll-description {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.scroll-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.scroll-card.has-gradient .scroll-meta {
  border-top-color: rgba(255, 255, 255, 0.2);
}

.scroll-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.scroll-card.has-gradient .scroll-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Library Filters */
.library-filters {
  max-width: 1400px;
  margin: 0 auto 40px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-label {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 1rem;
}

.filter-button {
  padding: 10px 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
}

.filter-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.filter-button.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Empty State */
.library-empty {
  text-align: center;
  padding: 80px 20px;
  color: rgba(255, 255, 255, 0.7);
}

.library-empty-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.library-empty h3 {
  font-size: 1.8rem;
  margin: 0 0 10px 0;
  color: rgba(255, 255, 255, 0.9);
}

.library-empty p {
  font-size: 1.1rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .library-header h1 {
    font-size: 2.5rem;
  }
  
  .scrolls-shelf {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .library-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-button {
    width: 100%;
  }
}

/* Scroll Image */
.scroll-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-radius: 12px 12px 0 0;
  margin: 0;
  padding: 0;
}

.scroll-card.has-gradient .scroll-image {
  opacity: 0.9;
}

/* Blur MA (Mature Adult) tenant images for content moderation */
.scroll-card.ma-tenant .scroll-image {
  filter: blur(20px);
  -webkit-filter: blur(20px);
  pointer-events: none;
  user-select: none;
}

/* Color Wobble Animation - 60 second cycle */
@keyframes libraryColorWobble {
  0%, 100% {
    filter: saturate(0.6) hue-rotate(0deg);
  }
  25% {
    filter: saturate(0.65) hue-rotate(15deg);
  }
  50% {
    filter: saturate(0.6) hue-rotate(0deg);
  }
  75% {
    filter: saturate(0.65) hue-rotate(-15deg);
  }
}

/* Lightbox Effect */
.library-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99998;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-lightbox.active {
  pointer-events: all;
  opacity: 1;
}

.library-lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.library-lightbox-card {
  position: relative;
  z-index: 1;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              0 0 40px rgba(102, 126, 234, 0.3);
  animation: lightboxCardZoom 0.4s ease-out forwards;
  transform: scale(0.8);
}

@keyframes lightboxCardZoom {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Full-screen transition overlay - LO-TECH to HI-TECH */
.library-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999; /* Above lightbox (99998) */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: rgba(0, 0, 0, 0.7); /* Slightly more transparent so card shows through */
  backdrop-filter: blur(5px); /* Less blur so card is more visible */
}

.library-transition-overlay.active {
  pointer-events: all;
  opacity: 1;
}

.library-transition-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3); /* More transparent so card shows through */
  filter: saturate(0.6);
  animation: transitionToHiTech 4s ease-in-out forwards;
}

@keyframes transitionToHiTech {
  0% {
    filter: saturate(0.6) hue-rotate(0deg) brightness(0.8);
    opacity: 0;
  }
  10% {
    opacity: 1;
    filter: saturate(0.6) hue-rotate(0deg) brightness(0.8);
  }
  30% {
    filter: saturate(0.7) hue-rotate(10deg) brightness(0.9);
  }
  60% {
    filter: saturate(0.9) hue-rotate(5deg) brightness(1);
  }
  100% {
    filter: saturate(1) hue-rotate(0deg) brightness(1);
    opacity: 1;
  }
}

/* Countdown Display */
.library-countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100000; /* Above overlay background */
  text-align: center;
  width: 200px;
  height: 200px;
}

.library-countdown-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8rem;
  font-weight: bold;
  color: white;
  text-shadow: 
    0 0 30px rgba(102, 126, 234, 0.8),
    0 0 60px rgba(102, 126, 234, 0.6),
    0 0 90px rgba(102, 126, 234, 0.4);
  font-family: 'AnimeAce', Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.library-countdown-number.show {
  opacity: 1;
  animation: countdownPulse 0.8s ease-in-out;
}

@keyframes countdownPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
}

/* Transition text overlay */
.library-transition-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 3rem;
  font-weight: bold;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation: transitionTextFade 1s ease-in-out forwards;
  z-index: 3;
  font-family: 'AnimeAce', Arial, sans-serif;
  letter-spacing: 0.1em;
  animation-delay: 3s;
}

@keyframes transitionTextFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* Quick Navigate Link */
.scroll-quick-nav {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 16px;
  background: rgba(102, 126, 234, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'AnimeAce', Arial, sans-serif;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  cursor: pointer;
  margin: 0;
}

.scroll-card:hover .scroll-quick-nav {
  opacity: 1;
  pointer-events: all;
}

.scroll-quick-nav:hover {
  background: rgba(102, 126, 234, 0.4);
  border-color: rgba(102, 126, 234, 0.6);
  transform: scale(1.05);
}

.scroll-card.has-gradient .scroll-quick-nav {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.scroll-card.has-gradient .scroll-quick-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Library Guide Character (Lucky) - Uses shared lucky-guide.css */
.library-guide-character {
  /* Styles inherited from lucky-guide.css */
}

