@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;700&family=Poppins:wght@300;400;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #000;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* ========== BACKGROUND ROMANTIS ========== */
.stars {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 2s infinite alternate;
}
@keyframes twinkle {
    0% { opacity: 0.3; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.2); }
}

#matrixCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 1s ease;
}
#matrixCanvas.active { opacity: 0.7; }

#romanceCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 1s ease;
}
#romanceCanvas.active { opacity: 0.9; }

/* ========== START OVERLAY ========== */
.start-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    cursor: pointer;
    backdrop-filter: blur(10px);
}
.start-message {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2rem, 8vw, 5rem);
    color: #ff69b4;
    text-align: center;
    padding: 2rem;
    text-shadow: 0 0 20px #ff1493;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%,100%{transform:scale(1)} 50%{transform:scale(1.1)}
}

/* ========== COUNTDOWN ========== */
.countdown {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: rgba(0,0,0,0.8);
}
.countdown.hidden { display: none; }
.countdown-number {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(20vw, 40vh, 500px);
    color: #ff1493;
    text-shadow: 0 0 20px #ff1493,0 0 40px #ff69b4,0 0 60px #ff1493;
    animation: pulseCount 1s infinite;
    margin-bottom: 2rem;
}
@keyframes pulseCount {
    0%,100%{transform:scale(1)} 50%{transform:scale(1.1)}
}
.countdown-text {
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: #fff;
    text-align: center;
    text-shadow: 0 0 10px #ff69b4;
}

/* ========== SAMPUL BUKU - VERTIKAL ========== */
/* ========== SAMPUL BUKU - VERTIKAL (ASPECT RATIO) ========== */
.book-cover {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(80vw, 350px);        /* Lebar maksimal 350px */
    aspect-ratio: 3 / 4;             /* Rasio 3:4 (vertikal) */
    background: #2a1a2a;
    border-radius: 30px 15px 15px 30px;
    box-shadow: 0 30px 50px rgba(255,20,147,0.6), inset -10px 0 20px rgba(0,0,0,0.5);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border: 2px solid #ff69b4;
    position: relative;
    overflow: hidden;
}
.book-cover.hidden { display: none; }

.cover-spine {
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, #4a2a4a, #2a1a2a);
    border-radius: 15px 0 0 15px;
    box-shadow: inset -2px 0 5px rgba(0,0,0,0.5);
    border: 1px solid #ff69b4;
    border-right: none;
    z-index: 2;
    height: 100%; /* memastikan spine setinggi cover */
}

.cover-front {
    width: calc(100% - 28px);
    height: 100%;
    margin-left: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* konten tersebar vertikal */
    background: linear-gradient(145deg, #3a1a3a, #1a0f1a);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    box-shadow: inset 0 0 30px rgba(255,105,180,0.3);
    border: 2px solid #ff69b4;
}

.cover-image {
    width: 80%;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(255,20,147,0.7);
    border: 4px solid #ff1493;
    margin: 0.5rem 0;
    animation: coverGlow 2s infinite alternate;
    overflow: hidden;
}
.cover-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes coverGlow {
    0% { box-shadow: 0 15px 30px rgba(255,20,147,0.5); }
    100% { box-shadow: 0 15px 50px rgba(255,20,147,1); }
}

.cover-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2rem, 5vw, 2.8rem);
    color: #ff69b4;
    text-shadow: 0 0 20px #ff1493;
    margin: 0.2rem 0;
    text-align: center;
    line-height: 1.2;
}

.cover-subtitle {
    font-size: clamp(1.2rem, 4vw, 2rem);
    color: #fff;
    text-shadow: 0 0 10px #ff69b4;
    background: rgba(255,20,147,0.2);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    border: 1px solid #ff69b4;
    text-align: center;
    margin: 0.2rem 0;
}

.open-btn {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    padding: 0.6rem 1.5rem;
    background: linear-gradient(45deg, #ff1493, #ff69b4);
    border: none;
    border-radius: 60px;
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255,20,147,0.7);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    border: 2px solid #fff;
    white-space: nowrap;
    margin: 0.5rem 0;
}
.open-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 50px rgba(255,20,147,1);
    background: linear-gradient(45deg, #ff69b4, #ff1493);
}

