/* ==========================================================================
   1. VARIABLES, RESET & CONFIGURACIÓN GLOBAL
   ========================================================================== */
:root {
    --bg: #05070d;
    --card: #0f172a;
    --text: #e0f2ff;
    --accent: #7dd3fc;
    --accent2: #a78bfa;
    --green: #22c55e;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 20% 30%, #1e3a8a, transparent),
                radial-gradient(circle at 80% 70%, #581c87, transparent),
                var(--bg);
}

/* ==========================================================================
   Cursores Personalizados (Globales)
   ========================================================================== */

/* Cursor normal para toda la página */
body, 
html {
    cursor: url("assets/cursors/Wii Cursors - Normal Select.cur"), auto;
}

/* Cursor de selección para TODOS los elementos interactivos */
button,
a,
input[type="button"],
input[type="submit"],
.btn,
.pagination button,
.admin-profile-btn,
.music-btn,
#volumeSlider,
.volume-icon {
    cursor: url("assets/cursors/Wii Cursors - Link Select.cur"), pointer !important;
}

/* ==========================================================================
   Barra de desplazamiento personalizada
   ========================================================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--card);
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(180deg, var(--bg), var(--card));
    border-left: 1px solid rgba(125, 211, 252, 0.10);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), var(--accent2));
    border-radius: 8px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #a5e3ff, #b9a7ff);
}

::-webkit-scrollbar-corner {
    background: var(--bg);
}

#stars {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ==========================================================================
   2. HEADER & ELEMENTOS DE NAVEGACIÓN
   ========================================================================== */
header {
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Contenedor de Botones */
.header-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
    background: linear-gradient(180deg, rgba(8, 15, 35, 0.92) 0%, rgba(7, 12, 28, 0.88) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(125, 211, 252, 0.10);
    padding: 6px 18px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    position: relative;
}

.header-btn::-webkit-scrollbar {
    height: 0;
}

.header-actions{
    display:flex;
    align-items:center;
    gap:6px;
    flex-shrink:0;
    margin-left:auto;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
    margin-right: 4px;
}

.logo h1 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: white;
}

.logo img {
    height: 22px;
    width: auto;
    border-radius: 5px;
    object-fit: contain;
}

#buscador {
    padding: 6px 10px;
    border-radius: 8px;
    outline: none;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex: 1;
    max-width: 240px;
    flex-shrink: 1;
    transition: 0.25s;
    font-size: 12px;
}

#buscador::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#buscador:focus {
    border-color: rgba(125, 211, 252, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

/* Switch Juegos / Homebrew */
.homebrew-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-left: 8px;
    padding: 5px 9px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.homebrew-switch:hover {
    border-color: rgba(125, 211, 252, 0.30);
}

.homebrew-switch.active {
    border-color: rgba(125, 211, 252, 0.45);
    background: rgba(125, 211, 252, 0.10);
}

.homebrew-switch .hbs-input {
    display: none;
}

.homebrew-switch .hbs-track {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.14);
    position: relative;
    flex-shrink: 0;
    transition: background 0.25s ease;
}

.homebrew-switch .hbs-knob {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    position: absolute;
    top: 3px;
    left: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease;
}

.homebrew-switch .hbs-input:checked + .hbs-track {
    background: rgba(125, 211, 252, 0.50);
}

.homebrew-switch .hbs-input:checked + .hbs-track .hbs-knob {
    transform: translateX(18px);
}

.homebrew-switch .hbs-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}


.header-btn button, .music-control {
    flex-shrink: 0;
}

.header-btn button:not(.admin-profile-btn) {
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 11px;
    width: auto;
    min-width: 0;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
    white-space: nowrap;
    line-height: 1;
}

.header-btn button:not(.admin-profile-btn):hover {
    background: rgba(125, 211, 252, 0.12);
    border-color: rgba(125, 211, 252, 0.25);
    color: white;
}

.header-btn button:not(.admin-profile-btn) img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Botón Perfil de Administrador */
.admin-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s ease;
}

.admin-profile-btn img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(125, 211, 252, 0.28);
    box-shadow: 0 0 8px rgba(125, 211, 252, 0.15);
}

.admin-profile-btn span {
    display: none;
}

.admin-profile-btn:hover {
    background: rgba(125, 211, 252, 0.12);
    border-color: rgba(125, 211, 252, 0.25);
}

/* ==========================================================================
   3. CONTROL MÚSICA
   ========================================================================== */
.music-control {
    display: flex;
    align-items: center;
    gap: 6px;
    height: auto;
    padding: 0 4px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.music-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: border-color 0.2s;
}

.music-icon:hover {
    border-color: rgba(125, 211, 252, 0.4);
}

.music-title {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 70px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Submenú de playlist: aparece bajo el disco al hacer clic */
.music-playlist {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 240px;
    max-width: calc(100vw - 16px);
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: rgba(10, 15, 30, 0.97);
    border: 1px solid rgba(125, 211, 252, 0.20);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 20px rgba(125, 211, 252, 0.10);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.music-playlist.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.music-playlist .playlist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
    color: white;
    transition: all 0.18s ease;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
}

.music-playlist .playlist-item img {
    width: 31px;
    height: 31px;
    min-width: 31px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(125, 211, 252, 0.20);
    background: rgba(255, 255, 255, 0.06);
}

.music-playlist .playlist-item:hover {
    background: rgba(125, 211, 252, 0.12);
    border-color: rgba(125, 211, 252, 0.25);
}

.music-playlist .playlist-item.active {
    background: rgba(125, 211, 252, 0.16);
    border-color: rgba(125, 211, 252, 0.35);
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.10);
}

/* Barra de scroll del submenú */
.music-playlist::-webkit-scrollbar {
    width: 6px;
}

.music-playlist::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.30);
    border-radius: 3px;
}

/* Icono giratorio de la canción actual */
.music-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(125, 211, 252, 0.28);
    box-shadow: 0 0 8px rgba(125, 211, 252, 0.15);
    animation: girar 6s linear infinite;
    animation-play-state: paused;
}

.music-icon.playing {
    animation-play-state: running;
    will-change: transform;
}

/* Nombre de la canción */
.music-title {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    width: 110px;
    min-width: 110px;
    max-width: 110px;
    line-height: 1;
    user-select: none;
}

.music-title-inner {
    display: inline-block;
    white-space: nowrap;
}

/* Cuando el nombre no cabe, se desliza (marquee) solo mientras el disco gira */
.music-title.scrolling {
    text-align: left;
}

.music-title.scrolling .music-title-inner {
    animation: marquee 9s linear infinite;
    animation-play-state: paused;
}

.music-icon.playing ~ .music-title.scrolling .music-title-inner {
    animation-play-state: running;
}

@keyframes marquee {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(0); }
    50%  { transform: translateX(calc(-1 * var(--scroll-dist, 80px))); }
    70%  { transform: translateX(calc(-1 * var(--scroll-dist, 80px))); }
    100% { transform: translateX(0); }
}

@keyframes girar {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Botones del reproductor */
.music-control .music-btn,
.music-control .skip-btn {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    height: 24px;
    border-radius: 5px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.music-control .music-btn:hover,
.music-control .skip-btn:hover {
    background: rgba(125, 211, 252, 0.12);
    border-color: rgba(125, 211, 252, 0.25);
    color: white;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 1px;
    width: auto;
    flex-shrink: 0;
}

.volume-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: rgba(224, 242, 255, 0.85);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.volume-icon .vol-on,
.volume-icon .vol-off {
    transition: opacity 0.2s ease;
}

.volume-icon .vol-off {
    opacity: 0;
}

.volume-icon:hover {
    color: #8bd8ff;
    transform: scale(1.1);
}

.volume-icon.muted {
    color: rgba(255, 255, 255, 0.38);
}

.volume-icon.muted .vol-on {
    opacity: 0;
}

.volume-icon.muted .vol-off {
    opacity: 1;
}

#volumeSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    outline: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

#volumeSlider:hover {
    box-shadow: 0 0 8px rgba(125, 211, 252, 0.15);
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(125, 211, 252, 0.4);
    cursor: pointer;
    transition: transform 0.15s ease;
}

#volumeSlider::-webkit-slider-thumb:hover,
#volumeSlider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

#volumeSlider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
}

