/* ------------------------------------------------------ */
/*  GLOBAL RESET & BASE STYLES                            */
/* ------------------------------------------------------ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Zilla Slab', serif;
    color: #fff;
}

body.gallery-bg {
    overflow-y: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

button, input, textarea {
    font-family: inherit;
}



/* ------------------------------------------------------ */
/*  BACKGROUND STYLES                                     */
/* ------------------------------------------------------ */

/* Login page background */
.landing-bg { 
    background: linear-gradient(135deg, #3a0000, #8b0000); 
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

/* Main menu background */
.main-bg { 
    background: linear-gradient(to bottom right, #4e0000, #200000); 
    min-height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

/* General content pages */
.page-bg { background: #1a0000; color: #fff; padding: 40px; }

.gallery-bg {
    background: #120000;
    padding: 0;              /* REMOVE padding */
    overflow: hidden;        /* HARD STOP vertical scroll */
}

/* Letter page background */
.letter-bg { background: #1a0000; padding: 40px; }


/* ------------------------------------------------------ */
/*  RESPONSIVE FIX FOR SMALL SCREENS                      */
/* ------------------------------------------------------ */

@media (max-height: 650px) {
    .landing-bg {
        align-items: flex-start;
        padding-top: 40px;
    }
}


/* ------------------------------------------------------ */
/*  LOGIN BOX & FORM                                       */
/* ------------------------------------------------------ */

.login-container {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
    padding: clamp(20px, 5vw, 40px);
    border-radius: 20px;
    text-align: center;
    
    /* Responsive width */
    width: auto;
    max-width: min(90%, 700px);

    /* Soft glow animation */
    box-shadow: 0 0 20px rgba(255,0,0,0.3);
    animation: glowPulse 4s infinite ease-in-out;
      overflow-y: auto;               /* scroll inside if needed */
    max-height: none;
    overflow: visible;
    padding: clamp(18px, 4vh, 40px);
}

.login-container input { 
    width: 100%; 
    padding: 10px; 
    margin-top: 15px; 
    border-radius: 10px; 
    border: none; 
}

.login-container button { 
    margin-top: 15px; 
    width: 100%; 
    padding: 10px; 
    border: none; 
    border-radius: 10px; 
    background: linear-gradient(90deg, #ff4d4d, #b30000); 
    color: #fff; 
    cursor: pointer; 
    font-weight: bold; 
}

/* Input/button responsive text */
.login-container input,
.login-container button {
    font-size: clamp(14px, 2.4vw, 18px);
    padding: clamp(8px, 1.8vw, 14px);
}


/* ------------------------------------------------------ */
/*  LOGIN PAGE — CIPHER TEXT DISPLAY                       */
/* ------------------------------------------------------ */

#cipher-text {
    font-size: clamp(16px, 4vw, 50px);
    text-align: center;
    padding: 0 15px;
    line-height: 1.3;
    word-break: break-word;
    
    /* Start hidden for animation */
    opacity: 0;
    animation: cipherReveal 1.5s ease forwards;
}

/* Cipher fade-in animation */
@keyframes cipherReveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ------------------------------------------------------ */
/*  PAGE TRANSITION ANIMATIONS                             */
/* ------------------------------------------------------ */

/* Fade OUT when leaving the page */
.fade-out {
    animation: fadeOut 0.6s forwards ease;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Fade IN when loading a new page */
.fade-in {
    animation: fadeInPage 0.8s ease forwards;
    opacity: 0;
}

@keyframes fadeInPage {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* ------------------------------------------------------ */
/*  MENU GRID (Unlock screen)                              */
/* ------------------------------------------------------ */

.menu-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 150px); 
    gap: 30px; 
}

.menu-box { 
    background: rgba(255,255,255,0.08); 
    backdrop-filter: blur(6px); 
    padding: 40px; 
    font-size: 50px; 
    border-radius: 20px; 
    text-align: center; 
    transition: 0.3s;
    
    /* Remove underline & visited styles */
    text-decoration: none;
    color: inherit;
}

.menu-box:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 0 15px rgba(255,0,0,0.4); 
}

.menu-box:visited,
.menu-box:active,
.menu-box:hover {
    text-decoration: none;
    color: inherit;
}


/* ------------------------------------------------------ */
/*  GALLERY PAGE STYLES                                    */
/* ------------------------------------------------------ */

.gallery-page {
    min-height: 100svh;              /* mobile-safe viewport */
    display: flex;
    flex-direction: column;
}

@supports not (height: 100svh) {
    .gallery-page {
        min-height: 100vh;           /* fallback */
    }
}

.gallery-title {
    margin-top: clamp(40px, 6svh, 80px);   /* pushes it down nicely */
    margin-bottom: 10px;

    text-align: center;
    font-size: clamp(28px, 4.5vw, 46px);
    letter-spacing: 3px;
    opacity: 0.95;
}

.gallery-title {
    text-shadow:
        0 0 10px rgba(255, 60, 60, 0.35),
        0 0 30px rgba(255, 0, 0, 0.15);
    font-weight: 600;
}

.gallery-title::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    margin: 12px auto 0;
    background: linear-gradient(
        90deg,
        transparent,
        #ff4d4d,
        transparent
    );
    opacity: 0.7;
}

.gallery-title {
    animation: titleFade 0.8s ease-out both;
}

@keyframes titleFade {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 0.95;
        transform: translateY(0);
    }
}

.gallery-wrapper {
    position: relative;
    width: 100%;
    flex: 1;                         /* fills remaining space */
    overflow-x: auto;
    overflow-y: hidden;

    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;

    border-radius: 25px;
    background: radial-gradient(
        circle at center,
        rgba(255, 60, 60, 0.08),
        rgba(0, 0, 0, 0.6)
    );
}

.gallery-wrapper::-webkit-scrollbar {
    display: none;
}

.gallery {
    position: relative;
    height: 100%;
}


/* Polaroid frames */
.polaroid {
    position: absolute;
    background: #fff;
    padding: 12px 12px 28px; /* thicker bottom */
    border-radius: 10px;
    width: 200px;

    box-shadow:
        0 25px 45px rgba(0,0,0,0.45),
        0 0 25px rgba(255,0,0,0.18);

    transition:
        transform 0.4s ease,
        box-shadow 0.4s ease;

    transform-origin: center 120%;
}


.polaroid img {
    width: 100%;
    display: block;
    border-radius: 4px;
    filter: contrast(1.05) saturate(1.1) brightness(1.02);
}

.polaroid::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background:
        repeating-linear-gradient(
            45deg,
            rgba(255,255,255,0.02),
            rgba(255,255,255,0.02) 2px,
            rgba(0,0,0,0.02) 4px
        );
    pointer-events: none;
}

.polaroid:hover {
    z-index: 10;
    transform:
        translateY(-12px)
        scale(1.05)
        rotate(0deg);
    box-shadow:
        0 40px 70px rgba(0,0,0,0.6),
        0 0 35px rgba(255,80,80,0.4);
}



/* Tooltip*/
.tooltip {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,0,0,0.9);
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}




/* ------------------------------------------------------ */
/*  LETTER PAGE                                            */
/* ------------------------------------------------------ */

.letter-box { 
    max-width: 600px; 
    margin: auto; 
    margin-bottom: 10vh;
    background: rgba(255,255,255,0.08); 
    padding: 30px; 
    border-radius: 20px; 
}


/* ------------------------------------------------------ */
/*  EXTRA ANIMATIONS                                       */
/* ------------------------------------------------------ */

/* Smooth glow effect on login box */
@keyframes glowPulse {
    0%   { box-shadow: 0 0 10px rgba(255,0,0,0.3); }
    50%  { box-shadow: 0 0 25px rgba(255,50,50,0.5); }
    100% { box-shadow: 0 0 10px rgba(255,0,0,0.3); }
}

/* ----------------------------- */
/* BACK BUTTON                   */
/* ----------------------------- */
/* BACK BUTTON STYLES */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #ff4d4d, #b30000);  /* Red gradient background */
    border: none;  /* Remove the default border */
    padding: 15px 30px;  /* Increase padding for a larger button */
    border-radius: 12px;  /* Slightly more rounded corners */
    color: #fff;  /* White text color */
    font-size: 22px;  /* Increase the font size */
    font-weight: bold;  /* Make the text bold */
    cursor: pointer;
    backdrop-filter: blur(6px);  /* Add blur effect behind button */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);  /* Soft shadow for a 3D effect */
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;  /* Smooth transitions */
    z-index: 999;  /* Ensures the button is always on top */
}

