* {

    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nanum Pen Script', cursive;
    font-weight: 400;
    font-style: normal;
    background-color: #2c2c2c;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

h1, h2, h3, .handwriting {
    font-family: 'Nanum Pen Script', cursive;
}

h1 {
    color: #f5e6d3;
    font-size: 3rem;
}

h2 {
    font-size: 2.2rem;
    color: blanchedalmond;
    margin-bottom: 1rem;
}

.handwriting {
    font-size: 1.5rem;
    color: #ccc;
}

.book-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    height: 70vh;
    min-height: 500px;
}

#book {
    width: 100%;
    height: 100%;
}

.page {
    background-color: #f5e6d3;
    background-image: url('../assets/textures/page.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    filter: blur(0.5px);
}

.page-content {
    width: 100%;
    height: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.page-content-scattered {
    width: 100%;
    height: 100%;
    padding: 40px;
    position: relative;
}

.page-content-scattered .photo-frame:nth-child(1) {
    position: absolute;
    top: 5%;
    left: 5%;
}

.page-content-scattered .photo-frame:nth-child(2) {
    position: absolute;
    top: 8%;
    right: 5%;
}

.page-content-scattered .photo-frame:nth-child(3) {
    position: absolute;
    bottom: 8%;
    left: 10%;
}

.page-content-scattered .photo-frame:nth-child(4) {
    position: absolute;
    bottom: 5%;
    right: 10%;
}

.page-cover {
    background-color: #8b4513;
    position: relative;
    z-index: 1;
}

.page-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../assets/textures/cover.jpg');
    background-repeat: repeat;
    background-size: auto;
    transform: rotate(0deg);
    z-index: -1;
    pointer-events: none;
}

.page-cover .page-content {
    justify-content: center;
    position: relative;
    z-index: 2;
}

.cover-layout {
    justify-content: flex-end !important;
    align-items: flex-start !important;
    text-align: left !important;
    padding-bottom: 30px !important;
}

.cover-layout .cover-spacer {
    flex: 1;
}

.cover-layout .handwriting {
    align-self: center;
    margin-bottom: auto;
    margin-top: 40%;
}

.cover-title {
    color: #1a1a1a !important;
    text-shadow: none !important;
    font-size: clamp(1.8rem, 5vmin, 2.8rem);
    line-height: 1.2;
}

.page-inline-text {
    position: absolute;
    left: -160px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Nanum Pen Script', cursive;
    font-size: clamp(1rem, 2.5vmin, 1.4rem);
    color: #1a1a1a;
    width: 140px;
    text-align: center;
    word-wrap: break-word;
    pointer-events: none;
}

.page-cover h1,
.page-cover h2 {
    color: #f5e6d3;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.page-cover .handwriting {
    color: #d4c4a8;
    margin-top: 1rem;
}

.page-cover-back {
    background-color: #654321;
    position: relative;
    z-index: 1;
}

.page-cover-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../assets/textures/cover.jpg');
    background-repeat: repeat;
    background-size: auto;
    z-index: -1;
    pointer-events: none;
}

.nav-hint {
    margin-top: 20px;
    color: #bbb;
    font-size: 1.1rem;
    text-align: center;
    line-height: 1.6;
}

.page:not(.page-cover)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* ================================
   Photo Frames - Polaroid Style
   ================================ */

.photo-frame {
    background: white;
    padding: clamp(6px, 1.2vmin, 10px);
    padding-bottom: clamp(26px, 4vmin, 40px);
    box-shadow: 
        2px 2px 5px rgba(0,0,0,0.2),
        0 0 1px rgba(0,0,0,0.1);
    display: inline-block;
    margin: clamp(6px, 1.4vmin, 15px);
    transition: transform 0.3s ease;
}

.photo-frame img {
    width: clamp(100px, 22vmin, 180px);
    height: clamp(100px, 22vmin, 180px);
    object-fit: cover;
    display: block;
}

.photo-caption {
    font-family: 'Nanum Pen Script', cursive;
    font-size: 1.1rem;
    color: #555;
    text-align: center;
    margin-top: 10px;
}

/* Hover effect - subtle lift */
.photo-frame:hover {
    transform: scale(1.05);
    cursor: pointer;
}

/* ================================
   Photo Rotations - Scrapbook Feel
   ================================ */

.rotate-left {
    transform: rotate(0deg);
}

.rotate-right {
    transform: rotate(3deg);
}

.rotate-left-more {
    transform: rotate(-6deg);
}

.rotate-right-more {
    transform: rotate(6deg);
}

/* Keep hover effect working with rotation */
.rotate-left:hover {
    transform: rotate(-3deg) scale(1.05);
}

.rotate-right:hover {
    transform: rotate(3deg) scale(1.05);
}

