/* Accesibilidad: oculto visualmente pero legible por lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    /* Design System Tokens */
    --primary: #e6007e;
    --primary-glow: rgba(230, 0, 126, 0.4);
    --accent: #5547ff;
    --accent-glow: rgba(85, 71, 255, 0.4);
    --bg-dark: #0f172a;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-blur: blur(12px);
    --radius: 12px;
    --anim-speed: 0.35s;
    --anim-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    /* Global fix for padding/border calculations */
}

body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    background-color: var(--bg-dark);
    background-image: url("Wallpaper/SummerWallpaper.webp");
    /*Wallpaper defaoult*/
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/*Pegatinas del Wallpaper*/
.Wallpaper {
    /*redes sociales*/
    position: fixed;
    top: 0%;
    right: -30px;
    width: 35vh;
    z-index: -3;
}

.Wallpaper2 {
    /*cucaracha*/
    position: fixed;
    bottom: 5%;
    left: 100px;
    width: 15vh;
    z-index: -3;
}

/*--------------------------------------------------------------------------------------------*/

/*Iconos del escritorio*/
.sidebar-menu {
    position: fixed;
    top: 20px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 600;
    max-height: calc(100vh - 80px);
    /* Deja espacio para la taskbar */
    overflow-y: auto;
    padding-bottom: 20px;
    padding-right: 15px;
    /* Margen para cuando aparezca el scroll invisible */

    /* Ocultar scrollbar en diferentes navegadores */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

.sidebar-menu::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

.icon {
    /*posicion de los iconos*/
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    cursor: pointer;
    flex-shrink: 0;
    /* Evita que el flexbox aplaste los iconos */
    transition: background 0.2s;
}

.icon img {
    /*iconos*/
    width: 48px;
    /* Tamaño consistente independientemente del viewport */
    height: auto;
    margin-top: 10px;
}

.icon:hover {
    /*iconos se hace un poco más grandes*/
    background-color: #ffffff23;
    border-radius: 5px;
}

.icon span {
    /*texto*/
    font-size: 12px;
    color: #ffffff;
    margin-top: 5px;
    font-family: Arial;
    text-align: center;
    text-shadow: 1px 1px 2px #000000;
}

#notas {
    position: fixed;
    top: 80%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

/*--------------------------------------------------------------------------------------------*/

/*Menu estilo sims*/
.menu-principal {
    position: absolute;
    top: 62%;
    /* Bajado para centrar mejor en la cara del Vtuber */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    /* Encima del Vtuber (z-index:0) */
    pointer-events: none;
    /* Dejar pasar clicks en lo transparente */
}

.menu-principal .botones {
    pointer-events: auto;
    /* Reactivar clicks solo en los botones */
}

.botones button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease-in-out;
    /* Para suavizar los cambios de posición si ajustas el tamaño */
}

.botones img {
    width: 15vw;
    max-width: 288px;
    height: auto;
}

.botones {
    position: relative;
    width: clamp(380px, 55vh, 600px);
    /* Aumentado para alejar botones */
    height: clamp(420px, 65vh, 700px);
    /* Aumentado para alejar botones */
    padding: 2vw;
    margin: auto;
}

/*El menu desaparece al verse desde un movil/tablet*/
@media (max-width: 1024px) {
    .menu-principal {
        display: none;
    }
}


/*Cambio al pasar el cursor*/
.botones #btn-RedesSociales:hover img {
    /*Redes Sociales*/
    content: url('menu sims/Seleccion/RS_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-Arte:hover img {
    /*Arte*/
    content: url('menu sims/Seleccion/Arte_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-Config:hover img {
    /*Referencias*/
    content: url('menu sims/Seleccion/Referencias_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-Updates:hover img {
    /*Updates*/
    content: url('menu sims/Seleccion/Updates_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-Contacto:hover img {
    /*VGen*/
    content: url('menu sims/Seleccion/VGen_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-GuestBook:hover img {
    /*GuestBook*/
    content: url('menu sims/Seleccion/GuestBook_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-SobreMi:hover img {
    /*Sobre Mi*/
    content: url('menu sims/Seleccion/SobreMi_seleccion.webp');
    transform: scale(1.1);
}

.botones #btn-Streams:hover img {
    /*Stream*/
    content: url('menu sims/Seleccion/Stream_seleccion.webp');
    transform: scale(1.1);
}

/* POSICIONAMIENTO POR IDs (Más seguro) */

/* 1. Redes Sociales (Arriba Centro) */
#btn-RedesSociales {
    top: -5%;
    left: 50%;
    transform: translate(-50%, -70%);
}

/* 2. Arte (Arriba Derecha) */
#btn-Arte {
    top: 14%;
    left: 70%;
    transform: translate(0%, -110%);
}

/* 3. Referencias/Config (Derecha Arriba) */
#btn-Config {
    top: 30.6%;
    left: 80%;
    transform: translate(0%, -90%);
}

/* 4. Updates (Derecha Abajo) */
#btn-Updates {
    top: 50%;
    left: 70%;
    transform: translate(0%, -60%);
}

