/* ===========================
   BeforeBedtime Project Ã¢â‚¬â€ style.css
   Custom animations, transitions, and effects
   =========================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Noto Sans Thai', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Selection Color ---- */
::selection {
  background: rgba(220, 38, 38, 0.3);
  color: inherit;
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.5);
}

/* ===========================
   Night Sky Ã¢â‚¬â€ Stars, Shooting Stars, Moon
   =========================== */

/* Container Ã¢â‚¬â€ visible in dark mode, hidden in light */
.night-sky {
  z-index: 1;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.dark .night-sky {
  opacity: 1;
}

/* ---- Static twinkling stars (3 layers, each with own rhythm) ---- */
.stars-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 55%;
}

.stars-small {
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 40% 10%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 85% 55%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 15% 65%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 35% 80%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 90% 30%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1px 1px at 5% 90%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 48% 55%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 78% 85%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 22% 48%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 92% 72%, rgba(255,255,255,0.4), transparent);
  animation: twinkleA 5s ease-in-out infinite alternate;
}

.stars-medium {
  background-image:
    radial-gradient(1.5px 1.5px at 18% 25%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 42% 58%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 68% 12%, rgba(255,255,255,0.65), transparent),
    radial-gradient(1.5px 1.5px at 82% 42%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1.5px 1.5px at 30% 78%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.5px 1.5px at 55% 32%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 8% 52%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 75% 68%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.5px 1.5px at 95% 15%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1.5px 1.5px at 50% 92%, rgba(255,255,255,0.5), transparent);
  animation: twinkleB 7s ease-in-out infinite alternate;
  animation-delay: -2s;
}

.stars-large {
  background-image:
    radial-gradient(2px 2px at 20% 18%, rgba(255,255,240,0.9), transparent),
    radial-gradient(2px 2px at 65% 38%, rgba(255,255,240,0.7), transparent),
    radial-gradient(2px 2px at 88% 62%, rgba(255,255,240,0.6), transparent),
    radial-gradient(2px 2px at 38% 88%, rgba(255,255,240,0.75), transparent),
    radial-gradient(2px 2px at 12% 42%, rgba(255,255,240,0.5), transparent),
    radial-gradient(2px 2px at 72% 8%, rgba(255,255,240,0.65), transparent),
    radial-gradient(2px 2px at 52% 72%, rgba(255,255,240,0.8), transparent);
  animation: twinkleC 9s ease-in-out infinite alternate;
  animation-delay: -4s;
}

/* Each layer has its own twinkle rhythm so they don't pulse in sync */
@keyframes twinkleA {
  0%   { opacity: 0.5; }
  40%  { opacity: 0.85; }
  70%  { opacity: 0.6; }
  100% { opacity: 0.75; }
}

@keyframes twinkleB {
  0%   { opacity: 0.65; }
  30%  { opacity: 0.4; }
  60%  { opacity: 0.8; }
  100% { opacity: 0.55; }
}

@keyframes twinkleC {
  0%   { opacity: 0.7; }
  25%  { opacity: 0.9; }
  55%  { opacity: 0.5; }
  80%  { opacity: 0.85; }
  100% { opacity: 0.6; }
}

/* ---- Shooting Stars (base) ---- */
.shooting-star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  opacity: 0;
  box-shadow:
    0 0 4px 1px rgba(255, 255, 255, 0.5),
    0 0 10px 3px rgba(200, 220, 255, 0.2);
}

/* Main trail (::after) */
.shooting-star::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  width: 80px;
  height: 1.2px;
  background: linear-gradient(to left,
    rgba(255, 255, 255, 0.7),
    rgba(180, 200, 255, 0.3) 40%,
    transparent
  );
  border-radius: 1px;
}

/* Spark particle (::before) Ã¢â‚¬â€ small detaching fragment behind the head */
.shooting-star::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  margin-right: 18px;
  width: 2px;
  height: 2px;
  background: rgba(200, 210, 255, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 4px 1px rgba(180, 200, 255, 0.3);
  animation: sparkFlicker 0.4s ease-in-out infinite alternate;
}

@keyframes sparkFlicker {
  0% { opacity: 0.3; transform: translateY(-50%) scale(0.8); }
  100% { opacity: 0.8; transform: translateY(-50%) scale(1.2); }
}

/* ---- Speed variants ---- */
.shooting-star.ss-fast {
  animation: ssShootFast 1.5s linear infinite;
}
.shooting-star.ss-medium {
  animation: ssShootMedium 2.5s linear infinite;
}
.shooting-star.ss-slow {
  animation: ssShootSlow 3.5s linear infinite;
}

