:root {
    --neon-violet: #9d4edd;
    --neon-orange: #ff6a00;
    --neon-cyan: #00f2fe;
    --glass-bg: rgba(255, 255, 255, 0.08); 
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-highlight: rgba(255, 255, 255, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #05020a; 
    color: #ffffff;
    height: 100vh;
    height: 100dvh; /* LA MAGIA: Altura dinámica que respeta los botones del celular */
    width: 100vw;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- NUEVO FONDO Y OSCILOSCOPIO --- */
.bg-image {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

#audioVisualizer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Por encima del fondo, por debajo del vidrio */
    opacity: 0.85;
    pointer-events: none; /* Evita que el osciloscopio bloquee los clics */
}

/* --- CONTENEDOR APP --- */
.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    height: 100vh;
    height: 100dvh; /* LA MAGIA: Altura dinámica */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 18px env(safe-area-inset-bottom, 20px) 18px;
    gap: 16px;
}


/* --- EFECTO 3D GLASS PRO (MÁS BLANCO Y REFLECTANTE) --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-top: 1px solid var(--glass-highlight);
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-radius: 26px;
    box-shadow: 
        0 25px 45px rgba(0, 0, 0, 0.4), /* Sombra exterior para despegarlo del fondo */
        inset 0 0 20px rgba(255, 255, 255, 0.1); /* Brillo interior */
}

/* --- HEADER --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    height: 70px;
}
.app-logo {
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
}
.live-tag {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--neon-orange);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 0 15px var(--neon-orange);
}
.live-pulse {
    width: 8px; height: 8px;
    background-color: #fff;
    border-radius: 50%;
    animation: emitPulse 1.4s infinite;
}
@keyframes emitPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9); }
    70% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* --- SLIDER 1:1 --- */
.slider-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0; /* VITAL: Permite que el contenedor se encoja si falta espacio */
}
.frame-1to1 {
    width: 100%;
    max-height: 100%; /* Evita que el slider sea más alto que la pantalla disponible */
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    padding: 12px;
}
.slider-track {
    width: 100%; height: 100%;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}
.slide-item {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.slide-item.active { opacity: 1; transform: scale(1); }

/* --- REPRODUCTOR INFERIOR --- */
.player-dock {
    display: flex;
    align-items: center;
    padding: 14px 22px;
    gap: 18px;
    height: 88px;
}
.stream-btn {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--neon-violet) 0%, var(--neon-orange) 100%);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(255, 77, 0, 0.5), inset 0 2px 5px rgba(255,255,255,0.4);
}
.stream-btn .control-icon { width: 28px; height: 28px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }
.stream-btn:active { transform: scale(0.92); }
.stream-btn.playing {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-violet) 100%);
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.5), inset 0 2px 5px rgba(255,255,255,0.4);
}

.broadcast-meta { flex: 1; overflow: hidden; }
.truncate {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8); /* Sombra dura para texto legible siempre */
}
.sub-truncate {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e0dcf5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hidden { display: none !important; }


/* AJUSTES PARA PANTALLAS CHICAS Y CELULARES */
@media (max-height: 720px) {
    .app-container { padding: 12px 14px; gap: 10px; }
    .main-header { height: 60px; padding: 0 16px; }
    .player-dock { height: 76px; padding: 10px 16px; gap: 12px;}
    .stream-btn { width: 52px; height: 52px; }
    .stream-btn .control-icon { width: 24px; height: 24px; }
    .app-logo { height: 34px; }
    .truncate { font-size: 1rem; margin-bottom: 2px; }
    .sub-truncate { font-size: 0.8rem; }
    .frame-1to1 { padding: 8px; }
}