/* 5. Contacto (Abajo Centro) */
#btn-Contacto {
    bottom: 20%;
    left: 50%;
    transform: translate(-50%, 0%);
}

/* 6. GuestBook (Izquierda Abajo) */
#btn-GuestBook {
    top: 50%;
    left: 30%;
    transform: translate(-100%, -60%);
}

/* 7. Sobre Mi (Izquierda Arriba) */
#btn-SobreMi {
    top: 30.6%;
    left: 20%;
    transform: translate(-100%, -90%);
}

/* 8. Streams (Arriba Izquierda) - Alineado VISUALMENTE con Arte */
#btn-Streams {
    top: 6%;
    left: 30%;
    transform: translate(-100%, -110%);
}

/*stream*/

/*--------------------------------------------------------------------------------------------*/

/* Vtuber video/canvas */
/* Vtuber video/canvas - Ocupa toda la pantalla */
.video-centro {
    position: fixed;
    /* Fixed para que no afecte el scroll si lo hubiera */
    top: 0;
    left: 0;
    margin: 0; /* Resetea el margen por defecto del <figure> (40px) */
    width: 100vw;
    height: 100vh;
    transform: none;
    /* Quitamos el centrado CSS, lo hace JS */

    z-index: 0;
    /* Nivel base */
    pointer-events: none;
    /* Dejar pasar clicks */
    overflow: hidden;
}

/* El canvas SÍ debe capturar eventos para el tracking, O NO? 
   Si usamos listener global en window, da igual.
   Pero si el canvas está "detrás" de un div fullscreen transparente, 
   el listener global funciona igual.
*/
.video-centro canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    will-change: transform, opacity;
    /* FORZAR ACELERACIÓN POR HARDWARE */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    filter: url(#sharpen) contrast(1.02) brightness(1.02);
    /* Aplicar filtro de nitidez real SVG + ajustes leves */
}

.video-centro video {
    top: 50px;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    /* Para que no interrumpa clicks */
    filter: url(#sharpen) contrast(1.02) brightness(1.02);
}


/*--------------------------------------------------------------------------------------------*/
/*Indicador de LIVE en el boton de Stram*/
#live-indicator {
    display: none;
    position: absolute;
    top: 53%;
    left: 80%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #ff2222;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 6px #ff2222;
    z-index: 2;
}

/* Cuando el botón de stream está en hover, agranda el círculo */
#btn-Streams:hover #live-indicator {
    /* Ajusta el translate para corregir el desplazamiento al escalar */
    transform: translate(-15%, -50%) scale(1.1);
    transition: transform 0.1s;
}

/* Asegúrate de que el círculo tenga transición suave */
#live-indicator {
    transition: transform 0.2s;
}

/* =========================================
   RESPONSIVE DESIGN (Móvil y Tablet)
   ========================================= */