/* Hover effect for Back Button */
.back-btn:hover {
    background: linear-gradient(135deg, #ff4d4d, #b30000);  /* Keep the gradient */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);  /* Stronger shadow on hover */
    transform: translateY(-4px);  /* Slight lift effect */
    color: #fff;  /* Ensure text color stays white */
}

/* Focused state for accessibility */
.back-btn:focus {
    outline: none;  /* Remove default focus outline */
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);  /* Red focus glow */
}


/* --------------------------------------------- */
/* BACK BUTTON FADE-IN ANIMATION                 */
/* --------------------------------------------- */

.back-btn {
    opacity: 0;                          /* Start invisible */
    animation: backBtnFade 0.8s ease forwards;
    animation-delay: 0.6s;               /* Appears AFTER page fade-in */
}

@keyframes backBtnFade {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------ */
/* FULL-SCREEN MUSIC PLAYER                               */
/* ------------------------------------------------------ */

.music-player {
    max-width: 700px;           /* Much larger */
    width: 90%;
    margin: auto;
    text-align: center;
    margin-top: 40px;
}

.music-cover {
    width: 350px;
    height: 350px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 0 35px rgba(255, 0, 0, 0.5);
    margin-bottom: 20px;
}

.music-title {
    font-size: 36px;
    margin-top: 20px;
}

.music-artist {
    font-size: 22px;
    opacity: 0.85;
    margin-bottom: 35px;
}

/* Controls */
.music-controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 25px;
}

.music-controls button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 15px 22px;
    border-radius: 14px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: 0.2s;
}

.music-controls button:hover {
    background: rgba(255, 70, 70, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 60, 60, 0.6);
}

/* Progress bar */
.progress {
    width: 100%;
    cursor: pointer;
    margin-bottom: 20px;
}

/* Volume slider */
.volume-container {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.volume-container input[type="range"] {
    width: 150px;
    cursor: pointer;
}

/* ------------------------------------------------------ */
/* GLASSMORPHIC MUSIC PLAYER                              */
/* ------------------------------------------------------ */

.music-player {
    max-width: 800px; 
    width: 95%;
    margin: auto;
    margin-top: 40px;
    text-align: center;

    /* GLASS EFFECT */
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.3);
}

/* Floating global player */
.global-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    box-shadow: 0 0 15px rgba(255,0,0,0.4);
}

.gp-cover {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 0 10px rgba(255,0,0,0.4);
}

.gp-info {
    font-size: 14px;
    line-height: 1.1;
}

