:root {
    --primary-color: #4a90e2;
    --primary-glow: rgba(74, 144, 226, 0.4);
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --bg-dark: #0a0b10;
    --glass-bg: rgba(255, 255, 255, 0.05); /* Più visibile su mobile */
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Rimuove flash blu su tocco mobile */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: "Poppins", sans-serif;
    min-height: 100vh;
    overflow-x: hidden; /* Importante per mobile */
}

/* Sfondo */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 10% 20%, rgba(74, 144, 226, 0.2), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(155, 43, 255, 0.15), transparent 40%);
}

.app-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- LOGO RESPONSIVE --- */
.wrapper.title {
    margin: 1rem 0 2rem 0;
    /* Font size dinamico: minimo 2.5rem, preferito 10vw, massimo 5rem */
    font-size: clamp(2.5rem, 10vw, 5rem); 
    font-weight: 900;
    text-transform: uppercase;
    display: grid;
    place-content: center;
    text-align: center;
    width: 100%;
}

.title > div { grid-area: 1/1/-1/-1; }
.top { clip-path: polygon(0% 0%, 100% 0%, 100% 48%, 0% 58%); }
.bottom {
    clip-path: polygon(0% 60%, 100% 50%, 100% 100%, 0% 100%);
    color: transparent;
    background: linear-gradient(177deg, var(--bg-dark) 53%, var(--text-color) 65%);
    background-clip: text;
    -webkit-background-clip: text;
    transform: translateX(-0.02em);
}

/* --- LAYOUT CONTAINER --- */
.main-container {
    width: 100%;
    display: flex;
    flex-direction: column; /* Mobile: Colonna */
    gap: 1.5rem;
}

/* Base Card Style */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* --- CLOCK DISPLAY --- */
.clock-display {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px; /* Altezza minima mobile */
    text-align: center;
    background: radial-gradient(circle at center, rgba(255,255,255,0.03), transparent 70%), var(--glass-bg);
}

.clock-layout {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.slot-secondary {
    font-size: 1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    min-height: 1.5em;
}

.slot-primary {
    font-size: 18vw; /* Enorme su mobile per l'ora */
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 20px var(--primary-glow);
    font-variant-numeric: tabular-nums;
    white-space: nowrap; /* L'ora non deve mai andare a capo */
    transition: font-size 0.3s ease; /* Transizione fluida se cambia dimensione */
}

/* --- NUOVO: STILE PER TESTO LUNGO (Per la DATA) --- */
.slot-primary.long-text {
    font-size: 7vw; /* Molto più piccolo per far stare la data */
    line-height: 1.2;
    white-space: normal; /* La data può andare a capo se serve */
    padding: 0 10px;
    word-spacing: 5px; /* Leggermente più spaziata per leggibilità */
}
.timezone-badge {
    margin-top: 1rem;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
}

/* --- CONTROLS PANEL --- */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Select */
.select-wrapper select {
    width: 100%;
    padding: 14px; /* Più grande per il tocco */
    background: rgba(0, 0, 0, 0.3);
    border: var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    appearance: none;
    outline: none;
}

/* Grid Pulsanti */
.format-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 colonne */
    gap: 10px;
}

.radio-chip span {
    display: block;
    padding: 12px 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid transparent;
    text-align: center;
    font-size: 0.9rem;
    transition: 0.2s;
}

.radio-chip input { position: absolute; opacity: 0; }

.radio-chip input:checked + span {
    background: rgba(74, 144, 226, 0.2);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.2);
}

/* =========================================
   DESKTOP / TABLET MODE (min-width: 900px)
   ========================================= */
@media (min-width: 900px) {
    .main-container {
        flex-direction: row; /* Affiancati */
        align-items: stretch;
    }

    .clock-display {
        flex: 1.4; /* Più spazio all'orologio */
        min-height: 400px;
    }

    .controls-panel {
        flex: 0.6; /* Meno ai controlli */
    }

    .slot-primary {
        font-size: clamp(4rem, 8vw, 7rem); 
    }

    /* Versione Desktop della data */
    .slot-primary.long-text {
        font-size: clamp(2rem, 3.5vw, 4rem);
    }

    .slot-secondary {
        font-size: 1.3rem;
    }

    .format-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); /* Grid più fitta */
    }
    
    .wrapper.title {
        margin: 2rem 0;
    }
}