/* ---- Brightness: bright ---- */
.shooting-star.ss-bright {
  width: 4px;
  height: 4px;
  background: white;
  box-shadow:
    0 0 6px 2px rgba(255, 255, 255, 0.7),
    0 0 18px 4px rgba(180, 200, 255, 0.25),
    0 0 30px 8px rgba(150, 180, 255, 0.08);
}
.shooting-star.ss-bright::after {
  width: 130px;
  height: 1.8px;
  background: linear-gradient(to left,
    rgba(255, 255, 255, 0.9),
    rgba(200, 220, 255, 0.5) 30%,
    rgba(160, 180, 255, 0.15) 60%,
    transparent
  );
}
.shooting-star.ss-bright::before {
  margin-right: 30px;
  width: 3px;
  height: 3px;
  background: rgba(220, 230, 255, 0.7);
  box-shadow: 0 0 6px 2px rgba(180, 200, 255, 0.4);
}

/* ---- Brightness: dim ---- */
.shooting-star.ss-dim {
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow:
    0 0 2px 1px rgba(255, 255, 255, 0.2);
}
.shooting-star.ss-dim::after {
  width: 45px;
  height: 0.8px;
  background: linear-gradient(to left,
    rgba(255, 255, 255, 0.4),
    rgba(180, 200, 255, 0.1) 50%,
    transparent
  );
}
.shooting-star.ss-dim::before {
  display: none;
}

/* ---- Warm-tinted variant ---- */
.shooting-star.ss-warm {
  background: rgba(255, 230, 180, 0.95);
  box-shadow:
    0 0 5px 2px rgba(255, 200, 120, 0.5),
    0 0 12px 4px rgba(255, 180, 80, 0.15);
}
.shooting-star.ss-warm::after {
  width: 90px;
  height: 1.2px;
  background: linear-gradient(to left,
    rgba(255, 220, 160, 0.7),
    rgba(255, 180, 100, 0.2) 50%,
    transparent
  );
}
.shooting-star.ss-warm::before {
  background: rgba(255, 210, 140, 0.5);
  box-shadow: 0 0 4px 1px rgba(255, 190, 100, 0.3);
}

/* ---- Fast: sharp straight streak toward lower-right ---- */
@keyframes ssShootFast {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(40deg) scale(0.5);
  }
  5% {
    opacity: 1;
    transform: translate(30px, 24px) rotate(40deg) scale(1.1);
  }
  50% {
    opacity: 0.9;
    transform: translate(150px, 120px) rotate(40deg) scale(1);
  }
  85% {
    opacity: 0.4;
    transform: translate(260px, 208px) rotate(40deg) scale(0.7);
  }
  100% {
    opacity: 0;
    transform: translate(320px, 256px) rotate(40deg) scale(0.3);
  }
}

/* ---- Medium: moderate straight streak toward lower-right ---- */
@keyframes ssShootMedium {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(34deg) scale(0.6);
  }
  5% {
    opacity: 0.9;
    transform: translate(25px, 17px) rotate(34deg) scale(1);
  }
  45% {
    opacity: 0.85;
    transform: translate(130px, 86px) rotate(34deg) scale(1);
  }
  80% {
    opacity: 0.35;
    transform: translate(250px, 165px) rotate(34deg) scale(0.7);
  }
  100% {
    opacity: 0;
    transform: translate(320px, 212px) rotate(34deg) scale(0.3);
  }
}

/* ---- Slow: long graceful straight streak toward lower-right ---- */
@keyframes ssShootSlow {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(28deg) scale(0.4);
  }
  4% {
    opacity: 0.7;
    transform: translate(18px, 9px) rotate(28deg) scale(1);
  }
  40% {
    opacity: 0.8;
    transform: translate(140px, 68px) rotate(28deg) scale(1);
  }
  75% {
    opacity: 0.35;
    transform: translate(280px, 136px) rotate(28deg) scale(0.7);
  }
  100% {
    opacity: 0;
    transform: translate(370px, 180px) rotate(28deg) scale(0.3);
  }
}

/* ---- Moon ---- */
.moon-wrapper {
  filter: drop-shadow(0 0 25px rgba(255,255,200,0.12));
  animation: moonFloat 10s ease-in-out infinite;
}

@keyframes moonFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%      { transform: translateY(-6px) rotate(0.5deg); }
  70%      { transform: translateY(-10px) rotate(-0.3deg); }
}

/* ===========================
   Noon Sky Ã¢â‚¬â€ Sun + Flying Birds (light mode only)
   =========================== */
.noon-sky {
  z-index: 1;
  opacity: 1;
  transition: opacity 1.2s ease;
}

.dark .noon-sky {
  opacity: 0;
}

/* ---- Sun ---- */
.sun-wrapper {
  animation: sunFloat 12s ease-in-out infinite;
}

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