.global-player button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.global-player button:hover {
    background: rgba(255, 70, 70, 0.3);
}

/* ------------------------------------------------------ */
/* MINI PLAYER (Spotify bottom bar)                       */
/* ------------------------------------------------------ */

.mini-player {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    z-index: 9999;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.4);
}

.mp-cover {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.mp-text {
    flex: 1;
}

.mp-title {
    font-size: 15px;
    font-weight: bold;
}

.mp-artist {
    font-size: 12px;
    opacity: 0.75;
}

.mp-progress {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    margin-top: 4px;
    position: relative;
}

.mp-progress::after {
    content: "";
    position: absolute;
    height: 100%;
    width: var(--progress, 0%);  /* Use custom property for progress */
    background: #ff4444;
    border-radius: 5px;
    transition: width 0.1s linear;
}

.mp-buttons button {
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
}


/* ------------------------------------------------------ */
/* FULL-SCREEN PLAYER (slide-up)                          */
/* ------------------------------------------------------ */

.full-player {
    position: fixed;
    left: 0;
    bottom: -100%;
    width: 100%;
    height: 100%;
    background: #1a0000;
    z-index: 99999;
    padding: 25px;
    text-align: center;
    transition: bottom 0.4s ease;
}

.full-player.show {
    bottom: 0;
}

.fp-close {
    font-size: 30px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.fp-cover {
    width: 70%;
    max-width: 350px;
    border-radius: 25px;
    margin: 20px auto;
    display: block;
}

.fp-title {
    font-size: 26px;
    margin-top: 10px;
}

.fp-artist {
    font-size: 18px;
    opacity: 0.8;
}

.fp-progress {
    width: 80%;
    margin: 25px 0;
    transition: width 0.1s ease-in-out; /* Smooth transition for progress */
}

.fp-controls {
    display: flex;
    justify-content: center;
    gap: 35px;
}

.fp-controls button {
    font-size: 36px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

/* -------------------------------- */
/* TRIANGLE MENU (fixed version)    */
/* -------------------------------- */

.triangle-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    width: 300px;             /* gives the layout structure */
    gap: 25px;
    place-items: center;
}

/* Top button sits centered above */
.triangle-menu a:nth-child(1) {
    grid-column: 1 / 3;       /* span across two columns */
    justify-self: center;
}

/* Bottom-left */
.triangle-menu a:nth-child(2) {
    grid-column: 1;
}

/* Bottom-right */
.triangle-menu a:nth-child(3) {
    grid-column: 2;
}

/* ------------------------ */
/* MOBILE: vertical menu     */
/* ------------------------ */
@media (max-width: 600px) {
    .triangle-menu {
        width: 100%;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .triangle-menu a:nth-child(1),
    .triangle-menu a:nth-child(2),
    .triangle-menu a:nth-child(3) {
        grid-column: 1;
    }
}


.mp-volume input,
.fp-volume input {
    width: 100px;
    touch-action: none;
}

@media (max-width: 600px) {
    .mp-volume input,
    .fp-volume input {
        width: 80px;
    }
}

input[type="range"] {
    height: 6px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
}

.story-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s ease;
  z-index: 99999;
  padding: 20px;
}

.story-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.story-content h2 {
  margin-bottom: 15px;
}

.story-content h3 {
  margin-top: 20px;
  color: #ff8080;
}

.story-content p {
  line-height: 1.6;
  margin-top: 10px;
}

.story-close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: none;
  border: none;
  font-size: 30px;
  color: white;
  cursor: pointer;
}

.ending {
  margin-top: 30px;
  font-style: italic;
  text-align: center;
  opacity: 0.9;
}


/* Auto-scroll reveal animation */
.story-content {
  scroll-behavior: smooth;
}

/* Fade-in paragraphs as they enter view */
.story-content p,
.story-content h3 {
  opacity: 0;
  transform: translateY(8px);
  animation: revealText 0.8s ease forwards;
}

.story-content p {
  animation-delay: 0.2s;
}

@keyframes revealText {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------------------- */
/* STORY IMAGE INSIDE MODAL         */
/* -------------------------------- */

.story-image {
  width: 100%;
  border-radius: 20px;
  margin-bottom: 25px;
  box-shadow: 0 0 30px rgba(255,0,0,0.4);
}

/* ===================================================== */
/* HORIZONTAL CINEMATIC TIMELINE                         */
/* ===================================================== */

.timeline-scroll {
  width: 100vw;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 120px 0 160px;
}

.timeline-scroll::-webkit-scrollbar {
  height: 8px;
}

.timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,80,80,0.4);
  border-radius: 10px;
}

.timeline-track {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 260px;
  padding: 0 50vw;
  z-index: 2;
  min-width: max-content; /* FORCE FLEX TO GROW */
}

/* Subtle base line */
.timeline-track::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,80,80,0.6),
    transparent
  );
  transform: translateY(-50%);
}

