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

/* Force full screen and prevent scrolling */
html, body {
    background: #050505;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    color: white;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    touch-action: none; /* Prevents mobile zoom/scroll */
}

#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 640px;
    height: 480px;
    visibility: hidden;
    pointer-events: none;
    z-index: -1;
}

/* Header */
.header {
    position: fixed;
    top: max(2rem, env(safe-area-inset-top)); 
    left: max(2rem, env(safe-area-inset-left));
    text-align: left;
    z-index: 10;
    pointer-events: none;
}

.header h1 {
    font-size: 3rem; 
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    background: linear-gradient(45deg, #ff6e7f, #bfe9ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0.9;
    letter-spacing: -2px;
    filter: drop-shadow(0 0 20px rgba(255,255,255,0.2));
}

/* Color Controls - Default (Portrait/Desktop) */
.color-controls {
    position: fixed;
    top: max(2rem, env(safe-area-inset-top));
    right: max(2rem, env(safe-area-inset-right));
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.color-scheme {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-scheme button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 120px;
}

.color-scheme button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.color-scheme button.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Theme Colors */
.color-preview.cosmic { background: linear-gradient(45deg, #ff6e7f, #bfe9ff); }
.color-preview.neon { background: linear-gradient(45deg, #00ff87, #60efff); }
.color-preview.sunset { background: linear-gradient(45deg, #ff8c37, #ff427a); }
.color-preview.ocean { background: linear-gradient(45deg, #0082c8, #00b4db); }
.color-preview.matrix { background: linear-gradient(45deg, #00ff00, #003300); }

/* Action Button (Shatter) */
.actions {
    position: fixed;
    bottom: max(2rem, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

#btn-shatter {
    background: linear-gradient(135deg, #ff4b1f, #ff9068);
    border: none;
    padding: 1rem 2rem;
    color: white;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 25px rgba(255, 75, 31, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#btn-shatter:active {
    transform: translateX(-50%) scale(0.95);
}

#btn-shatter.active {
    background: white;
    color: black;
}

/* --- RESPONSIVE: Mobile Portrait --- */
@media (max-width: 768px) and (orientation: portrait) {
    .header h1 { font-size: 2rem; }
    .color-controls { padding: 0.5rem; }
    .color-scheme button { padding: 0.4rem; min-width: auto; }
    .color-scheme button span { display: none; }
}

/* --- RESPONSIVE: Landscape Mode Fix --- */
@media (max-height: 500px) and (orientation: landscape) {
    .color-controls {
        top: auto; 
        right: auto;
        left: max(1rem, env(safe-area-inset-left));
        bottom: max(1rem, env(safe-area-inset-bottom));
        transform: none;
        padding: 0.5rem;
        width: auto;
        max-width: 90%;
        display: flex;
        justify-content: center;
    }

    .color-scheme {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .color-scheme button {
        min-width: auto;
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Move shatter button to right corner in landscape */
    .actions {
        left: auto;
        transform: none;
        right: max(2rem, env(safe-area-inset-right));
        bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .header {
        top: max(1rem, env(safe-area-inset-top));
        left: max(1rem, env(safe-area-inset-left));
    }
    .header h1 {
        font-size: 1.5rem;
    }
}
