/* Overlay ảnh bất ngờ */
.surprise-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 0, 40, 0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.4s;
}

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

.surprise-img-wrapper {
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(255,77,141,0.18);
    padding: 18px 18px 10px 18px;
    margin-bottom: 18px;
}

#surprise-img {
    max-width: 80vw;
    max-height: 60vh;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(203,62,121,0.18);
    cursor: pointer;
    transition: transform 0.2s;
}
#surprise-img:active {
    transform: scale(0.97);
}

.surprise-count {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px #000;
}
/* Nút redirect bất ngờ */
.redirect-btn {
    padding: 14px 36px;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(90deg, #ff4d8d, #ff9fc9);
    color: white;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(255, 77, 141, 0.18);
    transition: all 0.3s;
    margin-bottom: 10px;
}
.redirect-btn:hover {
    background: linear-gradient(90deg, #ff9fc9, #ff4d8d);
    transform: scale(1.06);
    box-shadow: 0 12px 32px rgba(255, 77, 141, 0.25);
}
/* Reset cơ bản */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #ffe6f2;
    font-family: 'Nunito', sans-serif;
    color: #5a2b3a;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Container chung cho các màn hình */
.screen {
    width: 100%;
    max-width: 1000px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: absolute;
    transition: opacity 0.5s ease-in-out;
    padding: 20px;
    opacity: 1;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Icon trang trí bay bay */
.decoration {
    position: absolute;
    font-size: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

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

/* --- SCREEN 1: Gift Box --- */
.gift-note {
    font-size: 1.4rem;
    color: #8b3a5a;
    margin-bottom: 50px;
    font-weight: 600;
    max-width: 600px;
    line-height: 1.6;
    animation: noteFloat 3.2s ease-in-out infinite;
}

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

.gift-wrapper {
    margin-top: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.gift-box {
    width: 280px;
    height: 240px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
    animation: giftFloat 3s ease-in-out infinite;
}

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

.gift-box:hover {
    animation-play-state: paused;
    transform: scale(1.08) translateY(-5px);
}

.gift-box .box {
    width: 100%;
    height: 75%;
    background: linear-gradient(145deg, #ff4d8d 0%, #ff1f6f 50%, #e91e63 100%);
    border-radius: 12px;
    box-shadow: 
        0 20px 60px rgba(233, 30, 99, 0.4),
        inset 0 -5px 20px rgba(0, 0, 0, 0.15),
        inset 0 5px 20px rgba(255, 255, 255, 0.2);
    position: absolute;
    bottom: 0;
    transition: transform 0.8s cubic-bezier(.2, .9, .2, 1);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.gift-box .lid {
    width: 110%;
    height: 60px;
    background: linear-gradient(145deg, #ff6b9d 0%, #ff4081 50%, #f50057 100%);
    border-radius: 12px 12px 8px 8px;
    position: absolute;
    top: 0;
    left: -5%;
    transform-origin: center bottom;
    box-shadow: 
        0 15px 40px rgba(245, 0, 87, 0.35),
        inset 0 -3px 10px rgba(0, 0, 0, 0.2),
        inset 0 3px 15px rgba(255, 255, 255, 0.3);
    transition: transform 0.8s cubic-bezier(.2, .9, .2, 1);
    z-index: 2;
    border: 3px solid rgba(255, 255, 255, 0.4);
}

/* Bow on top of lid */
.gift-box .lid::before {
    content: '🎀';
    position: absolute;
    font-size: 3rem;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 5px 10px rgba(233, 30, 99, 0.4));
}

/* Ribbon decorations */
.ribbon-v, .ribbon-h {
    position: absolute;
    background: linear-gradient(180deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    box-shadow: 
        0 3px 15px rgba(255, 215, 0, 0.5),
        inset 0 2px 5px rgba(255, 255, 255, 0.6),
        inset 0 -2px 5px rgba(0, 0, 0, 0.15);
    transition: all 0.8s cubic-bezier(.2, .9, .2, 1);
}

.ribbon-v {
    width: 30px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    border-radius: 4px;
    z-index: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.ribbon-h {
    width: 100%;
    height: 30px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    border-radius: 4px;
    z-index: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Sparkles around gift */
.gift-box::after {
    content: '✨';
    position: absolute;
    font-size: 2rem;
    top: -30px;
    right: -30px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { 
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% { 
        opacity: 0.5;
        transform: scale(1.3) rotate(180deg);
    }
}

.gift-box.open .lid {
    transform: translateY(-120px) rotateX(60deg) scale(1.05);
}

.gift-box.open .box {
    transform: translateY(-15px) scale(0.98);
}

.gift-box.open .ribbon-v,
.gift-box.open .ribbon-h {
    opacity: 0;
    transform: scale(0.8);
}

/* --- SCREEN 2: Greeting --- */
h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 4rem;
    color: #8b3a5a;
    margin-bottom: 20px;
    min-height: 80px;
}

.cursor {
    display: inline-block;
    width: 3px;
    background-color: #8b3a5a;
    animation: blink 1s infinite;
}

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

.heart-row {
    font-size: 2.5rem;
    margin-bottom: 50px;
    display: flex;
    gap: 15px;
}

.heart-row span {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.heart-row span:nth-child(2) {
    animation-delay: 0.3s;
}

.heart-row span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.items-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.item-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(203, 62, 121, 0.15);
    border: 3px solid transparent;
}

.item-card:hover {
    transform: translateY(-10px);
    border-color: #ff9fc9;
    box-shadow: 0 12px 35px rgba(203, 62, 121, 0.25);
}

.item-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.item-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: #8b3a5a;
}

/* --- SCREEN 3: Letter --- */
.screen-title {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    color: #d94f7a;
    margin-bottom: 30px;
}

.letter-content {
    width: 100%;
    max-width: 700px;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.letter-paper {
    background: #fffef9;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0e6d2;
    position: relative;
    height: 400px;
    overflow-y: auto;
}

.letter-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 40px;
    width: 2px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 25px,
        #ffe6f2 25px,
        #ffe6f2 27px
    );
}

#letter-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #4a2b3a;
    text-align: left;
    white-space: pre-line;
    position: relative;
    z-index: 1;
}

/* --- SCREEN 4: Photo --- */
.photo-viewer {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

#main-photo {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.photo-caption {
    font-size: 1.3rem;
    color: #8b3a5a;
    font-weight: 600;
    text-align: center;
}

/* --- SCREEN 5: Voice Message --- */
.voice-message-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.voice-card {
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.voice-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #ff4d8d, #e91e63);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(233, 30, 99, 0.3);
}

.avatar-emoji {
    font-size: 1.5rem;
}

.voice-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sender-name {
    font-size: 1rem;
    font-weight: 700;
    color: #8b3a5a;
}

.voice-duration {
    font-size: 0.9rem;
    color: #999;
}

.waveform-container {
    position: relative;
    width: 100%;
    height: 120px;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

#waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #ff4d8d;
    pointer-events: none;
    transition: left 0.05s linear;
    box-shadow: 0 0 10px rgba(255, 77, 141, 0.5);
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.play-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff4d8d, #e91e63);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(233, 30, 99, 0.3);
    transition: all 0.3s ease;
    padding: 0;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 7px 20px rgba(233, 30, 99, 0.4);
}

.play-btn:active {
    transform: scale(0.95);
}

#play-icon {
    display: block;
    line-height: 1;
}

.time-display {
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

.separator {
    margin: 0 5px;
    color: #999;
}

.instruction {
    font-size: 1.1rem;
    color: #8b3a5a;
    margin-bottom: 15px;
    text-align: center;
}

.playback-status {
    font-size: 1rem;
    color: #ff4d8d;
    font-weight: 600;
    margin-top: 10px;
}

/* --- Buttons --- */
.back-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    background-color: #ff9fc9;
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(255, 159, 201, 0.3);
    transition: all 0.3s ease;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

.back-btn:hover {
    transform: scale(1.05);
    background-color: #ff7aa2;
    box-shadow: 0 8px 25px rgba(255, 122, 162, 0.4);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .gift-note {
        font-size: 1.1rem;
        padding: 0 20px;
    }
    
    .gift-box {
        width: 240px;
        height: 200px;
    }
    
    h1 {
        font-size: 3rem;
    }
    
    .screen-title {
        font-size: 2.2rem;
    }
    
    .items-container {
        gap: 20px;
    }
    
    .item-card {
        width: 160px;
        padding: 30px;
    }
    
    .letter-paper {
        padding: 25px;
    }
    
    #letter-text {
        font-size: 1rem;
    }
    
    .voice-card {
        padding: 20px;
        gap: 15px;
    }
    
    .voice-avatar {
        width: 45px;
        height: 45px;
    }
    
    .avatar-emoji {
        font-size: 1.3rem;
    }
    
    #waveform-canvas {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .gift-box {
        width: 200px;
        height: 170px;
    }
    
    .gift-box .lid::before {
        font-size: 2.5rem;
    }
    
    h1 {
        font-size: 2.6rem;
    }
    
    .item-card {
        width: 140px;
        padding: 25px;
    }
    
    .item-icon {
        font-size: 3rem;
    }
    
    .voice-card {
        padding: 15px;
        flex-direction: column;
        align-items: center;
    }
    
    .voice-avatar {
        width: 40px;
        height: 40px;
    }
    
    .sender-name {
        font-size: 0.9rem;
    }
    
    .waveform-container {
        height: 100px;
    }
    
    .play-btn {
        width: 40px;
        height: 40px;
    }
    
    .time-display {
        font-size: 0.85rem;
    }
}