/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-white: #FFFFFF;
    --primary-pink: #FFB6C1;
    --primary-gold: #FFD700;
    --accent-pink: #FF69B4;
    --text-dark: #333333;
    --error-red: #FF6B6B;
    --success-green: #51CF66;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-white) 0%, var(--primary-pink) 100%);
    overflow-x: hidden;
}

/* Stage Container */
.stage {
    display: none;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.stage.active {
    display: flex;
    opacity: 1;
}

.container {
    text-align: center;
    max-width: 600px;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    color: var(--text-dark);
    font-size: 28px;
    margin-bottom: 30px;
    line-height: 1.4;
}

h2 {
    color: var(--text-dark);
    font-size: 24px;
    margin-bottom: 20px;
}

/* Stage 1: Code Entry */
#codeInput {
    width: 100%;
    padding: 15px 20px;
    font-size: 18px;
    border: 2px solid var(--primary-pink);
    border-radius: 12px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

#codeInput:focus {
    outline: none;
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 4px rgba(255, 105, 180, 0.1);
}

button {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submitCode {
    background: var(--accent-pink);
    color: white;
}

#submitCode:hover {
    background: #FF1493;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.3);
}

.error-message {
    color: var(--error-red);
    margin-top: 15px;
    font-size: 14px;
    min-height: 20px;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* Stage 2: Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item.selected {
    border-color: var(--success-green);
}

.photo-item.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--success-green);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

#verifyPhotos {
    background: var(--accent-pink);
    color: white;
}

#verifyPhotos:hover {
    background: #FF1493;
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* Stage 3: Answer Buttons */
.button-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 40px;
}

.answer-button {
    padding: 20px 50px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 16px;
}

.yes-button {
    background: var(--accent-pink);
    color: white;
}

.yes-button:hover {
    background: #FF1493;
    transform: scale(1.05);
}

.no-button {
    background: #E0E0E0;
    color: var(--text-dark);
    position: relative;
    transition: all 0.2s ease;
}

/* Stage 4: Countdown */
.countdown {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--accent-pink);
    min-width: 80px;
}

.countdown-label {
    font-size: 16px;
    color: var(--text-dark);
    margin-top: 5px;
}

.final-message {
    margin-top: 60px;
    font-size: 20px;
    line-height: 1.8;
    color: var(--text-dark);
}

.fade-in-line {
    opacity: 0;
    animation: fadeIn 1s ease-in-out forwards;
}

.fade-in-line:nth-child(1) { animation-delay: 0s; }
.fade-in-line:nth-child(2) { animation-delay: 1s; }
.fade-in-line:nth-child(3) { animation-delay: 2s; }
.fade-in-line:nth-child(4) { animation-delay: 3s; }

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

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 22px;
    }

    .photo-grid {
        gap: 10px;
    }

    .countdown {
        gap: 20px;
    }

    .countdown-value {
        font-size: 36px;
        min-width: 60px;
    }

    .answer-button {
        padding: 15px 35px;
        font-size: 20px;
    }

    .final-message {
        font-size: 18px;
    }
}