#volumeSlider::-moz-range-progress {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.55), rgba(167, 139, 250, 0.55));
}

#volumeSlider::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: 1px solid rgba(125, 211, 252, 0.60);
    border-radius: 50%;
    background: linear-gradient(180deg, #ffffff, #e8f6ff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.40);
    cursor: pointer;
    transition: transform 0.15s ease;
}

#volumeSlider::-moz-range-thumb:hover,
#volumeSlider::-moz-range-thumb:active {
    transform: scale(1.2);
}

/* ==========================================================================
   4. MODALES, LOGIN & BIENVENIDA
   ========================================================================== */
#loginBox,
#emuladoresBox,
#recursosBox,
#donacionesBox,
#descargaBox {
    display: none;
    position: fixed;
    inset: 0;
    justify-content: center;
    align-items: center;
}

#loginBox {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 10;
}

#emuladoresBox,
#recursosBox,
#donacionesBox {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 999;
}

#descargaBox {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10002;
}

/* Modal con la página de descarga (captcha) incrustada */
#captchaBox {
    display: none;
    position: fixed;
    inset: 0;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10002;
}

.captcha-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(560px, calc(100vw - 32px));
    height: min(760px, calc(100vh - 32px));
    padding: 14px;
    box-sizing: border-box;
    border-radius: 24px;
    background: #0d1424;
    border: 1px solid rgba(125, 211, 252, 0.18);
}

.captcha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-weight: 700;
}

.captcha-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.captcha-marco {
    position: relative;
    flex: 1;
    overflow: hidden;
    border-radius: 14px;
    background: #0d1424;
}

/* No se puede cambiar el estilo de la página incrustada (otro dominio), así
   que se invierte a tonos oscuros y se tiñe de azul con capas que no
   bloquean los clics. */
#captchaFrame {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    filter: invert(0.92) hue-rotate(180deg) contrast(1.05);
}

/* Tinte azul suave. No se usa mix-blend-mode: combinado con el filter del
   iframe, Chrome deja de pintar la página incrustada (se ve en blanco). */
/* Aviso mientras la página incrustada termina de cargar (tarda varios
   segundos y hasta entonces el marco se ve vacío). */
.captcha-cargando {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
    text-align: center;
    color: #7dd3fc;
    font-size: 14px;
    font-weight: 600;
    background: #0d1424;
    pointer-events: none;
}

.captcha-cargando[hidden] {
    display: none;
}

.captcha-tinte {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: #1e3a8a;
    opacity: 0.18;
}

/* Tapa la franja superior con el logotipo */
.captcha-tapa {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    pointer-events: none;
    background: #0d1424;
}

.captcha-tab {
    width: 100%;
    padding: 14px 0;
    border-radius: 14px;
    cursor: pointer;
    color: white;
    font-size: 15px;
    font-weight: 700;
    transition: all 0.25s ease;
    background: linear-gradient(180deg, rgba(110, 231, 255, 0.18) 0%, rgba(167, 139, 250, 0.16) 100%);
    border: 1px solid rgba(125, 211, 252, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.22);
}

.captcha-hosting {
    margin: 0;
    text-align: center;
    font-size: 13px;
    color: #7dd3fc;
}

.captcha-tab:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.28) 0%, rgba(167, 139, 250, 0.24) 100%);
    border: 1px solid rgba(125, 211, 252, 0.26);
    transform: translateY(-2px);
}

/* Barra de progreso del modal de descarga */
.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(125, 211, 252, 0.18);
    overflow: hidden;
    box-sizing: border-box;
}

.progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.55), rgba(167, 139, 250, 0.55));
    transition: width 0.25s ease;
}

/* Ventana recortada de VikingFile: la página carga detrás, tapada por completo
   con un botón de Luma. El clic atraviesa el botón y cae en lo que haya justo
   debajo de su centro: primero el "Download" real y, si hace falta
   verificarse, la casilla de Turnstile (ver .casilla). */
.descarga-viking {
    position: relative;
    width: 100%;
    height: 130px;
    margin: 0 0 14px;
    overflow: hidden;
    background: transparent;
}

.descarga-viking[hidden] {
    display: none;
}

#descargaVikingFrame {
    position: absolute;
    top: -180px;
    left: 0;
    width: 100%;
    height: 800px;
    border: 0;
    background: #0d1424;
    filter: invert(0.92) hue-rotate(180deg) contrast(1.05);
}

/* Desplaza la página para que la casilla de Turnstile (a la izquierda, ~7.5%
   del ancho) quede bajo el centro del botón. */
.descarga-viking.casilla #descargaVikingFrame {
    transform: translate(calc(42.5% - 2px), -3px);
}

.descarga-viking-tinte {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: #1e3a8a;
    opacity: 0.18;
}

.descarga-viking-capa {
    position: absolute;
    /* Sobresale 2px para que no asome el borde del iframe por los lados */
    inset: -2px;
    z-index: 2;
    pointer-events: none;
    /* Mismo tono que el fondo del modal para que la capa no se note */
    background: #0d1424;
}

.descarga-viking-boton {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 52%;
    height: 65px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
    pointer-events: none;
    border-radius: 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    background: linear-gradient(180deg, rgba(110, 231, 255, 0.28) 0%, rgba(167, 139, 250, 0.26) 100%);
    border: 1px solid rgba(125, 211, 252, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 8px 20px rgba(0, 0, 0, 0.28);
    transition: opacity 0.35s ease;
}

/* Mientras la página carga, el botón se atenúa y captura los clics para que
   no se pulse nada antes de tiempo. */
.descarga-viking.cargando .descarga-viking-boton {
    opacity: 0.5;
    pointer-events: auto;
    cursor: inherit;
}


#descargaBox h3 {
    margin-bottom: 6px;
    font-size: 20px;
    letter-spacing: 0.3px;
}

#descargaEstado {
    font-size: 13px;
    color: rgba(226, 232, 240, 0.72);
}

#descargaBox .progress-bar {
    height: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
}

#descargaBox .progress-fill {
    background: linear-gradient(90deg, #38bdf8, #6366f1, #a855f7);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.55);
}

.descarga-acciones {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

#descargaBox .descarga-accion {
    flex: 1;
    width: auto;
    margin: 0;
    padding: 12px 0;
    font-size: 14px;
}

#descargaBox .descarga-cancelar {
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
    box-shadow: none;
}

#descargaBox .descarga-cancelar:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.5);
}

#descargaBox .login-content {
    max-height: 92vh;
    overflow-x: hidden;
    overflow-y: auto;
}

#emuladoresBox .login-content,
#recursosBox .login-content,
#donacionesBox .login-content {
    width: min(95%, 900px);
    max-height: 85vh;
    overflow-y: auto;
}

.login-content {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(125, 211, 252, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-sizing: border-box;
    padding: 38px 30px;
    border-radius: 28px;
    width: min(92%, 410px);
    margin: auto;
    box-shadow: 0 0 25px rgba(125, 211, 252, 0.12), 0 20px 50px rgba(0, 0, 0, 0.35);
    animation: fadeIn 0.4s ease;
    text-align: center;
}

.login-content h3 {
    margin-bottom: 15px;
    font-weight: 700;
    font-size: 18px;
}

.login-content input {
    width: calc(100% - 4px);
    box-sizing: border-box;
    padding: 14px;
    margin: 10px auto;
    display: block;
    border-radius: 14px;
    outline: none;
    background: #020617;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 15px;
    transition: 0.25s;
}

.login-content input:focus {
    border: 1px solid var(--accent);
    box-shadow: 0 0 10px rgba(125, 211, 252, 0.35);
}

.login-content button {
    display: block;
    width: calc(100% - 4px);
    box-sizing: border-box;
    padding: 14px 0;
    margin: 14px auto 0 auto;
    border-radius: 14px;
    cursor: pointer;
    color: white;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    transition: all 0.25s ease;
    background: linear-gradient(180deg, rgba(110, 231, 255, 0.18) 0%, rgba(167, 139, 250, 0.16) 100%);
    border: 1px solid rgba(125, 211, 252, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.22);
}

.login-content button:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.28) 0%, rgba(167, 139, 250, 0.24) 100%);
    border: 1px solid rgba(125, 211, 252, 0.26);
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(125, 211, 252, 0.14), 0 0 24px rgba(167, 139, 250, 0.12);
}

