/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    /* Su mobile il contenuto parte dall'alto, su desktop si centra se c'è spazio */
    align-items: flex-start; 
    min-height: 100vh;
    background: #0a0e1a;
    color: #f8fafc;
    /* Permette lo scorrimento naturale della pagina */
    overflow-y: auto;
    padding: 20px;
}

/* Background Visualizer (rimane fisso dietro) */
#visualizer {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.4;
    pointer-events: none; /* Non blocca i click sui controlli */
}

/* --- Container Principale --- */
.container {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); /* Supporto Safari */
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    padding: 30px;
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1;
    margin: auto; /* Centra orizzontalmente */
}

/* Titoli e Testi */
h1 {
    margin-top: 0;
    font-size: 1.8rem;
    color: #38bdf8;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    text-align: center;
}

p {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 30px;
    text-align: center;
}

/* --- Form e Controlli --- */
.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #38bdf8;
    margin-top: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.3);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.section-title:nth-of-type(3) {
    margin-top: 20px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    display: block;
    width: 100%;
}

.value-display {
    float: right;
    color: #38bdf8;
    font-family: monospace;
}

/* Input Styles */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: #1e293b;
    border-radius: 5px;
    outline: none;
    accent-color: #38bdf8;
    cursor: pointer;
}

select {
    width: 100%;
    background: #1e293b;
    color: #fff;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 12px; /* Più grande per il touch */
    border-radius: 8px;
    margin-top: 5px;
    font-size: 1rem;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 5px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: #38bdf8;
}

/* --- Bottone Play --- */
button {
    width: 100%;
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
    color: #0f172a;
    border: none;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:active {
    transform: scale(0.98);
}

button.playing {
    background: linear-gradient(135deg, #f43f5e 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
    animation: pulse 2s infinite;
}

/* --- Animazioni & Media Queries --- */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.9; transform: scale(1.02); }
}

/* Tablet e Desktop */
@media (min-width: 600px) {
    body {
        align-items: center; /* Ricentra verticalmente su schermi grandi */
    }
    .container {
        padding: 40px;
    }
    h1 {
        font-size: 2.2rem;
    }
}

/* Ottimizzazione per scrollbar WebKit */
.container::-webkit-scrollbar {
    width: 6px;
}
.container::-webkit-scrollbar-thumb {
    background: #38bdf8;
    border-radius: 10px;
}