/* ===============================
   🔵 RESET GLOBAL
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* Quita flash gris al tocar en iOS */
    transition: 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===============================
   🔵 SAFE AREAS (VARIABLES)
   ================================ */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* ===============================
   🔵 BODY GLOBAL & FULLSCREEN FIX
   ================================ */
/* ===============================
   🔵 BODY GLOBAL & FULLSCREEN FIX
   ================================ */
html {
    height: 100%;
    width: 100%;
    background-color: #0f1215;
    overscroll-behavior-y: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-padding-top: 80px;
    overflow-x: hidden;
    /* 🔥 FORCE NO SCROLL */
}

body {
    color: white;
    background-color: #0f1215;
    width: 100%;
    /* Ensure full width */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-x: hidden;
    /* Double safety */
    position: relative;
}

/* --- BLOQUEO DE SELECCIÓN (App Feel Definitive iOS/Android) --- */
html,
body {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* Prevent iOS context menu on long press */
}

/* Permitir selección de texto solo en elementos de entrada */
input,
textarea,
select,
[contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
}

body:not(.home-page) {
    background-color: #0f1215;
}

/* ===============================
   🔵 CONTENEDOR PRINCIPAL (Aquí aplicamos el Notch)
   ================================ */
main.page-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 100%;
    width: 100%;
    /* Force constraint */
    max-width: 100%;
    /* Hard limit (changed from vw to avoid scrollbar overflow) */

    padding-top: 0;
    padding-bottom: calc(20px + var(--safe-bottom));
    padding-left: calc(15px + var(--safe-left));
    padding-right: calc(15px + var(--safe-right));

    position: relative;
    z-index: 2;
    box-sizing: border-box;
    /* Include padding in width */
}

/* Fondo borroso fijo detrás de todo */
.background-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* Switch from 100vw to 100% to avoid scrollbar width issues */
    height: 100%;
    /* Switch from 100vh */
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at top, #1a2a3a 0%, #000000 90%);
}

/* ===============================
   🔵 ELEMENTOS BASE
   ================================ */
a {
    color: inherit;
    text-decoration: none;
}

input,
select,
button {
    font-family: inherit;
    outline: none;
}

.glass {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
}

/* ===============================
   🔵 BOTÓN ATRÁS (Ajustado al Notch)
   ================================ */
.back-btn {
    position: fixed;
    /* Se adapta dinámicamente */
    top: calc(var(--safe-top) + 15px);
    left: calc(var(--safe-left) + 15px);

    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.30);
    /* Más transparente */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    backdrop-filter: blur(12px);

    /* Resplandor */
    box-shadow: 0 0 12px rgba(0, 180, 255, 0.25);
    z-index: 9999;
    transition: 0.25s ease;
}

.icon-back {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 0 2px rgba(0, 200, 255, 0.5));
}

.back-btn:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.6);
}

/* ===============================
   🔵 FOOTER GLOBAL (EFECTO CRISTAL REAL)
   ================================ */
.global-footer {
    position: relative;
    width: 100%;
    z-index: 10;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    /* Un poco más sutil */

    /* Padding generoso */
    padding-top: 30px;
    padding-bottom: calc(20px + var(--safe-bottom));

    /* Separación superior automática para empujar al fondo si hay poco contenido */
    margin-top: auto;

    /* Sin bordes ni fondos molestos, integrado en el scroll */
    background: transparent;
    border-top: none;
}


/* ===============================
   🔵 TARJETAS BASE
   ================================ */
.card {
    padding: 20px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

/* =========================================================
   🎬 TRANSICIONES DE PÁGINA (PAGE LOADER)
   ========================================================= */

/* 🚀 Navegación instantánea — sin fade-out, sin View Transitions.
   La página actual se mantiene visible hasta que el browser carga la nueva.
   Solo la barra de progreso 3px arriba como feedback sutil. */
body {
    opacity: 1;
    transition: opacity 0.08s ease-out;
}
body.loaded { opacity: 1; }
body.fade-out {
    opacity: 0;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

/* ===============================
   🔔 NOTIFICATION BELL (GLOBAL)
   ================================ */
.notif-btn {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 15px);
    right: 20px !important;
    /* 🔥 FORCE RIGHT */
    left: auto !important;
    /* 🔥 FORCE NO LEFT */

    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 12px rgba(108, 92, 231, 0.55);
    cursor: pointer;
    z-index: 99999;
    /* Higher than back button */
    transition: 0.25s ease;
    text-decoration: none;
    font-size: 20px;
}

.notif-btn:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.60);
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #FF3B30;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #1a1e2c;
    z-index: 10000;
}

/* ===============================
   👑 VIP GOLD THEME (SOCIO EXCLUSIVO)
   ================================ */
/* 
body.vip-theme .background-blur {
    background: radial-gradient(circle at top, #2c2005 0%, #000000 90%);
} 
*/

body.vip-theme .card,
body.vip-theme .menu-card,
body.vip-theme .social-icon-btn {
    border: 1px solid rgba(241, 196, 15, 0.4) !important;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.1);
}