.login-content button:active {
    transform: scale(0.985);
}

/* Perfil Administrador en Login */
.admin-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
}

.admin-profile img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(125, 211, 252, 0.35);
    box-shadow: 0 0 18px rgba(125, 211, 252, 0.22), 0 0 30px rgba(167, 139, 250, 0.12);
    margin-bottom: 14px;
}

.admin-profile h3 {
    margin: 0;
    font-size: 22px;
    color: white;
    font-weight: 700;
}

.admin-profile p {
    margin-top: 8px;
    font-size: 14px;
    color: #9fb4c7;
    text-align: center;
}

/* Pantalla de Bienvenida */
#welcomeScreen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background: linear-gradient(rgba(3,7,18,0.72), rgba(3,7,18,0.82)),
                url('assets/images/Background.jpg') center/cover no-repeat;
}

.welcome-overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.25);
}

.welcome-box {
    position: relative;
    z-index: 2;
    width: min(92%, 650px);
    padding: 40px 35px;
    text-align: center;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(125, 211, 252, 0.22);
    border-radius: 28px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 0 30px rgba(125, 211, 252, 0.15), 0 20px 60px rgba(0, 0, 0, 0.45);
    animation: welcomeFade 0.55s ease;
}

.welcome-box img {
    width: 120px;
    max-width: 40%;
    margin-bottom: 18px;
    filter: drop-shadow(0 8px 18px rgba(255, 255, 255, 0.12));
}

.welcome-box h2 {
    margin: 0 0 14px;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    color: white;
    text-shadow: 0 0 12px rgba(125, 211, 252, 0.18);
}

.welcome-box p {
    font-size: clamp(15px, 2vw, 19px);
    line-height: 1.7;
    color: #dbeafe;
    margin: 0 auto 28px auto;
    max-width: 90%;
}

.welcome-buttons {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.accept-btn {
    padding: 14px 34px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: white;
    position: relative;
    overflow: hidden;
    transition: all 0.28s ease;
    background: linear-gradient(180deg, rgba(110, 231, 255, 0.22) 0%, rgba(167, 139, 250, 0.20) 100%);
    border: 1px solid rgba(125, 211, 252, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.25);
}

.accept-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: 0.6s;
}

.accept-btn:hover::before {
    left: 130%;
}

.accept-btn:hover {
    transform: translateY(-3px) scale(1.03);
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.34) 0%, rgba(167, 139, 250, 0.30) 100%);
}

.accept-btn:active {
    transform: scale(0.98);
}

/* ==========================================================================
   5. PANEL DE CONTROL (ADMIN) & CONFIGURACIONES
   ========================================================================== */
#adminPanel {
    --ap-border: rgba(255, 255, 255, 0.08);
    --ap-surface: rgba(255, 255, 255, 0.035);
    --ap-field: rgba(2, 6, 18, 0.55);
    --ap-accent: #7dd3fc;
    --ap-accent2: #a78bfa;

    display: none;
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 14px auto 6px;
    width: calc(100% - 28px);
    box-sizing: border-box;
    padding: 22px 24px 26px;
    border-radius: 20px;
    border: 1px solid var(--ap-border);
    background:
        radial-gradient(900px 260px at 0% 0%, rgba(125, 211, 252, 0.08), transparent 70%),
        radial-gradient(700px 260px at 100% 0%, rgba(167, 139, 250, 0.09), transparent 70%),
        rgba(10, 15, 30, 0.88);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}
#adminPanel.open {
    opacity: 1;
    transform: translateY(0);
}

/* ----- Cabecera ----- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ap-border);
}
.admin-header-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.admin-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #fff;
}
.admin-header h3 i {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 15px;
    color: #06101f;
    background: linear-gradient(135deg, var(--ap-accent), var(--ap-accent2));
    box-shadow: 0 6px 18px -4px rgba(125, 211, 252, 0.5);
}
.admin-header-sub {
    margin: 0 0 0 48px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
}
.admin-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.10);
    border: 1px solid rgba(34, 197, 94, 0.28);
    font-size: 12px;
    font-weight: 700;
    color: #4ade80;
    max-width: 50%;
}
.admin-mode #adminModeText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-mode.editing {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.32);
    color: #fbbf24;
}
.mode-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 currentColor;
    animation: pulso 2s ease-out infinite;
}
@keyframes pulso {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ----- Cuerpo ----- */
.admin-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.admin-section {
    background: var(--ap-surface);
    border: 1px solid var(--ap-border);
    border-radius: 16px;
    padding: 18px;
    transition: border-color 0.2s;
}
.admin-section:hover,
.admin-section:focus-within {
    border-color: rgba(125, 211, 252, 0.22);
}
.admin-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
}
.admin-section h4 i {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 11px;
    color: var(--ap-accent);
    background: rgba(125, 211, 252, 0.10);
    border: 1px solid rgba(125, 211, 252, 0.18);
}
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.admin-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}
.admin-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.admin-field.full {
    grid-column: 1 / -1;
}
.admin-field label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.55);
}

/* ----- Campos ----- */
.admin-field input[type="text"],
.admin-field textarea,
#adminSearch,
.boton-fila select,
.boton-fila input[type="text"],
.boton-fila textarea,
.boton-agregar select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--ap-border);
    background: var(--ap-field);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.admin-field input::placeholder,
.admin-field textarea::placeholder,
#adminSearch::placeholder,
.boton-fila input::placeholder,
.boton-fila textarea::placeholder {
    color: rgba(255, 255, 255, 0.28);
}
.admin-field input[type="text"]:hover,
.admin-field textarea:hover,
#adminSearch:hover {
    border-color: rgba(255, 255, 255, 0.16);
}
.admin-field input[type="text"]:focus,
.admin-field textarea:focus,
#adminSearch:focus,
.boton-fila select:focus,
.boton-fila input[type="text"]:focus,
.boton-fila textarea:focus,
.boton-agregar select:focus {
    border-color: rgba(125, 211, 252, 0.6);
    background: rgba(2, 6, 18, 0.8);
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.14);
}
.admin-field textarea {
    resize: vertical;
    min-height: 64px;
    line-height: 1.4;
}

/* ----- Casilla Homebrew ----- */
.admin-field .admin-homebrew-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 12px;
    background: rgba(167, 139, 250, 0.07);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.admin-field .admin-homebrew-label:hover {
    background: rgba(167, 139, 250, 0.13);
    border-color: rgba(167, 139, 250, 0.5);
}
.admin-field .admin-homebrew-label i {
    color: var(--ap-accent2);
}
.admin-field .admin-homebrew-label small {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
}
.admin-field .admin-homebrew-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #8b5cf6;
    cursor: pointer;
}
.hb-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
    line-height: 14px;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 999px;
    vertical-align: middle;
}

/* ----- Barra de acciones ----- */
.admin-actions-bar {
    display: flex;
    gap: 10px;
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--ap-border);
    background: rgba(8, 13, 28, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, 0.6);
}
.admin-actions-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
#btnGuardar {
    flex: 1;
    color: #06101f;
    background: linear-gradient(135deg, var(--ap-accent), var(--ap-accent2));
    box-shadow: 0 8px 22px -8px rgba(125, 211, 252, 0.6);
}
#btnGuardar.editando {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    box-shadow: 0 8px 22px -8px rgba(249, 115, 22, 0.6);
}
#btnCancelar {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.28);
}
.admin-actions-bar button:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}
.admin-actions-bar button:active {
    transform: translateY(0);
}
.admin-actions-bar button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

