/* --- RESET E BASI --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    background-color: #050505;
    color: #00ffff; 
    font-family: 'Fira Code', monospace;
    margin: 0; padding: 10px;
    text-transform: uppercase;
    overflow-x: hidden;
}

/* --- WRAPPER PER LA CENTRATURA DEL FULLSCREEN --- */
.fullscreen-wrapper {
    width: 100%;
    display: block;
}

.fullscreen-wrapper:fullscreen,
.fullscreen-wrapper:-webkit-full-screen {
    background: #010408 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100vw !important;
    height: 100vh !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* --- OBLÒ CON SFONDO SPAZIALE ANIMATO --- */
.terminal-header {
    position: relative;
    background: radial-gradient(circle at center, #0a1428 0%, #030814 100%) !important;
    border: 3px double #00ffff;
    border-radius: 50% 50% 45% 45% / 15% 15% 12% 12%; 
    box-shadow: 
        0 0 0 4px rgba(0, 255, 255, 0.1),
        inset 0 0 30px rgba(0, 255, 255, 0.3),
        0 15px 35px rgba(0, 0, 0, 0.8);
    margin: 15px auto 55px auto; 
    padding: 45px 35px 75px 35px; 
    text-align: center;
    overflow: visible; 
    max-width: 750px; 
    width: 100%;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    perspective: 1000px;
}

/* LOGO INTEGRATO SULLA PLANCIA CON PERCORSO AGGIORNATO */
.player-logo {
    position: absolute;
    top: 10px;
    left: 15px;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    border: 1px solid #00ffff;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    z-index: 10;
    object-fit: cover;
}

/* TIMER SUPER PINK NEON PUNK */
.neon-countdown-timer {
    display: none;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    font-weight: 800;
    color: #ff1493; 
    text-shadow: 0 0 5px #ff1493, 0 0 15px #ff1493;
    background: rgba(255, 20, 147, 0.15);
    border: 1px solid #ff1493;
    padding: 2px 10px;
    border-radius: 4px;
    letter-spacing: 2px;
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.3);
    margin: 5px auto;
    width: fit-content;
    z-index: 10;
}

.header-content-air {
    position: relative;
    z-index: 2;
    pointer-events: none; 
}

/* --- STELLE ANIMATE --- */
.stars-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.85;
    border-radius: 50% 50% 45% 45% / 15% 15% 12% 12%; 
    overflow: hidden;
}

.stars-small {
    background-image: 
        radial-gradient(1px 1px at 25px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 75px 120px, #00ffff, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 150px 50px, #fff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 220px 180px, #ffb6c1, rgba(0,0,0,0));
    background-size: 300px 300px;
    animation: drift 90s linear infinite, twinkle 3s ease-in-out infinite alternate;
}

.stars-medium {
    background-image: 
        radial-gradient(2px 2px at 40px 80px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 180px 240px, #ffb6c1, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 290px 150px, #00ffff, rgba(0,0,0,0));
    background-size: 400px 400px;
    animation: drift 150s linear infinite, twinkle 4s ease-in-out infinite alternate-reverse;
}

.stars-large {
    background-image: 
        radial-gradient(3px 3px at 100px 150px, #00ffff, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 320px 50px, #fff, rgba(0,0,0,0));
    background-size: 500px 500px;
    animation: drift 210s linear infinite, twinkle 2s ease-in-out infinite alternate;
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-15px, -10px); }
    100% { transform: translate(0, 0); }
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

.telemetry-left {
    position: absolute; 
    top: 18px; left: 65px; 
    font-size: 0.55rem; 
    color: rgba(0,255,255,0.7); 
}
.telemetry-right {
    position: absolute; 
    top: 18px; right: 45px; 
    font-size: 0.55rem; 
    color: rgba(255,182,193,0.7); 
}

.glitch {
    font-size: 1.7rem; font-weight: 800;
    color: #fff; 
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    letter-spacing: 3px;
    margin: 10px 0 2px 0;
}

.terminal-header h3 {
    font-size: 0.8rem;
    color: #ffb6c1; 
    letter-spacing: 4px;
    margin: 0 auto 15px auto;
    opacity: 0.9;
}

.infrastructure-title {
    font-size: 0.65rem;
    color: #00ffff;
    letter-spacing: 2px;
    margin: 10px auto 5px auto;
    text-shadow: 0 0 5px rgba(0,255,255,0.8);
    font-weight: 800;
}

.blink {
    animation: blinker 1.5s steps(2, start) infinite;
    color: #ffb6c1; font-size: 0.65rem;
    letter-spacing: 1px;
}

/* --- ACTIVE PLAYER BOX --- */
.station-active-info {
    display: none; 
    flex-direction: column;
    width: 100%;
    gap: 14px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 8px;
    padding: 15px;
    background: #010610; 
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.9),
        inset 0 0 15px rgba(0, 255, 255, 0.15);
    margin-top: 5px;
    position: relative;
    z-index: 5; 
}

.player-main-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.player-flag {
    font-size: 1.8rem;
    animation: floatingOrb 4s ease-in-out infinite;
}
@keyframes floatingOrb {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(5deg); }
}