/* ---- Flying Birds ---- */
.bird {
  position: absolute;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.bird-1 {
  width: 28px;
  top: 18%;
  left: -30px;
  animation: birdFly1 18s linear infinite;
  animation-delay: 0s;
}

.bird-2 {
  width: 22px;
  top: 14%;
  left: -25px;
  animation: birdFly2 22s linear infinite;
  animation-delay: 4s;
}

.bird-3 {
  width: 16px;
  top: 25%;
  left: -20px;
  animation: birdFly3 26s linear infinite;
  animation-delay: 8s;
}

.bird-4 {
  width: 24px;
  top: 10%;
  left: -28px;
  animation: birdFly1 20s linear infinite;
  animation-delay: 12s;
}

/* Each bird has a slightly different arc path */
@keyframes birdFly1 {
  0%   { transform: translate(0, 0); opacity: 0; }
  5%   { opacity: 0.7; }
  25%  { transform: translate(30vw, -15px); }
  50%  { transform: translate(60vw, -8px); }
  75%  { transform: translate(90vw, -20px); }
  95%  { opacity: 0.7; }
  100% { transform: translate(110vw, -12px); opacity: 0; }
}

@keyframes birdFly2 {
  0%   { transform: translate(0, 0); opacity: 0; }
  5%   { opacity: 0.6; }
  30%  { transform: translate(25vw, -10px); }
  60%  { transform: translate(55vw, -22px); }
  80%  { transform: translate(85vw, -5px); }
  95%  { opacity: 0.6; }
  100% { transform: translate(110vw, -18px); opacity: 0; }
}

@keyframes birdFly3 {
  0%   { transform: translate(0, 0); opacity: 0; }
  5%   { opacity: 0.5; }
  20%  { transform: translate(20vw, -8px); }
  45%  { transform: translate(50vw, -18px); }
  70%  { transform: translate(80vw, -6px); }
  95%  { opacity: 0.5; }
  100% { transform: translate(110vw, -14px); opacity: 0; }
}

/* ---- Drifting Clouds ---- */
.cloud {
  position: absolute;
  pointer-events: none;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.cloud-1 {
  width: 180px;
  top: 12%;
  left: -200px;
  animation: cloudDrift1 45s linear infinite;
}

.cloud-2 {
  width: 140px;
  top: 28%;
  left: -160px;
  animation: cloudDrift2 55s linear infinite;
  animation-delay: 8s;
}

.cloud-3 {
  width: 220px;
  top: 6%;
  left: -240px;
  animation: cloudDrift1 60s linear infinite;
  animation-delay: 20s;
}

.cloud-4 {
  width: 120px;
  top: 20%;
  left: -140px;
  animation: cloudDrift2 50s linear infinite;
  animation-delay: 30s;
}

@keyframes cloudDrift1 {
  0%   { transform: translateX(0); opacity: 0; }
  3%   { opacity: 0.8; }
  50%  { transform: translateX(55vw); opacity: 0.9; }
  97%  { opacity: 0.8; }
  100% { transform: translateX(110vw); opacity: 0; }
}

@keyframes cloudDrift2 {
  0%   { transform: translateX(0); opacity: 0; }
  3%   { opacity: 0.7; }
  50%  { transform: translateX(50vw); opacity: 0.85; }
  97%  { opacity: 0.7; }
  100% { transform: translateX(110vw); opacity: 0; }
}

@media (min-width: 768px) {
  .cloud-1 { width: 280px; }
  .cloud-2 { width: 200px; }
  .cloud-3 { width: 340px; }
  .cloud-4 { width: 180px; }
}

/* ===========================
   Film Grain Overlay
   =========================== */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ===========================
   Scroll Indicator
   =========================== */
.scroll-indicator {
  width: 24px;
  height: 40px;
  border: 1.5px solid currentColor;
  border-radius: 12px;
  position: relative;
  opacity: 0.4;
}

.scroll-dot {
  width: 3px;
  height: 8px;
  background: currentColor;
  border-radius: 2px;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollBounce 2s ease-in-out infinite;
}

.hero-social-link {
  color: rgba(24, 24, 27, 0.78);
  transition: color 0.3s ease, transform 0.3s ease;
}

.hero-social-link:hover {
  color: rgba(10, 10, 10, 1);
}

.dark .hero-social-link {
  color: rgba(255, 255, 255, 0.82);
}

.dark .hero-social-link:hover {
  color: rgba(255, 255, 255, 1);
}

@keyframes scrollBounce {
  0%, 100% { top: 8px; opacity: 1; }
  50% { top: 20px; opacity: 0.3; }
}

/* ===========================
   Hero Fade-In-Up Animation
   =========================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  opacity: 0;
  animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ===========================
   Scroll Reveal Animation
   =========================== */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Story Card Hover Effects
   =========================== */
.story-card {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-card:hover {
  transform: translateY(-4px);
}

/* ===========================
   Modal-open performance: pause/hide expensive effects
   =========================== */
body.modal-open .grain-overlay {
  display: none;
}

/* Reduce grain cost on story page */
.story-page .grain-overlay {
  opacity: 0.015;
  will-change: auto;
  backface-visibility: hidden;
}

body.modal-open .night-sky,
body.modal-open .noon-sky {
  animation: none !important;
  visibility: hidden;
}

body.modal-open .shooting-star {
  animation: none !important;
  display: none;
}

/* GPU-promote modal scroll container */
.story-modal .modal-content {
  will-change: scroll-position;
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
}

/* Use solid background instead of backdrop-blur for sticky header */
body.modal-open .story-modal .sticky {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: var(--noon-50, #f5efe6) !important;
}

.dark body.modal-open .story-modal .sticky,
body.modal-open .dark .story-modal .sticky {
  background: var(--dark-900, #0a0a0a) !important;
}

/* ===========================
   Story Modal Ã¢â‚¬â€ Full-screen overlay
   =========================== */
.story-modal {
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-modal.active {
  opacity: 1;
  pointer-events: all;
}

.story-modal .modal-close {
  opacity: 0;
  transition: opacity 0.5s ease 0.3s;
}

.story-modal.active .modal-close {
  opacity: 0.6;
}

.story-modal.active .modal-close:hover {
  opacity: 1;
}

/* Staggered reveal for modal items */
.story-modal .modal-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-modal.active .modal-item:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.15s; }
.story-modal.active .modal-item:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.25s; }
.story-modal.active .modal-item:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.35s; }
.story-modal.active .modal-item:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.45s; }
.story-modal.active .modal-item:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.55s; }
.story-modal.active .modal-item:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 0.65s; }
.story-modal.active .modal-item:nth-child(7) { opacity: 1; transform: translateY(0); transition-delay: 0.75s; }