/* ----- Lista de publicaciones ----- */
.admin-list {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--ap-surface);
    border: 1px solid var(--ap-border);
    border-radius: 16px;
    padding: 16px;
}
.admin-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.admin-list h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.admin-list h4 i {
    color: var(--ap-accent);
    font-size: 13px;
}
.admin-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(125, 211, 252, 0.12);
    border: 1px solid rgba(125, 211, 252, 0.25);
    color: var(--ap-accent);
    font-size: 11px;
    font-weight: 700;
}
.admin-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.admin-search-wrap i {
    position: absolute;
    left: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}
#adminSearch {
    padding-left: 34px;
}
.admin-empty {
    margin: 14px 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
}
.admin-game-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 560px;
    overflow-y: auto;
    padding-right: 4px;
}
.admin-game-list::-webkit-scrollbar { width: 5px; }
.admin-game-list::-webkit-scrollbar-track { background: transparent; }
.admin-game-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }
.admin-game-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.admin-game-item:hover {
    background: rgba(125, 211, 252, 0.07);
    border-color: rgba(125, 211, 252, 0.2);
}
.admin-game-item img {
    width: 34px;
    height: 46px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.admin-game-item-info {
    flex: 1;
    min-width: 0;
}
.admin-game-item-info span {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-game-item-info small {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.4);
}
.admin-game-item .btn-edit,
.admin-game-item .btn-delete {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid var(--ap-border);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.admin-game-item .btn-edit:hover {
    background: rgba(125, 211, 252, 0.16);
    border-color: rgba(125, 211, 252, 0.35);
    color: #fff;
}
.admin-game-item .btn-delete:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}
.admin-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

/* ----- Editor de botones de publicación ----- */
.boton-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.boton-fila {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--ap-border);
    border-left: 4px solid var(--c, #1565c0);
    background: rgba(0, 0, 0, 0.2);
}
.boton-fila .bf-icono {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: var(--c, #7dd3fc);
}
.boton-fila .bf-tipo { flex: 0 0 140px; width: auto; }
.boton-fila .bf-url { flex: 1 1 180px; min-width: 0; width: auto; }
.boton-fila .bf-texto { flex: 1 1 100%; display: none; }
.boton-fila.es-otro .bf-texto { display: block; }
/* Tipo "Partes": la URL única se sustituye por la lista de partes */
.boton-fila .bf-partes { flex: 1 1 100%; display: none; resize: vertical; font-family: inherit; }
.boton-fila.es-partes .bf-partes { display: block; }
.boton-fila.es-partes .bf-url { visibility: hidden; }
.boton-fila select option,
.boton-agregar select option { background: #0b1226; }
.boton-fila .bf-color {
    width: 38px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--ap-border);
    border-radius: 10px;
    background: var(--ap-field);
    cursor: pointer;
}
.boton-fila .bf-acciones {
    display: flex;
    gap: 4px;
}
.boton-fila .bf-acciones button {
    width: 32px;
    height: 38px;
    padding: 0;
    border-radius: 9px;
    border: 1px solid var(--ap-border);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}
.boton-fila .bf-acciones button:hover { background: rgba(125, 211, 252, 0.16); }
.boton-fila .bf-acciones button[data-op="borrar"]:hover { background: rgba(239, 68, 68, 0.3); }
.boton-fila .bf-paleta {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-top: 2px;
}
.boton-fila .bf-paleta button {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.boton-fila .bf-paleta button:hover {
    transform: scale(1.18);
    border-color: #fff;
}
.boton-agregar {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.boton-agregar select { flex: 0 0 160px; width: auto; }
.boton-agregar button {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(125, 211, 252, 0.45);
    background: rgba(125, 211, 252, 0.07);
    color: var(--ap-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.boton-agregar button:hover { background: rgba(125, 211, 252, 0.15); }

/* ==========================================================================
   6. GRID DE LA TIENDA & TARJETAS (CARDS)
   ========================================================================== */
.store {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 14px 20px 4px;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* ===== SOLO LA TIENDA PRINCIPAL (ajustada por resolución) ===== */

#store {
    grid-template-columns: repeat(14, 1fr); /* 4K > 2560 */
}

@media (max-width: 2560px) {
    #store { grid-template-columns: repeat(10, 1fr); } /* 2K */
}

@media (max-width: 1920px) {
    #store { grid-template-columns: repeat(8, 1fr); } /* 1440p */
}

@media (max-width: 1600px) {
    #store { grid-template-columns: repeat(7, 1fr); } /* 1080p */
}

@media (max-width: 1280px) {
    #store { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 1080px) {
    #store { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    #store { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
    #store { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 450px) {
    #store { grid-template-columns: repeat(1, 144px); }
}

.store.page-transition {
    opacity: 0;
    transform: translateY(18px);
}

.card {
    position: relative;
    background: transparent;
    border-radius: 14px;
    overflow: hidden;
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.card img {
    width: 90.3%;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

/* Capa de contenido por defecto de las tarjetas estándar */
.card .content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    background: linear-gradient(to top, rgba(3,7,18,0.92) 0%, rgba(3,7,18,0.55) 35%, transparent 70%);
    opacity: 0;
    transition: 0.3s;
    border-radius: 14px;
    overflow: hidden;
}

.card:hover .content {
    opacity: 1;
}

.info-overlay h3 {
    font-size: 14px;
    margin: 0 0 4px 0;
    line-height: 1.3;
    color: white;
}

.info-overlay p {
    font-size: 12px;
    color: #cbd5e1;
    margin: 0 0 10px 0;
    line-height: 1.35;
}

.btns {
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
}

.card:hover .btns {
    opacity: 1;
    transform: translateY(0);
}

.btn {
    flex: 1;
    padding: 7px;
    font-size: 12px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    background: linear-gradient(180deg, rgba(110, 231, 255, 0.18) 0%, rgba(167, 139, 250, 0.16) 100%);
    border: 1px solid rgba(125, 211, 252, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 10px rgba(0, 0, 0, 0.16);
}

.btn:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.28) 0%, rgba(167, 139, 250, 0.24) 100%);
}

/* ==========================================================================
   7. TARJETAS ESPECIALES (EMULADORES Y RECURSOS)
   ========================================================================== */
#emuladoresStore .card, #recursosStore .card {
    display: flex;
    flex-direction: column;
    background: #0f172a;
    border-radius: 18px;
    overflow: hidden;
    transition: .25s;
    border: 1px solid rgba(125, 211, 252, .08);
}

#emuladoresStore .card:hover, #recursosStore .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .35), 0 0 20px rgba(125, 211, 252, .18);
}

#emuladoresStore .card img, #recursosStore .card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    transition: .25s;
}

#emuladoresStore .card:hover img, #recursosStore .card:hover img {
    transform: scale(1.04);
}

#emuladoresStore .content, #recursosStore .content {
    position: static;
    opacity: 1;
    background: none;
    padding: 14px;
    border-radius: 0;
    overflow: visible;
}

#emuladoresStore, #recursosStore {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 10px 0;
}

#emuladoresStore .info-overlay h3, #recursosStore .info-overlay h3 {
    font-size: 15px;
    margin-bottom: 8px;
}

#emuladoresStore .info-overlay p, #recursosStore .info-overlay p {
    font-size: 12px;
    color: #b8c5d6;
    margin-bottom: 14px;
}

#emuladoresStore .btns, #recursosStore .btns {
    display: flex;
    gap: 8px;
    opacity: 1;
    transform: none;
}

#emuladoresStore .btn, #recursosStore .btn {
    flex: 1;
    padding: 9px;
    font-size: 12px;
    border-radius: 10px;
}