/* Timeline dot */
.timeline-event {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff7777, #b30000);
  box-shadow: 0 0 18px rgba(255,0,0,0.6);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.timeline-event:hover {
  transform: scale(1.35);
  z-index: 5;
}

/* Date below */
.timeline-date {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  opacity: 0.85;
}

/* Floating preview */
.timeline-preview {
  position: absolute;
  bottom: 65px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(255,0,0,0.9);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: 0.35s ease;
  box-shadow: 0 0 20px rgba(255,0,0,0.5);
}

.timeline-event.active .timeline-preview,
.timeline-event:hover .timeline-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#star-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.timeline-scroll {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
  background: radial-gradient(circle at center, #200000, #050000);
}

.timeline-track {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 260px;
  padding: 0 50vw;
  z-index: 2;
}

#timeline-paths {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#star-canvas { z-index: 0; }
#timeline-paths { z-index: 1; }
.timeline-track { z-index: 2; }
.timeline-title { z-index: 5; }


.path-line {
  fill: none;
  stroke: rgba(255,80,80,0.6);
  stroke-width: 3;
  stroke-dasharray: 8 6;
}

.cinematic-btn {
  position: fixed;
  top: 25px;
  right: 25px;

  z-index: 20000; /* ABOVE player */

  background: rgba(255, 0, 0, 0.85);
  border: none;
  padding: 14px 22px;
  border-radius: 14px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;

  box-shadow:
    0 0 20px rgba(255, 0, 0, 0.4),
    0 0 40px rgba(255, 0, 0, 0.2);

  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cinematic-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 30px rgba(255, 80, 80, 0.6);
}



/* ===================================================== */
/* TIMELINE-SPECIFIC POLAROIDS (SAFE OVERRIDE)           */
/* ===================================================== */

.timeline-track .polaroid {
  position: relative; /* overrides gallery absolute */
  width: 220px;
  background: #fff;
  padding: 12px 12px 30px;
  border-radius: 10px;
  box-shadow:
    0 25px 50px rgba(0,0,0,0.6),
    0 0 25px rgba(255,0,0,0.4);
  transform: rotate(var(--rot)) translateY(var(--offset));
  transition: 0.4s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.timeline-track .polaroid:hover {
  transform: scale(1.08) rotate(0deg);
  z-index: 5;
}

/* Adjust the image inside the polaroid */
.timeline-track .polaroid img {
  width: 100%;
  height: 220px;  /* Set a fixed height for the images */
  object-fit: cover;  /* Ensure the images cover the space without distortion */
  border-radius: 5px;
}

.timeline-track .polaroid-title {
  color: #000;
  text-align: center;
  margin-top: 10px;
  font-weight: bold;
}

/* Timeline page needs edge-to-edge canvas */
body.page-bg .timeline-scroll {
  margin: 0;
  padding: 0;
}

/* Reserve space so timeline is not hidden behind player */
.timeline-scroll {
  padding-bottom: 180px; /* height of mini/global player */
}

.timeline-title {
  position: absolute;
  top: 40px;
  width: 100%;
  text-align: center;
  font-size: 48px;
  letter-spacing: 4px;
  z-index: 5;
  pointer-events: none;
  text-shadow:
    0 0 15px rgba(255,60,60,0.4),
    0 0 30px rgba(255,0,0,0.2);
}

body.page-bg {
  padding: 0;
}

.timeline-scroll {
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE */
}

.timeline-scroll::-webkit-scrollbar {
  display: none;                /* Chrome / Safari */
}

/* ===================================================== */
/* STORY MODAL – CINEMATIC LAYOUT                        */
/* ===================================================== */

.story-content {
  max-width: 900px;
  width: 90%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);

  max-height: calc(100svh - 120px); /* ✅ constrain height */
  overflow-y: auto;                 /* ✅ allow scrolling */
  overflow-x: hidden;

  border-radius: 25px;
  box-shadow: 0 0 40px rgba(255,0,0,0.4);
  padding: 50px;

  -webkit-overflow-scrolling: touch; /* smooth mobile scroll */
}

/* ===================================================== */
/* STORY MODAL — CUSTOM SCROLLBAR                        */
/* ===================================================== */

/* Firefox */
.story-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 80, 80, 0.6) rgba(255, 255, 255, 0.06);
}

/* Chrome / Edge / Safari */
.story-content::-webkit-scrollbar {
  width: 8px;
}

.story-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin: 8px 0; /* breathing room top/bottom */
}

.story-content::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 120, 120, 0.9),
    rgba(180, 0, 0, 0.85)
  );
  border-radius: 10px;
  box-shadow:
    inset 0 0 6px rgba(0, 0, 0, 0.35),
    0 0 10px rgba(255, 80, 80, 0.45);
}

.story-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 160, 160, 1),
    rgba(200, 0, 0, 0.95)
  );
}

/* Layout container */
.story-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 35px;
  align-items: start;
}

/* Image styling */
.story-image {
  width: 100%;
  max-width: 280px;
  border-radius: 18px;
  box-shadow: 0 0 25px rgba(255,0,0,0.35);
}

/* Text container */
.story-text {
  color: #fff;
}

/* Headings */
.story-text h1,
.story-text h2 {
  margin-bottom: 10px;
}

.story-text h1 {
  font-size: 28px;
}

.story-text h2 {
  font-size: 20px;
  color: #ff8c8c;
}

/* Paragraphs */
.story-text p {
  margin-top: 12px;
  line-height: 1.7;
  font-size: 16px;
  opacity: 0.95;
}

/* Text flowing under image on small screens */
@media (max-width: 700px) {
  .story-layout {
    grid-template-columns: 1fr;
  }

  .story-image {
    max-width: 100%;
    margin-bottom: 20px;
  }
}