/* ---- Modal atmospheric background layers ---- */

/* Red glow fades in when modal is active */
.story-modal.active .modal-glow {
  opacity: 1;
  transition-delay: 0.2s;
}

/* Fog layers Ã¢â‚¬â€ slow horizontal drift */
.fog-layer {
  background-repeat: repeat-x;
  background-size: 50% 100%;
  opacity: 0.35;
  will-change: transform;
  backface-visibility: hidden;
}

.fog-1 {
  background-image:
    radial-gradient(ellipse at 25% 60%, rgba(180,40,40,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 75% 40%, rgba(100,20,20,0.06) 0%, transparent 55%);
  animation: fogDrift1 30s linear infinite;
}

.fog-2 {
  background-image:
    radial-gradient(ellipse at 30% 45%, rgba(60,10,10,0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(140,30,30,0.05) 0%, transparent 60%);
  animation: fogDrift2 40s linear infinite;
  opacity: 0.25;
}

@keyframes fogDrift1 {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes fogDrift2 {
  0%   { transform: translateX(0); }
  100% { transform: translateX(50%); }
}

.story-modal.active .modal-fog {
  opacity: 1;
  transition-delay: 0.4s;
}

/* Vignette Ã¢â‚¬â€ dark edges for cinematic feel */
.modal-vignette {
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.25) 100%);
}

.dark .modal-vignette {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.5) 100%);
}

.story-modal.active .modal-vignette {
  opacity: 1;
  transition-delay: 0.3s;
}

/* Scene SVG (forest + mountains) Ã¢â‚¬â€ fixed to bottom */
.modal-scene {
  position: fixed;
  transition: opacity 1.5s ease;
}

.story-modal.active .modal-scene {
  opacity: 1;
  transition-delay: 0.5s;
}

/* ---- Story Page (standalone ss0.html etc.) ---- */
.story-page {
  z-index: 1;
}

.story-page .modal-scene {
  opacity: 1;
}

.story-page .modal-fog {
  opacity: 1;
}

.story-page .modal-vignette {
  opacity: 1;
}

/* Story page scroll performance */
.story-page .char-grid-wrapper {
  contain: layout style;
}

/* Story page character cards Ã¢â‚¬â€ 5 per row on lg, 3 on sm, 2 on mobile */
.story-char-card {
  width: calc(50% - 0.75rem);
  contain: layout style paint;
  transform: translateZ(0);
}

@media (min-width: 640px) {
  .story-char-card {
    width: calc(33.333% - 1rem);
  }
}

@media (min-width: 1024px) {
  .story-char-card {
    width: calc(20% - 1.2rem);
  }
}

/* ===========================
   Character Cards
   =========================== */
.character-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.6s ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 420px;
}

/* Inside modal: strip unnecessary transitions for scroll perf */
.story-modal .character-card {
  transition: none;
}