@media screen and (max-width: 1024px) {

    /* CORRECCIÓN FONDO IPAD/IOS */
    /* En iOS, background-size: cover + body 100vh a veces falla. */
    html {
        height: 100%;
        width: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    body {
        background-position: center center !important;
        background-attachment: scroll !important;
        /* Fix para iOS que no le gusta fixed + cover */
        background-size: cover !important;
        height: 100% !important;
        width: 100% !important;
        position: fixed;
        /* Forzar que el body no se mueva */
        overflow: hidden !important;
        touch-action: none;
        overscroll-behavior: none;
    }


    /* 2. Ocultar elementos decorativos grandes */
    .Wallpaper,
    .Wallpaper2 {
        display: none !important;
        /* Chao pegatinas en móvil para limpiar visual */
    }

    /* 3. Ocultar menús de escritorio — navegación pasa al Start Menu */
    .sidebar-menu,
    .menu-principal {
        display: none !important;
    }

    .icon {
        width: 70px;
        /* Más pequeños */
        margin: 5px;
    }

    .icon img {
        width: 40px;
        /* Iconos más pequeños */
    }

    .icon span {
        font-size: 10px;
        display: none;
        /* Ocultar texto para ahorrar espacio si se quiere, o dejarlo */
    }

    #notas {
        top: 20px;
        right: 10px;
        transform: none;
        /* Reubicar notas */
    }

    /* Ventanas y Popups (FullScreen en móvil) */
    .popup,
    .ventana-web,
    .discord-popup,
    .sobre-mi-popup {
        width: 95% !important;
        height: 85% !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        border-radius: var(--radius);
        touch-action: auto;
        /* Permitir scroll dentro de las ventanas */
    }


    .window-header,
    .web-header,
    .powershell-header {
        height: 40px;
        /* Cabecera un poco más alta para dedo */
    }

    .window-controls-group {
        top: 15px !important;
        right: 10px !important;
        transform: translateY(-50%) !important;
    }


    .window-controls-group button {
        width: 24px !important;
        height: 18px !important;
        font-size: 10px !important;
    }

    .web-link-display {
        top: 13px !important;
        /* Subido significativamente */
        font-size: 12px !important;
        /* Tamaño más coherente para móvil */
    }

    /* Forzar que el popup de arte no use los 650px del inline style */
    #popup-arte {
        width: 95% !important;
        height: 85% !important;
    }

    /* 6. Barra de Tareas */
    #taskbar-container {
        height: 75px !important;
        min-height: 75px !important;
        max-height: 75px !important;
        /* Aumentado para evitar que se tape */
        padding-bottom: env(safe-area-inset-bottom) !important;
        display: flex;
        align-items: center;
        z-index: 100001 !important;
        /* Por encima de todo incluso del menu movil */

        /* ESTABILIZACIÓN AVANZADA */
        transform: translateZ(0);
        /* Forzar aceleración por GPU */
        contain: layout;
        /* Aislar el layout de la barra del resto de la web */
        backface-visibility: hidden;
    }

    .start-button {
        z-index: 100002 !important;
        margin-top: -5px !important;
        /* Usar margen en vez de top para mayor estabilidad */
        transform: translateZ(0);
    }


    .start-button img {
        width: 35px;
    }

    #task-list {
        display: none !important;
        /* Ocultar apps en la barra móvil */
    }


    #clock-tray {
        font-size: 10px;
        padding-right: 10px;
    }

    #date-text {
        display: none;
    }

    /* 7. Menú Inicio — responsivo en tablet/móvil */
    #start-menu {
        width: 92%;
        height: 80vh;
        bottom: 85px;
        left: 4%;
        border-radius: 10px;
        max-height: none;
        /* Sin límite de alto en móvil */
        touch-action: auto;
    }


    .start-body {
        flex-direction: column;
        overflow: hidden;
    }

    .start-left {
        flex: 2;
        /* Lista más grande */
        min-height: 0;
    }

    .start-right {
        width: 100%;
        flex-direction: row;
        /* Perfil + links en horizontal */
        flex-shrink: 0;
        min-height: 80px;
        max-height: 100px;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    /* Perfil horizontal en móvil */
    .user-profile {
        flex-direction: row;
        padding: 8px 14px;
        gap: 10px;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.07);
        width: 140px;
        flex-shrink: 0;
    }

    .user-avatar-frame {
        width: 40px;
        height: 40px;
    }

    .user-name-start {
        font-size: 12px;
    }

    /* Links en horizontal scrollable */
    .system-links {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px;
        overflow-y: auto;
        align-items: center;
        gap: 2px;
    }

    .system-link {
        padding: 5px 10px;
        font-size: 11px;
        white-space: nowrap;
        border-radius: 4px;
    }

    /* Items táctiles: más alto para el dedo */
    .start-item {
        padding: 10px 14px;
        min-height: 48px;
    }

    .start-item img {
        width: 28px;
        height: 28px;
    }

    /* 8. Ventanas de sistema (Config, Explorer) — responsivas */
    #popup-config,
    #popup-explorer {
        width: min(650px, 95vw);
        height: min(450px, 85vh);
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }


    /* 9. Ajuste posición Vtuber móvil (Lienzo más bajo) */
    .video-centro {
        height: 120vh !important;
        top: -10vh !important;
        transform: none !important;
    }


    .video-centro canvas,
    .video-centro video {
        /* Fuerza la nitidez en móvil */
        image-rendering: -webkit-optimize-contrast !important;
        image-rendering: crisp-edges !important;
        filter: url(#sharpen) contrast(1.04) brightness(1.03) !important;
    }

    /* BURBUJA DE TWITCH MÓVIL */
    .twitch-bubble {
        display: none;
        /* Se activa por JS */
        position: absolute;
        top: 28%;
        /* Posición aproximada sobre la cabeza */
        left: 50%;
        transform: translateX(-50%);
        background: rgba(145, 71, 255, 0.48);
        /* Twitch Purple con Glassmorphism */
        backdrop-filter: blur(5px);
        color: white;
        padding: 10px 18px;
        border-radius: 50px;
        font-weight: 800;
        font-size: 13px;
        letter-spacing: 0.5px;
        z-index: 1000;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.097);
        border: 1px solid rgba(255, 255, 255, 0.2);
        white-space: nowrap;
        animation: pulseBubble 3s ease-in-out infinite;
        cursor: pointer;
    }

    .twitch-bubble.is-live {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .live-dot {
        color: #ff4a4a;
        animation: blinkDot 1.5s infinite;
        font-size: 16px;
    }

    @keyframes pulseBubble {

        0%,
        100% {
            transform: translate(-50%, 0);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        }

        50% {
            transform: translate(-50%, -8px);
            box-shadow: 0 8px 30px rgba(145, 71, 255, 0.6);
        }
    }

    @keyframes blinkDot {

        0%,
        100% {
            opacity: 1;
            transform: scale(1);
        }

        50% {
            opacity: 0.5;
            transform: scale(0.8);
        }
    }
}