.orientation-warning {
    display: none;
    color: #ff69b4;
    font-size: 1rem;
    margin-top: 0.3rem;
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 0.3rem 0.8rem;
    border-radius: 30px;
    border: 1px solid #ff69b4;
}

/* ========== BUKU 3D (TETAP HORIZONTAL) ========== */
.book-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(95vw, 1000px);
    height: min(80vh, 600px);
    perspective: 3000px;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease;
    pointer-events: none;
}
.book-container.show {
    opacity: 1;
    pointer-events: auto;
}

.book {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.book.open {
    transform: rotateY(12deg) rotateX(2deg);
}

.page-left, .page-right {
    width: 50%;
    height: 100%;
    position: absolute;
    top: 0;
    background: #f9f1e6;
    background-image: linear-gradient(145deg, #fff5e6 0%, #f0e0d0 100%);
    overflow: hidden;
    backface-visibility: visible;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border-radius: 5px;
    border: 1px solid #d4b59e;
    transform-style: preserve-3d;
}

.page-left {
    left: 0;
    transform-origin: right center;
    border-right: 3px solid #b38b6d;
    box-shadow: inset -5px 0 15px rgba(0,0,0,0.2);
}

.page-right {
    right: 0;
    transform-origin: left center;
    transform: rotateY(0deg);
    border-left: 3px solid #b38b6d;
    box-shadow: inset 5px 0 15px rgba(0,0,0,0.2);
    transition: transform 0.8s ease-in-out;
}

/* ========== EFEK MEMBALIK HALAMAN (PAPER SLIDE) ========== */
.page-turn {
    position: absolute;
    width: 50%;
    height: 100%;
    right: 0;
    top: 0;
    background: #f9f1e6;
    background-image: linear-gradient(145deg, #fff5e6 0%, #f0e0d0 100%);
    transform-origin: left center;
    transform: rotateY(0deg);
    backface-visibility: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border-radius: 5px;
    border: 1px solid #d4b59e;
    border-left: 3px solid #b38b6d;
    transition: transform 0.9s cubic-bezier(0.4, 0.2, 0.2, 1), box-shadow 0.9s ease;
    z-index: 30; /* pastikan di atas halaman lain */
    display: none;
    pointer-events: none; /* agar tidak mengganggu klik */
}
.page-turn.turning {
    display: block;
    transform: rotateY(-165deg) scale(0.98);
    box-shadow: -30px 0 50px rgba(0, 0, 0, 0.7);
}

.page-content {
    width: 100%;
    height: 100%;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #2c1a0f;
}

.photo-frame {
    width: 100%;
    height: 100%;
    background: rgba(255,255,240,0.9);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(180,130,100,0.3);
    border: 3px solid #d4a373;
}
.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.love-gradient {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #5a2a2a;
    font-family: 'Dancing Script', cursive;
    border-radius: 10px;
}
.love-gradient div:first-child { font-size: clamp(2rem, 5vw, 3rem); }
.love-gradient div:last-child { font-size: clamp(1.5rem, 4vw, 2rem); }

.page-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(1.8rem, 5vw, 3rem);
    color: #b13e3e;
    text-shadow: 0 0 10px #ffb6c1;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}
.page-message {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: #3a2a1a;
    line-height: 1.5;
    max-width: 90%;
    word-break: break-word;
}

/* ========== NAVIGASI DOTS ========== */
.nav-dots {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.8rem;
    z-index: 20;
}
.nav-dots.hidden { display: none; }
.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #ff69b4;
}
.nav-dot.active {
    background: #ff1493;
    box-shadow: 0 0 20px #ff1493;
    transform: scale(1.4);
}

/* ========== VIDEO AKHIR ========== */
.video-container {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 1s;
    pointer-events: none;
    padding: 1rem;
}
.video-container.show {
    opacity: 1;
    pointer-events: auto;
}
.video-wrapper {
    width: min(95vw, 800px);
    max-width: 100%;
    aspect-ratio: 16/9;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(255,20,147,0.8);
    margin-bottom: 1.5rem;
    border: 3px solid #ff69b4;
}
video { width:100%; height:100%; object-fit:cover; }
.video-title {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2rem, 6vw, 4rem);
    color: #ff69b4;
    text-shadow: 0 0 20px #ff1493;
    text-align: center;
    margin-bottom: 0.5rem;
}
.video-message {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #fff;
    text-align: center;
    max-width: 90%;
    line-height: 1.4;
    padding: 0 1rem;
}

/* ========== FULLSCREEN & COPYRIGHT ========== */
.fullscreen-btn {
    position: fixed;
    top:1rem; right:1rem;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(20px);
    border: 2px solid #ff69b4;
    color: white;
    padding:0.6rem;
    border-radius:50%;
    cursor: pointer;
    z-index:100;
    font-size:1.2rem;
    width:40px; height:40px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fullscreen-btn:hover {
    background: #ff1493;
    transform: scale(1.1);
}
.copyright {
    position: fixed;
    bottom:5px; right:10px;
    color: rgba(255,255,255,0.4);
    font-size:10px;
    z-index:10002;
    pointer-events:none;
}

/* ========== RESPONSIVE ORIENTASI ========== */
@media (orientation: portrait) {
    .open-btn {
        display: none;
    }
    .orientation-warning {
        display: block;
    }
}

@media (orientation: landscape) {
    .orientation-warning {
        display: none;
    }
    .open-btn {
        display: inline-block;
    }
}

/* Penyesuaian ukuran untuk handphone - COVER VERTIKAL */
@media (max-width: 768px) {
    .book-cover {
        width: min(85vw, 320px)
    }
    .cover-image {
        width: 70%;
        max-height: 30%;
    }
    .open-btn {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    .book-container {
        width: 95vw;
        height: 70vh;
    }
    .page-content {
        padding: 0.5rem;
    }
    .page-title {
        font-size: 1.8rem;
    }
    .page-message {
        font-size: 0.9rem;
    }
    .nav-dots {
        bottom: 1rem;
        gap: 0.6rem;
    }
    .nav-dot {
        width: 10px;
        height: 10px;
    }
}

/* Landscape mode khusus handphone - BUKU TETAP HORIZONTAL */
@media (orientation: landscape) and (max-height: 600px) {
    .book-cover {
        width: min(60vw, 280px);  /* Lebar lebih kecil di landscape sempit */
    }
    .cover-image {
        width: 70%;
    }
    .cover-title {
        font-size: 1.8rem;
    }
    .cover-subtitle {
        font-size: 1.2rem;
        padding: 0.3rem 1rem;
    }
    .open-btn {
        font-size: 1rem;
        padding: 0.4rem 1rem;
    }
    .book-container {
        height: 80vh;
        width: 80vw;
    }
    .page-content {
        padding: 0.3rem;
    }
    .page-title {
        font-size: 1.5rem;
        margin-bottom: 0.2rem;
    }
    .page-message {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    .video-wrapper {
        width: 80vw;
    }
    .video-title {
        font-size: 2rem;
    }
    .video-message {
        font-size: 1rem;
    }
}

/* Untuk layar sangat kecil */
@media (max-width: 380px) and (orientation: portrait) {
    .book-cover {
        height: 70vh;
    }
    .cover-image {
        width: 60%;
        max-height: 25%;
    }
    .cover-title {
        font-size: 1.6rem;
    }
    .cover-subtitle {
        font-size: 1rem;
    }
    .page-title {
        font-size: 1.5rem;
    }
    .page-message {
        font-size: 0.8rem;
    }
}

/* Landscape dengan tinggi sangat kecil */
@media (orientation: landscape) and (max-height: 400px) {
    .book-cover {
        width: min(50vw, 240px);
    }
    .cover-title {
        font-size: 1.4rem;
    }
    .cover-subtitle {
        font-size: 0.9rem;
    }
    .open-btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
    .page-title {
        font-size: 1.2rem;
    }
    .page-message {
        font-size: 0.7rem;
    }
    .video-wrapper {
        width: 70vw;
    }
    .video-title {
        font-size: 1.5rem;
    }
    .video-message {
        font-size: 0.9rem;
    }
}
/* Efek fade-in untuk gambar */
.fade-in {
    animation: fadeIn 0.8s ease-in-out forwards;
    opacity: 0; /* Mulai dari transparan */
}
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