.story-modal .character-card .char-img-wrapper img,
.story-modal .character-card .char-img-wrapper .char-placeholder {
  transition: none;
}

.story-modal .character-card:hover {
  transform: none;
  box-shadow: none;
}

.story-modal .character-card:hover .char-img-wrapper img,
.story-modal .character-card:hover .char-img-wrapper .char-placeholder {
  transform: none;
}

/* Contain reflow to the grid */
.story-modal #modalCharGrid {
  contain: layout style;
}

.character-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.dark .character-card:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Character image zoom on hover */
.character-card .char-img-wrapper {
  overflow: hidden;
}

.character-card .char-img-wrapper img,
.character-card .char-img-wrapper .char-placeholder {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.character-card:hover .char-img-wrapper img,
.character-card:hover .char-img-wrapper .char-placeholder {
  transform: scale(1.05);
}

/* Social icon hover effect */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.2);
  transition: all 0.3s ease;
}

.social-icon:hover {
  border-color: rgba(128, 128, 128, 0.5);
  background: rgba(128, 128, 128, 0.08);
  transform: translateY(-2px);
}

/* ===========================
   Collapsible Character Grid
   =========================== */
.char-grid-wrapper {
  max-height: 600px;
  overflow: hidden;
  position: relative;
  transition: max-height 0.5s ease;
  contain: layout style;
}

.char-grid-wrapper.expanded {
  max-height: 5000px;
  overflow: visible;
}

/* Fade-out gradient at the bottom when collapsed */
.char-grid-wrapper:not(.expanded)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--grid-fade-color, #e8e0d4) 0%, transparent 100%);
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.dark .char-grid-wrapper:not(.expanded)::after {
  --grid-fade-color: #0a0a0a;
}

/* Arrow rotation when expanded */
.char-toggle-btn .rotated {
  transform: rotate(180deg);
}

/* ===========================
   Navbar scroll effect
   =========================== */
#navbar {
  border-bottom: 1px solid transparent;
}

.navbar-scrolled {
  background: rgba(232, 224, 212, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.dark .navbar-scrolled {
  background: rgba(10, 10, 10, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* ===========================
   Responsive Adjustments
   =========================== */
@media (max-width: 640px) {
  .hero-content h1 {
    font-size: 2.8rem;
  }
}

/* ===========================
   Loading Screen (Thematic Intro)
   =========================== */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity 1s ease, visibility 1s ease;
}

.loading-screen.dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

/* Typewriter text */
.typewriter-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.15em;
  min-height: 1.8em;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: rgba(255, 255, 255, 0.7);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.7s steps(1) infinite;
}

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

/* Enter button */
.enter-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.9rem 2.5rem;
  border-radius: 9999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease,
              border-color 0.3s ease, color 0.3s ease;
  pointer-events: none;
}

.enter-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.enter-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

/* ===========================
   Audio Toggle Icon Transitions
   =========================== */
#audioToggle .audio-icon-active {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#audioToggle .audio-icon-hidden {
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===========================
   Gallery Tabs
   =========================== */
.gallery-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: transparent;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dark .gallery-tab {
  border-color: rgba(255, 255, 255, 0.15);
}

.gallery-tab:hover:not(:disabled) {
  opacity: 0.8;
  border-color: rgba(0, 0, 0, 0.3);
}

.dark .gallery-tab:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.3);
}

.gallery-tab.active {
  opacity: 1;
  border-color: rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.05);
}

.dark .gallery-tab.active {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.gallery-tab.locked {
  opacity: 0.25;
  cursor: not-allowed;
}

html:not(.dark) .gallery-tab {
  color: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.16);
  opacity: 0.68;
}

html:not(.dark) .gallery-tab:hover:not(:disabled) {
  opacity: 0.9;
  border-color: rgba(255, 255, 255, 0.3);
}

html:not(.dark) .gallery-tab.active {
  opacity: 1;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.06);
}

html:not(.dark) .gallery-tab.locked {
  opacity: 0.42;
}

/* ===========================
   Forest Silhouette Layers
   =========================== */
.forest-container {
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  height: clamp(14rem, 26vw, 24rem);
  min-height: 240px;
  z-index: 2;
  overflow: hidden;
  transition: opacity 1.2s ease;
  isolation: isolate;
}

/* Each layer is an SVG filled with a different shade for depth */
.forest-layer {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: block;
  width: 132%;
  min-width: 132%;
  max-width: none;
  height: 100%;
  min-height: 240px;
  transform: translateX(-50%);
}

/* ---- Light mode: dark green/brown forest (opaque) ---- */
.forest-back path {
  fill: rgb(35, 45, 30);
}
.forest-mid path {
  fill: rgb(22, 30, 18);
}
.forest-front path {
  fill: rgb(14, 18, 12);
}