.story-content * {
  animation: modalFadeIn 0.6s ease both;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================== */
/* 📱 MOBILE RESPONSIVE TIMELINE                         */
/* ===================================================== */

@media (max-width: 768px) {

  /* Page safety */
  html, body {
    overflow-x: hidden;
  }

  /* Title */
  .timeline-title {
    font-size: 28px;
    top: 25px;
    letter-spacing: 2px;
  }

  /* Back button */
  .back-btn {
    padding: 10px 18px;
    font-size: 16px;
    top: 15px;
    left: 15px;
  }

  /* Timeline container */
  .timeline-scroll {
    height: 100svh;
    padding-top: 100px;
    padding-bottom: 160px;
  }

  /* Polaroid sizing */
  .timeline-track .polaroid {
    width: 160px;
    padding: 10px 10px 22px;
    transform: rotate(var(--rot)) translateY(calc(var(--offset) * 0.6));
  }

  .timeline-track .polaroid img {
    height: 160px;
  }

  .timeline-track {
    gap: 180px;
    padding: 0 60vw;
  }

  /* SVG path thinner */
  .path-line {
    stroke-width: 2;
    stroke-dasharray: 6 6;
  }

}

/* ===================================================== */
/* 📱 MOBILE STORY MODAL                                 */
/* ===================================================== */

@media (max-width: 768px) {

  .story-content {
    width: 92%;
    max-height: calc(100svh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 30px 22px;
    border-radius: 22px;
  }

  .story-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .story-image {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
  }

  .story-text h1 {
    font-size: 22px;
  }

  .story-text h2 {
    font-size: 18px;
  }

  .story-text p {
    font-size: 15px;
    line-height: 1.65;
  }

  .story-close {
    position: fixed;
    top: env(safe-area-inset-top, 14px);
    right: 18px;
    font-size: 26px;
    z-index: 100000;
  }
}


.timeline-scroll {
  padding-bottom: calc(180px + env(safe-area-inset-bottom));
}

.jump-menu {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: 0.3s ease;
  z-index: 30000;
}

.jump-menu.show {
  opacity: 1;
  pointer-events: auto;
}

.jump-inner {
  max-width: 420px;
  max-height: 70vh;
  margin: 100px auto;
  padding: 30px;
  overflow-y: auto;
  background: rgba(255,255,255,0.08);
  border-radius: 24px;
  box-shadow: 0 0 40px rgba(255,0,0,0.4);
}

/* ===================================================== */
/* 🎬 MOMENTS MENU — CINEMATIC SCROLLBAR                 */
/* ===================================================== */

/* Firefox */
.jump-inner {
  scrollbar-width: thin;
  scrollbar-color:
    rgba(255, 80, 80, 0.8)
    rgba(255, 255, 255, 0.08);
}

/* Chrome / Edge / Safari */
.jump-inner::-webkit-scrollbar {
  width: 8px;
}

.jump-inner::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin: 6px 0; /* breathing room top/bottom */
}

.jump-inner::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 140, 140, 0.95),
    rgba(180, 0, 0, 0.85)
  );
  border-radius: 10px;
  box-shadow:
    inset 0 0 6px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(255, 80, 80, 0.45);
}

.jump-inner::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 180, 180, 1),
    rgba(200, 0, 0, 0.95)
  );
}

.jump-inner {
  -webkit-overflow-scrolling: touch;
}

.jump-item {
  padding: 14px 18px;
  margin-bottom: 10px;
  border-radius: 14px;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  transition: 0.25s ease;
}

.jump-item:hover {
  background: rgba(255,80,80,0.25);
  transform: translateX(4px);
}

.scrubber {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  z-index: 20000;
}

.scrubber-thumb {
  width: 24px;
  height: 24px;
  background: #ff5555;
  border-radius: 50%;
  position: absolute;
  top: -9px;
  left: 0;
  cursor: grab;
  box-shadow: 0 0 15px rgba(255,0,0,0.6);
}

/* ===================================================== */
/* FIX: SCRUBBER ABOVE PLAYER                            */
/* ===================================================== */

.scrubber {
  z-index: 100000; /* above mini + global player */
  bottom: calc(100px + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  .scrubber {
    display: none !important;
  }
}

.menu-box.locked {
  opacity: 0.35;
  filter: blur(1px);
  cursor: not-allowed;
}

.menu-box.unlocked {
  cursor: pointer;
}

.stage-buttons {
  margin-top: 30px;
}


/* ===================================================== */
/* STAGE BUTTONS – INDEX PAGE ONLY                       */
/* ===================================================== */

.stage-buttons .menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 90px);
  gap: 22px;
  justify-content: center;
}

.stage-buttons {
  margin-top: 35px;
  display: flex;
  justify-content: center;
}

.stage-buttons .menu-box {
  padding: 28px;
  font-size: 42px;
}
.stage-buttons .menu-box.locked {
  opacity: 0.25;
  filter: grayscale(1) blur(0.5px);
  pointer-events: none;
}

.stage-modal .story-content {
  box-shadow: 0 0 50px rgba(255,80,80,0.45);
}

.stage-modal .modal-title {
  text-align: center;
  letter-spacing: 2px;
  font-size: 26px;
  margin-bottom: 20px;
}

.stage-modal .modal-riddle {
  font-size: 18px;
  line-height: 1.8;
  text-align: center;
  opacity: 0.95;
  margin-bottom: 30px;
}

.stage-modal.final form,
.stage-modal.final form button {
  display: none !important;
}

.stage-modal.final #stagePasswordForm {
  display: none !important;
}



.grid-hint {
  margin-top: 35px;
  display: grid;
  grid-template-columns: repeat(6, 24px);
  gap: 10px;
  justify-content: center;
  opacity: 0.25;
}

.grid-hint div {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,120,120,0.6);
  border-radius: 4px;
}


@keyframes rewardAppear {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================== */
/* INDEX PAGE ONLY — STAGE BUTTONS (POLISHED)           */
/* ===================================================== */

.landing-bg .stage-buttons {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.landing-bg .stage-buttons .menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 88px);
  gap: 26px;
}

