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

body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #E0BC00 0%, #FFD32C 35%, #FFEA99 70%, #FFDE21 100%);
    background-size: 300% 300%;
    animation: gradientShift 12s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #5a4300;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 45%);
    pointer-events: none;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.title {
    font-size: 3.5rem;
    font-weight: 800;
    color: #fffdf2;
    text-shadow:
        0 2px 0 rgba(140, 110, 0, 0.25),
        0 6px 18px rgba(122, 90, 0, 0.2);
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-align: center;
}

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

/* Camera Section */
.camera-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.camera-container {
    position: relative;
    width: 480px;
    height: 360px;
    background: #3f3200;
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 0 0 5px rgba(255, 250, 220, 0.95),
        0 0 0 11px rgba(224, 188, 0, 0.85),
        0 20px 45px rgba(90, 70, 0, 0.25);
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    font-weight: 800;
    color: #fffdf4;
    text-shadow: 0 0 30px rgba(224, 188, 0, 0.75);
    animation: pulse 1s ease-in-out infinite;
    z-index: 10;
}

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

/* Controls */
.controls {
    display: flex;
    gap: 15px;
}

.btn {
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

/* Cute main capture button */
.capture-btn {
    width: 70px;
    height: 70px;
    border-radius: 24px;
    background: linear-gradient(145deg, #FFDE21, #E0BC00);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 20px rgba(224, 188, 0, 0.35),
        inset 0 2px 10px rgba(255, 255, 255, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.capture-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 12px 28px rgba(224, 188, 0, 0.45),
        inset 0 2px 10px rgba(255, 255, 255, 0.3);
}

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

.capture-btn:disabled {
    background: #d6d6d6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Cute undo button */
.undo-btn {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: linear-gradient(145deg, #FFEA99, #FFD32C);
    color: #5a4300;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 20px rgba(170, 135, 0, 0.22),
        inset 0 2px 10px rgba(255, 255, 255, 0.22);
}

.undo-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 12px 28px rgba(170, 135, 0, 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.22);
}

.undo-btn:disabled {
    background: #d6d6d6;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.action-btn {
    padding: 15px 30px;
    border-radius: 22px;
    font-size: 1rem;
    font-weight: 700;
    background: rgba(255, 250, 220, 0.96);
    color: #5a4300;
    box-shadow: 0 8px 20px rgba(116, 90, 0, 0.12);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(116, 90, 0, 0.18);
}

.download-btn {
    background: linear-gradient(145deg, #FFD32C, #E0BC00);
    color: white;
}

.download-btn:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Photo Strip */
.strip-section {
    position: relative;
}

.photo-strip {
    position: relative;
    width: 180px;
    aspect-ratio: 533 / 1600;
    background: transparent;
    border-radius: 10px;
    overflow: hidden;
    box-shadow:
        0 14px 40px rgba(83, 65, 0, 0.2),
        0 0 0 4px rgba(255, 250, 220, 0.95);
}

/* Frame image stays on top */
.frame-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 5;
    pointer-events: none;
}

/* Important: no flex here */
.photo-slots {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Exact slot placement based on your frame */
.photo-slot {
    position: absolute;
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slot positions */
#slot1 {
    left: 5.63%;
    top: 4.69%;
    width: 88.74%;
    height: 23.13%;
}

#slot2 {
    left: 5.63%;
    top: 30.44%;
    width: 88.74%;
    height: 23.13%;
}

#slot3 {
    left: 5.63%;
    top: 56.19%;
    width: 88.74%;
    height: 23.13%;
}

.photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slot-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: rgba(126, 98, 0, 0.35);
}

.photo-slot.filled .slot-number {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 48, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fffdf2;
    padding: 30px;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(58, 46, 0, 0.22);
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #E0BC00;
    font-weight: 800;
}

.frame-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.frame-option {
    aspect-ratio: 1 / 3;
    border: 3px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff3b8;
}

.frame-option:hover {
    transform: scale(1.05);
    border-color: #FFD32C;
}

.frame-option.selected {
    border-color: #E0BC00;
    box-shadow: 0 0 20px rgba(224, 188, 0, 0.25);
}

.frame-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.close-modal-btn {
    width: 100%;
    padding: 12px;
    border-radius: 22px;
    background: linear-gradient(145deg, #FFDE21, #E0BC00);
    color: white;
    font-size: 1rem;
    font-weight: 700;
}

/* Footer */
.footer {
    margin-top: 20px;
    text-align: center;
}

.footer p {
    font-size: 0.9rem;
    color: #6f5600;
    font-weight: 500;
}

.footer .creator {
    color: #E0BC00;
    font-weight: 800;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Flash effect */
.flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    animation: flash 0.3s ease-out;
    pointer-events: none;
    z-index: 100;
}

@keyframes flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }

    .title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .camera-container {
        width: 100%;
        max-width: 400px;
        height: 300px;
    }
}

@media (max-width: 500px) {
    .title {
        font-size: 2rem;
    }

    .camera-container {
        height: 250px;
    }

    .photo-strip {
        width: 140px;
    }

    .slot-number {
        font-size: 1.2rem;
    }

    .controls {
        gap: 10px;
    }

    .capture-btn {
        width: 60px;
        height: 60px;
        border-radius: 20px;
    }

    .undo-btn {
        width: 50px;
        height: 50px;
        border-radius: 16px;
    }
}