/* ---- Dark mode: near-black silhouettes (opaque) ---- */
.dark .forest-back path {
  fill: rgb(14, 18, 12);
}
.dark .forest-mid path {
  fill: rgb(10, 13, 8);
}
.dark .forest-front path {
  fill: rgb(7, 9, 6);
}

/* Mist / fog between trees */
.forest-mist {
  height: 38%;
  background: linear-gradient(
    to top,
    rgba(200, 210, 200, 0.08) 0%,
    rgba(180, 190, 180, 0.03) 30%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

.dark .forest-mist {
  background: linear-gradient(
    to top,
    rgba(20, 30, 40, 0.16) 0%,
    rgba(15, 20, 30, 0.08) 30%,
    transparent 100%
  );
}

/* Subtle sway animation on mid & front layers */
.forest-back {
  z-index: 2;
}

.forest-mid {
  z-index: 3;
  animation: forestSway 20s ease-in-out infinite;
}
.forest-front {
  z-index: 4;
  animation: forestSway 15s ease-in-out infinite reverse;
}

@media (max-width: 768px) {
  .forest-container {
    height: clamp(13rem, 42vw, 20rem);
    min-height: 210px;
  }

  .forest-layer {
    width: 190%;
    min-width: 190%;
    min-height: 210px;
  }
}

@keyframes forestSway {
  0%, 100% { transform: translateX(-50%); }
  50%      { transform: translateX(calc(-50% - 3px)); }
}

/* Pause forest animation when modal is open */
body.modal-open .forest-container {
  animation: none !important;
  visibility: hidden;
}

/* ---- Forest Bridge: smooth gradient from hero bottom into content ---- */
.forest-bridge {
  height: 120px;
  margin-top: -120px;
  background: linear-gradient(to bottom, transparent 0%, rgb(14, 18, 12) 100%);
}

.dark .forest-bridge {
  background: linear-gradient(to bottom, transparent 0%, rgb(7, 9, 6) 100%);
}

/* ---- Forest Section: solid dark background for Gallery & Stories ---- */
.forest-section {
  background: rgb(14, 18, 12);
  color: #171717;
}

.dark .forest-section {
  background: rgb(7, 9, 6);
  color: #e5e5e5;
}

html:not(.dark) #gallery > .max-w-5xl > .mb-8,
html:not(.dark) #stories > .max-w-7xl > .mb-20 {
  color: #f5f5f5;
}

/* ===========================
   Lightbox Modal
   =========================== */
.lightbox-modal {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-modal.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.lightbox-modal .lightbox-close,
.lightbox-modal .lightbox-nav,
.lightbox-modal #lightboxCounter {
  opacity: 0;
  transition: opacity 0.4s ease 0.2s, border-color 0.3s ease, color 0.3s ease;
}

.lightbox-modal.active .lightbox-close,
.lightbox-modal.active .lightbox-nav,
.lightbox-modal.active #lightboxCounter {
  opacity: 1;
}

#lightboxContent img {
  max-height: 80vh;
  width: auto;
  max-width: 100%;
}

/* ===========================
   Mods Page
   =========================== */
.mods-page {
  min-height: 100vh;
}

.mods-page #navbar {
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.mods-page .night-sky {
  opacity: 1;
}

.mods-shell {
  position: relative;
  padding-top: 11rem;
}

.mods-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.06), transparent 25%),
    radial-gradient(circle at 80% 8%, rgba(255,255,255,0.04), transparent 18%),
    linear-gradient(180deg, rgba(5,5,5,0.82) 0%, rgba(8,8,8,0.94) 30%, rgba(7,7,7,1) 100%);
  pointer-events: none;
}

html:not(.dark) .mods-page #navbar,
html:not(.dark) .mods-page #navbar {
  background: rgba(244, 239, 232, 0.82);
  border-bottom: 1px solid rgba(15,15,15,0.08);
}

html:not(.dark) .mods-page .mods-shell::before {
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.75), transparent 24%),
    radial-gradient(circle at 80% 8%, rgba(255,255,255,0.55), transparent 18%),
    linear-gradient(180deg, rgba(245,239,230,0.95) 0%, rgba(232,224,212,0.94) 32%, rgba(224,216,203,0.98) 100%);
}

html:not(.dark) .mods-page .night-sky,
html:not(.dark) .mods-page .night-sky {
  opacity: 0.14;
}

.mods-shell > .max-w-7xl {
  position: relative;
  z-index: 1;
}

.mods-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  padding: 0 0 2.5rem;
}

.mods-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-bottom: 1rem;
}

.mods-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2.75rem, 7vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
}

.mods-subtitle {
  max-width: 44rem;
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.62);
}