/* Square buttons with true centering */
.landing-bg .stage-buttons .menu-box {
  width: 88px;
  height: 88px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 38px;
  line-height: 1;

  padding: 0; /* 🔴 remove padding-based sizing */

  border-radius: 22px;
}

@media (max-width: 480px) {

  .landing-bg .stage-buttons {
    margin-top: 30px;
  }

  .landing-bg .stage-buttons .menu-grid {
    grid-template-columns: repeat(2, 84px);
    gap: 22px;
  }

  .landing-bg .stage-buttons .menu-box {
    width: 84px;
    height: 84px;
    font-size: 34px;
    border-radius: 20px;
  }
}

.landing-bg .stage-buttons .menu-box {
  box-shadow: 
    0 0 0 rgba(255,0,0,0),
    0 0 18px rgba(255,0,0,0.25);
}

@media (max-width: 480px) {

  /* Make the login container feel important again */
  .landing-bg .login-container {
    padding: 28px 22px;
  }

  /* Cipher text — louder on mobile */
  .landing-bg #cipher-text {
    font-size: 28px;
    margin-bottom: 18px;
  }

  /* Password input */
  .landing-bg #passwordForm input {
    font-size: 18px;
    padding: 14px;
  }

  /* Unlock button */
  .landing-bg #passwordForm button {
    font-size: 18px;
    padding: 14px;
  }

  /* Space between form and stage buttons */
  .landing-bg .stage-buttons {
    margin-top: 28px;
  }
}

/* ===================================================== */
/* STAGE MODAL — PASSWORD FORM (POLISHED)               */
/* ===================================================== */

.stage-modal #stagePasswordForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

/* Input field */
.stage-modal #stagePasswordInput {
  width: 100%;
  padding: 14px 16px;

  font-size: 18px;
  text-align: center;
  letter-spacing: 2px;

  color: #fff;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,120,120,0.4);
  border-radius: 14px;

  backdrop-filter: blur(6px);
  outline: none;

  transition: 
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.stage-modal #stagePasswordInput::placeholder {
  color: rgba(255,200,200,0.55);
  letter-spacing: 1px;
}

/* Focus state */
.stage-modal #stagePasswordInput:focus {
  border-color: rgba(255,120,120,0.8);
  box-shadow: 0 0 14px rgba(255,80,80,0.45);
}

/* Submit button */
.stage-modal #stagePasswordForm button {
  margin-top: 18px;
  padding: 14px;

  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;

  color: #fff;
  background: linear-gradient(135deg, #ff4d4d, #b30000);
  border: none;
  border-radius: 14px;

  cursor: pointer;

  box-shadow: 0 0 18px rgba(255,0,0,0.35);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* Hover / press */
.stage-modal #stagePasswordForm button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 26px rgba(255,80,80,0.55);
}

.stage-modal #stagePasswordForm button:active {
  transform: translateY(0);
  box-shadow: 0 0 14px rgba(255,80,80,0.4);
}

/* Slight emphasis on modal riddle */
.stage-modal #modalRiddle {
font-family: 'Zilla Slab', serif; /* fallback */
  font-style: italic;
  font-weight: 400;
  white-space: pre-line;
  letter-spacing: 0.5px;
  line-height: 2;

  opacity: 0.9;

  text-shadow:
    0 0 8px rgba(255, 120, 120, 0.25);
}

/* Subtle divider before input */
.stage-modal #stagePasswordForm::before {
  content: "";
  height: 1px;
  width: 60%;
  margin: 10px auto 6px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,120,120,0.6),
    transparent
  );
}

/* ===================================================== */
/* STAGE REWARD — SYMBOL REVEAL (VERTICAL + FADE)       */
/* ===================================================== */

#modalReward {
  margin-top: 26px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;

  font-size: 28px;
  letter-spacing: 6px;
  color: #ffd6d6;
  font-weight: bold;
  animation: rewardAppear 0.6s ease-out both;

  text-shadow:
    0 0 12px rgba(255,120,120,0.45),
    0 0 28px rgba(255,0,0,0.25);
}

/* Individual symbols */
#modalReward span {
  opacity: 0;
  transform: translateY(6px);

  animation: rewardSymbolReveal 0.6s ease forwards;
}

/* Fade + rise animation */
@keyframes rewardSymbolReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ===================================================== */
/* REWARD — CURSIVE GRID HINT                           */
/* ===================================================== */

.reward-hint {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;

  font-size: 15px;
  letter-spacing: 1px;
  text-align: center;

  opacity: 0;
  transform: translateY(6px);

  animation: rewardSymbolReveal 0.6s ease forwards;
  animation-delay: 0.1s;

  color: #ffdede;

  text-shadow:
    0 0 10px rgba(255,120,120,0.35);

  margin-bottom: 14px;
}

/* REWARD UNLOCKED label (separate class now) */
.reward-title {
  font-size: 12px;
  letter-spacing: 3px;
  opacity: 0.6;
  margin-bottom: 10px;
}

/* ===================================================== */
/* PASSWORD HINT BUTTON */
/* ===================================================== */

.hint-btn {
  margin-top: 12px;
  background: none;
  border: 1px dashed rgba(255,120,120,0.5);
  color: #ffdede;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  opacity: 0.6;
  transition: 0.25s ease;
}

.hint-btn:hover {
  opacity: 1;
  border-color: rgba(255,120,120,0.9);
  box-shadow: 0 0 12px rgba(255,80,80,0.35);
}