/* ==========================================================================
   8. PAGINACIÓN
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 2px 25px 6px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.pagination button {
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    color: white;
    transition: 0.25s;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.pagination button:hover {
    transform: translateY(-1px);
    background: rgba(125, 211, 252, 0.12);
    border-color: rgba(125, 211, 252, 0.25);
}

.pagination button.active {
    background: rgba(125, 211, 252, 0.20);
    border-color: rgba(125, 211, 252, 0.35);
}

.pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ==========================================================================
   9. ANIMACIONES
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   FIX RESPONSIVE (MÓVILES, TABLETS Y MONITORES PEQUEÑOS)
   ========================================================================== */

@media (max-width: 1200px) {
    header {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 15px !important;
        height: auto !important;
    }

    .logo {
        width: 100% !important;
        justify-content: center !important;
    }

    #buscador {
        order: 2 !important;
        width: 100% !important;
        max-width: 350px !important;
        margin: 0 auto !important;
    }

    .header-btn {
        order: 3 !important;
        width: 100% !important;
        margin-left: 0 !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        overflow: visible !important;
        gap: 10px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        padding: 10px !important;
        border-radius: 14px !important;
    }
}

/* El reproductor no cabe arriba en pantallas medianas/estrechas:
   adelanta el salto a la barra flotante inferior (como Android). */
@media (max-width: 1100px) {
    /* Sin blur/filtro/transform en el header para que la barra flotante
       pueda anclarse a la pantalla (position: fixed) y no al header */
    header,
    .header-btn {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        filter: none !important;
        transform: none !important;
    }
    header {
        z-index: auto !important;
    }

    /* Espacio abajo para no tapar el contenido con la barra flotante */
    body {
        padding-bottom: 90px !important;
    }

    /* Los toasts suben para no tapar la barra flotante inferior */
    #toastContainer {
        bottom: 80px !important;
        right: 10px !important;
        left: 10px !important;
    }

    /* Barra flotante del reproductor en la parte inferior, compacta y centrada */
    .music-control {
        display: flex !important;
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        bottom: 12px !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        z-index: 2000 !important;
        width: auto !important;
        max-width: min(600px, calc(100vw - 24px)) !important;
        min-width: 0 !important;
        margin: 0 auto !important;
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
        padding: 10px 18px !important;
        background: rgba(10, 15, 30, 0.92) !important;
        border: 1px solid rgba(125, 211, 252, 0.20) !important;
        border-radius: 18px !important;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }
}

/* Icono de usuario: en pantallas medianas (769-1100px) queda al lado
   de la barra de búsqueda, en la misma fila, dentro del header. */
@media (max-width: 1100px) and (min-width: 769px) {
    .header-btn {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 12px 10px !important;
    }

    /* Hace que los botones del header-actions se integren al header-btn */
    .header-actions {
        display: contents !important;
    }

    /* Fila del buscador: se une con el icono de usuario a su lado */
    .header-btn #buscador {
        order: 2 !important;
        width: auto !important;
        max-width: none !important;
        flex: 1 1 auto !important;
        margin: 0 !important;
    }

    /* Switch Juegos / Homebrew a la derecha del buscador */
    .homebrew-switch {
        order: 2 !important;
        margin-left: 8px !important;
    }

    .header-actions .admin-profile-btn {
        order: 3 !important;
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        flex: 0 0 auto !important;
        margin: 0 0 0 6px !important;
        flex-direction: row !important;
        gap: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .header-actions .admin-profile-btn span {
        display: none !important;
    }

    /* El resto de botones de acciones van después, en su propia fila */
    .header-actions > button:not(.admin-profile-btn) {
        order: 4 !important;
    }
}

@media (max-width: 768px) {
    /*Ajustes para que las tarjetas de la tienda no se rompan en tablets */
    .store {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        padding: 12px !important;
    }

    /* Header móvil: logo + botones 2x2 + perfil
       (el reproductor es una barra flotante abajo) */
    .header-btn {
        position: relative !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 420px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 10px 10px !important;
        background: linear-gradient(180deg, rgba(8, 15, 35, 0.92) 0%, rgba(7, 12, 28, 0.88) 100%) !important;
        border-radius: 16px !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: 1px solid rgba(125, 211, 252, 0.10) !important;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35) !important;
    }

    /* Ocultar botón panel en el header móvil */
    #panelToggleBtn {
        display: none !important;
    }

    /* Buscador debajo de los botones en Android */
    #buscador {
        order: 10 !important;
        width: auto !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
        margin: 8px 0 0 !important;
        display: block !important;
        font-size: 14px !important;
        padding: 10px 14px !important;
        border-radius: 12px !important;
    }

    /* Switch Juegos / Homebrew a la derecha del buscador en Android */
    .homebrew-switch {
        order: 10 !important;
        margin: 8px 0 0 8px !important;
        flex-shrink: 0 !important;
    }

    /* Logo pequeño */
    .logo {
        flex-shrink: 0;
    }

    .header-actions {
        display: grid !important;
        grid-template-columns: auto auto auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 6.8px 5.8px !important;
        margin: 0 auto !important;
    }
    .header-actions > button:not(.admin-profile-btn):not(#logoutBtn) {
        width: 101px !important;
        min-width: 101px !important;
        height: 38px !important;
        font-size: 12px !important;
        padding: 5px 7px !important;
        justify-self: center !important;
        align-self: center !important;
    }
    .header-actions > button:nth-child(1) { grid-row: 1 !important; grid-column: 1 !important; }
    .header-actions > button:nth-child(2) { grid-row: 1 !important; grid-column: 2 !important; }
    .header-actions > button:nth-child(3) { grid-row: 2 !important; grid-column: 1 !important; }
    .header-actions > button:nth-child(4) { grid-row: 2 !important; grid-column: 2 !important; }
    .header-actions > button:nth-child(5) { grid-row: 3 !important; grid-column: 1 !important; }
    .header-actions > button:nth-child(6) { grid-row: 3 !important; grid-column: 2 !important; }

    /* Perfil al lado de la 2x3, tamaño original (60px) */
    .header-actions .admin-profile-btn {
        order: 2 !important;
        grid-row: 1 / span 3 !important;
        grid-column: 3 !important;
        justify-self: center !important;
        align-self: stretch !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: auto !important;
        aspect-ratio: 1 / 1 !important;
        height: auto !important;
        border-radius: 14px !important;
        padding: 10px 16px !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 4px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(125, 211, 252, 0.20) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0, 0, 0, 0.18) !important;
    }

    .header-actions .admin-profile-btn:hover {
        transform: scale(1.05) !important;
    }

    .header-actions .admin-profile-btn img {
        width: 68px !important;
        height: 68px !important;
        margin-bottom: 0 !important;
        border: 2px solid rgba(125, 211, 252, 0.40) !important;
        box-shadow: 0 0 14px rgba(125, 211, 252, 0.30) !important;
    }

    .header-actions .admin-profile-btn span {
        display: block !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: white !important;
        line-height: 1 !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
    }

    #logoutBtn {
        display: none !important;
    }

    #volumeSlider {
        width: 70px !important;
        min-width: 70px !important;
    }
}

@media (max-width: 520px) {
    header {
        padding: 12px 8px !important;
    }

    .logo h1 {
        font-size: 19px !important;
        gap: 6px !important;
    }

    .logo img {
        height: 26px !important;
    }

    /* Forzar que las ventanas modales de login/recursos queden legibles en celular */
    .login-content {
        width: 95% !important;
        padding: 20px 15px !important;
    }
    .admin-body {
        grid-template-columns: 1fr !important;
    }
    .admin-grid.cols-3 {
        grid-template-columns: 1fr 1fr !important;
    }
    .admin-game-list {
        max-height: 250px;
    }
    #adminPanel {
        width: calc(100% - 16px);
        margin-top: 8px;
        padding: 16px 14px 18px;
        border-radius: 16px;
    }
    .admin-list {
        position: static;
    }
    .admin-header-sub {
        margin-left: 0;
    }
    .admin-mode {
        max-width: 45%;
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .boton-fila .bf-tipo,
    .boton-fila .bf-url {
        flex: 1 1 100%;
    }
}