.player-station-name {
    color: #00ffff;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.player-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px dashed rgba(0, 255, 255, 0.2);
    padding-top: 12px;
    width: 100%;
}

.player-toggle-btn {
    background: rgba(255, 182, 193, 0.05);
    border: 1px solid #ffb6c1;
    color: #ffb6c1;
    padding: 7px 16px;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.player-toggle-btn:hover {
    background: #ffb6c1;
    color: #050505;
    box-shadow: 0 0 15px #ffb6c1;
}

.player-timer-btn {
    background: rgba(255, 255, 0, 0.05);
    border: 1px solid #ffff00;
    color: #ffff00;
    padding: 7px 10px;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.player-timer-btn:hover, .player-timer-btn.is-active {
    background: #ffff00;
    color: #050505;
    box-shadow: 0 0 15px #ffff00;
}

.player-fullscreen-btn {
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 5px 10px;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
}

.fullscreen-exit-btn {
    display: none;
    position: absolute;
    top: 20px; right: 25px;
    background: transparent;
    border: 1px solid #00ffff;
    color: #00ffff;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 9999;
}

.player-volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    justify-content: flex-end;
}
.volume-label { font-size: 0.65rem; color: #00ffff; font-weight: 800; }

.cyber-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%; max-width: 100px; height: 4px;
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid #00ffff; outline: none; border-radius: 2px;
}
.cyber-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 10px; height: 14px; background: #ffb6c1;
    border: 1px solid #00ffff; cursor: pointer;
}

.cyber-equalizer { display: flex; align-items: flex-end; gap: 3px; height: 18px; padding: 0 4px; }
.equalizer-bar { width: 3px; background-color: #ffb6c1; animation: bounce 0.6s ease-in-out infinite alternate; }
.equalizer-bar:nth-child(2) { animation-duration: 0.4s; background-color: #00ffff; }
.equalizer-bar:nth-child(3) { animation-duration: 0.7s; }
.equalizer-bar:nth-child(4) { animation-duration: 0.5s; background-color: #00ffff; }

@keyframes bounce { 0% { height: 2px; } 100% { height: 18px; } }

.terminal-header.is-playing .infrastructure-title,
.terminal-header.is-playing .blink { display: none; }
.terminal-header.is-playing .station-active-info { display: flex; }

/* --- CONSOLLE DEI CONTINENTI INTEGRATA NELLA CURVA DELL'OBLÒ --- */
.continent-nav {
    position: absolute;
    bottom: -15px; 
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 710px;
    z-index: 99; 
}

.continent-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
}

.cont-btn {
    position: relative; 
    z-index: 100; 
    background: #030814; 
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 8px 14px;
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.9);
}

/* Modifica Radiale: Segue perfettamente l'arco convesso inferiore del pannello risalendo ai lati */
.cont-btn:nth-child(1) { transform: translateY(-7px) rotate(8deg); }
.cont-btn:nth-child(2) { transform: translateY(-1px) rotate(4deg); }
.cont-btn:nth-child(3) { transform: translateY(3px) rotate(1deg); }
.cont-btn:nth-child(4) { transform: translateY(3px) rotate(-1deg); }
.cont-btn:nth-child(5) { transform: translateY(-1px) rotate(-4deg); }
.cont-btn:nth-child(6) { transform: translateY(-7px) rotate(-8deg); }

.cont-btn:hover {
    color: #ffb6c1;
    border-color: #ffb6c1;
    box-shadow: 0 0 12px rgba(255, 182, 193, 0.7);
    z-index: 101;
}

.cont-btn.active {
    background: #00ffff;
    color: #050505;
    box-shadow: 0 0 15px #00ffff;
    border-color: #00ffff;
    z-index: 101;
}

/* Ripristino stile specifico Tasto NEURAL in Pink */
.cont-btn.neural-btn {
    border-color: #ff1493;
    color: #ff1493;
    text-shadow: 0 0 5px rgba(255, 20, 147, 0.4);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.3);
}
.cont-btn.neural-btn:hover, .cont-btn.neural-btn.active {
    background: #ff1493;
    color: #050505;
    border-color: #ff1493;
    box-shadow: 0 0 15px #ff1493;
    z-index: 101;
}

