/* --- CORE STYLES --- */
:root {
    --bg-color: #1a0b2e; /* Deep, romantic dark purple */
    --accent-pink: #ff6b9e;
    --glow-pink: rgba(255, 107, 158, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.06);
    --text-light: #fce4ec;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* Keeps it acting like a mobile app, no scrolling */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

/* Screen Management */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* --- THE LOCK SCREEN (Glow/Glassmorphism) --- */
.lock-container {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 40px 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 400px;
}

.glow-text {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--accent-pink);
    text-shadow: 0 0 15px var(--glow-pink);
    font-weight: 600;
}

#passcode-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--accent-pink);
    color: white;
    padding: 15px 20px;
    border-radius: 30px;
    font-size: 1.2rem;
    outline: none;
    text-align: center;
    width: 100%;
    margin-bottom: 25px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.3s;
}

#passcode-input:focus {
    border-color: #fff;
    box-shadow: 0 0 10px var(--glow-pink), inset 0 0 10px rgba(0,0,0,0.5);
}

#unlock-btn {
    background: var(--accent-pink);
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 15px var(--glow-pink);
    transition: transform 0.2s, box-shadow 0.2s;
}

#unlock-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 5px var(--glow-pink);
}

#error-msg {
    color: #ff4d4d;
    margin-top: 15px;
    font-size: 0.95rem;
    height: 20px; 
    opacity: 0;
    transition: opacity 0.3s;
}

/* Shake animation for wrong password */
.shake { animation: shake 0.4s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

/* --- THE SURPRISE BOX (Styled & Animated) --- */
.gift-container {
    position: relative;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
    animation: float 3s ease-in-out infinite;
    width: 250px;
}

.gift-container:active { transform: scale(0.95); }

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

.box-base {
    background: linear-gradient(135deg, #ff4d85, #ff75a3);
    color: white;
    padding: 40px 30px;
    border-radius: 0 0 15px 15px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    position: relative;
    z-index: 1;
}

.box-lid {
    background: linear-gradient(135deg, #e6396c, #ff4d85);
    height: 40px;
    width: 110%; /* Lid is slightly wider than the base */
    margin-left: -5%; /* Centers the wider lid */
    border-radius: 10px;
    position: relative;
    z-index: 2;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Bouncy transition */
}

/* Triggered by JS */
.open-lid {
    transform: translateY(-80px) rotate(15deg);
    opacity: 0;
}

/* --- THE CANVAS PUZZLE --- */
#heart-canvas {
    width: 100vw;
    height: 100vh;
    touch-action: none; /* Crucial for mobile drawing */
    z-index: 1;
}

/* Orientation Prompt Overlay */
#orientation-prompt {
    position: absolute;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: var(--bg-color);
    color: white;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; padding: 20px;
    z-index: 20; /* Sit above canvas */
    opacity: 1;
    transition: opacity 0.5s ease;
}

.phone-icon {
    width: 100px; height: 100px;
    color: var(--accent-pink);
    margin-bottom: 20px;
    animation: rotatePhone 2s infinite ease-in-out;
}

#orientation-prompt p { font-size: 1.2rem; line-height: 1.6; color: var(--text-light); }
#orientation-prompt strong { color: var(--accent-pink); }

/* Only show prompt on small mobile portrait screens */
@media (min-width: 768px), (orientation: landscape) {
    #orientation-prompt { opacity: 0; pointer-events: none; }
}

@keyframes rotatePhone {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(90deg); }
    70% { transform: rotate(90deg); }
    100% { transform: rotate(0deg); }
}

/* --- FINAL REVEAL / LETTER --- */
#final-letter-screen {
    background-color: rgba(26, 11, 46, 0.95); /* Darken overlay */
    display: flex;
    justify-content: center;
    align-items: center;
}

.envelope {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 158, 0.3);
    text-align: center;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(255, 107, 158, 0.2);
    /* Letter fade-in animation */
    animation: letterFadeIn 1s ease-out;
}

@keyframes letterFadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.letter-text {
    font-size: 1.3rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
    font-weight: 500;
}