/* ANIMACIÓN DE APERTURA PREMIUM */
@keyframes windowOpen {
    0% {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Aplicación de Animación a todas las ventanas */
.popup,
.ventana-web,
.discord-popup,
.sobre-mi-popup,
#popup-arte,
#powershell-popup,
#popup-config,
#popup-explorer,
#start-menu {
    animation: windowOpen var(--anim-speed) var(--anim-curve) forwards;
    will-change: transform, opacity;
}

/* UTILERÍAS DE ESTABILIDAD */
.no-animation {
    animation: none !important;
    transition: none !important;
}

.dragging {
    cursor: move !important;
    user-select: none;
    will-change: left, top;
}

/* ====================================================
   EASTER EGG — Burbuja de diálogo del Vtuber
   ==================================================== */
#vtuber-dialogue {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(230, 0, 126, 0.45);
    border-radius: 20px;
    padding: 12px 22px;
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 600;
    z-index: 9000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 24px rgba(230, 0, 126, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05);
    opacity: 0;
}

#vtuber-dialogue::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(230, 0, 126, 0.45);
}

#vtuber-dialogue.dialogue-show {
    animation: dialoguePop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#vtuber-dialogue.dialogue-hide {
    animation: dialogueFadeOut 0.4s ease forwards;
}

@keyframes dialoguePop {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(14px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes dialogueFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
}

/* ====================================================
   UPDATES BADGE — Punto rojo de notificación
   ==================================================== */
.update-badge {
    position: absolute;
    top: 39px;
    right: 168px;
    width: 11px;
    height: 11px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    pointer-events: none;
    animation: badgePulse 2s ease-in-out infinite;
    z-index: 10;
}



@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(255, 59, 48, 0);
    }
}

/* ====================================================
   SPOTIFY WIDGET — Mini reproductor flotante
   ==================================================== */
#spotify-widget {
    position: fixed;
    bottom: 85px;
    right: 16px;
    width: 300px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.07);
    z-index: 99999;
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#spotify-widget.widget-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tray-music-btn {
    /* Reset estilos por defecto del <button> */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    outline: inherit;
    /* Estilos propios */
    cursor: pointer;
    transition: color 0.2s;
}

.tray-music-btn.playing svg {
    color: #1db954;
    filter: drop-shadow(0 0 4px rgba(29, 185, 84, 0.7));
    animation: musicNote 1.5s ease-in-out infinite;
}

@keyframes musicNote {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.15) rotate(-8deg);
    }

    75% {
        transform: scale(1.15) rotate(8deg);
    }
}

/* En móvil el widget iframe no se usa — se abre Spotify directamente */
@media screen and (max-width: 1024px) {
    #spotify-widget {
        display: none !important;
    }

    /* El icono de música en móvil se anima siempre para indicar que lleva a Spotify */
    .tray-music-btn svg {
        color: #1db954;
        filter: drop-shadow(0 0 3px rgba(29, 185, 84, 0.5));
    }
}