.cont-btn.timetable-btn {
    border-color: #ff1493;
    color: #ff1493;
    text-shadow: 0 0 5px rgba(255, 20, 147, 0.4);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.3);
}
.cont-btn.timetable-btn:hover, .cont-btn.timetable-btn.active {
    background: #ff1493;
    color: #050505;
    border-color: #ff1493;
    box-shadow: 0 0 15px #ff1493;
    z-index: 101;
}

/* --- SEZIONE BANDIERE --- */
.country-slider-container {
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 255, 0.2);
    margin-bottom: 25px; border-radius: 4px;
}
.button-grid { display: flex; overflow-x: auto; gap: 14px; padding: 15px 15px 22px 15px; scrollbar-width: none; }

.country-btn-flag {
    flex: 0 0 auto; width: 55px; height: 38px;
    border-radius: 3px; border: 1px solid #00ffff;
    background: #050505; color: #fff;
    font-size: 1.6rem; cursor: pointer; 
    display: flex; align-items: center; justify-content: center;
    position: relative;
    transition: all 0.2s ease-in-out;
}
.country-btn-flag:hover, .country-btn-flag.active-flag {
    border-color: #ffb6c1;
    box-shadow: 0 0 12px rgba(255, 182, 193, 0.6);
    transform: scale(1.05);
}
.country-btn-flag::after {
    content: attr(data-code);
    position: absolute;
    bottom: -15px; font-size: 0.55rem; color: #00ffff; font-weight: 800;
}

/* --- LISTE STAZIONI --- */
#station-list { max-height: 550px; overflow-y: auto; scrollbar-width: thin; }
.station-item { background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid #222; padding: 12px; cursor: pointer; }
.name { font-size: 0.95rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.station-details { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; font-size: 0.7rem; color: #00ffff; }
.station-item.active .station-details { max-height: 150px; margin-top: 10px; padding: 8px; border-top: 1px solid rgba(0, 255, 255, 0.2); }
.detail-label { color: #ffb6c1; font-weight: bold; margin-right: 5px; }

.play-mini-btn { background: #00ffff; color: #000; border: none; padding: 8px 12px; font-weight: bold; font-size: 0.7rem; }
.fav-btn { background: transparent; border: none; color: #444; font-size: 1.5rem; cursor: pointer; }
.fav-btn.is-fav { color: #ffb6c1; text-shadow: 0 0 8px #ffb6c1; }

/* --- FULLSCREEN OBLÒ --- */
.fullscreen-wrapper:fullscreen .terminal-header,
.fullscreen-wrapper:-webkit-full-screen .terminal-header {
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 700px !important; 
}
.fullscreen-wrapper:fullscreen .fullscreen-exit-btn,
.fullscreen-wrapper:-webkit-full-screen .fullscreen-exit-btn { display: block; }

/* --- PERFEZIONAMENTO SMARTPHONE --- */
@media screen and (max-width: 480px) {
    .terminal-header {
        padding: 40px 15px 55px 15px;
        margin-top: 10px; margin-bottom: 35px;
        border-radius: 25px 25px 40px 40px / 15px 15px 20px 20px; 
        max-width: 100%; 
    }
    .player-volume-container { display: none !important; }
    .player-logo { width: 30px; height: 30px; top: 8px; left: 10px; }
    .telemetry-left { font-size: 0.48rem; top: 12px; left: 45px; }
    .telemetry-right { font-size: 0.48rem; top: 12px; right: 15px; }
    .neon-countdown-timer { font-size: 0.8rem; margin-top: 8px; }

    .continent-nav { bottom: -11px; width: 98%; }
    .cont-btn { padding: 6px 5px; font-size: 0.48rem; letter-spacing: -0.5px; }

    /* Ottimizzazione curvatura mobile */
    .cont-btn:nth-child(1) { transform: translateY(-3px) rotate(4deg); }
    .cont-btn:nth-child(2) { transform: translateY(0px) rotate(2deg); }
    .cont-btn:nth-child(3) { transform: translateY(1.5px) rotate(0.5deg); }
    .cont-btn:nth-child(4) { transform: translateY(1.5px) rotate(-0.5deg); }
    .cont-btn:nth-child(5) { transform: translateY(0px) rotate(-2deg); }
    .cont-btn:nth-child(6) { transform: translateY(-3px) rotate(-4deg); }
}