.rotate-left-more:hover {
    transform: rotate(-6deg) scale(1.05);
}

.rotate-right-more:hover {
    transform: rotate(6deg) scale(1.05);
}


/* ================================
   Page Layouts
   ================================ */

.page-scattered {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 3vmin, 28px);
    padding: clamp(12px, 3.5vmin, 34px);
    place-items: center;
}

.page-scattered .photo-frame {
    margin: 0;
}

.photo-grid-five {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: clamp(10px, 2.6vmin, 24px);
    width: 100%;
    height: 100%;
    place-items: center;
    padding: clamp(10px, 3vmin, 28px);
}

.photo-grid-five .photo-frame {
    margin: 0;
}

.photo-grid-five .photo-frame:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
    position: relative;
    top: clamp(-18px, -2.8vmin, -10px);
}

.photo-grid-five .photo-frame:nth-child(3) img {
    width: clamp(150px, 34vmin, 240px);
    height: clamp(95px, 20vmin, 150px);
}

.photo-grid-five .photo-frame:nth-child(1) img,
.photo-grid-five .photo-frame:nth-child(2) img {
    width: clamp(80px, 16vmin, 130px);
    height: clamp(80px, 16vmin, 130px);
}

.photo-grid-five .photo-frame:nth-child(1),
.photo-grid-five .photo-frame:nth-child(2) {
    position: relative;
    top: clamp(-36px, -5vmin, -22px);
}

.photo-grid-five .photo-frame:nth-child(1) {
    left: clamp(10px, 2vmin, 18px);
}

.photo-grid-five .photo-frame:nth-child(2) {
    right: clamp(10px, 2vmin, 18px);
}

.photo-crop-top {
    object-position: center top;
}

/* ================================
   Hover Overlay
   ================================ */

.hover-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.hover-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.hover-overlay-content {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 30px;
    padding: 40px;
    justify-content: center;
    align-items: center;
}

.hover-polaroids {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
    max-width: 60%;
}

.hover-polaroid {
    background: white;
    padding: clamp(10px, 1.8vmin, 16px);
    padding-bottom: clamp(35px, 5vmin, 50px);
    box-shadow:
        0 10px 40px rgba(0,0,0,0.3),
        0 0 1px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: zoomIn 0.3s ease-in-out;
}

/* Single image - large */
.hover-polaroids.count-1 .hover-polaroid img {
    width: clamp(280px, 38vmin, 420px);
    height: clamp(280px, 38vmin, 420px);
    object-fit: cover;
    display: block;
}

/* Two images - medium */
.hover-polaroids.count-2 .hover-polaroid img {
    width: clamp(200px, 28vmin, 320px);
    height: clamp(200px, 28vmin, 320px);
    object-fit: cover;
    display: block;
}

.hover-polaroids.count-2 .hover-polaroid:nth-child(1) {
    transform: rotate(-3deg);
}

.hover-polaroids.count-2 .hover-polaroid:nth-child(2) {
    transform: rotate(3deg);
}

/* Four images - smaller grid */
.hover-polaroids.count-4 {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 16px;
    max-width: 55%;
}

.hover-polaroids.count-4 .hover-polaroid img {
    width: clamp(140px, 20vmin, 220px);
    height: clamp(140px, 20vmin, 220px);
    object-fit: cover;
    display: block;
}

.hover-polaroids.count-4 .hover-polaroid:nth-child(1) { transform: rotate(-2deg); }
.hover-polaroids.count-4 .hover-polaroid:nth-child(2) { transform: rotate(3deg); }
.hover-polaroids.count-4 .hover-polaroid:nth-child(3) { transform: rotate(2deg); }
.hover-polaroids.count-4 .hover-polaroid:nth-child(4) { transform: rotate(-3deg); }

.hover-polaroid-caption {
    font-family: 'Nanum Pen Script', cursive;
    font-size: 1rem;
    color: #666;
    text-align: center;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.hover-note-panel {
    background: white;
    padding: 30px;
    padding-top: 40px;
    border-radius: 8px;
    box-shadow:
        0 10px 40px rgba(0,0,0,0.3),
        0 0 1px rgba(0,0,0,0.1);
    width: 280px;
    min-height: 250px;
    max-height: clamp(300px, 50vh, 500px);
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideIn 0.3s ease-in-out;
    position: relative;
}

.note-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    background: #fff;
    border: 2px solid #e0d5c7;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-family: 'Nanum Pen Script', cursive;
    font-size: 1rem;
    color: #8b4513;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.2s, transform 0.2s;
}

.note-close:hover {
    background: #fdf0e0;
    transform: scale(1.12) rotate(90deg);
}