.donate-container{
    display: flex;
    justify-content: center;
    margin: 18px 0;
}

.donate-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: auto;
    min-width: 150px;
    padding: 12px 24px;

    background: linear-gradient(135deg, #1e3a5f, #2b2848);
    color: #fff;

    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;

    font-size: 15px;
    font-weight: 700;
    text-decoration: none;

    cursor: pointer;
    transition: .25s ease;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.08),
        0 8px 20px rgba(0,0,0,.30);
}

.donate-btn:hover{
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.12),
        0 12px 28px rgba(0,0,0,.40);
}

.donate-btn:active{
    transform: scale(.97);
}

.donate-btn .heart{
    font-size: 17px;
}

/* ==========================================================================
   MODAL PREVIEW JUEGO
   ========================================================================== */
#previewBox{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.85);
    z-index:3000;
    justify-content:center;
    align-items:center;
    padding:20px;
}

.preview-content{
    background:linear-gradient(145deg,#0f172a,#1a1a3e);
    border:1px solid rgba(125,211,252,.2);
    border-radius:16px;
    /* 15% más ancha que la original (950px); en alto se usa todo el espacio
       disponible, ya que 90vh + 15% no cabe en la pantalla */
    max-width:1093px;
    width:100%;
    height:calc(100vh - 40px);
    position:relative;
    overflow-y:auto;
}

.preview-close{
    position:absolute;
    top:10px;
    right:14px;
    background:none;
    border:none;
    color:var(--text);
    font-size:20px;
    cursor:pointer;
    z-index:10;
    opacity:.6;
    transition:opacity .2s;
}

.preview-close:hover{
    opacity:1;
}

/* Grid: portada izquierda + info derecha */
.preview-grid{
    display:grid;
    grid-template-columns:280px 1fr;
    gap:24px;
    padding:24px;
    align-items:start;
    /* El contenido mantiene su tamaño original aunque la ventana sea más grande */
    max-width:950px;
    box-sizing:border-box;
    margin:0 auto;
}

.preview-cover{
    display:flex;
    flex-direction:column;
    gap:12px;
    align-items:stretch;
}

.preview-cover img{
    width:100%;
    border-radius:12px;
    border:2px solid rgba(125,211,252,.25);
    background:#0a0f1e;
}

/* Info del archivo */
.preview-file-info{
    display:flex;
    flex-direction:column;
    gap:4px;
    font-size:11px;
    color:rgba(224,242,255,.7);
}

.preview-file-info .fi{
    display:flex;
    gap:6px;
}

.preview-file-info .fi b{
    color:rgba(125,211,252,.9);
    white-space:nowrap;
}

/* Info derecha */
.preview-info{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.preview-title{
    font-size:24px;
    margin:0;
    line-height:1.2;
}

/* Meta tags */
.preview-meta{
    display:flex;
    justify-content:space-between;
    font-size:12px;
    border:1px solid var(--border);
    border-radius:8px;
    padding:12px 16px;
    background:rgba(0,0,0,.2);
    text-align:center;
}

.preview-meta .fi-col{
    display:flex;
    flex-direction:column;
    gap:4px;
    flex:1;
}

.preview-meta .label{
    color:rgba(125,211,252,.85);
    font-weight:600;
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:.4px;
}

.preview-meta .value{
    color:rgba(224,242,255,.9);
    font-size:13px;
    font-weight:700;
}

.preview-meta .value.gold{
    color:#facc15;
}

/* Descripción */
.preview-desc{
    font-size:13px;
    color:rgba(224,242,255,.7);
    margin:0;
    line-height:1.5;
}

/* Main preview (imagen grande o video) */
.preview-main{
    width:100%;
    aspect-ratio:16/9;
    border-radius:10px;
    overflow:hidden;
    background:#000;
    border:1px solid var(--border);
}

.preview-main img,
.preview-main iframe{
    width:100%;
    height:100%;
    object-fit:contain;
    border:none;
    display:block;
}

/* Thumbnails */
.preview-thumbs{
    display:flex;
    gap:8px;
    overflow-x:visible;
}

.preview-thumbs .thumb{
    width:144px;
    height:82px;
    object-fit:cover;
    border-radius:6px;
    border:2px solid var(--border);
    flex-shrink:0;
    cursor:pointer;
    opacity:.5;
    transition:border-color .2s, opacity .2s;
}

.preview-thumbs .thumb:hover{
    opacity:.8;
}

.preview-thumbs .thumb.active{
    border-color:var(--accent);
    opacity:1;
}

.preview-thumbs .thumb-video{
    position:relative;
    background:#000;
}

.preview-thumbs .thumb-video img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.preview-thumbs .thumb-video .play-icon{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.4);
    justify-content:center;
    align-items:center;
    display:flex;
}

.preview-thumbs .thumb-video .play-icon::before{
    content:"";
    filter:drop-shadow(0 1px 4px #0009);
    border-top:8px solid transparent;
    border-bottom:8px solid transparent;
    border-left:12px solid #fff;
}

/* Botones debajo de la portada */
.preview-links{
    display:flex;
    flex-direction:row;
    flex-wrap:wrap;
    gap:8px;
}

.preview-links .btn{
    flex:1 1 calc(50% - 8px);
    min-width:110px;
    padding:9px 12px;
    border-radius:8px;
    font-size:13px;
    font-weight:700;
    cursor:pointer;
    border:none;
    color:#fff;
    text-align:center;
    transition:filter .2s;
}

.preview-links .btn:hover{
    filter:brightness(1.15);
}

/* Botón "Partes": el contenedor ocupa el hueco de un botón normal y al
   abrirse pasa a ancho completo con la lista de partes debajo. */
.preview-links .btn-partes{
    display:flex;
    flex-direction:column;
    gap:6px;
    padding:0;
    background:none;
    cursor:default;
}

.preview-links .btn-partes:hover{
    filter:none;
}

.preview-links .btn-partes.abierto{
    flex-basis:100%;
}

.btn-partes-toggle,
.btn-parte{
    width:100%;
    padding:9px 12px;
    border:none;
    border-radius:8px;
    font:inherit;
    font-weight:700;
    text-align:center;
    transition:filter .2s;
}

.btn-partes-toggle:hover,
.btn-parte:hover{
    filter:brightness(1.15);
}

.btn-partes-flecha{
    margin:0 0 0 6px !important;
    font-size:11px;
    transition:transform .2s;
}

.btn-partes.abierto .btn-partes-flecha{
    transform:rotate(180deg);
}

.btn-partes-lista{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(120px, 1fr));
    gap:6px;
    animation:fadeIn .2s ease;
}

.btn-partes-lista[hidden]{
    display:none;
}

.btn-parte{
    opacity:.9;
    font-size:12px;
}

.btn-parte i{ margin-right:4px; }

/* Con 3 botones, uno por fila en vez de 2 arriba y 1 abajo */
.preview-links:has(> .btn:nth-child(3):last-child) .btn{
    flex-basis:100%;
}


/* ==========================================================================
   10. CARRITO DE COMPRAS
   ========================================================================== */

.cart-btn-header {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.15) 100%) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: #10b981 !important;
    font-weight: bold;
}

.cart-badge {
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    min-width: 18px;
    text-align: center;
    line-height: 16px;
}