.mods-hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10rem;
  padding: 0.95rem 1.35rem;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.04);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.mods-hero-cta:hover {
  border-color: rgba(255,255,255,0.36);
  background: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}

.mods-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.mods-stat-card,
.mods-card,
.mods-toolbar {
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.015) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

html:not(.dark) .mods-page .mods-stat-card,
html:not(.dark) .mods-page .mods-card,
html:not(.dark) .mods-page .mods-toolbar,
html:not(.dark) .mods-page .mods-manage-note {
  border-color: rgba(15,15,15,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.68) 0%, rgba(255,255,255,0.45) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 20px 60px rgba(35,25,10,0.06);
}

html:not(.dark) .mods-page .mods-subtitle,
html:not(.dark) .mods-page .mods-card-copy,
html:not(.dark) .mods-page .mods-manage-copy {
  color: rgba(25,25,25,0.7);
}

html:not(.dark) .mods-page .mods-kicker,
html:not(.dark) .mods-page .mods-stat-label,
html:not(.dark) .mods-page .mods-filter-label,
html:not(.dark) .mods-page .mods-card-version,
html:not(.dark) .mods-page .mods-download-count,
html:not(.dark) .mods-page .mods-version-sub {
  color: rgba(20,20,20,0.45);
}

html:not(.dark) .mods-page .mods-chip,
html:not(.dark) .mods-page .mods-tag,
html:not(.dark) .mods-page .mods-card-category,
html:not(.dark) .mods-page .mods-loader-pill,
html:not(.dark) .mods-page .mods-search-wrap,
html:not(.dark) .mods-page .mods-version-row,
html:not(.dark) .mods-page .mods-version-link,
html:not(.dark) .mods-page .mods-open-btn,
html:not(.dark) .mods-page .mods-modal-close,
html:not(.dark) .mods-page .mods-modal-panel,
html:not(.dark) .mods-page .mods-password-input {
  border-color: rgba(20,20,20,0.1);
  background: rgba(255,255,255,0.45);
  color: rgba(20,20,20,0.78);
}

html:not(.dark) .mods-page .mods-chip.active,
html:not(.dark) .mods-page .mods-chip:hover {
  background: rgba(20,20,20,0.88);
  color: #fff;
  border-color: rgba(20,20,20,0.88);
}

html:not(.dark) .mods-page .mods-card-icon {
  background: linear-gradient(180deg, rgba(35,35,35,0.12), rgba(35,35,35,0.04));
  border-color: rgba(20,20,20,0.08);
}

html:not(.dark) .mods-page .mods-card:hover,
html:not(.dark) .mods-page .mods-card:focus-visible {
  border-color: rgba(20,20,20,0.14);
  box-shadow: 0 22px 60px rgba(35,25,10,0.1);
}

html:not(.dark) .mods-page .mods-modal-icon {
  background: linear-gradient(180deg, rgba(35,35,35,0.12), rgba(35,35,35,0.04));
  border-color: rgba(20,20,20,0.08);
  color: rgba(20,20,20,0.82);
}

html:not(.dark) .mods-page .mods-modal-kicker,
html:not(.dark) .mods-page .mods-modal-summary,
html:not(.dark) .mods-page .mods-password-label {
  color: rgba(20,20,20,0.62);
}

html:not(.dark) .mods-page .mods-password-error {
  color: #b42318;
}

html:not(.dark) .mods-page .mods-search-input::placeholder {
  color: rgba(25,25,25,0.35);
}

html:not(.dark) .mods-page .mods-hero-cta,
html:not(.dark) .mods-page .mods-download-btn,
html:not(.dark) .mods-page .mods-version-link,
html:not(.dark) .mods-page .mods-open-btn,
html:not(.dark) .mods-page .mods-password-submit {
  background: rgba(20,20,20,0.92);
  color: #fff;
  border-color: rgba(20,20,20,0.92);
}

html:not(.dark) .mods-page .mods-hero-cta:hover,
html:not(.dark) .mods-page .mods-download-btn:hover,
html:not(.dark) .mods-page .mods-version-link:hover,
html:not(.dark) .mods-page .mods-open-btn:hover,
html:not(.dark) .mods-page .mods-password-submit:hover {
  background: #000;
  border-color: #000;
}

.mods-stat-card {
  border-radius: 1.5rem;
  padding: 1.7rem 1.6rem;
}

.mods-stat-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin-bottom: 0.65rem;
}

.mods-stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  opacity: 0.45;
}

.mods-toolbar {
  border-radius: 1.5rem;
  padding: 1.4rem;
  margin-bottom: 1.8rem;
}

.mods-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 9999px;
  padding: 0.95rem 1.2rem;
  margin-bottom: 1.25rem;
  background: rgba(255,255,255,0.02);
}

