:root {
    --bg-color: #FFF0F5;
    /* Lavender Blush */
    --accent-color: #ff0202;
    --text-color: #2D3436;
    --card-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.8);
    --strip-bg: #FFFFFF;
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Quicksand', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #FFF0F5 0%, #E0F7FA 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    color: var(--accent-color);
    text-shadow: 2px 2px 0px #fff;
    margin-bottom: 0.5rem;
}

header span {
    display: inline-block;
    animation: heartbeat 1.5s infinite;
}

#status-text {
    font-weight: 500;
    color: #636e72;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

main {
    display: flex;
    flex-wrap: wrap;
    gap: 4rem;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.booth-container {
    flex: 1;
    min-width: 320px;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.camera-wrapper {
    position: relative;
    width: 100%;
    /* Check width */
    max-width: 480px;
    /* Standard 4:3ish */
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 8px solid #fff;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    /* Mirror effect */
}

#output_canvas {
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1);
    /* Match mirror */
}

#instruction-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.icon-heart-hands {
    font-size: 1.5rem;
}

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

#countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-size: 8rem;
    color: #fff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
    animation: poop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

#flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.1s;
}

.flash-active {
    opacity: 1 !important;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.btn {
    border: none;
    outline: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn.primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn.secondary {
    background: #fff;
    color: var(--text-color);
    border: 2px solid #eee;
}

.gallery-section {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 300px;
}

.film-strip {
    background: var(--strip-bg);
    padding: 1.5rem;
    border-radius: 2px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 250px;
    /* Fixed width for strip */
    transform-origin: top center;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.strip-header {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 2px;
    color: #ccc;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.strip-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 0.5rem;
}

#date-text {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    color: #ccc;
    letter-spacing: 1px;
}

.insta-handle {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.photo-placeholder {
    width: 200px;
    height: 150px;
    /* 4:3 */
    background: #f0f0f0;
    border: 1px solid #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ddd;
    font-size: 2rem;
}

.film-photo {
    width: 200px;
    height: 150px;
    object-fit: cover;
    filter: sepia(0.3) contrast(1.1) brightness(1.1);
    /* Default vintage vibe */
    transition: filter 0.3s;
}

/* Specific Filters */
.filter-vintage .film-photo {
    filter: sepia(0.4) contrast(1.2) brightness(1.05) hue-rotate(-10deg);
}

.filter-cute .film-photo {
    filter: saturate(1.3) brightness(1.1) contrast(1.05);
}

.filter-bw .film-photo {
    filter: grayscale(1) contrast(1.2);
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.3);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    60% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }

    main {
        flex-direction: column;
        align-items: center;
    }

    .film-strip {
        padding: 1rem;
        width: 220px;
    }

    .film-photo,
    .photo-placeholder {
        width: 180px;
        height: 135px;
    }
}