.btn.blue.cart-add-btn {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.btn.green.cart-add-btn {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

#cartBox, #purchaseSuccessBox {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.cart-content {
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.cart-item-img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.cart-item span {
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    margin-right: 10px;
    text-align: left;
}

.cart-item button {
    background: transparent !important;
    border: none !important;
    color: #ef4444 !important;
    cursor: pointer !important;
    font-size: 18px !important;
    padding: 5px 10px !important;
    width: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.cart-item button:hover {
    transform: scale(1.1) !important;
    background: transparent !important;
    box-shadow: none !important;
}

.cart-total {
    font-size: 18px;
    font-weight: bold;
    text-align: right;
    margin-bottom: 15px;
    color: #e2e8f0;
}

.cart-total span {
    color: #10b981;
}

.checkout-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    font-weight: bold !important;
    font-size: 16px !important;
    padding: 12px !important;
}

.checkout-btn:disabled {
    background: #475569 !important;
    cursor: not-allowed;
    opacity: 0.5;
}

.cart-close-btn {
    width: 100%;
    margin-top: 10px;
}

/* --- SUCCESS MODAL --- */
.success-content {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(125, 211, 252, 0.2);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 90%;
    width: 450px;
}

.success-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: floatIcon 2s ease-in-out infinite;
    color: #10b981;
}

.success-content h2 {
    color: #10b981;
    margin-bottom: 10px;
    font-size: 24px;
}

.success-content p {
    color: #cbd5e1;
    margin-bottom: 20px;
}

.success-downloads {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.download-link-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border: none !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    color: white !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.download-link-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

.success-close-btn {
    background: transparent !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 10px 25px !important;
    border-radius: 12px !important;
    color: #fff !important;
    cursor: pointer;
    font-weight: bold !important;
    transition: all 0.2s !important;
    width: 100%;
}

.success-close-btn:hover {
    background: rgba(255,255,255,0.1) !important;
}

.download-all-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
    border: none !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 15px !important;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 10px;
}

.download-all-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4) !important;
}

/* --- TOAST --- */
#toastContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(167, 139, 250, 0.4);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-in 2.7s forwards;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes slideInRight {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10px); }
}

@media (max-width: 768px) {
    /* ===== PREVIEW MODAL ANDROID ===== */
    #previewBox {
        padding: 8px;
    }

    .preview-content {
        height: auto;
        max-height: 85vh;
        border-radius: 12px;
    }

    .preview-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 14px;
    }

    .preview-grid {
        display: flex !important;
        flex-direction: column !important;
    }

    .preview-info {
        order: 1 !important;
    }

    .preview-cover {
        order: 2 !important;
    }

    .preview-cover img {
        display: none !important;
    }

    .preview-title {
        font-size: 17px;
    }

    .preview-desc {
        font-size: 12px;
        line-height: 1.4;
    }

    .preview-main {
        aspect-ratio: 16/9;
        max-height: 180px;
    }

    .preview-thumbs {
        gap: 6px;
        overflow-x: hidden;
        padding-bottom: 4px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .preview-thumbs .thumb {
        width: 80px;
        height: 46px;
    }

    .preview-meta {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
        font-size: 11px;
    }

    .preview-meta .fi-col {
        min-width: 60px;
    }

    .preview-meta .label {
        font-size: 9px;
    }

    .preview-meta .value {
        font-size: 11px;
    }

    .preview-file-info {
        font-size: 10px;
    }

    .preview-links .btn {
        padding: 9px 12px;
        font-size: 12px;
    }
}

.preview-links .btn i { margin-right: 4px; }

/* Selector de tema del encabezado (sustituye al interruptor Juegos/Homebrew) */
.tema-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 0 4px 0 10px;
    height: 28px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
}

.tema-selector:hover,
.tema-selector:focus-within {
    border-color: rgba(125, 211, 252, 0.30);
}

.tema-selector select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    padding: 0 18px 0 0;
    cursor: url("assets/cursors/Wii Cursors - Link Select.cur"), pointer;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: right 7px center, right 3px center;
    background-size: 4px 4px;
    background-repeat: no-repeat;
}

.tema-selector select option {
    background: #0b1226;
    color: #fff;
}

@media (max-width: 768px) {
    .tema-selector {
        order: 10;
        margin: 8px 0 0 8px;
        height: 38px;
    }
}

/* ==========================================================================
   ANIMACIONES GENERALES
   Sirven para todos los temas. Las animaciones de entrada usan
   "animation-fill-mode: backwards" para no fijar el transform final y no
   pisar los efectos de hover de las tarjetas. Si el sistema pide reducir el
   movimiento, se desactivan (ver el final de la sección).
   ========================================================================== */