/* Hint text reveal */
.password-hint {
  margin-top: 14px;
  font-style: italic;
  text-align: center;
  color: #ffcccc;
  opacity: 0;
  animation: revealText 0.6s ease forwards;
}

/* ===================================================== */
/* HINT CONFIRMATION PANEL */
/* ===================================================== */

.hint-confirm {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 40, 40, 0.08);
  border: 1px solid rgba(255,120,120,0.35);
  text-align: center;
  box-shadow: 0 0 22px rgba(255,0,0,0.25);
  animation: confirmFadeIn 0.35s ease both;
}

.hint-confirm.hidden {
  display: none;
}

.hint-confirm p {
  margin-bottom: 6px;
  font-size: 15px;
}

.hint-warning {
  font-style: italic;
  opacity: 0.75;
  margin-bottom: 14px;
}

/* Buttons */
.hint-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.hint-confirm-actions button {
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 1px;
}

#hintCancel {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}

#hintConfirmYes {
  background: linear-gradient(135deg, #ff4d4d, #b30000);
  color: white;
  box-shadow: 0 0 14px rgba(255,0,0,0.45);
}

/* Subtle entrance */
@keyframes confirmFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================== */
/* EXTERNAL PUZZLE LINK */
/* ===================================================== */

.external-link {
  margin: 18px auto 10px;
  text-align: center;
  opacity: 0;
  animation: revealText 0.6s ease forwards;
}

.external-link.hidden {
  display: none;
}

.external-label {
  font-size: 12px;
  letter-spacing: 2px;
  opacity: 0.6;
  margin-bottom: 6px;
}

.external-link a {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 14px;
  text-decoration: none;
  color: #ffdede;
  border: 1px solid rgba(255,120,120,0.5);
  background: rgba(255,255,255,0.05);
  transition: 0.25s ease;
}

.external-link a:hover {
  border-color: rgba(255,120,120,0.9);
  box-shadow: 0 0 18px rgba(255,80,80,0.45);
  transform: translateY(-1px);
}

/* Slightly reduce vertical padding on smaller screens */
@media (max-height: 900px) {
  .login-container {
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

/* Laptop-sized screens (1080p and below) */
@media (max-height: 800px) {
  .login-container {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .stage-buttons {
    margin-top: 22px;
  }
}

/* Phones */
@media (max-width: 600px) {
  .login-container {
    /* max-height: calc(100svh - 40px); mobile-safe viewport */
    padding: 22px 20px;
  }

  /* Reduce cipher dominance */
  #cipher-text {
    font-size: 26px;
    margin-bottom: 14px;
  }

  /* Tighten form spacing */
  #passwordForm input,
  #passwordForm button {
    padding: 12px;
  }

  /* Stage buttons feel lighter */
  .landing-bg .stage-buttons {
    margin-top: 22px;
  }
}

/* Very small-height phones (landscape) */
@media (max-height: 500px) {
  .login-container {
    max-height: calc(100svh - 20px);
    padding: 16px;
  }

  .landing-bg .stage-buttons .menu-grid {
    gap: 18px;
  }
}


/* ===================================================== */
/* LOGIN CONTAINER — NO SCROLL, HEIGHT-RESPONSIVE        */
/* ===================================================== */


/* --------------------------------------------- */
/* Cipher text scales with height, not width     */
/* --------------------------------------------- */

#cipher-text {
  font-size: clamp(22px, 4.5vh, 50px);
  margin-bottom: clamp(12px, 3vh, 24px);
}

/* --------------------------------------------- */
/* Password form spacing                         */
/* --------------------------------------------- */

#passwordForm input,
#passwordForm button {
  padding: clamp(10px, 2.5vh, 14px);
  font-size: clamp(14px, 2.2vh, 18px);
}

/* --------------------------------------------- */
/* Stage buttons scale DOWN on shorter screens   */
/* --------------------------------------------- */

.landing-bg .stage-buttons {
  margin-top: clamp(18px, 3vh, 40px);
}

.landing-bg .stage-buttons .menu-grid {
  gap: clamp(18px, 3vh, 26px);
}

/* Button size scales by height */
.landing-bg .stage-buttons .menu-box {
  width: clamp(72px, 10vh, 88px);
  height: clamp(72px, 10vh, 88px);
  font-size: clamp(30px, 5vh, 38px);
  border-radius: clamp(18px, 3vh, 22px);
}

/* --------------------------------------------- */
/* Laptop screens (1080p and below)              */
/* --------------------------------------------- */

@media (max-height: 800px) {

  .login-container {
    padding: 22px;
  }

  #cipher-text {
    font-size: 34px;
  }

  .landing-bg .stage-buttons .menu-grid {
    gap: 20px;
  }
}

/* --------------------------------------------- */
/* Phones — no scrolling, tighter composition    */
/* --------------------------------------------- */

@media (max-width: 600px) {

  .login-container {
    padding: 20px 18px;
  }

  #cipher-text {
    font-size: 26px;
  }

  .landing-bg .stage-buttons .menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-bg .stage-buttons .menu-box {
    width: 70px;
    height: 70px;
    font-size: 30px;
  }
}

/* --------------------------------------------- */
/* Very short screens (mobile landscape)         */
/* --------------------------------------------- */

@media (max-height: 500px) {

  .login-container {
    padding: 14px;
  }

  #cipher-text {
    font-size: 22px;
  }

  .landing-bg .stage-buttons {
    margin-top: 14px;
  }

  .landing-bg .stage-buttons .menu-box {
    width: 64px;
    height: 64px;
    font-size: 26px;
  }
}

