/* Design System */
:root {
    /* Colors */
    --primary-purple: hsl(270, 70%, 55%);
    --primary-cyan: hsl(180, 70%, 55%);
    --primary-pink: hsl(330, 70%, 60%);
    --primary-orange: hsl(30, 90%, 60%);

    --bg-dark: hsl(240, 20%, 8%);
    --bg-darker: hsl(240, 25%, 5%);

    --text-light: hsl(0, 0%, 95%);
    --text-glow: hsla(180, 100%, 70%, 0.8);

    /* Gradients */
    --gradient-cosmic: linear-gradient(135deg,
            hsl(270, 70%, 25%) 0%,
            hsl(240, 60%, 15%) 50%,
            hsl(200, 70%, 20%) 100%);

    /* Shadows & Glows */
    --glow-cyan: 0 0 20px hsla(180, 100%, 50%, 0.5),
        0 0 40px hsla(180, 100%, 50%, 0.3);
    --glow-purple: 0 0 20px hsla(270, 100%, 60%, 0.5),
        0 0 40px hsla(270, 100%, 60%, 0.3);

    /* Typography */
    --font-display: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-display);
    background: var(--bg-darker);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
    cursor: default;
    /* Changed from none to allow UI interaction */
}

/* Canvas */
#screensaver {
    display: block;
    width: 100%;
    height: 100%;
    /* Background handled by Themes now */
    background: #000;
}

/* Info Overlay */
.info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
    display: none;
    /* Hidden by default */
}

.info h1 {
    font-size: clamp(2rem, 6vw, 5rem);
    font-weight: 700;
    color: var(--text-light);
    text-shadow: var(--glow-cyan);
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg,
            var(--primary-cyan) 0%,
            var(--primary-purple) 50%,
            var(--primary-pink) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s ease-in-out infinite;
}

.info p {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-glow);
    text-shadow: var(--glow-cyan);
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Settings Panel - Horizontal Modal */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(900px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    color: var(--text-light);
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
}

.settings-panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -45%) scale(0.95);
    pointer-events: none;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.settings-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: linear-gradient(to right, var(--primary-cyan), var(--primary-purple));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#close-settings {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
}

#close-settings:hover {
    opacity: 1;
    transform: rotate(90deg);
    transition: transform 0.3s ease;
}

/* Horizontal Layout */
.horizontal-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.settings-column {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-column h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--primary-cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

/* Grids & Buttons */
.theme-grid,
.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.theme-btn,
.color-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-btn:hover,
.color-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.theme-btn.active,
.color-btn.active {
    background: var(--primary-purple);
    border-color: var(--primary-cyan);
    color: white;
    box-shadow: 0 0 15px rgba(180, 70, 255, 0.3);
    font-weight: 600;
}

/* Controls Column adjustments */
.controls-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.value-row {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
}

.value-display {
    color: var(--primary-cyan);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Toggle Customizations for Column */
.toggles-container {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
}

.control-group.toggle-row {
    margin-bottom: 15px;
}

.control-group.toggle-row:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 900px) {
    .horizontal-layout {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        bottom: 20px;
        max-height: none;
        overflow-y: scroll;
        height: auto;
    }

    .settings-panel.hidden {
        transform: translateX(-50%) translateY(20px);
    }
}

/* Toggle Switches */
.control-group.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.control-group.toggle-row label.toggle-label {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-light);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Countdown Display */
.countdown-display {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 10, 20, 0.7);
    color: var(--text-light);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: monospace;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    z-index: 50;
    display: none;
}

.countdown-display.active {
    display: block;
}

/* Animations */
@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0;
    }

    10%,
    90% {
        opacity: 0.9;
    }
}

@keyframes shimmer {

    0%,
    100% {
        filter: hue-rotate(0deg) brightness(1);
    }

    50% {
        filter: hue-rotate(30deg) brightness(1.2);
    }
}

@media (max-width: 768px) {
    .info h1 {
        font-size: 2.5rem;
    }

    .info p {
        font-size: 1rem;
    }

    .settings-panel {
        width: 90%;
        right: 5%;
    }
}