@keyframes lumaAparecerArriba {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

@keyframes lumaFundido {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes lumaVentana {
    0%   { opacity: 0; transform: translateY(18px) scale(0.94); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: none; }
}

@keyframes lumaBajar {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: none; }
}

@keyframes lumaLatido {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Encabezado: baja al cargar la página */
.header-btn {
    animation: lumaBajar 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

/* Tarjetas: entran una detrás de otra al cargar y al cambiar de página */
.store > .card {
    animation: lumaAparecerArriba 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.store > .card:nth-child(1)  { animation-delay: 0.02s; }
.store > .card:nth-child(2)  { animation-delay: 0.05s; }
.store > .card:nth-child(3)  { animation-delay: 0.08s; }
.store > .card:nth-child(4)  { animation-delay: 0.11s; }
.store > .card:nth-child(5)  { animation-delay: 0.14s; }
.store > .card:nth-child(6)  { animation-delay: 0.17s; }
.store > .card:nth-child(7)  { animation-delay: 0.20s; }
.store > .card:nth-child(8)  { animation-delay: 0.23s; }
.store > .card:nth-child(9)  { animation-delay: 0.26s; }
.store > .card:nth-child(10) { animation-delay: 0.29s; }
.store > .card:nth-child(11) { animation-delay: 0.32s; }
.store > .card:nth-child(12) { animation-delay: 0.35s; }
.store > .card:nth-child(n+13) { animation-delay: 0.38s; }

/* Portadas: leve zoom al pasar el ratón */
.card img {
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#store .card:hover img {
    transform: scale(1.03);
}

/* Fondos oscurecidos de las ventanas: aparecen con un fundido */
#loginBox,
#emuladoresBox,
#recursosBox,
#donacionesBox,
#descargaBox,
#captchaBox,
#cartBox,
#purchaseSuccessBox,
#previewBox {
    animation: lumaFundido 0.25s ease backwards;
}

/* Ventanas: entran con un pequeño rebote */
.login-content,
.preview-content,
.captcha-content,
.cart-content,
.success-content {
    animation: lumaVentana 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

/* Contenido de la ficha: aparece en cascada */
.preview-cover,
.preview-title,
.preview-desc,
.preview-main,
.preview-thumbs,
.preview-meta {
    animation: lumaAparecerArriba 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.preview-cover  { animation-delay: 0.08s; }
.preview-title  { animation-delay: 0.12s; }
.preview-desc   { animation-delay: 0.16s; }
.preview-main   { animation-delay: 0.20s; }
.preview-thumbs { animation-delay: 0.24s; }
.preview-meta   { animation-delay: 0.28s; }

/* Botones: se hunden un poco al pulsarlos */
button,
.btn {
    transition-property: background, border-color, box-shadow, color, filter, transform, opacity;
    transition-duration: 0.18s;
}

button:active,
.btn:active {
    transform: scale(0.96);
}

/* Miniaturas de la ficha */
.preview-thumbs .thumb {
    transition: transform 0.2s ease, border-color 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.preview-thumbs .thumb:hover {
    transform: translateY(-2px);
}

/* Contador del carrito: late cuando cambia (script.js añade .latido) */
.cart-badge.latido {
    animation: lumaLatido 0.4s ease;
}

/* Menú desplegable de "Partes" */
.btn-partes-lista:not([hidden]) {
    animation: lumaAparecerArriba 0.25s ease backwards;
}

/* Quien pide menos movimiento en su sistema no ve animaciones */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   BUSCADOR Y LOGO
   Lupa dibujada (en lugar del emoji, que cambia según el sistema) y logo
   mejor alineado. La lupa va en propiedades sueltas con !important porque
   los temas cambian el fondo del buscador con "background", que la borraría.
   ========================================================================== */
#buscador {
    padding-left: 34px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a96a3' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 20 20'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 12px center !important;
    background-size: 15px 15px !important;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, max-width 0.25s ease;
}

/* Al escribir, el buscador gana algo de ancho en escritorio */
@media (min-width: 1201px) {
    #buscador:focus {
        max-width: 320px;
    }
}

/* Botón nativo de borrar (aparece al escribir) más discreto */
#buscador::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a96a3' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / 12px no-repeat;
    opacity: 0.8;
}

#buscador::-webkit-search-cancel-button:hover {
    opacity: 1;
}

/* Logo: icono y texto alineados y con un poco más de presencia */
.logo h1 {
    gap: 8px;
    letter-spacing: 0.2px;
    line-height: 1;
}

.logo img {
    height: 26px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.logo:hover img {
    transform: rotate(-12deg) scale(1.08);
}

/* ==========================================================================
   MENÚ DE TEMAS
   Botón y lista propios (los crea script.js a partir del <select>, que se
   oculta). Los colores salen de variables con valores oscuros por defecto;
   los temas claros los redefinen (--menu-*).
   ========================================================================== */
.tema-selector.con-menu {
    position: relative;
    padding: 0 0 0 10px;
}

.tema-selector.con-menu select {
    display: none;
}

.tema-boton {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
    padding: 0 10px 0 2px;
    font: inherit;
    font-weight: 600;
    color: inherit;
    cursor: url("assets/cursors/Wii Cursors - Link Select.cur"), pointer;
}

.tema-flecha {
    font-size: 9px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.tema-boton[aria-expanded="true"] .tema-flecha {
    transform: rotate(180deg);
}

.tema-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 3500;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border-radius: 14px;
    background: var(--menu-fondo, rgba(14, 20, 34, 0.98));
    border: 1px solid var(--menu-borde, rgba(125, 211, 252, 0.22));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
    animation: lumaAparecerArriba 0.18s ease backwards;
}

.tema-menu[hidden] {
    display: none;
}

.tema-menu [role="option"] {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--menu-texto, #e6f3ff);
    cursor: url("assets/cursors/Wii Cursors - Link Select.cur"), pointer;
    transition: background 0.15s ease;
}

.tema-menu [role="option"]:hover,
.tema-menu [role="option"]:focus-visible {
    background: var(--menu-hover, rgba(125, 211, 252, 0.14));
}

.tema-menu [role="option"][aria-selected="true"] {
    background: var(--menu-activo, rgba(125, 211, 252, 0.2));
}

.tema-menu [role="option"] > span:not(.tema-muestra) {
    flex: 1;
}

/* Muestra del tema: tres franjas de sus colores en una píldora */
.tema-muestra {
    display: flex;
    width: 34px;
    height: 16px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 999px;
    box-shadow: 0 0 0 1px var(--menu-borde, rgba(125, 211, 252, 0.3));
}

.tema-muestra i {
    flex: 1;
}

.tema-check {
    font-size: 11px;
    color: var(--menu-acento, #7dd3fc);
    opacity: 0;
}

.tema-menu [aria-selected="true"] .tema-check {
    opacity: 1;
}

/* Los temas dan estilo a todos los botones del encabezado; el botón y las
   opciones del menú de temas no deben heredarlo */
.header-btn .tema-selector .tema-boton,
.header-btn .tema-selector .tema-boton:hover,
.header-btn .tema-selector .tema-menu [role="option"],
.header-btn .tema-selector .tema-menu [role="option"]:hover {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
    filter: none !important;
    font-size: 13px !important;
    justify-content: flex-start !important;
}

.header-btn .tema-selector .tema-boton,
.header-btn .tema-selector .tema-boton:hover {
    background: none !important;
    color: inherit !important;
    padding: 0 10px 0 2px !important;
    font-size: 11px !important;
    height: 100% !important;
}

.header-btn .tema-selector .tema-menu [role="option"] {
    background: transparent !important;
    color: var(--menu-texto, #e6f3ff) !important;
    padding: 8px 10px !important;
}

.header-btn .tema-selector .tema-menu [role="option"]:hover,
.header-btn .tema-selector .tema-menu [role="option"]:focus-visible {
    background: var(--menu-hover, rgba(125, 211, 252, 0.14)) !important;
}

.header-btn .tema-selector .tema-menu [role="option"][aria-selected="true"] {
    background: var(--menu-activo, rgba(125, 211, 252, 0.2)) !important;
}

/* Mientras el menú de temas está abierto, el encabezado se pone por encima
   de la tienda (ambos tenían el mismo nivel y la tienda, al ir después,
   tapaba el menú) */
header:has(.tema-menu:not([hidden])),
.header-btn:has(.tema-menu:not([hidden])) {
    z-index: 3000 !important;
}

/* ==========================================================================
   RENDIMIENTO
   ========================================================================== */
/* Listas largas: el navegador no pinta (ni guarda en memoria) los elementos
   que quedan fuera de la vista hasta que se desplaza hasta ellos */
.admin-game-item {
    content-visibility: auto;
    contain-intrinsic-size: auto 64px;
}

.music-playlist .playlist-item,
.success-downloads > *,
.cart-item {
    content-visibility: auto;
    contain-intrinsic-size: auto 44px;
}

/* El nombre de la canción solo reserva capa propia mientras se desliza */
.music-icon.playing ~ .music-title.scrolling .music-title-inner {
    will-change: transform;
}

/* ==========================================================================
   ENCABEZADO EN UNA SOLA FILA
   Con la sesión iniciada aparecen "Panel" y "Salir": se compacta todo para
   que siga cabiendo en una fila y la tienda no baje. En ventanas estrechas
   se oculta el texto del logo y se reduce la letra de los botones.
   ========================================================================== */
@media (min-width: 1201px) {
    .header-btn {
        flex-wrap: nowrap;
        gap: 6px;
        padding-left: 10px;
        padding-right: 10px;
        box-sizing: border-box;
    }

    .header-btn #buscador {
        flex: 0 1 200px;
        min-width: 110px;
    }

    .homebrew-switch,
    .tema-selector {
        margin-left: 0;
    }

    .header-btn button:not(.admin-profile-btn) {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .music-title {
        flex: 0 1 90px;
        width: auto !important;
        min-width: 50px;
        max-width: 90px;
    }

    #volumeSlider {
        width: 40px;
        min-width: 40px;
    }

    .header-actions {
        flex-wrap: nowrap;
        gap: 4px;
    }
}

@media (min-width: 1201px) and (max-width: 1700px) {
    .logo h1 {
        font-size: 0;
        gap: 0;
    }

    /* Los botones conservan su texto: solo se reduce un poco */
    .header-btn button:not(.admin-profile-btn) {
        font-size: 10px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .header-btn #buscador {
        flex-basis: 140px;
    }
}

/* Encabezado ordenado en tres zonas: marca y búsqueda, música al centro y
   acciones a la derecha. Usa currentColor para servir en todos los temas. */
@media (min-width: 1201px) {
    .header-btn {
        min-height: 54px;
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .logo {
        margin-right: 8px;
    }

    .logo img {
        margin-right: 2px;
    }

    .header-btn #buscador {
        flex: 0 1 230px;
        min-width: 150px;
        height: 34px;
        box-sizing: border-box;
        padding-right: 12px;
    }

    .music-control {
        margin-inline: auto;
        gap: 8px;
        padding: 3px 12px 3px 4px;
        border-radius: 999px;
        background: color-mix(in srgb, currentColor 5%, transparent);
    }

    .music-icon,
    .admin-profile-btn,
    .admin-profile-btn img {
        width: 38px;
        min-width: 38px;
        height: 38px;
    }

    .header-actions {
        gap: 6px;
        align-items: center;
    }

    .cart-btn-header {
        margin-right: 6px;
    }

    .header-actions .admin-profile-btn {
        margin-left: 6px;
    }
}

/* Red de seguridad: nada del encabezado ensancha la página */
html,
body {
    /* clip y no hidden: no crea un contenedor de scroll y sticky sigue igual */
    overflow-x: clip;
}