.password-hint {
  white-space: pre-line;
}

/* ================================= */
/* LETTER VIEWER                     */
/* ================================= */

.letter-viewer {
  text-align: center;
  animation: letterReveal 1s ease-out both;
}

@keyframes letterReveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.letter-image-container {
  margin: 30px auto;
  max-width: 520px;
}

.letter-image-container img {
  width: 100%;
  border-radius: 18px;

  background: #fff;
  padding: 14px;

  box-shadow:
    0 30px 70px rgba(0,0,0,0.65),
    inset 0 0 25px rgba(0,0,0,0.08),
    0 0 35px rgba(255, 80, 80, 0.35);

  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.letter-image-container img:hover {
  transform: scale(1.015);
  box-shadow:
    0 40px 90px rgba(0,0,0,0.75),
    inset 0 0 25px rgba(0,0,0,0.1),
    0 0 45px rgba(255, 80, 80, 0.5);
}

.letter-image-container {
  position: relative;
}

.letter-image-container::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.015),
      rgba(255,255,255,0.015) 2px,
      rgba(0,0,0,0.015) 4px
    );
}

/* Controls */
.letter-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.letter-controls button {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,120,120,0.35);
  padding: 12px 22px;
  border-radius: 14px;

  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;

  backdrop-filter: blur(6px);
  box-shadow: 0 0 18px rgba(255,0,0,0.25);

  transition: 0.25s ease;
  color: white;
}

.letter-controls button:hover {
  box-shadow: 0 0 30px rgba(255,80,80,0.5);
  transform: translateY(-2px);
}

.letter-controls button:disabled {
  opacity: 0.25;
  box-shadow: none;
}

#pageIndicator {
  font-size: 12px;
  letter-spacing: 4px;
  opacity: 0.65;
  margin-top: 4px;
}

.letter-image-container {
  filter: drop-shadow(0 0 50px rgba(255, 60, 60, 0.25));
}

/* ================================= */
/* 📱 LETTER — MOBILE FULL VIEW     */
/* ================================= */

@media (max-width: 600px) {

  body.letter-bg {
    padding: 0;
  }

  .letter-box {
    max-width: none;
    padding: 0;
    background: none;
  }

  .letter-image-container {
    width: 100%;
    padding: 16px;          /* 👈 breathing room */
    box-sizing: border-box;
  }

  .letter-image-container img {
    width: 100%;
    height: auto;

    border-radius: 14px;    /* 👈 softer edges */
    padding: 10px;          /* 👈 faux paper border */
    background: #fff;

    box-shadow:
      0 20px 45px rgba(0,0,0,0.55),
      0 0 25px rgba(255, 80, 80, 0.25);

    max-width: 100%;
  }

}

@media (max-width: 600px) {
  .letter-viewer h1 {
    font-size: 22px;
    padding: 18px 16px 10px;
    opacity: 0.9;
    letter-spacing: 1px;
  }
}

@media (max-width: 600px) {
  .letter-controls {
    display: none;
  }
}

@media (max-width: 600px) {

  .letter-controls {
    position: sticky;
    bottom: calc(20px + env(safe-area-inset-bottom));
    background: rgba(26, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 14px 10px;
    border-radius: 16px;
    z-index: 50;
  }

}

/* ================================= */
/* 📱 LETTER EDGE ARROWS             */
/* ================================= */

.letter-arrow {
  display: none;
}

@media (max-width: 600px) {

  .letter-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    position: fixed;
    top: 50%;
    transform: translateY(-50%);

    width: 36px;
    height: 56px;

    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);

    border: none;
    color: white;
    font-size: 30px;
    font-weight: 300;

    z-index: 100;
    cursor: pointer;

    opacity: 0.45;
    transition: opacity 0.2s ease;
  }

  .letter-arrow:hover {
    opacity: 0.75;
  }

  .letter-arrow.left {
    left: 6px;
    border-radius: 0 12px 12px 0;
  }

  .letter-arrow.right {
    right: 6px;
    border-radius: 12px 0 0 12px;
  }
}

@media (max-width: 600px) {

  body.letter-bg {
    padding: 0; /* 🔑 critical */
  }

  .letter-box {
    max-width: none;
    padding: 0;
    border-radius: 0;
    background: none;
  }

}

.letter-arrow {
  transition: opacity 0.35s ease;
}

.letter-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ================================= */
/* MAIN PASSWORD — LOCKED STYLE FIX */
/* ================================= */

#passwordInput:disabled {
  opacity: 1; /* prevent chrome fade */
  color: rgba(255, 220, 220, 0.6);
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,120,120,0.4);
  cursor: not-allowed;
}

#passwordForm button:disabled {
  opacity: 0.6;
  background: rgba(120,0,0,0.5);
  cursor: not-allowed;
  box-shadow: none;
}

/* Smooth transition for main password */
#passwordInput,
#passwordForm button {
  transition:
    background 0.4s ease,
    border 0.4s ease,
    box-shadow 0.4s ease,
    color 0.4s ease,
    opacity 0.4s ease,
    transform 0.3s ease;
}

@keyframes mainUnlockFlash {
  0% {
    box-shadow: 0 0 0 rgba(255,0,0,0);
  }
  40% {
    box-shadow: 0 0 30px rgba(255,80,80,0.9);
  }
  100% {
    box-shadow: 0 0 18px rgba(255,0,0,0.4);
  }
}

.main-unlocked {
  animation: mainUnlockFlash 0.8s ease forwards;
  transform: scale(1.02);
}

.polaroid {
  will-change: transform;
  transform: translateZ(0);
}