@keyframes slideIn {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.hover-note-title {
    display: none;
}

.hover-note-text {
    font-family: 'Nanum Pen Script', cursive;
    font-size: 1.1rem;
    color: #555;
    flex: 1;
    overflow-y: auto;
    line-height: 1.6;
}

/* Highlight photo-frames that have hover groups */
.photo-frame[data-hover-group] {
    cursor: pointer;
    position: relative;
}

/* ================================
   Close Button (video overlay)
   ================================ */

.hover-close {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1001;
    background: #fff;
    border: 2px solid #e0d5c7;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-family: 'Nanum Pen Script', cursive;
    font-size: 1.3rem;
    color: #8b4513;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    transition: background 0.2s, transform 0.2s;
}

.hover-close:hover {
    background: #fdf0e0;
    transform: scale(1.12) rotate(90deg);
}

/* ================================
   Sparkle Effect on Hoverable Frames
   ================================ */

.photo-frame[data-hover-group].has-sparkle::after {
    content: '✨';
    position: absolute;
    top: -16px;
    right: -16px;
    font-size: 2rem;
    animation: sparkle-pulse 2s ease-in-out infinite;
    pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(245, 200, 66, 0.9));
    z-index: 5;
}

@keyframes sparkle-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ================================
   Valentine Question Page
   ================================ */

.valentine-page {
    position: relative;
    overflow: hidden;
}

.valentine-question {
    font-family: 'Nanum Pen Script', cursive;
    font-size: clamp(1.6rem, 4.5vmin, 2.6rem);
    color: #8b4513;
    text-align: center;
    z-index: 2;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.valentine-buttons {
    display: flex;
    gap: 20px;
    z-index: 2;
}

.btn-yes {
    font-family: 'Nanum Pen Script', cursive;
    font-size: clamp(1.2rem, 3vmin, 1.6rem);
    padding: 10px 28px;
    background: #e8a0bf;
    color: white;
    border: 2px solid #d4789b;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 3px 10px rgba(228, 160, 191, 0.3);
}

.btn-yes:hover {
    background: #d4789b;
    transform: scale(1.08);
    box-shadow: 0 5px 18px rgba(228, 160, 191, 0.5);
}

.btn-no {
    font-family: 'Nanum Pen Script', cursive;
    font-size: clamp(1.2rem, 3vmin, 1.6rem);
    padding: 10px 28px;
    background: #ccc;
    color: #666;
    border: 2px solid #bbb;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease;
    position: relative;
}

/* Stickers */
.sticker {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    object-fit: contain;
}

.sticker-so {
    width: clamp(60px, 14vmin, 110px);
    top: 6%;
    left: 5%;
    transform: rotate(-8deg);
}

.sticker-chii {
    width: clamp(70px, 16vmin, 120px);
    top: 4%;
    right: 4%;
    transform: rotate(10deg);
}

.sticker-chii2 {
    width: clamp(70px, 16vmin, 120px);
    bottom: 4%;
    left: 4%;
    transform: rotate(10deg);
}

.sticker-anxious {
    width: clamp(55px, 13vmin, 100px);
    bottom: 8%;
    right: 8%;
    transform: rotate(-5deg);
}

/* Page stickers */
.page-with-stickers {
    position: relative;
}

.sticker-pg1-beginning {
    width: clamp(40px, 10vmin, 75px);
    top: 42%;
    right: 8%;
    transform: rotate(8deg);
}

.sticker-pg1-tl {
    width: clamp(45px, 11vmin, 80px);
    top: 3%;
    left: 3%;
    transform: rotate(-12deg);
}

.sticker-pg2 {
    width: clamp(40px, 10vmin, 70px);
    top: 45%;
    left: 42%;
    transform: rotate(6deg);
    z-index: 3;
}

.sticker-pg3 {
    width: clamp(40px, 9vmin, 65px);
    top: 48%;
    right: 40%;
    transform: rotate(-10deg);
    z-index: 3;
}

.sticker-pg4 {
    width: clamp(38px, 9vmin, 65px);
    bottom: 46%;
    left: 42%;
    transform: rotate(12deg);
    z-index: 3;
}

.sticker-pg5 {
    width: clamp(40px, 9vmin, 68px);
    top: 46%;
    right: 38%;
    transform: rotate(-6deg);
    z-index: 3;
}

.sticker-pg6 {
    width: clamp(40px, 10vmin, 70px);
    bottom: 44%;
    left: 40%;
    transform: rotate(8deg);
    z-index: 3;
}

/* ================================
   Confetti
   ================================ */

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(110%) rotate(720deg);
        opacity: 0;
    }
}

/* ================================
   Video Overlay
   ================================ */

.video-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.88);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.video-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.video-overlay-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.video-overlay-content video {
    max-width: 80vw;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}