body.vip-theme .menu-icon {
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

body.vip-theme h1,
body.vip-theme h2,
body.vip-theme .panel-title {
    color: #f1c40f !important;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

/* ===============================
   ✨ VIP / PREMIUM styling — efecto moneda
   =============================== */
.vip-pill {
    position: relative;
    display: inline-block;
    overflow: hidden;
    font-size: 0.7rem;
    font-weight: 900;
    color: #3a2600;
    padding: 6px 18px;
    border-radius: 14px;
    letter-spacing: 1.4px;
    text-shadow: 0 1px 0 rgba(255, 240, 180, 0.6);
    border: 1px solid rgba(180, 120, 20, 0.65);
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.35),
        0 0 18px rgba(255, 190, 70, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -2px 3px rgba(120, 70, 0, 0.35);
    background-size: 300% 100%;
    animation: vipShimmer 4s linear infinite;
    isolation: isolate;
}
.vip-premium {
    background-image: linear-gradient(135deg, #b8821a 0%, #ffda79 25%, #fff4b8 50%, #ffb347 75%, #b8821a 100%);
}
.vip-beta {
    background-image: linear-gradient(135deg, #a87113 0%, #ffe082 25%, #fff2b0 50%, #f39c12 75%, #a87113 100%);
}
@keyframes vipShimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Pasada de luz tipo moneda */
.vip-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 45%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.85) 50%,
        transparent 100%
    );
    transform: skewX(-25deg);
    animation: coinShine 2.8s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes coinShine {
    0%   { left: -60%; }
    60%  { left: 130%; }
    100% { left: 130%; }
}

.nh-card.vip-card {
    position: relative;
    box-shadow:
        0 0 0 1px rgba(255, 215, 100, 0.28),
        0 10px 28px rgba(255, 159, 67, 0.16);
}
/* Borde dorado shimmer (conic-gradient rotativo) */
.nh-card.vip-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(
        from var(--vip-angle, 0deg),
        rgba(255, 200, 80, 0) 0%,
        rgba(255, 200, 80, 0) 40%,
        rgba(255, 240, 180, 0.9) 48%,
        rgba(255, 255, 230, 1) 50%,
        rgba(255, 240, 180, 0.9) 52%,
        rgba(255, 200, 80, 0) 60%,
        rgba(255, 200, 80, 0) 100%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
    animation: vipBorderSpin 4.5s linear infinite;
}
@property --vip-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes vipBorderSpin {
    to { --vip-angle: 360deg; }
}

/* Noise overlay eliminado: causaba interferencia con bottom-nav fixed en iOS PWA */

/* ===============================
   🌊 CONSTELACIÓN SUBMARINA
   =============================== */
.reef-constellation {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
    mix-blend-mode: screen;
}
.reef-constellation .star {
    position: absolute;
    width: 2px; height: 2px;
    background: #5ceaf2;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(92, 234, 242, 0.6);
    opacity: 0;
    animation: reefFloat linear infinite, reefTwinkle ease-in-out infinite;
}
@keyframes reefFloat {
    from { transform: translateY(105vh) translateX(0); }
    to   { transform: translateY(-10vh) translateX(var(--drift, 30px)); }
}
@keyframes reefTwinkle {
    0%, 100% { opacity: 0; }
    15%, 85% { opacity: var(--max-op, 0.3); }
}
@media (prefers-reduced-motion: reduce) {
    .reef-constellation { display: none; }
}

/* ===============================
   ⚡ PARTÍCULAS STORM-MODE
   =============================== */
.nh-grid-card.storm-active {
    position: relative;
    overflow: hidden;
}
.storm-spark {
    position: absolute;
    width: 3px; height: 3px;
    background: #ffe680;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 220, 120, 0.9);
    pointer-events: none;
    animation: sparkFly 2.2s ease-out infinite;
    opacity: 0;
}
@keyframes sparkFly {
    0%   { transform: translate(0, 0) scale(0);   opacity: 0; }
    15%  { transform: translate(var(--sx,0), var(--sy,0)) scale(1); opacity: 1; }
    100% { transform: translate(calc(var(--sx,0) * 3), calc(var(--sy,0) * 3)) scale(0.2); opacity: 0; }
}

/* ===============================
   🖼️ SKELETON IMG LOADER
   =============================== */
.img-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(20, 30, 44, 0.9) 0%,
        rgba(40, 60, 90, 0.95) 50%,
        rgba(20, 30, 44, 0.9) 100%);
    background-size: 200% 100%;
    animation: skShimmer 1.4s ease-in-out infinite;
    z-index: 1;
    transition: opacity 0.35s ease;
}
.img-skeleton.fade-out { opacity: 0; pointer-events: none; }
@keyframes skShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
/* ===============================
   📱 iOS-STYLE SHEET MODALS
   ================================ */
.sheet-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100000;
    background: rgba(0,0,0,0);
    transition: background 0.3s;
}
.sheet-overlay.active {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,0.6);
}
.sheet-content {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: #1a1a2e;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sheet-overlay.active .sheet-content {
    transform: translateY(0);
}
.sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 16px;
}
.sheet-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
}
