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

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap');

body {
    font-family: 'Poppins', 'Arial', sans-serif;
    background: linear-gradient(135deg,
        #ff73ff 0%,
        #ffa774 20%,
        #ffd26a 40%,
        #ffff68 60%,
        #a0ff65 80%,
        #69d4ff 100%);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow-x: hidden;
    margin: 0;
    padding: 0 0 50px 0; /* Bottom padding for fixed footer */
}

/* Prevent mobile scrolling when content fits */
@media (max-width: 768px) {
    html {
        height: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    body {
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background-attachment: fixed;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}


.container {
    text-align: center;
    max-width: 800px;
    padding: 20px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
    }
}

.logo {
    max-width: 300px;
    width: 100%;
    height: auto;
    margin-bottom: 15px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .logo {
        max-width: 140px;
        margin-bottom: 12px;
    }
}

/* Animate logo transition when experience starts */
.container.experience-started .logo {
    max-width: 100px;
    margin-bottom: 10px;
    transition: all 0.6s ease-in-out;
}

/* Increase logo size at final result step on desktop */
#result-step.active ~ * .logo,
.container.experience-started.show-result .logo {
    max-width: 150px;
}

@media (max-width: 768px) {
    #result-step.active ~ * .logo,
    .container.experience-started.show-result .logo {
        display: none;
    }
}

@media (max-width: 768px) {
    .container.experience-started .logo {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
        max-height: 0;
        margin-bottom: 0;
        transition: all 0.6s ease-in-out;
    }
}

/* Animate content positioning */
.container {
    transition: all 0.6s ease-in-out;
}

.step {
    transition: all 0.6s ease-in-out;
}

/* Smooth step transitions */
.step.active {
    animation: slideInUp 0.6s ease-out;
}

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

.step {
    display: none;
}

.step.active {
    display: block;
}


video, canvas {
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 100%;
    margin: 20px auto;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    video, canvas {
        margin: 10px auto;
        border-width: 2px;
    }
}

/* Video mirroring classes - controlled by JavaScript based on camera type */
video.mirror-front {
    transform: scaleX(-1) !important;
    -webkit-transform: scaleX(-1) !important;
}

video.mirror-back {
    transform: scaleX(1) !important;
    -webkit-transform: scaleX(1) !important;
}

/* Square aspect ratio for sampling and review videos */
.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 15px;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Camera loading state */
.camera-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    color: white;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.camera-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

/* Mobile-specific video constraints */
@media (max-width: 768px) {
    .video-container {
        max-width: 300px;
    }

    video {
        max-width: 90vw;
        max-height: 50vh;
        object-fit: cover;
        position: relative;
        z-index: 1;
    }
    
    /* Ensure instructions stay visible */
    .instructions {
        position: relative;
        z-index: 10;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(15px);
        margin: 10px 0;
        padding: 20px;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .countdown {
        position: relative;
        z-index: 10;
        background: rgba(0,0,0,0.7);
        border-radius: 50%;
        width: 120px;
        height: 120px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 20px auto;
    }
}

.color-palette {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .color-palette {
        gap: 8px;
        margin: 15px 0;
    }
}

.color-sample {
    width: 60px;
    height: 60px;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .color-sample {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }
}

.color-sample:hover {
    transform: scale(1.1);
}

.color-sample.collected {
    border-color: #4CAF50;
    border-width: 4px;
}

/* GDPR Consent Banner */
.consent-banner {
    display: none;
}

/* Attribution text - creators */
.attribution-creators {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 12px;
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    text-align: center;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-attribution {
    font-size: 10px;
    opacity: 0.75;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.5;
}

.footer-attribution a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.5);
    text-underline-offset: 2px;
    transition: all 0.3s ease;
}

.footer-attribution a:hover {
    color: white;
    text-decoration-color: white;
}

@media (max-width: 768px) {
    .site-footer {
        padding: 8px 10px;
    }

    .footer-attribution {
        font-size: 8px;
        line-height: 1.4;
    }
}

/* Camera selection */
.camera-selection {
    display: none;
}

/* Debug display */
#debug-display {
    display: none;
    margin-top: 10px;
    padding: 5px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    font-size: 12px;
    color: white;
}

/* Debug panel */
.debug-panel {
    display: none;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.debug-panel h3 {
    color: white;
    margin-bottom: 15px;
}


/* Hidden canvas */
#hidden-canvas {
    display: none;
}

/* Mobile image modal text */
.modal-close-instruction {
    font-size: 14px;
    opacity: 0.8;
}

/* Review step - smaller video (inherits square aspect ratio from .video-container) */
.review-video {
    max-width: 320px;
}

@media (max-width: 768px) {
    .review-video {
        max-width: 250px;
    }
}

button {
    background: linear-gradient(45deg, #db50c8, #e08d4e, #e8be42, #e8e840, #79ed3f, #3aa8e7);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 18px 10px 25px 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    button {
        padding: 12px 24px;
        font-size: 16px;
        margin: 15px 5px 20px 5px;
    }
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.instructions {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    margin: 15px 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .instructions {
        padding: 15px;
        margin: 12px 0;
    }
}

.instructions h2 {
    color: white;
    margin-bottom: 15px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    font-size: 1.4em;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    letter-spacing: -0.01em;
}

@media (max-width: 768px) {
    .instructions h2 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
}

.instructions p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.5;
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    margin-bottom: 10px;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .instructions p {
        font-size: 14px;
        line-height: 1.45;
        margin-bottom: 8px;
    }
}

.instructions p:last-child {
    margin-bottom: 0;
}

/* Hyperlink styling */
.instructions a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.6);
    text-underline-offset: 2px;
    transition: all 0.3s ease;
}

