:root {
    --theme-accent: #ffd24d;
    --theme-accent-alpha: rgba(255, 210, 77, 0.4);
    --theme-dark: #0d0d11;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
html { height: 100%; overflow: hidden; }

body {
    height: 100vh;
    height: 100dvh;
    background: #070708;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    color: #ffffff;
    position: relative;
}

body.transitioning .container-arcade,
body.transitioning .container-nikke-play { pointer-events: none !important; }

body.nikke-minimized,
body.nikke-minimized * {
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: default !important;
}

/* Fondo único opaco (cero overdraw múltiple) */
.bg-blur {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.video-bg-container {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.video-bg-container.visible { opacity: 0.58; }
.video-bg-container.visible.buffering { opacity: 0.15; transition: opacity 0.18s ease; }
.video-bg-container video { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 1024px) { .video-bg-container.visible { opacity: 0.82 !important; } }

/* Botones globales */
.global-mute-btn {
    position: fixed;
    top: clamp(14px, 2.6vh, 22px);
    right: clamp(16px, 4vw, 32px);
    z-index: 6500;
    background: rgba(9, 9, 13, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #d4d4d8;
    width: 44px;
    height: 44px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.global-mute-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; transform: scale(1.05); }
.global-mute-btn.muted-active {
    background: rgba(239, 68, 68, 0.22) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
    color: #ef4444 !important;
}

.arcade-limbo-btn {
    position: fixed;
    top: clamp(14px, 2.6vh, 22px);
    left: clamp(16px, 4vw, 32px);
    z-index: 4500;
    height: 44px;
    padding: 0 16px;
    background: rgba(255, 30, 64, 0.16);
    border: 1px solid rgba(255, 30, 64, 0.55);
    color: #ff4d6a;
    font-family: "Rajdhani", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.arcade-limbo-btn:hover { background: #ff1e40; color: #fff; transform: scale(1.04); }
body:not(.mode-arcade) .arcade-limbo-btn,
body.focused-mode-active .arcade-limbo-btn,
body.transitioning .arcade-limbo-btn {
    opacity: 0;
    pointer-events: none;
}

/* Pantalla de bienvenida ligera (se elimina del DOM al entrar) */
.welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #070708;
    overflow: hidden;
    transition: opacity 0.42s ease;
}
.welcome-screen.hidden { opacity: 0; pointer-events: none; }

.welcome-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 55% at 50% 105%, rgba(255, 157, 60, 0.14) 0%, transparent 65%),
        radial-gradient(ellipse 60% 40% at 15% 15%, rgba(85, 203, 251, 0.06) 0%, transparent 60%),
        #070708;
}
.welcome-scan-line {
    position: absolute;
    left: 0; top: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 210, 77, 0.35), transparent);
    animation: scanDown 4s ease-in-out infinite;
    will-change: transform;
}
@keyframes scanDown {
    0% { transform: translate3d(0, 0, 0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translate3d(0, 100vh, 0); opacity: 0; }
}
.welcome-corner {
    position: absolute;
    width: 52px; height: 52px;
    border-color: rgba(255, 157, 60, 0.3);
    border-style: solid;
}
.welcome-corner.tl { top: 24px; left: 24px; border-width: 2px 0 0 2px; }
.welcome-corner.tr { top: 24px; right: 24px; border-width: 2px 2px 0 0; }
.welcome-corner.bl { bottom: 24px; left: 24px; border-width: 0 0 2px 2px; }
.welcome-corner.br { bottom: 24px; right: 24px; border-width: 0 2px 2px 0; }

.welcome-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.welcome-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: welcomeFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes welcomeFadeUp {
    from { opacity: 0; transform: translate3d(0, 16px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.welcome-icon-ring {
    width: 86px; height: 86px;
    border-radius: 50%;
    border: 2px solid rgba(255, 157, 60, 0.55);
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 157, 60, 0.06);
}
.welcome-icon-ring i { font-size: 32px; color: #ff9d3c; }
.welcome-title {
    font-size: clamp(24px, 6vw, 38px);
    font-weight: 900;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #fff;
    text-align: center;
}
.welcome-title span { color: #ff9d3c; }
.welcome-subtitle { font-size: clamp(9px, 2.2vw, 12px); color: rgba(255, 255, 255, 0.35); letter-spacing: 6px; text-transform: uppercase; }
.welcome-divider {
    width: min(300px, 78vw); height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 157, 60, 0.4), transparent);
    margin: 24px 0 18px;
}
.welcome-slogan {
    font-size: clamp(12px, 3vw, 14px);
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    max-width: min(340px, 82vw);
    line-height: 1.65;
    margin-bottom: 26px;
}
.welcome-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 15px 46px;
    background: linear-gradient(135deg, #ff9d3c, #ffd24d);
    color: #0a0a0c;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
    transition: transform 0.2s ease;
}
.welcome-start-btn:hover { transform: scale(1.05); }
.welcome-start-btn:active { transform: scale(0.96); }
.welcome-footer {
    position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
    font-size: 9px; color: rgba(255, 255, 255, 0.2); letter-spacing: 3px; text-transform: uppercase;
}

/* Toast HUD */
.brcs-toast {
    position: fixed;
    bottom: max(18px, env(safe-area-inset-bottom, 18px));
    left: 50%;
    transform: translate3d(-50%, 36px, 0);
    z-index: 10000;
    padding: 10px 22px;
    background: rgba(12, 14, 22, 0.95);
    border: 1px solid var(--theme-accent, #ffd24d);
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    font-family: "Rajdhani", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}
.brcs-toast.visible { opacity: 1; transform: translate3d(-50%, 0, 0); }