.mods-search-icon {
  font-size: 1.15rem;
  opacity: 0.45;
}

.mods-search-input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: inherit;
  font-size: 0.95rem;
}

.mods-search-input::placeholder {
  color: rgba(255,255,255,0.34);
}

.mods-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.mods-filter-label {
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.5;
}

.mods-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.mods-chip {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.72);
  border-radius: 9999px;
  padding: 0.6rem 0.95rem;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.mods-chip:hover,
.mods-chip.active {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.mods-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.35rem;
}

.mods-manage-note {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.5rem;
  padding: 1.15rem 1.3rem;
  margin-bottom: 1.8rem;
  background: rgba(255,255,255,0.02);
}

.mods-manage-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.mods-manage-copy {
  color: rgba(255,255,255,0.62);
  line-height: 1.7;
}

.mods-card {
  border-radius: 1.5rem;
  padding: 1.35rem;
  min-height: 24rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.28s ease, border-color 0.28s ease, background 0.28s ease, box-shadow 0.28s ease;
}

.mods-card:hover,
.mods-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.14);
  box-shadow: 0 22px 60px rgba(0,0,0,0.22);
  outline: none;
}

.mods-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.mods-card-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.1);
}

.mods-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.mods-card-version {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.42;
}

.mods-card-category,
.mods-loader-pill,
.mods-tag {
  border-radius: 9999px;
}

.mods-card-category {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.45rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.7;
}

.mods-card-copy {
  color: rgba(255,255,255,0.62);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.mods-loader-row,
.mods-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.mods-loader-row {
  margin-bottom: 0.9rem;
}

.mods-loader-pill {
  background: rgba(255,255,255,0.1);
  padding: 0.42rem 0.65rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.mods-tag {
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
}

.mods-card-action {
  margin-top: auto;
  padding-top: 1.2rem;
}

.mods-open-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.05rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.mods-card:hover .mods-open-btn,
.mods-card:focus-visible .mods-open-btn {
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

.mods-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1rem;
  background: rgba(255,255,255,0.03);
}

.mods-version-meta {
  min-width: 0;
}

.mods-version-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.mods-version-name span {
  opacity: 0.45;
}

.mods-version-sub {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.48);
  word-break: break-all;
}

.mods-version-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.2rem;
  padding: 0.78rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.mods-version-link:hover {
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}

.mods-version-link[aria-disabled="true"] {
  opacity: 0.45;
}

.mods-empty {
  grid-column: 1 / -1;
  border-radius: 1.5rem;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 3rem 1.5rem;
  text-align: center;
  background: rgba(255,255,255,0.02);
}

.mods-empty-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  margin-bottom: 0.7rem;
}

.mods-empty-copy {
  color: rgba(255,255,255,0.55);
}

.mods-modal-open {
  overflow: hidden;
}

.mods-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.mods-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mods-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.66);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mods-modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(85vh, 920px);
  overflow-y: auto;
  border-radius: 1.9rem;
  border: 1px solid rgba(255,255,255,0.1);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.05), transparent 28%),
    linear-gradient(180deg, rgba(14,14,14,0.96) 0%, rgba(7,7,7,0.98) 100%);
  box-shadow: 0 30px 120px rgba(0,0,0,0.5);
  padding: 1.5rem;
}

.mods-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.mods-modal-close:hover {
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

.mods-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-right: 3.5rem;
  margin-bottom: 1.35rem;
}

.mods-modal-icon {
  flex: 0 0 auto;
  width: 4rem;
  height: 4rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.85);
}

.mods-modal-copy {
  min-width: 0;
}

.mods-modal-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.46);
  margin-bottom: 0.45rem;
}

.mods-modal-title {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
  margin-bottom: 0.8rem;
}

.mods-modal-summary {
  color: rgba(255,255,255,0.62);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.mods-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.mods-modal-versions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.mods-password-panel {
  width: min(520px, 100%);
  max-height: none;
}

.mods-password-copy {
  margin-bottom: 1.1rem;
}

.mods-password-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.mods-password-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.52);
}

.mods-password-input {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #fff;
  padding: 1rem 1.05rem;
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.mods-password-input:focus {
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}

.mods-password-error {
  min-height: 1.2rem;
  font-size: 0.82rem;
  color: #ff8f8f;
}

.mods-password-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.95rem 1.05rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.mods-password-submit:hover {
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

@media (max-width: 1024px) {
  .mods-stats,
  .mods-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .mods-shell {
    padding-top: 9rem;
  }

  .mods-hero {
    flex-direction: column;
    align-items: start;
  }

  .mods-stats,
  .mods-grid {
    grid-template-columns: 1fr;
  }

  .mods-card-head {
    grid-template-columns: auto 1fr;
  }

  .mods-card-category {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