.instructions a:hover {
    color: white;
    text-decoration-color: white;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8em;
    font-weight: 900;
    color: white;
    animation: countdownPulse 1s infinite;
    text-shadow: 
        0 0 20px rgba(0,0,0,0.8),
        0 0 40px rgba(0,0,0,0.6),
        3px 3px 0px rgba(0,0,0,0.9);
    z-index: 15;
    pointer-events: none;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.1em;
    white-space: nowrap;
    text-align: center;
    min-width: 200px;
}

/* Adjust font size when displaying "[swatching]" */
.countdown.text-mode {
    font-size: 2em;
}

@keyframes countdownPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        text-shadow: 
            0 0 20px rgba(0,0,0,0.8),
            0 0 40px rgba(0,0,0,0.6),
            3px 3px 0px rgba(0,0,0,0.9);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        text-shadow: 
            0 0 30px rgba(0,0,0,0.9),
            0 0 60px rgba(0,0,0,0.7),
            5px 5px 0px rgba(0,0,0,1);
    }
}

.crosshair {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

.crosshair.active {
    opacity: 1;
    transform: scale(1.1);
}

.video-container {
    position: relative;
    display: inline-block;
}

/* Ensure countdown step has relative positioning for overlay */
#countdown-step {
    position: relative;
}

.final-result {
    margin: 20px 0;
}

@media (max-width: 768px) {
    .final-result {
        margin: 15px 0;
    }
}

.main-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.main-buttons button {
    flex: 0 1 auto;
    white-space: nowrap;
    min-width: 0;
}

@media (max-width: 768px) {
    .main-buttons {
        gap: 10px;
        margin-bottom: 10px;
        flex-direction: row;
    }

    .main-buttons button {
        padding: 10px 16px;
        font-size: 14px;
        flex: 1 1 auto;
        max-width: 45%;
    }
}

.debug-link-container {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.debug-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s ease;
}

.debug-link:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}


.debug-images {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.debug-item {
    text-align: center;
}

.debug-item h4 {
    margin-bottom: 10px;
    font-size: 14px;
}

.debug-item canvas {
    border: 2px solid white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Palette control buttons */
.palette-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

@media (max-width: 768px) {
    .palette-controls {
        gap: 10px;
        margin: 10px 0;
    }
}


/* Camera Selection Dropdown */
.camera-selection {
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .camera-selection {
        margin: 10px 0;
        padding: 8px;
    }
}

.camera-selection label {
    color: white;
    font-weight: 600;
    margin-right: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#camera-select {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    min-width: 200px;
    backdrop-filter: blur(5px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#camera-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

#camera-select option {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 5px;
}

/* GDPR Consent Banner Styles */
.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 20px;
    z-index: 10000;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.consent-text h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.consent-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.consent-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.consent-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.consent-btn.accept {
    background: #4CAF50;
    color: white;
}

.consent-btn.accept:hover {
    background: #45a049;
}

.consent-btn.decline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.consent-btn.decline:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Privacy Policy Link */
.privacy-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
}

.privacy-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Privacy Policy Drawer */
.privacy-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.privacy-drawer.open {
    transform: translateY(0);
}

.privacy-drawer-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    color: white;
}

.privacy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.privacy-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.privacy-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: opacity 0.3s ease;
}

.privacy-close-btn:hover {
    opacity: 0.7;
}

.privacy-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    line-height: 1.6;
}

.privacy-section {
    margin-bottom: 24px;
}

.privacy-section:last-child {
    margin-bottom: 0;
}

.privacy-section h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #4CAF50;
}

.privacy-section p {
    margin: 0 0 12px 0;
    font-size: 14px;
    opacity: 0.9;
}

.privacy-section ul {
    margin: 0 0 12px 0;
    padding-left: 20px;
}

.privacy-section li {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.privacy-section strong {
    color: white;
}

/* Mobile responsiveness for consent banner */
@media (max-width: 768px) {
    .consent-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .consent-text h3 {
        font-size: 16px;
    }
    
    .consent-text p {
        font-size: 13px;
    }
    
    .consent-buttons {
        justify-content: center;
        width: 100%;
    }
    
    .consent-btn {
        flex: 1;
        max-width: 120px;
    }
}

/* Privacy drawer mobile responsiveness */
@media (max-width: 768px) {
    .privacy-drawer {
        height: 80vh;
    }
    
    .privacy-header {
        padding: 15px;
    }
    
    .privacy-header h2 {
        font-size: 20px;
    }
    
    .privacy-body {
        padding: 15px;
    }
    
    .privacy-section h3 {
        font-size: 16px;
    }
    
    .privacy-section p,
    .privacy-section li {
        font-size: 13px;
    }
}