:root {
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #e2e8f0;
    --primary: rgba(255, 255, 255, 0.4);
    --primary-hover: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.08);
    /* More transparent white */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    overflow: hidden;
    /* Full screen app */
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Background Image Layer */
#background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    transition: background-image 0.8s ease-in-out;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
    z-index: 1;
    pointer-events: none;
}

/* Canvas Layer */
#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Onboarding Section Fade */
.onboarding-section {
    transition: opacity 0.3s ease-out, max-height 0.3s ease-out, margin 0.3s ease-out, padding 0.3s ease-out, transform 0.3s ease-out;
    max-height: 500px;
    overflow: hidden;
}

.onboarding-section h3 {
    font-size: 1.1rem;
    text-transform: none;
    letter-spacing: -0.3px;
    color: #ffffff;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

body.has-image .onboarding-section {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

/* UI Layer */
.ui-container {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

header {
    text-align: center;
    pointer-events: auto;
    animation: fadeInDown 1s ease-out;
}

header h1 {
    font-size: 2.6rem;
    font-weight: 600;
    letter-spacing: -1px;
    color: #ffffff;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Glassmorphic Panel */
.glass-panel {
    background: transparent;
    /* Removed surrounding background */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    /* Removed border */
    box-shadow: none;
    /* Removed shadow */
    border-radius: 0;
    padding: 1rem 0;
    pointer-events: auto;

    margin-top: auto;
    width: 100%;
    max-width: 850px;
    align-self: center;
    margin-bottom: 2rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.glass-panel:hover {
    transform: none;
}

.control-group {
    margin-bottom: 2rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.action-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.custom-file-upload {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    /* Slightly more fill but NO blur */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: #ffffff;
    /* Sharp white text */
    border-radius: 16px;
    cursor: pointer;
    font-weight: 500;
    /* Sharper font weight */
    font-size: 0.95rem;
    /* Tiny bit bigger */
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    /* Sharper, more whiteish outline */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
}

.custom-file-upload:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.custom-file-upload:active {
    transform: translateY(1px);
}

/* Icon Buttons for Export */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    color: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 20;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
    transform: translateY(1px) scale(0.95);
}

.action-btn.recording {
    background: rgba(239, 68, 68, 0.5);
    /* Red for recording */
    border-color: rgba(239, 68, 68, 0.8);
    animation: pulseRed 1.5s infinite;
}

/* Sample Wallpapers Group */
.sample-grid {
    display: flex;
    gap: 0.75rem;
}

.sample-item {
    flex: 1;
    height: 70px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sample-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
}

.sample-item:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.sample-item:hover::after {
    background: rgba(255, 255, 255, 0.1);
}

/* File Upload Button */
input[type="file"] {
    display: none;
}

/* Effect Buttons */
.effect-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.effect-btn {
    flex: 1 1 calc(25% - 0.75rem);
    min-width: 120px;
    padding: 0.8rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    /* Slightly more fill but NO blur */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    /* Sharper whiteish outline */
    border-radius: 16px;
    color: #ffffff;
    /* Sharp white text */
    font-family: inherit;
    font-size: 0.85rem;
    /* Tiny bit bigger */
    letter-spacing: 0.5px;
    font-weight: 500;
    /* Sharper font weight */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.effect-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.effect-btn.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Slider */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

#density-value {
    color: var(--text-light);
}

/* Adjustments Row */
.adjustments-row {
    display: flex;
    gap: 1.5rem;
}

.adjust-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.adjust-col h3 {
    margin-bottom: 0.25rem;
}

.mini-slider {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.mini-slider label {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.mini-slider input[type="range"] {
    height: 6px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(139, 92, 246, 0.5);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    margin-top: 0;
    margin-bottom: 0;
    max-width: 400px;
    position: relative;
    animation: none;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    color: #fff;
    text-shadow: none;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #fff;
}

.info-steps {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-num {
    background: rgba(255, 255, 255, 0.15);
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.step p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    text-align: center;
}