/* ====================================
   GLOBAL STYLES & BACKGROUND
====================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #040a13;
    color: #ffffff;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: background-color 0.8s ease;
}

canvas#bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ====================================
   CONTAINER MANAGEMENT
====================================== */
.container {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    text-align: center;
    width: 90%;
    max-width: 400px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.container-letter {
    position: relative;
    z-index: 10;
    width: 95%;
    max-width: 680px;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.container-gallery {
    position: relative;
    z-index: 10;
    width: 95%;
    max-width: 800px;
    text-align: center;
    transition: opacity 0.6s ease;
}

.hide {
    display: none !important;
    opacity: 0;
}

/* ====================================
   TYPOGRAPHY & PIN SCREENS
====================================== */
h1 { font-size: 2rem; margin-bottom: 10px; font-weight: 500; }
.top-text { font-size: 0.9rem; color: #e8d3a9; font-style: italic; margin-bottom: 5px; }
.hint, .instruction-text { font-size: 0.9rem; color: #aaaaaa; margin-bottom: 25px; }

.pin-box { display: flex; justify-content: center; gap: 15px; margin-bottom: 20px; }
.pin {
    width: 50px; height: 60px; background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 10px;
    text-align: center; font-size: 1.5rem; color: #fff; font-weight: bold; transition: all 0.3s ease;
}
.pin:focus { outline: none; border-color: #e8d3a9; background: rgba(255, 255, 255, 0.2); box-shadow: 0 0 10px rgba(232, 211, 169, 0.5); }
#status { font-size: 0.9rem; min-height: 40px; line-height: 1.4; }

/* ====================================
   CAKE STYLES 🎂
====================================== */
.cake-wrapper { position: relative; width: 100%; height: 150px; margin: 20px 0 40px 0; display: flex; justify-content: center; align-items: flex-end; }
.cake { position: relative; width: 160px; height: 100px; }
.bottom-layer, .mid-layer, .top-layer { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 10px 10px 0 0; border: 2px solid rgba(255, 255, 255, 0.2); }
.bottom-layer { width: 160px; height: 40px; bottom: 0; background: #6c5ce7; }
.mid-layer { width: 130px; height: 35px; bottom: 38px; background: #a29bfe; }
.top-layer { width: 100px; height: 30px; bottom: 71px; background: #ff7675; }
.candle { position: absolute; width: 8px; height: 35px; background: #ffeaa7; top: -33px; left: 50%; transform: translateX(-50%); border-radius: 3px; z-index: 2; }
.flame {
    position: absolute; width: 16px; height: 25px; border-radius: 80% 0 55% 50% / 55% 0 80% 50%; transform: translateX(-50%) rotate(-45deg);
    top: -23px; left: 50%; background: linear-gradient(to bottom, #ff9f43, #ffff2e); box-shadow: 0 0 20px #ff9f43; cursor: pointer; animation: flicker 0.6s ease-in-out infinite alternate;
}
@keyframes flicker { 0% { transform: translateX(-50%) rotate(-43deg); box-shadow: 0 0 15px #ff9f43; } 100% { transform: translateX(-50%) rotate(-47deg) scale(1.08); box-shadow: 0 0 25px #ff7675; } }

/* ====================================
   VINTAGE LETTER 📜
====================================== */
.paper {
    background: #fdf5e6; color: #111a24; padding: 45px 40px; border-radius: 15px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.1), 0 15px 35px rgba(0,0,0,0.6);
    min-height: 500px; display: flex; flex-direction: column; justify-content: space-between;
}
.letter-date { font-size: 0.95rem; color: #555; text-align: right; margin-bottom: 20px; font-weight: 500; }
.letter-dear { font-family: 'Cormorant Garamond', serif; font-size: 2.3rem; font-weight: 700; margin-bottom: 25px; border-bottom: 1px solid rgba(0, 0, 0, 0.1); padding-bottom: 5px; }
.letter-text { font-size: 1.15rem; line-height: 1.8; margin-bottom: 20px; text-align: justify; }
.letter-from { text-align: right; font-size: 1rem; margin-top: 30px; color: #333; }
.letter-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.btn-page { background: #111a24; color: #fdf5e6; border: none; padding: 10px 20px; font-size: 1rem; border-radius: 6px; cursor: pointer; transition: all 0.3s ease; }
.btn-page:hover { background: #000; transform: translateY(-1px); }

/* ====================================
   DYNAMIC GALLERY LAYOUT 📸
====================================== */
.gallery-title { font-size: 2.5rem; font-weight: 600; margin-bottom: 5px; letter-spacing: 1px; }
.gallery-subtitle { font-size: 1.05rem; color: #e8d3a9; font-style: italic; margin-bottom: 30px; transition: color 0.5s ease; min-height: 30px; }

.slide-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 10px;
}

.photo-frame {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    flex: 1;
    max-width: 360px;
    transition: all 0.5s ease;
}

.photo-frame:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--theme-glow, #e8d3a9) !important;
    box-shadow: 0 15px 35px var(--theme-shadow, rgba(232, 211, 169, 0.3)) !important;
}

.photo-frame img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.gallery-controls { display: flex; justify-content: center; align-items: center; gap: 30px; margin-top: 20px; }
.btn-gal { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); padding: 8px 20px; border-radius: 20px; cursor: pointer; transition: all 0.3s ease; }
.btn-gal:hover { background: #fff; color: #000; }
#gal-counter { font-size: 1rem; font-weight: 500; letter-spacing: 1px; }

/* GLOBAL BTN */
.btn-next { background: #ffffff; color: #040a13; border: none; padding: 12px 30px; font-size: 1rem; font-weight: 500; border-radius: 25px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2); text-decoration: none; }
.btn-next:hover { background: #e8d3a9; transform: translateY(-2px); }

.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* Style tambahan untuk tombol playlist lagu */
.btn-song {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.3s ease;
}
.btn-song:hover, .btn-song.active {
    background: #e8d3a9;
    color: #040a13;
    border-color: #e8d3a9;
    transform: translateX(4px);
    box-shadow: 0 0 15px rgba(232, 211, 169, 0.3);
}

/* FIX SURAT BIAR BISA DI-SCROLL KALAU KATA-KATA KEPANJANGAN */
.container-letter {
    max-height: 90vh; /* Biar kontainer surat gak melebihi tinggi layar laptop */
    display: block;   /* Mencegah konflik layout */
}

.paper {
    max-height: 500px;    /* Tinggi maksimal kertas surat */
    overflow-y: auto;     /* Otomatis munculin scrollbar kebawah kalau teks panjang */
    padding-right: 15px;  /* Kasih jarak di kanan biar teks gak mepet scrollbar */
    scroll-behavior: smooth;
}

/* Biar tampilan scrollbar-nya tetep estetik dan gak ngerusak pemandangan */
.paper::-webkit-scrollbar {
    width: 6px;
}
.paper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}
.paper::-webkit-scrollbar-thumb {
    background: rgba(4, 10, 19, 0.2);
    border-radius: 10px;
}
.paper::-webkit-scrollbar-thumb:hover {
    background: rgba(4, 10, 19, 0.4);
}