:root {
    /* ================================================ */
    /* 🌊 BACKGROUNDS - Estados del Timer              */
    /* ================================================ */
    /* 🌊 DEEP OCEAN - Clásico y profesional */
    --primary: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1476a3 100%);
    --preparing: linear-gradient(135deg, #00FF00 0%, #008000 100%);
    --fighting: linear-gradient(135deg, #8B0000 0%, #B22222 50%, #DC143C 100%);
    --warning: linear-gradient(135deg, #8B0000 0%, #660000 100%);
    --resting: linear-gradient(135deg, #54a0ff 0%, #2e86de 100%);
    --finished: linear-gradient(135deg, #00b894 0%, #00cec9 100%);

    /* ================================================ */
    /* ?? PANEL SETTINGS - Galaxy Mix                  */
    /* ================================================ */
    --panel-bg: linear-gradient(135deg,
        rgba(25, 35, 100, 0.85),
        rgba(60, 30, 110, 0.75),
        rgba(40, 50, 120, 0.8));
    --panel-border: rgba(120, 100, 255, 0.5);
    --panel-glow-1: rgba(100, 80, 255, 0.5);
    --panel-glow-2: rgba(150, 100, 255, 0.3);
    --panel-glow-inner: rgba(120, 100, 255, 0.15);
    --panel-blur: 20px;
    --panel-radius: 20px;

    /* ================================================ */
    /* ? BOTONES - Arrow Tech (Cyan)                  */
    /* ================================================ */
    --btn-bg: rgba(0, 30, 60, 0.5);
    --btn-border: rgba(0, 255, 255, 0.6);
    --btn-border-hover: rgba(0, 255, 255, 1);
    --btn-color: #00ffff;
    --btn-bg-hover: rgba(0, 255, 255, 0.2);
    --btn-radius: 8px;
    --btn-size: 42px;
    --btn-glow: rgba(0, 255, 255, 0.3);
    --btn-glow-inner: rgba(0, 255, 255, 0.1);

    /* ================================================ */
    /* ?? BOTONES DE MODO (HIIT, Sparring, EMOM)      */
    /* ================================================ */
    --mode-btn-bg: rgba(8, 18, 55, 0.82);
    --mode-btn-bg-hover: rgba(10, 28, 80, 0.92);
    --mode-btn-bg-active: rgba(0, 38, 100, 0.92);
    --mode-btn-radius: 12px;

    /* ================================================ */
    /* ?? COLORES GENERALES                            */
    /* ================================================ */
    --dark: #2d3436;
    --light: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);

    /* ================================================ */
    /* ?? SAFE AREA (Notch de m?viles)                */
    /* ================================================ */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
            -webkit-user-select: none;
            user-select: none;
            -webkit-touch-callout: none; /* iOS: bloquea menú nativo al mantener pulsado */
        }

/* OPT1: Eliminate 300ms tap delay on all interactive elements */
button,
.btn, .counter-btn, .float-btn, .icon-btn, .mode-btn,
.trophy-btn, .league-btn, .music-btn, .darkmode-btn,
.btn-google-signin, .btn-google-signout, .btn-save,
.btn-close, .btn-disconnect-google, .btn-delete-account {
    touch-action: manipulation;
}
/* OPT1b: inputs also need manipulation to kill tap-delay and prevent zoom-jank */
input, select, textarea {
    touch-action: manipulation;
}

        /* REEMPLAZA LAS REGLAS DE HTML Y BODY POR ESTO: */

/* ============ ?? SCROLL GLOBAL DE P?GINA ============ */
html {
    height: auto;
    min-height: 100%;
    overscroll-behavior: none; /* Evita rebote Android/iOS */
}

body {
    /* ── Scroll & Layout (iOS-safe) ── */
    overflow-y: auto !important;  /* Permite scroll de página */
    overflow-x: clip; /* clip (no hidden): recorta overflow horizontal sin
                         crear un scroll container - evita el bug de iOS Safari
                         donde overflow:hidden en body rompe position:fixed */
    height: auto;
    min-height: 100vh;
    min-height: 100dvh; /* Soporte para iOS Safari */
    margin: 0;
    padding: 0;
    position: relative;
    -webkit-overflow-scrolling: touch; /* Scroll suave iOS */
    overscroll-behavior: none; /* Evita que baje de más */

    background-color: #1e3c72;
}

/* scroll del panel — solo aplica en estado abierto (ver .settings-panel.show) */

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--primary);
            /* auroraShift eliminado: animaba background-position de un gradiente 200% — muy costoso
               en GPU móvil (no es una propiedad compositable). Reemplazado por transición suave
               en cambio de estado, que solo dispara una vez por evento en lugar de cada frame. */
            transition: background 0.5s ease;
            z-index: -1;
        }

        /* Cambios de estado del timer: transición suave entre colores, sin animación continua */
        body.fighting::before   { background: var(--fighting); }
        body.preparing::before  { background: var(--preparing); }
        body.resting::before    { background: var(--resting); }
        body.finished::before   { background: var(--finished); }

        #particleCanvas {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            height: 100dvh;
            pointer-events: none;
            z-index: 0;
            will-change: transform; /* promueve el canvas a su propia capa GPU */
        }

        /* Destruir el canvas de partículas durante estados activos del timer.
           display:none elimina el elemento del árbol de render — el browser deja de
           procesar el RAF del canvas por completo. Sin esto, el JS sigue dibujando
           partículas invisibles detrás del fondo rojo/verde. */
        body.fighting #particleCanvas,
        body.preparing #particleCanvas,
        body.resting #particleCanvas {
            display: none;
        }

        @keyframes pulse {
            /* filter:brightness reemplazado por opacity — compositable por GPU sin software fallback */
            0%, 100% { opacity: 1; }
            50%       { opacity: 0.75; }
        }

        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        /* Top Controls */
        .top-controls {
            position: fixed;
            top: max(10px, calc(var(--safe-top) + 10px));
            left: max(10px, calc(var(--safe-left) + 10px));
            display: flex;
            gap: 10px;
            z-index: 1000;
        }

        body.timer-active .top-controls { display: none; }
        /* ================================================ */
        /* ??? REGLA ?NICA: Ocultar SOLO el anuncio         */
        /* ================================================ */

        /* .brand-card y .ad-space ya NO se ocultan en combate -
           el anuncio nativo rota durante el entrenamiento (ver blindaje abajo) */

        /* FIX #15: Touch-action para eliminar latencia de 300ms en m?viles */
        .icon-btn {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.2);
            backdrop-filter: blur(10px);
            color: white;
            font-size: 1.5em;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            box-shadow: 0 8px 25px rgba(0, 229, 255, 0.3);
            transition: all 0.3s;
            touch-action: manipulation;
        }

        .icon-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); box-shadow: 0 12px 35px rgba(0, 229, 255, 0.45); }
        .icon-btn:active { transform: scale(0.95); }

        /* Language Dropdown */
        .lang-dropdown {
            position: relative;
        }

        .lang-menu {
            position: absolute;
            top: 55px;
            left: 0;
            background: rgba(255,255,255,0.95);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            padding: 8px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.2);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            transition: all 0.3s;
        }

        .lang-menu.show {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .lang-option {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.95em;
            color: var(--dark);
            transition: background 0.2s;
            white-space: nowrap;
        }

        .lang-option:hover { background: rgba(102, 126, 234, 0.1); }
        .lang-option.active { background: rgba(102, 126, 234, 0.2); font-weight: 600; }
        .lang-option span:first-child { font-size: 1.3em; }

        .music-btn {
            position: fixed;
            top: max(10px, calc(var(--safe-top) + 10px));
            right: max(10px, calc(var(--safe-right) + 10px));
            width: 48px;
            height: 48px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.2);
            backdrop-filter: blur(10px);
            color: white;
            font-size: 1.5em;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
            z-index: 1000;
        }

        /* Dark Mode Button */
        .darkmode-btn {
            position: fixed;
            top: max(10px, calc(var(--safe-top) + 10px));
            right: max(70px, calc(var(--safe-right) + 70px));
            width: 48px;
            height: 48px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.2);
            backdrop-filter: blur(10px);
            color: white;
            font-size: 1.5em;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            box-shadow: 0 8px 25px rgba(100, 149, 237, 0.3);
            z-index: 1000;
        }

        .darkmode-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); box-shadow: 0 12px 35px rgba(100, 149, 237, 0.45); }
        body.timer-active .darkmode-btn { display: none; }

        /* Dark Mode Styles */
        body.dark-mode {
            --primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            --preparing: linear-gradient(135deg, #004d00 0%, #000000 100%);
            --fighting: linear-gradient(135deg, #4a0000 0%, #2d0000 100%);
            --warning: linear-gradient(135deg, #3d0000 0%, #1a0000 100%);
            --resting: linear-gradient(135deg, #0a2647 0%, #051937 100%);
            --finished: linear-gradient(135deg, #064635 0%, #042f2e 100%);
        }

        body.dark-mode .timer-card {
            background: linear-gradient(145deg, #1e1e2e 0%, #2d2d44 100%);
            color: #e0e0e0;
        }

        body.dark-mode .time-display {
            color: #e0e0e0;
        }

        body.dark-mode .status-display {
            color: #4ecca3;
        }

        body.dark-mode .round-info {
            color: #ff6b6b;
        }

        body.dark-mode .settings-panel { background: var(--panel-bg); box-shadow: 0 0 25px rgba(0, 0, 0, 0.5), 0 20px 60px rgba(0,0,0,0.3); }

        body.dark-mode .training-summary {
            background: linear-gradient(135deg, #0d6b63 0%, #1a9e55 100%);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
        }

        body.dark-mode .training-summary .total {
            color: #ffffff;
        }

        body.dark-mode .modal-content {
            background: linear-gradient(145deg, #1e1e2e 0%, #2d2d44 100%);
            color: #e0e0e0;
        }

        body.dark-mode .form-input {
            background: #2d2d44;
            border-color: #3d3d5c;
            color: #e0e0e0;
        }

        body.dark-mode .btn-settings {
            background: linear-gradient(135deg, #2d2d44 0%, #1e1e2e 100%);
            color: #e0e0e0;
        }

        .music-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); box-shadow: 0 12px 35px rgba(124, 58, 237, 0.5); }
        .music-btn.playing { background: rgba(0,184,148,0.6); }

        body.timer-active .music-btn { display: none; }

        /* Ad Space */
        .ad-space {
            position: fixed;
            bottom: max(12px, calc(var(--safe-bottom) + 12px));
            left: max(12px, calc(var(--safe-left) + 12px));
            background: rgba(255,255,255,0.9);
            backdrop-filter: blur(10px);
            border-radius: 10px;
            padding: 10px 14px;
            font-size: 0.75em;
            color: #636e72;
            display: flex;
            align-items: center;
            gap: 8px;
            text-decoration: none;
            transition: all 0.3s;
            z-index: 100;
        }

        .ad-space:hover { background: white; transform: translateY(-2px); box-shadow: 0 5px 20px rgba(0,0,0,0.15); }
        .ad-space .ad-icon { font-size: 1.5em; }
        .ad-space .ad-label { font-size: 0.8em; opacity: 0.6; text-transform: uppercase; }


        /* Main Container - Limitado en desktop */
        .container {
            position: relative;
            z-index: 10;
            width: 100%;
            max-width: 500px;
            margin: 0 auto;
            padding: max(110px, calc(var(--safe-top) + 110px)) 20px max(20px, calc(var(--safe-bottom) + 20px));
            min-height: auto;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            align-items: center;
            box-shadow: none; /* Sin sombra en m?vil */
        }

        body.timer-active .container { display: none; }

        /* Asegurar que los hijos del container ocupen el ancho completo */
        .container > * {
            width: 100%;
            max-width: 100%;
        }


        /* Header */
        .header {
            position: relative;
            display: inline-block;
            text-align: center;
            margin-bottom: 30px;
        }

        .elite-badge {
            position: absolute;
            bottom: -16px;
            right: 38px;
            font-size: 11px;
            font-weight: 900;
            letter-spacing: 2px;
            text-transform: uppercase;
            color: #00e5ff;
            text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
            pointer-events: none;
            z-index: 10;
        }

        .logo {
            display: inline-flex;
            align-items: center;
            gap: 13px;
            background: linear-gradient(145deg, #ea5f50, #c0392b);
            padding: 18px 38px;
            border-radius: 50px;
            box-shadow:
                12px 12px 30px rgba(0,0,0,0.4),
                -4px -4px 15px rgba(255,100,80,0.3),
                inset 0 1px 0 rgba(255,255,255,0.3);
            border: 1px solid rgba(0,0,0,0.1);
        }

        .logo-icon {
            font-size: 2em;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .logo-text {
            font-size: 1.6em;
            font-weight: 900;
            color: white;
            letter-spacing: 1px;
            text-shadow: 2px 2px 6px rgba(0,0,0,0.4);
        }

                /* 2. TARJETA PRINCIPAL ? Glassmorphism Premium */
        .timer-card {
            background: rgba(255, 255, 255, 0.15) !important;
            backdrop-filter: blur(16px) !important;
            -webkit-backdrop-filter: blur(16px) !important;
            border: 1px solid rgba(255, 255, 255, 0.3) !important;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
            border-radius: 24px !important;
            color: #ffffff !important;
            position: relative;
            z-index: 50;
        }

        .round-info {
            text-align: center;
            font-size: clamp(16px, 4.5vw, 24px) !important;
            font-weight: 700;
            color: #FFD700;
            text-transform: uppercase;
            letter-spacing: 2px;
            margin-bottom: 20px;
        }

        .time-display {
            text-align: center;
            font-size: 5em;
            font-weight: 800;
            font-family: 'Courier New', monospace;
            color: #ffffff;
            text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
            line-height: 1;
            margin: 20px 0;
        }

        .status-display {
            text-align: center;
            font-size: clamp(24px, 6vw, 36px) !important;
            font-weight: 900;
            color: #00b894;
            text-transform: uppercase;
            letter-spacing: 4px;
            font-family: 'Impact', sans-serif;
            animation: statusExpand 2s ease-in-out infinite;
            will-change: transform, opacity;
        }

        /* Detener la animación del status durante estados activos del timer.
           statusExpand corre 30 frames/seg en pantalla durante rounds completos.
           Idle (READY) es el único estado donde la animación tiene sentido visual. */
        body.fighting .status-display,
        body.preparing .status-display,
        body.resting .status-display,
        body.finished .status-display {
            animation: none;
        }

        @keyframes statusExpand {
            /* text-shadow eliminado del keyframe: no es compositable por GPU.
               Solo transform:scale + opacity — ambas operaciones de compositor puro. */
            0%, 100% { transform: scale(1);   opacity: 0.9; }
            50%       { transform: scale(1.1); opacity: 1;   }
        }

        /* Progress Bar */
        .progress-wrap {
            margin: 25px 0;
            height: 16px;
            background: rgba(0,0,0,0.1);
            border-radius: 10px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #00b894, #00cec9);
            border-radius: 10px;
            /* scaleX en lugar de width: GPU-compositable, cero reflow por tick.
               transform-origin:left mantiene el fill pegado al borde izquierdo. */
            width: 100%;
            transform: scaleX(1);
            transform-origin: left center;
            transition: transform 0.3s ease;
            will-change: transform;
        }

        /* Sand timer: scaleY desde los extremos correctos — sin reflow de altura */
        .sand-top {
            width: 100%;
            height: 100%;
            background: #f0c040;
            transform-origin: top center;
            transform: scaleY(1);
        }
        .sand-bottom {
            width: 100%;
            height: 100%;
            background: #f0c040;
            transform-origin: bottom center;
            transform: scaleY(0);
        }

        /* Quote */
        .quote-box {
            background: rgba(0,0,0,0.15);
            backdrop-filter: blur(5px);
            border-radius: 12px; border: 1px solid rgba(255, 215, 0, 0.15); box-shadow: 0 4px 15px rgba(0,0,0,0.3); background: linear-gradient(135deg, rgba(20,20,30,0.8), rgba(10,10,20,0.95)); /* rectangulo */
            padding: 20px;
            margin-top: 20px;
            margin-left: 20px;
            margin-right: 20px;
            width: calc(100% - 40px);
            box-sizing: border-box;
            color: white;
            font-style: italic;
        }

        .quote-text { font-size: clamp(18px, 4.5vw, 26px) !important; line-height: 1.5; margin-bottom: 10px; }
        .quote-author { font-size: clamp(14px, 3.5vw, 20px) !important; text-align: right; font-weight: 700; color: #ffd93d; font-style: normal; }

        /* Buttons */
        .btn-group {
            display: grid;
            gap: 12px;
            margin-bottom: 20px;
            margin-left: 20px;
            margin-right: 20px;
            width: calc(100% - 40px);
            box-sizing: border-box;
        }

        .btn {
            padding: 18px;
            font-size: 1.1em;
            font-weight: 700;
            border: none;
            border-radius: 14px;
            cursor: pointer;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s;
        }

        .btn:hover { transform: translateY(-2px); }
        .btn:active { transform: translateY(0); }

        .btn-start {
            background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
            color: white;
            box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4);
        }

        /* ── Idle punch animation — #startBtn ────────────────────────────────
           El guante golpea el texto cada 7 s cuando el timer está en reposo.
           Solo activo mientras JS añade .is-punching al botón.
        ──────────────────────────────────────────────────────────────────── */

        /* Estado base: guante en guardia apuntando a la derecha
           rotate(45deg) → nudillos apuntan directamente hacia el texto */
        .glove-icon {
            display: inline-block;
            transform: rotate(45deg);
            will-change: transform;
        }
        #startText {
            display: inline-block;
            will-change: transform;
        }

        /* ── 1. GUANTE: jab horizontal puro — solo varía translateX ──── */
        @keyframes punchGlove {
            0%   {
                transform: rotate(45deg) translateX(0) scale(1);
                animation-timing-function: cubic-bezier(0.4, 0, 0.1, 1);
            }
            30%  {
                transform: rotate(45deg) translateX(18px) scale(1.1); /* IMPACTO recto */
                animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
            }
            50%  {
                transform: rotate(45deg) translateX(-4px) scale(0.98); /* spring back */
                animation-timing-function: ease-out;
            }
            75%  {
                transform: rotate(45deg) translateX(2px) scale(1);
                animation-timing-function: ease-out;
            }
            100% {
                transform: rotate(45deg) translateX(0) scale(1);
            }
        }

        /* ── 2. TEXTO: hundimiento con peso + rebote elástico ─────────── */
        @keyframes impactText {
            0%   {
                transform: translate(0, 0) scale(1) skewX(0deg);
                color: inherit;
                text-shadow: none;
                animation-timing-function: cubic-bezier(0.4, 0, 0.1, 1);
            }
            30%  {
                /* Hundimiento: el golpe empuja abajo y a la derecha */
                transform: translate(4px, 4px) scale(0.95) skewX(-5deg);
                color: #ffffff;
                text-shadow: 0 -2px 10px rgba(255, 255, 255, 0.8);
                animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
            }
            50%  {
                /* Rebote: salta hacia arriba/izquierda como elástico pesado */
                transform: translate(-2px, -2px) scale(1.02) skewX(0deg);
                color: inherit;
                text-shadow: none;
                animation-timing-function: ease-out;
            }
            72%  {
                transform: translate(1px, 1px) scale(1) skewX(0deg);
                animation-timing-function: ease-out;
            }
            100% {
                transform: translate(0, 0) scale(1) skewX(0deg);
                color: inherit;
                text-shadow: none;
            }
        }

        /* ── 3. BOTÓN: flash blanco seco en el pico, luego shockwave ── */
        @keyframes buttonShockwave {
            0%   {
                box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4);
                transform: scale(1);
                filter: brightness(1);
            }
            30%  {
                /* Destello blanco brillante sincronizado con el impacto */
                box-shadow: 0 8px 25px rgba(0, 184, 148, 0.5), 0 0 20px rgba(255, 255, 255, 0.6);
                transform: scale(0.97);
                filter: brightness(1.4);
            }
            65%  {
                box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4), 0 0 0 18px rgba(255, 255, 255, 0);
                transform: scale(1.01);
                filter: brightness(1);
            }
            100% {
                box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4), 0 0 0 0 rgba(255, 255, 255, 0);
                transform: scale(1);
                filter: brightness(1);
            }
        }

        /* Clase activa — duración 0.45s                                  */
        /* punchGlove: jab horizontal, impacto al 30% = 135ms            */
        /* impactText + buttonShockwave: sincronizados al 30%            */
        #startBtn.is-punching .glove-icon {
            animation: punchGlove 0.45s forwards;
        }
        #startBtn.is-punching #startText {
            animation: impactText 0.45s forwards;
        }
        #startBtn.is-punching {
            animation: buttonShockwave 0.45s forwards;
        }

        .btn-settings {
            background: linear-gradient(135deg, #dfe6e9 0%, #b2bec3 100%);
            color: var(--dark);
        }

        /* ================================================ */
/* ?? SETTINGS PANEL - MODO DASHBOARD (GRID 2x2)    */
/* ================================================ */

.settings-panel {
    /* Morado oscuro elegante y profundo */
    background: #1e1428 !important;
    background-size: 200% 200%;
    /* backdrop-filter eliminado: el fondo es opaco — el blur no era visible pero sí costoso en GPU */
    border-radius: var(--panel-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* ESTADO CERRADO — tamaño colapsa instantáneo (sin transición), solo transform/opacity animan */
    max-height: 0;
    overflow: hidden;
    padding: 12px 20px 28px; /* bottom: margen elegante tras los presets */

    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px) scaleY(0.95);
    transform-origin: top center;
    transition:
        transform  0.15s cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity    0.15s ease;
    will-change: transform, opacity;

    /* ESTILOS VISUALES */
    margin-bottom: 4px;
    margin-left: 20px;
    margin-right: 20px;
    width: calc(100% - 40px);
    box-sizing: border-box;

    /* ESTRUCTURA FLEX PARA LA CUADRÍCULA */
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
}

/* Gradiente en movimiento - da vida al fondo sin repintar el DOM */
@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Respiración de neón: azul eléctrico → violeta, 6s — compositor-only via opacity */
@keyframes premiumGlow {
    0%, 100% { opacity: 0.88; }
    50%       { opacity: 1.0; }
}

/* CLASE ACTIVA (cuando JS añade .show) */
.settings-panel.show {
    max-height: 2000px !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;

    /* Estado visual final — animado desde el estado cerrado vía transition */
    opacity: 1;
    transform: translateY(0) scaleY(1);
    pointer-events: auto;

    /* will-change activo solo cuando el panel está abierto — libera la capa GPU al cerrar */
    will-change: transform, opacity;

    /* Animaciones decorativas activas solo mientras el panel está abierto */
    box-shadow: 0 0 25px rgba(60, 50, 200, 0.30), inset 0 0 16px rgba(60, 50, 200, 0.10);
    animation:
        gradientShift 8s ease infinite,
        premiumGlow   6s ease-in-out infinite;
}

/* === ELEMENTOS DE ANCHO COMPLETO (100%) === */
/* Hacemos que el t?tulo, resumen y modos ocupen toda la l?nea */
.settings-title,
.training-summary,
.mode-buttons,
.settings-content {
    width: 100%;
    flex-basis: 100%;
    margin-bottom: 8px;
}

/* Ajuste espec?fico para el t?tulo */
.settings-title {
    font-size: 1.2em;
    font-weight: 700;
    color: white;
    text-align: center;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-top: 5px;
}

/* Ajuste espec?fico para el resumen */
.training-summary {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-radius: 12px; border: 1px solid rgba(255, 215, 0, 0.15); box-shadow: 0 4px 15px rgba(0,0,0,0.3); background: linear-gradient(135deg, rgba(20,20,30,0.8), rgba(10,10,20,0.95)); /* rectangulo */
    padding: 10px 15px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.25);
}
.training-summary h4 { font-size: 0.82em; color: rgba(255,255,255,0.9); margin-bottom: 4px; }
.training-summary .total { font-size: 1.65em; font-weight: 800; color: #ffffff; font-family: 'Courier New', monospace; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.training-summary .breakdown { font-size: 0.78em; color: rgba(255,255,255,0.85); margin-top: 4px; }
.training-summary .kcal-estimate {
    font-size: 0.95em; font-weight: 700; color: rgba(255,255,255,0.95);
    margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(255,255,255,0.3);
}

/* === REJILLA 2x2 PARA LOS CONTROLES - Premium Dark Glass === */
.setting-row {
    width: 48%;
    margin: 1%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px; border: 1px solid rgba(255, 215, 0, 0.15); box-shadow: 0 4px 15px rgba(0,0,0,0.3); background: linear-gradient(135deg, rgba(20,20,30,0.8), rgba(10,10,20,0.95)); /* rectangulo */
    border: 1px solid rgba(255, 255, 255, 0.08);

    padding: 12px 10px;
    min-height: 72px;
    box-sizing: border-box;
}

.setting-row:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }

/* ── Audio Modal — iOS Clean Cyan ───────────────────────────────────────── */
.audio-modal-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 24px 60px rgba(0, 0, 0, 0.14);
    padding: 24px 20px 20px;
    width: min(340px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #1e293b;
}

/* Header */
.audio-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.audio-modal-title {
    font-size: 0.72em;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #334155;
    text-shadow: none;
}

.audio-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1em;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.audio-modal-close:hover {
    color: #00b8d4;
    background: rgba(0, 229, 255, 0.08);
}

/* ── 4-Panel cards ── */
.audio-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audio-section-label {
    font-size: 0.58em;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
}

/* Play / Stop CTA */
.audio-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 0;
    border-radius: 99px;
    border: none;
    background: linear-gradient(135deg, #00e5ff 0%, #00b8d4 100%);
    color: #0f172a;
    font-size: 0.88em;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    text-shadow: none;
    box-shadow: 0 2px 12px rgba(0, 229, 255, 0.35);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.audio-play-btn:hover {
    background: linear-gradient(135deg, #18eeff 0%, #00cfe8 100%);
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.45);
}
.audio-play-btn:active {
    transform: scale(0.97);
    background: linear-gradient(135deg, #00c8e0 0%, #0099b3 100%);
    box-shadow: 0 1px 6px rgba(0, 229, 255, 0.25);
}

.audio-play-icon { font-size: 1em; }

/* Volume row */
.audio-vol-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Sliders Premium ── */
.audio-vol-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(
        to right,
        #00b8d4 0%,
        #00b8d4 calc(var(--vol, 100) * 1%),
        #e2e8f0 calc(var(--vol, 100) * 1%),
        #e2e8f0 100%
    );
    box-shadow: none;
    outline: none;
    cursor: pointer;
}
.audio-vol-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #00b8d4;
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.14),
        0 0 0 3px rgba(0, 229, 255, 0.12);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.audio-vol-row input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.20);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.14),
        0 0 0 5px rgba(0, 229, 255, 0.22);
}
.audio-vol-row input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #00b8d4;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
    cursor: pointer;
}

.audio-vol-pct {
    font-size: 0.78em;
    font-weight: 700;
    color: #00b8d4;
    min-width: 38px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    text-shadow: none;
}

/* Mode toggle — pill moderno */
.audio-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.audio-mode-btn {
    padding: 9px 8px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.76em;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.audio-mode-btn.active {
    background: #ffffff;
    color: #00b8d4;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
    text-shadow: none;
}

/* Close button — scoped al audio modal */
#audioModal .btn-close {
    background: transparent;
    border: 1.5px solid #e2e8f0;
    color: #1e293b;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.82em;
    letter-spacing: 0.04em;
    padding: 10px 0;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    box-shadow: none;
}
#audioModal .btn-close:hover {
    border-color: #00b8d4;
    background: rgba(0, 229, 255, 0.10);
    color: #00b8d4;
}

/* Sombra base en las tarjetas del panel */
.setting-row {
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    transition: box-shadow 0.25s ease, transform 0.15s ease;
}

/* Labels - elegantes, espaciados */
.setting-label {
    font-size: 0.62em;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
    width: 100%;
}

/* Counter row — ancho automático: no rellena el panel, se centra por el padre */
.counter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 0;
    gap: 2px;
}

/* Flechas — diseño premium cian (sobrescritas por el bloque estilizado m?s abajo) */
        .counter-btn {
            width: 32px;
            height: 32px;
            flex-shrink: 0;
            border-radius: 50%;
            background: linear-gradient(
                145deg,
                rgba(0, 180, 230, 0.22) 0%,
                rgba(0, 70, 130, 0.30) 100%
            );
            border: 1px solid rgba(0, 229, 255, 0.55);
            color: #00e5ff;
            font-size: 0.88em;
            font-weight: normal;
            line-height: 1;
            padding: 0;
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45),
                        0 0 10px rgba(0, 229, 255, 0.22),
                        inset 0 1px 0 rgba(0, 229, 255, 0.28);
            transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
        }

.counter-btn:hover {
    background: linear-gradient(
        145deg,
        rgba(0, 210, 255, 0.30) 0%,
        rgba(0, 90, 160, 0.38) 100%
    );
    border-color: rgba(0, 229, 255, 0.80);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45),
                0 0 16px rgba(0, 229, 255, 0.38),
                inset 0 1px 0 rgba(0, 229, 255, 0.38);
}

.counter-btn:active {
    transform: scale(0.88);
    background: linear-gradient(
        145deg,
        rgba(0, 229, 255, 0.30) 0%,
        rgba(0, 100, 180, 0.40) 100%
    );
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.40),
                0 0 8px rgba(0, 229, 255, 0.28);
}

/* N?mero central */
.counter-value {
    font-size: 1.5em;
    min-width: 32px;
    width: auto;
    flex-shrink: 0;
    text-align: center;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    line-height: 1;
}

        /* Kcal Goal Section - cristal oscuro con chispas ascendentes */
        .kcal-goal-section {
            margin-top: 8px;
            margin-left: 0;
            margin-right: 0;
            padding: 10px 15px;
            width: 100% !important;
            max-width: 100%;
            box-sizing: border-box !important;
            background: rgba(0, 0, 0, 0.25);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: 12px; border: 1px solid rgba(255, 215, 0, 0.15); box-shadow: 0 4px 15px rgba(0,0,0,0.3); background: linear-gradient(135deg, rgba(20,20,30,0.8), rgba(10,10,20,0.95)); /* rectangulo */
            border: 1px solid rgba(255, 255, 255, 0.08);
            position: relative;
            overflow: hidden;
            z-index: 1;
        }

        /* Sin pseudo-elementos: las chispas son los .fire-particle divs */
        .kcal-goal-section::before,
        .kcal-goal-section::after { content: none; }

        /* Chispas/brasas ascendentes ? sutiles y elegantes */
        .fire-particles {
            display: block;
            position: absolute;
            inset: 0;
            pointer-events: none;
            overflow: hidden;
            z-index: 0;
        }

        @keyframes emberRise {
            0%   { transform: translateY(0) translateX(0);    opacity: 0; }
            20%  { opacity: 0.65; }
            80%  { opacity: 0.2; }
            100% { transform: translateY(-48px) translateX(4px); opacity: 0; }
        }

        .fire-particle {
            position: absolute;
            bottom: 4px;
            width: 3px;
            height: 3px;
            border-radius: 50%;
            background: radial-gradient(circle, #fff9c4 0%, #ffb300 55%, #ff5722 100%);
            box-shadow: 0 0 4px 1px rgba(255, 160, 0, 0.5);
            opacity: 0;
            animation: emberRise 3.2s ease-in infinite;
        }

        .fire-particle:nth-child(1) { left: 8%;  animation-delay: 0s;    animation-duration: 3.4s; }
        .fire-particle:nth-child(2) { left: 22%; animation-delay: 0.6s;  animation-duration: 2.8s; }
        .fire-particle:nth-child(3) { left: 38%; animation-delay: 1.2s;  animation-duration: 3.7s; }
        .fire-particle:nth-child(4) { left: 54%; animation-delay: 0.3s;  animation-duration: 3.1s; }
        .fire-particle:nth-child(5) { left: 70%; animation-delay: 0.9s;  animation-duration: 2.9s; }
        .fire-particle:nth-child(6) { left: 85%; animation-delay: 1.6s;  animation-duration: 3.5s; }

        .kcal-goal-title {
            font-family: system-ui, -apple-system, sans-serif;
            font-size: 0.9rem;
            font-weight: 600;
            color: #ffffff;
            margin: 0;
            /* El t?tulo CEDE espacio al input-row para que el bot?n nunca se corte */
            flex: 1 1 auto;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* Fila interna - z-index 2 ? siempre sobre las chispas */
        .kcal-goal-inner {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            width: 100%;
            box-sizing: border-box;
            flex-wrap: nowrap;
            overflow: hidden;
            position: relative;
            z-index: 2;
        }

        .kcal-goal-input-row {
            display: flex;
            align-items: center;
            gap: 6px;
            /* Nunca encoge: input + bot?n siempre visibles */
            flex: 0 0 auto;
            margin-bottom: 0;
        }

        /* Input limpio ? solo el n?mero, sin texto extra */
        .kcal-goal-input {
            width: 60px !important;
            min-width: 50px;
            height: 34px;
            padding: 4px 6px;
            background: rgba(255, 255, 255, 0.15) !important;
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 8px;
            font-size: 1rem;
            font-weight: bold;
            text-align: center;
            color: #ffffff !important;
            font-family: system-ui, -apple-system, sans-serif;
            flex: 0 0 auto;
        }

        /* Ocultar flechas nativas del input[type=number] */
        .kcal-goal-input::-webkit-inner-spin-button,
        .kcal-goal-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
        .kcal-goal-input { appearance: textfield; -moz-appearance: textfield; }

        .kcal-goal-input:focus {
            outline: none;
            border-color: rgba(255, 75, 75, 0.6);
            background: rgba(255, 255, 255, 0.15);
        }

        .kcal-goal-input::placeholder {
            color: rgba(255, 255, 255, 0.45);
            font-size: 0.75em;
        }

        .kcal-goal-unit { display: none; }
        .kcal-goal-result { display: none; }

        /* Bot?n blindado ? nunca encoge, nunca se corta */
        .kcal-goal-btn {
            height: 34px;
            padding: 0 15px;
            margin: 0;
            background: rgba(0, 195, 255, 0.10);
            color: #00d4ff;
            border: 1px solid rgba(0, 195, 255, 0.40);
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 700;
            flex-shrink: 0 !important;
            white-space: nowrap;
            box-shadow: inset 0 0 8px rgba(0, 195, 255, 0.06);
            cursor: pointer;
            transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
            font-family: system-ui, -apple-system, sans-serif;
            text-shadow: 0 0 6px rgba(0, 212, 255, 0.40);
            letter-spacing: 0.04em;
        }

        .kcal-goal-btn:hover {
            background: rgba(0, 195, 255, 0.18);
            border-color: rgba(0, 195, 255, 0.70);
            box-shadow: 0 0 10px rgba(0, 195, 255, 0.40), inset 0 0 8px rgba(0, 195, 255, 0.08);
        }

        .kcal-goal-btn:active {
            transform: scale(0.96);
            background: rgba(0, 195, 255, 0.24);
        }
        .counter {
            display: flex;
            align-items: center;
            justify-content: center;
            width: auto;
            gap: 2px;
            padding: 0;
        }

        /* Counter buttons — premium cian táctil */
        .counter-btn {
            width: 32px;
            height: 32px;
            flex-shrink: 0;
            border-radius: 50%;
            background: linear-gradient(
                145deg,
                rgba(0, 180, 230, 0.22) 0%,
                rgba(0, 70, 130, 0.30) 100%
            );
            border: 1px solid rgba(0, 229, 255, 0.55);
            color: #00e5ff;
            font-size: 0.88em;
            font-weight: normal;
            line-height: 1;
            padding: 0;
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45),
                        0 0 10px rgba(0, 229, 255, 0.22),
                        inset 0 1px 0 rgba(0, 229, 255, 0.28);
            transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
            position: relative;
            overflow: hidden;
        }

        .counter-btn:hover {
            background: linear-gradient(
                145deg,
                rgba(0, 210, 255, 0.30) 0%,
                rgba(0, 90, 160, 0.38) 100%
            );
            border-color: rgba(0, 229, 255, 0.80);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45),
                        0 0 16px rgba(0, 229, 255, 0.38),
                        inset 0 1px 0 rgba(0, 229, 255, 0.38);
        }

        .counter-btn:active {
            transform: scale(0.88);
            background: linear-gradient(
                145deg,
                rgba(0, 229, 255, 0.30) 0%,
                rgba(0, 100, 180, 0.40) 100%
            );
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.40),
                        0 0 8px rgba(0, 229, 255, 0.28);
        }

        /* N?mero central - limpio, sin animaci?n pulsante */
        .counter-value {
            min-width: 32px;
            width: auto;
            flex-shrink: 0;
            text-align: center;
            font-size: 1.5em;
            font-weight: 800;
            color: #ffffff;
            text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
            letter-spacing: 0.5px;
            line-height: 1;
        }

        /* Mode Buttons - Quick-Action bar, ahora al fondo */
        .mode-buttons {
            margin-top: 6px;
            margin-bottom: 0;
        }

        .mode-grid {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            width: 100%;
        }

        .mode-grid.three-cols {
            /* sobrescribe el grid con flex para distribuir equitativamente */
            display: flex;
            gap: 8px;
        }

        .mode-btn {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 8px 4px;
            background: linear-gradient(
                145deg,
                rgba(8, 18, 55, 0.82) 0%,
                rgba(18, 8, 48, 0.74) 100%
            );
            border: 1px solid rgba(0, 229, 255, 0.15);
            border-radius: var(--mode-btn-radius);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.40),
                        inset 0 1px 0 rgba(0, 229, 255, 0.06);
            cursor: pointer;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            transition: background 0.25s ease, border-color 0.25s ease,
                        box-shadow 0.25s ease, transform 0.15s ease;
        }

        .mode-btn:hover {
            background: linear-gradient(
                145deg,
                rgba(10, 28, 80, 0.92) 0%,
                rgba(22, 12, 62, 0.84) 100%
            );
            border-color: rgba(0, 229, 255, 0.38);
            box-shadow: 0 4px 18px rgba(0, 0, 0, 0.50),
                        0 0 10px rgba(0, 229, 255, 0.14),
                        inset 0 1px 0 rgba(0, 229, 255, 0.10);
            transform: translateY(-1px);
        }

        .mode-btn:active {
            transform: scale(0.95);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.40);
        }

        /* Botón seleccionado: neón encendido con pulso de luz */
        .mode-btn.active {
            background: linear-gradient(
                145deg,
                rgba(0, 38, 100, 0.92) 0%,
                rgba(12, 18, 72, 0.88) 100%
            );
            border-color: rgba(0, 229, 255, 0.65);
            box-shadow: 0 0 15px rgba(0, 229, 255, 0.40),
                        0 4px 14px rgba(0, 0, 0, 0.50),
                        inset 0 1px 0 rgba(0, 229, 255, 0.22);
            will-change: filter;
            animation: pulseGlow 2.6s ease-in-out infinite;
        }

        /* El texto activo permanece blanco — no oscuro */
        .mode-btn.active .mode-name,
        .mode-btn.active .mode-desc {
            color: #ffffff;
        }

        /* Latido de luz neón solo en el estado activo — compositor-only via opacity */
        @keyframes pulseGlow {
            0%, 100% { opacity: 0.88; }
            50%       { opacity: 1.0; }
        }

        .mode-icon {
            font-size: 1.25em;
            margin-bottom: 2px;
        }

        .mode-name {
            font-size: 0.8em;
            font-weight: 700;
            color: rgba(210, 240, 255, 0.95);
        }

        .mode-desc {
            font-size: 0.65em;
            color: rgba(160, 210, 240, 0.80);
            margin-top: 2px;
        }

        /* Profile Modal */
        .modal-overlay {
            position: fixed;
            inset: 0;
            /* backdrop-filter eliminado: blurear el fondo animado (aurora) causaba jank en móviles.
               Compensamos con overlay más oscuro para mantener el contraste del modal. */
            background: rgba(0,0,0,0.72);
            z-index: 2000;
            display: none;
            content-visibility: hidden;
            justify-content: center;
            align-items: center;
            /* Safe-area: respeta notch arriba y barra de nav abajo en iOS */
            padding: max(20px, env(safe-area-inset-top, 20px))
                     max(15px, env(safe-area-inset-right, 15px))
                     max(20px, env(safe-area-inset-bottom, 20px))
                     max(15px, env(safe-area-inset-left, 15px));
        }

        .modal-overlay.show { 
            display: flex; 
            content-visibility: visible;
        }

        .modal-content {
            background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
            border-radius: 24px;
            padding: 20px 18px 15px;
            max-width: 380px;
            width: 100%;
            text-align: center;
        }

        /* -- Flexbox scroll structure: Profile + Stats ----------- */
        #profileModal .modal-content,
        #statsModal .modal-content {
            height: fit-content;
            /* dvh = viewport visual real en iOS Safari (excluye barra del nav) */
            max-height: calc(100vh - 40px);          /* fallback */
            max-height: calc(100dvh - 40px);         /* moderno */
            display: flex;
            flex-direction: column;
            overflow: hidden;
            border-radius: 20px;
            padding-bottom: 15px;
        }

        /* Scrollable body — Stats: scroll habilitado; Profile: bloqueado abajo */
        .modal-scroll-body {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            scrollbar-width: none;
            padding-right: 2px;
        }
        .modal-scroll-body::-webkit-scrollbar { display: none; }

        /* 1. Profile: sin scroll — el modal se ajusta al contenido */
        #profileModal .modal-content   { height: auto; }
        #profileModal .modal-scroll-body {
            overflow-y: clip;   /* corta sin crear scroll container */
            flex: 0 0 auto;     /* no estira: el modal crece con el contenido */
        }

        /* 2. Stats: override pwa-optimizations.css:292 (flex-shrink:0) que rompía
           el patrón flex-column scroll. Sin estas dos propiedades, el body
           scrollable no se encogía a la altura disponible del padre y el
           contenido sobresalía recortado por el overflow:hidden de .modal-content
           sin generar scrollbar interno. */
        #statsModal .modal-scroll-body {
            flex-shrink: 1;
            min-height: 0;
        }
        /* Compactar verticalmente para que todo quepa en una pantalla */
        /* ── Auth loader — visible mientras Firebase no ha resuelto ── */
        .profile-auth-loader {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 14px 0;
            color: rgba(255, 255, 255, 0.65);
            font-size: 0.88rem;
            letter-spacing: 0.02em;
        }
        .profile-auth-spinner {
            display: inline-block;
            width: 16px;
            height: 16px;
            border: 2px solid rgba(255, 255, 255, 0.2);
            border-top-color: rgba(255, 255, 255, 0.75);
            border-radius: 50%;
            animation: profileSpinnerRotate 0.75s linear infinite;
            flex-shrink: 0;
        }
        @keyframes profileSpinnerRotate {
            to { transform: rotate(360deg); }
        }
        /* ─────────────────────────────────────────────────────────── */

        #profileModal .google-auth-section { margin-bottom: 2px; }
        #profileModal .profile-divider     { margin: 4px 0 2px; }
        #profileModal .profile-form        { margin-bottom: 4px; }
        #profileModal .form-row            { padding: 2px 0; margin-bottom: 4px; }
        #profileModal .form-grid-row       { margin-bottom: 4px; }
        #profileModal .form-input          { height: 30px; font-size: 0.88em; }
        #profileModal .imc-display         { margin: 4px 0 2px; }

        /* Footer - empujado al fondo naturalmente por el flex, sin sticky */
        .modal-footer {
            flex-shrink: 0;
            padding: 8px 0 0;
            margin-bottom: 0 !important;
            padding-bottom: 0;
            background: inherit;
        }

        /* Stats Dashboard: overflow e height se manejan por #statsModal .modal-content */

        /* Divisor entre Stats y Journey */
        .stats-journey-divider {
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(0,0,0,0.12), transparent);
            margin: 8px 0 8px;
        }

        .modal-title { font-size: 1.2em; font-weight: 700; color: var(--dark); margin-bottom: 10px; flex-shrink: 0; }

        .stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
            margin-bottom: 8px;
        }

        .stat-card {
            background: var(--primary);
            border-radius: 10px;
            padding: 8px 10px;
            color: white;
        }

        .stat-value { font-size: 1.4em; font-weight: 800; font-family: 'Courier New', monospace; }
        .stat-label { font-size: 0.68em; opacity: 0.9; margin-top: 2px; }

        .kcal-stats {
            background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(192, 57, 43, 0.1) 100%);
            border-radius: 10px;
            padding: 7px 10px;
            margin-bottom: 8px;
        }

        .kcal-stat-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 5px 0;
        }

        .kcal-stat-row:first-child {
            border-bottom: 1px solid rgba(231, 76, 60, 0.2);
        }

        .kcal-stat-label {
            font-size: 0.85em;
            font-weight: 600;
            color: var(--dark);
        }

        .kcal-stat-value {
            font-size: 1.05em;
            font-weight: 800;
            color: #e74c3c;
            font-family: 'Courier New', monospace;
        }

        .btn-close {
            width: 100%;
            padding: 9px;
            background: linear-gradient(135deg, #ff4757 0%, #ff6348 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 0.9em;
            font-weight: 700;
            cursor: pointer;
        }

        /* -- Google Auth Section -------------------------------- */

        .google-auth-section {
            margin-bottom: 4px;
        }

        /* Bot?n Sign In con Google */
        .btn-google-signin {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            padding: 8px 14px;
            background: #202124;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 10px;
            color: #e8eaed;
            font-size: 0.84em;
            font-weight: 600;
            cursor: pointer;
            letter-spacing: 0.01em;
            transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
            box-shadow: 0 1px 3px rgba(0,0,0,0.35);
        }

        .btn-google-signin:hover,
        .btn-google-signin:focus-visible {
            background: #2c2e31;
            border-color: rgba(255,255,255,0.22);
            box-shadow: 0 4px 16px rgba(0,0,0,0.45);
        }

        .btn-google-signin:active {
            background: #18191c;
            box-shadow: 0 1px 4px rgba(0,0,0,0.5);
        }

        .google-icon {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
        }

        /* Estado conectado - tarjeta de usuario */
        .google-user-info {
            display: none;          /* JS muestra esto cuando est? logueado */
            align-items: center;
            gap: 8px;
            padding: 7px 12px;
            background: #202124;
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 10px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.3);
        }

        /* Cuando el padre tiene .logged-in: ocultar bot?n, mostrar tarjeta */
        .google-auth-section.logged-in .btn-google-signin {
            display: none;
        }
        .google-auth-section.logged-in .google-user-info {
            display: flex;
        }

        .google-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
            border: 2px solid rgba(255,255,255,0.15);
        }

        .google-user-details {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            flex: 1;
            min-width: 0;
        }

        .google-user-name {
            font-size: 0.88em;
            font-weight: 700;
            color: #e8eaed;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        .google-user-email {
            font-size: 0.78em;
            color: #9aa0a6;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        /* Bot?n de cerrar sesi?n - icono sutil */
        .btn-google-signout {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            background: transparent;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 8px;
            color: #9aa0a6;
            cursor: pointer;
            transition: background 0.2s, color 0.2s, box-shadow 0.2s;
        }

        .btn-google-signout:hover {
            background: rgba(234,67,53,0.15);
            border-color: rgba(234,67,53,0.4);
            color: #ea4335;
            box-shadow: 0 2px 8px rgba(234,67,53,0.2);
        }

        /* Luna: indicador de sesi?n guardada */
        .google-saved-indicator {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            gap: 6px;
            padding: 10px 0 4px;
        }
        .google-saved-moon {
            font-size: 2rem;
            cursor: default;
            animation: moonPop 0.55s cubic-bezier(0.34,1.56,0.64,1) forwards;
            filter: drop-shadow(0 0 8px rgba(74,222,128,0.7));
        }
        .google-saved-moon.moon-idle {
            /* estado est?tico: sin re-animar, solo glow suave */
            animation: none;
            filter: drop-shadow(0 0 5px rgba(74,222,128,0.4));
        }
        .google-saved-text {
            font-size: 0.78rem;
            color: #4ade80;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-align: center;
            opacity: 0;
            transform: scale(0.8) translateY(6px);
            animation: epicTextIn 0.5s 0.28s cubic-bezier(0.34,1.56,0.64,1) forwards;
            text-shadow: 0 0 10px rgba(74,222,128,0.95), 0 0 22px rgba(74,222,128,0.5);
        }
        .google-saved-text.hide {
            animation: savedTextOut 0.45s ease-in forwards;
        }

        /* Divisor entre secci?n Google y datos del luchador */
        .profile-divider {
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 8px 0 4px;
        }

        .profile-divider::before,
        .profile-divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: rgba(0,0,0,0.1);
        }

        .profile-divider-label {
            font-size: 0.75em;
            font-weight: 700;
            color: #9aa0a6;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            white-space: nowrap;
        }

        /* Dark-mode: los elementos sobre fondo oscuro ya encajan
           (btn-google-signin usa #202124 que es nativo dark),
           solo ajustar el divisor */
        body.dark-mode .profile-divider::before,
        body.dark-mode .profile-divider::after {
            background: rgba(255,255,255,0.1);
        }

        /* -- fin Google Auth Section ----------------------------- */

        /* Profile Form */
        .profile-form {
            margin-bottom: 6px;
        }

        /* Fila completa (Nombre del luchador) */
        .form-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 4px 0;
            border-bottom: 1px solid rgba(0,0,0,0.1);
            margin-bottom: 6px;
        }

        .form-row:last-child {
            border-bottom: none;
        }

        /* Fila de 2 columnas (Peso/Altura, Edad/Sexo) */
        .form-grid-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 6px;
        }

        .form-grid-cell {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .form-label {
            font-size: 0.72em;
            font-weight: 700;
            color: var(--dark);
            text-align: left;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            opacity: 0.65;
        }

        /* Input base */
        .form-input {
            width: 100%;
            box-sizing: border-box;
            height: 34px;
            padding: 0 8px;
            border: 1.5px solid rgba(102, 126, 234, 0.3);
            border-radius: 8px;
            font-size: 0.92em;
            font-weight: 600;
            text-align: center;
            background: white;
            color: var(--dark);
        }

        /* Fighter Name input - un poco m?s ancho */
        .form-row .form-input {
            width: 130px;
            height: 34px;
        }

        .form-input:focus {
            outline: none;
            border-color: #667eea;
        }

        /* Sex toggle - ocupa todo el ancho de su celda */
        .sex-toggle {
            display: flex;
            gap: 2px;
            width: 100%;
        }

        .sex-btn {
            flex: 1;
            height: 34px;
            padding: 0;
            border: 1.5px solid rgba(102, 126, 234, 0.3);
            border-radius: 8px;
            background: white;
            font-size: 0.82em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--dark);
        }

        .sex-btn.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-color: transparent;
            color: white;
        }

        /* IMC - franja ultra-fina */
        .imc-display {
            display: flex;
            align-items: center;
            gap: 8px;
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
            border-radius: 8px;
            padding: 5px 10px;
            margin-bottom: 6px;
        }

        .imc-label {
            font-size: 0.68em;
            font-weight: 700;
            color: #636e72;
            flex-shrink: 0;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .imc-value {
            font-size: 1.25em;
            font-weight: 800;
            color: var(--dark);
            font-family: 'Courier New', monospace;
            flex-shrink: 0;
        }

        .imc-status {
            font-size: 0.73em;
            font-weight: 600;
            flex: 1;
            text-align: right;
        }

        .imc-status.underweight { color: #3498db; }
        .imc-status.normal { color: #27ae60; }
        .imc-status.overweight { color: #f39c12; }
        .imc-status.obese { color: #e74c3c; }

        .btn-save {
            width: 100%;
            padding: 9px;
            background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 0.9em;
            font-weight: 700;
            cursor: pointer;
            margin-bottom: 6px;
        }

        .btn-save:active {
            transform: scale(0.98);
        }

        /* Fullscreen Timer */
        .fullscreen-timer {
            /* display:flex siempre activo — el browser computa el layout del timer
               y promueve sus capas al GPU en el lobby, ANTES de que el usuario toque START.
               Al añadir body.timer-active, el GPU solo actualiza el blend de la capa:
               0ms de layout, 0ms de paint → primer frame aparece en el mismo vsync del tap.
               will-change:opacity reserva una capa compuesta propia para el contenedor.
               visibility:hidden + pointer-events:none ocultan el elemento e impiden clics
               sin sacarlo del árbol de render (que es lo que queremos). */
            display: flex;
            visibility: hidden;
            opacity: 0;
            pointer-events: none;
            will-change: opacity;
            position: fixed;
            inset: 0;
            flex-direction: column;
            /* contain:layout paint: cambios internos no provocan reflow fuera del timer.
               NO usamos contain:strict porque .fs-round tiene position:fixed y
               contain:size rompería su posicionamiento relativo al viewport. */
            contain: layout paint;
            justify-content: flex-start;
            align-items: center;
            padding-top: calc(var(--safe-top) + 100px);
            padding-left: 20px;
            padding-right: 20px;
            padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 220px);
            cursor: pointer;
            z-index: 1500; /* Aumentado para estar por encima de celebration-text */
        }

        body.timer-active .fullscreen-timer {
            visibility: visible;
            opacity: 1;
            pointer-events: auto;
        }

        .fs-round {
            position: fixed;
            top: calc(var(--safe-top) + 20px);
            left: 50%;
            transform: translateX(-50%);
            font-size: 2em;
            font-weight: 700;
            color: rgba(255,255,255,0.9);
            text-transform: uppercase;
            letter-spacing: 3px;
            z-index: 510;
        }

        .fs-status {
    font-size: 2em;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 30px;
        }
            /* ============ ?? MODO PELEA: VERSI?N SEGURA (FIX TABLA Y EFECTOS) ============ */

        /* ============ ?? MODO PELEA FINAL (ESTRUCTURA + DISE?O) ============ */

/* ============ ?? DISE?O FIGHT: EXPLOSI?N RADIAL (VERSI?N FINAL BLINDADA) ============ */

        /* 1. CONTENEDOR PRINCIPAL (La pantalla de pelea) */
        body.fighting .fullscreen-timer {
            /* POSICIONAMIENTO: Cubrir pantalla completa y tapar todo */
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100vw !important;
            height: 100vh !important;
            z-index: 9999 !important; /* Encima de todo (incluida la tabla) */

            /* ESTRUCTURA: Centrar todo */
            display: flex !important;
            flex-direction: column !important;
            justify-content: center !important;
            align-items: center !important;

            /* FONDO: Rojo oscuro (Importante: NO transparente, para tapar la tabla) */
            background-color: #1a0000 !important;
            overflow: hidden !important;
            margin: 0 !important;
            padding: 0 !important;
        }

        /* 2. EFECTO RADAR (Explosi?n Giratoria) */
        /* Lo aplicamos dentro del timer para asegurar que se vea */
        body.fighting .fullscreen-timer::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(2.5);
            width: 100vw;
            height: 100vh;

            /* El dise?o que te gusta: Radar Rojo */
            background: conic-gradient(
                from 0deg,
                #ff0000, #990000, #ff0000, #990000,
                #ff0000, #990000, #ff0000, #990000, #ff0000
            );
            opacity: 0.15;
            animation: none; /* FIX QUIRÚRGICO: Fondo estático */
            z-index: 1; /* Fondo nivel 1 */
            pointer-events: none;
        }

        @keyframes fightExplode {
            0% { transform: translate(-50%, -50%) rotate(0deg); }
            100% { transform: translate(-50%, -50%) rotate(360deg); }
        }

        /* 3. GLOW CENTRAL (Pulso) */
        body.fighting .fullscreen-timer::after {
            content: '';
            position: absolute;
            /* Posicionamiento estático separado del transform animado.
               Antes: translate(-50%,-50%) vivía dentro del @keyframes → se recalculaba cada frame.
               Ahora: el centrado es CSS puro (top/left/margin), y el keyframe solo mueve scale+opacity,
               que son las únicas propiedades 100% compositables sin reflow. */
            top: 50%;
            left: 50%;
            margin-top: -40vw;
            margin-left: -40vw;
            width: 80vw;
            height: 80vw;
            background: radial-gradient(circle, rgba(255,0,0,0.4) 0%, transparent 70%);
            animation: fightCenterPulse 1.5s ease-in-out infinite;
            will-change: transform, opacity; /* promueve a capa GPU dedicada */
            z-index: 2;
            pointer-events: none;
        }

        @keyframes fightCenterPulse {
            /* Solo transform:scale + opacity — ambas compositables por GPU sin reflow */
            0%, 100% { transform: scale(1);   opacity: 0.4; }
            50%       { transform: scale(1.3); opacity: 0.7; }
        }

        /* 4. TEXTOS (Encima de los efectos) */
        body.fighting .fs-status {
            position: relative;
            z-index: 100 !important; /* Muy arriba */

            font-size: clamp(40px, 10vw, 70px) !important;
            font-weight: 900 !important;
            color: white !important;
            text-shadow: 0 0 30px #ff0000, 0 0 60px #ff0000 !important;

            width: 100% !important;
            text-align: center !important;
            margin-bottom: 2vh !important;
            display: block !important;
            visibility: visible !important;

            /* Reset visual */
            -webkit-text-fill-color: white !important;
            background: none !important;
        }

        body.fighting .fs-time {
            position: relative;
            z-index: 100 !important; /* Muy arriba */

            font-size: clamp(80px, 15vh, 120px) !important;
            line-height: 0.9 !important;
            color: white !important;
            text-shadow: 0 0 30px rgba(255,0,0,0.6) !important;
            font-family: 'Courier New', monospace !important;
            font-weight: bold !important;

            width: 100% !important;
            text-align: center !important;
            margin: 0 !important;
        }

        /* 5. SEGURIDAD: Ocultar expl?citamente la tabla y otros elementos */
        body.fighting .celebration-text,
        body.fighting .fs-round,
        body.fighting .vignette-overlay,
        body.fighting .comments-table, /* <-- Oculta la tabla */
        body.fighting .history-log {   /* <-- Oculta el historial */
            display: none !important;
        }

        /* Frases motivacionales visibles durante el combate */
        body.fighting .quote-box,
        body.fighting .fs-quote {
            display: block !important;
            opacity: 1 !important;
            visibility: visible !important;
        }

        .fs-time {
            font-size: clamp(80px, 15vh, 120px);
            font-weight: 900;
            color: white;
            font-family: 'Courier New', monospace;
            text-shadow: 0 10px 50px rgba(0,0,0,0.5);
            line-height: 1;
        }

        .fs-center-block {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
        }

        .fs-quote {
            position: relative;
            align-self: center;
            width: 90%;
            max-width: 600px;
            z-index: 10001;
            background: rgba(0,0,0,0.2);
            backdrop-filter: blur(10px);
            border-radius: 12px; border: 1px solid rgba(255, 215, 0, 0.15); box-shadow: 0 4px 15px rgba(0,0,0,0.3); background: linear-gradient(135deg, rgba(20,20,30,0.8), rgba(10,10,20,0.95)); /* rectangulo */
            padding: 20px;
            color: white;
            font-style: italic;
            text-align: center;
        }

/* ============ ?? CHISPAS FINAS Y VISIBLES (FINAL) ============ */
.fire-spark {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #ff6600; /* Naranja fuego */
    border-radius: 50%;
    pointer-events: none;

    /* Z-INDEX 20000: Para que floten ENCIMA de la pantalla roja */
    z-index: 20000 !important;

    /* Brillo m?s peque?o para que parezca ascua, no mancha */
    box-shadow:
        0 0 4px #ff6600,
        0 0 8px #ff3300;

    animation: sparkRise linear forwards;
    will-change: transform, opacity;
}

@keyframes sparkRise {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        /* Suben hasta arriba del todo */
        transform: translateY(-100vh) scale(0.5);
    }
}

        .fs-quote .quote-text { margin-bottom: 10px; }
        .fs-quote .quote-author { font-style: normal; font-weight: 700; opacity: 0.8; }

        .blinking { animation: blink 0.4s ease-in-out infinite; }


 /* ============ PREPARING LAYOUT ============ */
        .fs-preparing-layout {
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 25px;
        }

        /* Mostrar layout de preparing (número gigante + hourglass) */
        body.preparing .fs-preparing-layout { display: flex !important; }
        /* Ocultar el reloj "0:08" durante preparing — prepNumber lo reemplaza */
        body.preparing .fs-time { display: none !important; }
        body.preparing .fs-status { font-size: clamp(40px, 10vw, 70px) !important; }

        .hourglass { display: none !important; }

        .prep-number {
            font-size: clamp(80px, 15vh, 120px) !important;
            font-weight: 900;
            color: #FFFFFF !important;
            font-family: 'Courier New', monospace;
            text-shadow: 0 0 20px rgba(0, 255, 0, 0.7) !important;
            line-height: 1;
            animation: numberPulse 1s ease-in-out infinite;
            image-rendering: pixelated;
        }

        @keyframes numberPulse {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.05);
                filter: brightness(1.2);
            }
        }


        /* GPU-only: transform+opacity (text-shadow removed — expensive paint) */
        @keyframes fightGlow {
            0%, 100% { transform: scale(1);    opacity: 0.85; }
            50%       { transform: scale(1.05); opacity: 1; }
        }

        /* BREATHE status - Ice text design */
       body.resting .fs-status {
    font-size: clamp(40px, 10vw, 70px) !important;
    font-weight: 900;
    letter-spacing: 8px;
    text-align: center;
    width: 100%;
    position: relative;
    left: 0;
    transform: none;
    margin: 20px auto;
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        #e0f7fa 20%,
        #80deea 40%,
        #4dd0e1 60%,
        #00bcd4 80%,
        #0097a7 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 5px rgba(0, 188, 212, 0.4));
}
        @keyframes iceText {
            0%, 100% {
                transform: translate(-50%, -50%) scale(1);
                filter: drop-shadow(0 0 5px rgba(0, 188, 212, 0.4));
            }
            50% {
                transform: translate(-50%, -50%) scale(1.03);
                filter: drop-shadow(0 0 8px rgba(0, 188, 212, 0.5));
            }
        }

        @keyframes iceText {
            0%, 100% {
                transform: scale(1);
                filter: drop-shadow(0 0 5px rgba(0, 188, 212, 0.4));
            }
            50% {
                transform: scale(1.03);
                filter: drop-shadow(0 0 8px rgba(0, 188, 212, 0.5));
            }
        }

        /* BREATHE number - Water effect */
      /* ============ BREATHE number - Clean Fix ============ */
        body.resting .fs-time {
            font-size: clamp(80px, 15vh, 120px) !important;
            color: #ffffff !important; /* Color de respaldo */
            background: linear-gradient(90deg, #ffffff, #e0f7fa, #ffffff) !important;
            background-size: 200% 100% !important;

            /* Propiedades de recorte para el degradado */
            -webkit-background-clip: text !important;
            background-clip: text !important; /* Versi?n est?ndar para evitar el error */
            -webkit-text-fill-color: transparent !important;

            animation: waterWave 3s ease-in-out infinite !important;
            filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4)) !important;
        }

        @keyframes waterWave {
            0% {
                background-position: 100% 0;
                transform: scale(1);
            }
            50% {
                transform: scale(1.02);
            }
            100% {
                background-position: -100% 0;
                transform: scale(1);
            }
        }



        @keyframes windLines {
            0% { transform: translateX(0); }
            100% { transform: translateX(50%); }
        }

        /* Leaves container */
        .wind-leaves {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 2;
            overflow: hidden;
        }

        body.resting .wind-leaves { display: block; }

        .leaf {
            position: absolute;
            font-size: 24px;
            opacity: 0.7;
            animation: leafBlow linear infinite;
        }

        .leaf:nth-child(1) { top: 10%; left: -50px; animation-duration: 6s; animation-delay: 0s; }
        .leaf:nth-child(2) { top: 25%; left: -50px; animation-duration: 8s; animation-delay: 1s; font-size: 18px; }
        .leaf:nth-child(3) { top: 40%; left: -50px; animation-duration: 5s; animation-delay: 2s; font-size: 28px; }
        .leaf:nth-child(4) { top: 55%; left: -50px; animation-duration: 7s; animation-delay: 0.5s; }
        .leaf:nth-child(5) { top: 70%; left: -50px; animation-duration: 9s; animation-delay: 1.5s; font-size: 20px; }
        .leaf:nth-child(6) { top: 85%; left: -50px; animation-duration: 6s; animation-delay: 3s; font-size: 22px; }
        .leaf:nth-child(7) { top: 15%; left: -50px; animation-duration: 7s; animation-delay: 2.5s; font-size: 16px; }
        .leaf:nth-child(8) { top: 45%; left: -50px; animation-duration: 5.5s; animation-delay: 0.8s; font-size: 26px; }
        .leaf:nth-child(9) { top: 65%; left: -50px; animation-duration: 8s; animation-delay: 1.8s; }
        .leaf:nth-child(10) { top: 80%; left: -50px; animation-duration: 6.5s; animation-delay: 0.3s; font-size: 20px; }

        @keyframes leafBlow {
            0% {
                left: -50px;
                opacity: 0;
                transform: rotate(0deg) translateY(0);
            }
            10% {
                opacity: 0.8;
            }
            25% {
                transform: rotate(90deg) translateY(-30px);
            }
            50% {
                transform: rotate(180deg) translateY(20px);
            }
            75% {
                transform: rotate(270deg) translateY(-20px);
            }
            90% {
                opacity: 0.8;
            }
            100% {
                left: calc(100% + 50px);
                opacity: 0;
                transform: rotate(360deg) translateY(10px);
            }
        }

        /* Floating Controls - Optimizado para desktop */
        .floating-controls {
            position: fixed;
            bottom: calc(var(--safe-bottom) + 30px);
            left: 50%;
            transform: translateX(-50%);
            display: none;
            gap: 15px;
            width: 90%;
            max-width: 450px;
            justify-content: center;
            z-index: 10000; /* FIX z-index: por encima de #fullscreenTimer (9999) */
        }

        body.timer-active .floating-controls { display: flex; }

        .float-btn {
            padding: 16px 28px;
            border-radius: 14px;
            border: none;
            font-size: 1em;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            text-transform: uppercase;
            box-shadow: 0 8px 30px rgba(0,0,0,0.3);
            transition: transform 0.2s;
        }

        .float-btn:hover { transform: translateY(-3px); }
        .float-btn:active { transform: translateY(0); }

        .float-btn.pause {
            background: linear-gradient(135deg, #ffd93d 0%, #f6b93b 100%);
            color: var(--dark);
        }

        .float-btn.reset {
            background: linear-gradient(135deg, #ff4757 0%, #ff6348 100%);
            color: white;
        }

        /* Responsive */
        /* ============ RESPONSIVE M?VIL ============ */

        /* Tablets */
        @media (max-width: 768px) {
            .container {
                padding: calc(var(--safe-top) + 70px) 15px calc(var(--safe-bottom) + 15px);
            }

            .timer-card {
                padding: 25px 20px;
                border-radius: 24px;
                contain: layout paint;
            }

            .time-display { font-size: 4.5em; }

            .settings-panel.show {
                max-height: none;
            }

            .hourglass {
                width: 200px;
                height: 300px;
            }

            .prep-number {
                font-size: clamp(80px, 15vh, 120px) !important;
            }
        }

        /* M?viles */
        @media (max-width: 480px) {
            .container {
                padding: calc(var(--safe-top) + 60px) 12px calc(var(--safe-bottom) + 10px);
            }

            .logo {
                padding: 14px 28px;
                border-radius: 40px;
            }

            .logo-icon { font-size: 2em; }
            .logo-text { font-size: 1.5em; }

            .timer-card {
                padding: 20px 15px;
                border-radius: 20px;
            }

            .time-display { font-size: 4.5em; }
            .status-display { letter-spacing: 2px; }

            .btn { padding: 15px; font-size: 1.1em; }

            .settings-panel.show {
                max-height: none;
            }

            .settings-title { font-size: 1.1em; }

            .training-summary {
                padding: 15px;
                border-radius: 12px;
            }

            .training-summary .total { font-size: 2em; }
            .training-summary .breakdown { font-size: 0.8em; }

            .setting-row {
                padding: 12px 15px;
                flex-wrap: wrap;
                gap: 10px;
            }

            .setting-label { font-size: 0.62em; letter-spacing: 1px; }
        .counter-btn {
            width: 30px;
            height: 30px;
            flex-shrink: 0;
            border-radius: 50%;
            background: rgba(0, 229, 255, 0.08);
            border: 1px solid rgba(0, 229, 255, 0.35);
            color: #00e5ff;
            font-size: 0.85em;
            font-weight: normal;
            line-height: 1;
            padding: 0;
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 0 8px rgba(0, 229, 255, 0.18),
                        inset 0 1px 0 rgba(0, 229, 255, 0.12);
            transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
        }

            .counter-value { font-size: 1.5em; min-width: 32px; width: auto; }

            .mode-grid.three-cols {
                grid-template-columns: repeat(3, 1fr);
                gap: 8px;
            }

            .mode-btn {
                padding: 10px 5px;
            }

            .mode-icon { font-size: 1.3em; }
            .mode-name { font-size: 0.8em; }
            .mode-desc { font-size: 0.65em; }

            .kcal-goal-section {
                padding: 10px 14px;
                border-radius: 14px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                box-sizing: border-box !important;
                width: 100% !important;
            }
            .kcal-goal-title { font-size: 0.85rem; }
            .kcal-goal-input {
                width: 60px !important;
                height: 34px !important;
                padding: 4px 6px !important;
                font-size: 1rem !important;
                color: #ffffff !important;
                background: rgba(255, 255, 255, 0.15) !important;
                flex: 0 0 auto !important;
            }
            .kcal-goal-btn {
                height: 34px !important;
                padding: 0 15px !important;
                font-size: 0.8rem !important;
                flex-shrink: 0 !important;
                white-space: nowrap !important;
                margin: 0;
            }

            /* Fullscreen Timer - M?vil */
            .fs-round {
                font-size: 1.3em;
                letter-spacing: 2px;
                top: calc(var(--safe-top) + 80px);
            }

            .fs-status {
                font-size: 3em !important;
                letter-spacing: 3px;
                margin-bottom: 20px;
            }

            /* FIGHT status en m?vil */
            body.fighting .fs-status {
                font-size: 4.5em !important;
                letter-spacing: 6px;
                margin-bottom: 30px;
            }

            /* BREATHE status en m?vil */
            body.resting .fs-status {
                font-size: 6.5em !important;
                letter-spacing: 6px;
                margin-bottom: 30px;
            }

            .fs-time { font-size: clamp(80px, 15vh, 120px) !important; }

            .fs-quote {
                padding: 15px;
                border-radius: 12px;
                font-size: 0.9em;
            }

            /* Hourglass m?s peque?o en m?vil */
            .hourglass {
                width: 160px;
                height: 240px;
            }

            .hourglass-cap {
                height: 18px;
            }

            .hourglass-cap.top,
            .hourglass-cap.bottom {
                width: 150px;
                border-width: 4px;
            }

            .hourglass-top,
            .hourglass-bottom {
                width: 120px;
                height: 80px;
            }

            .hourglass-middle {
                width: 18px;
                height: 28px;
            }

            .sand-stream {
                top: 100px;
                width: 10px;
                height: 40px;
            }

            .prep-number {
                font-size: clamp(80px, 15vh, 120px) !important;
            }

            /* Floating controls */
            .floating-controls {
                bottom: calc(var(--safe-bottom) + 20px);
                gap: 10px;
            }

            .float-btn {
                padding: 14px 20px;
                font-size: 0.9em;
                border-radius: 12px;
            }

            /* Hojas m?s peque?as */
            .leaf {
                font-size: 18px;
            }

            /* Modal */
            .modal-content {
                padding: 16px 14px 12px;
                border-radius: 20px;
                max-height: calc(100vh - 40px);
                max-height: calc(100dvh - 40px);
            }
            #profileModal .modal-content,
            #statsModal .modal-content {
                max-height: calc(100vh - 40px);
                max-height: calc(100dvh - 40px);
                padding-bottom: 12px;
            }

            .modal-title { font-size: 1.1em; margin-bottom: 8px; }

            .stats-grid {
                gap: 7px;
            }

            .stat-card {
                padding: 9px 10px;
                border-radius: 10px;
            }

            .stat-value { font-size: 1.4em; }
            .stat-label { font-size: 0.68em; }

            .form-input {
                height: 34px;
                font-size: 0.9em;
            }

            .form-row .form-input { width: 120px; }
            .imc-display { padding: 7px 10px; }
            .imc-value { font-size: 1.35em; }

            .icon-btn,
            .music-btn,
            .darkmode-btn,
            .trophy-btn,
            .league-btn {
                width: 42px;
                height: 42px;
                font-size: 1.3em;
            }
        }

        /* M?viles muy peque?os */
        @media (max-width: 360px) {
            .logo-text { font-size: 1.3em; }
            .time-display { font-size: 4em; }
            .fs-time { font-size: clamp(80px, 15vh, 120px) !important; }

            body.fighting .fs-status,
            body.resting .fs-status {
                font-size: 6.5em !important;
                letter-spacing: 4px;
            }

            .hourglass {
                width: 140px;
                height: 210px;
            }

            .prep-number {
                font-size: clamp(80px, 15vh, 120px) !important;
            }

            .float-btn {
                padding: 12px 16px;
                font-size: 0.85em;
            }

            .mode-grid.three-cols {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        /* FIX-2: Portrait muy corto - ocultar quote para evitar solapamiento */
        @media (max-height: 620px) and (orientation: portrait) {
            .fs-quote { display: none; }
        }

        /* Landscape en m?vil */
        @media (max-height: 500px) and (orientation: landscape) {
            .fs-preparing-layout {
                flex-direction: row;
                gap: 30px;
            }

            .hourglass {
                width: 120px;
                height: 180px;
            }

            .prep-number {
                font-size: clamp(60px, 12vh, 90px) !important;
            }

            .fs-time { font-size: clamp(80px, 15vh, 120px); }

            body.fighting .fs-status,
            body.resting .fs-status {
                font-size: 15vh;
                margin-bottom: 10px;
            }

            .fs-round {
                font-size: 1.2em;
            }

            .fs-quote {
                display: none;
            }

            .floating-controls {
                bottom: 10px;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                transition-duration: 0.01ms !important;
            }

            /* Settings Panel - Accesibilidad */
            .settings-panel {
                transition: opacity 0.15s ease;
                transform: none !important;
            }

            .settings-panel.show {
                transform: none !important;
            }
        }

@keyframes floatUp {
    0% {
        bottom: -20px;
        opacity: 0;
        transform: translateX(0);
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        bottom: 100vh;
        opacity: 0;
        transform: translateX(30px);
    }

}

/* ============ CELEBRACIONAL ============ */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
    display: none;
}

.confetti-container.active {
    display: block;
}

.confetti {
    position: absolute;
    top: -20px;
    width: 12px;
    height: 12px;
    animation: confettiFall linear forwards;
}

.confetti:nth-child(1) { left: 5%; background: #ff0000; animation-duration: 3s; animation-delay: 0s; }
.confetti:nth-child(2) { left: 10%; background: #00ff00; animation-duration: 3.5s; animation-delay: 0.1s; border-radius: 50%; }
.confetti:nth-child(3) { left: 15%; background: #0000ff; animation-duration: 2.8s; animation-delay: 0.2s; }
.confetti:nth-child(4) { left: 20%; background: #ffff00; animation-duration: 3.2s; animation-delay: 0.3s; border-radius: 50%; }
.confetti:nth-child(5) { left: 25%; background: #ff00ff; animation-duration: 3s; animation-delay: 0.1s; }
.confetti:nth-child(6) { left: 30%; background: #00ffff; animation-duration: 3.4s; animation-delay: 0.4s; border-radius: 50%; }
.confetti:nth-child(7) { left: 35%; background: #ff8800; animation-duration: 2.9s; animation-delay: 0.2s; }
.confetti:nth-child(8) { left: 40%; background: #ff0088; animation-duration: 3.1s; animation-delay: 0.5s; border-radius: 50%; }
.confetti:nth-child(9) { left: 45%; background: #88ff00; animation-duration: 3.3s; animation-delay: 0.1s; }
.confetti:nth-child(10) { left: 50%; background: #0088ff; animation-duration: 2.7s; animation-delay: 0.3s; border-radius: 50%; }
.confetti:nth-child(11) { left: 55%; background: #ff0000; animation-duration: 3s; animation-delay: 0.2s; }
.confetti:nth-child(12) { left: 60%; background: #00ff00; animation-duration: 3.5s; animation-delay: 0.4s; border-radius: 50%; }
.confetti:nth-child(13) { left: 65%; background: #ffff00; animation-duration: 2.8s; animation-delay: 0.1s; }
.confetti:nth-child(14) { left: 70%; background: #ff00ff; animation-duration: 3.2s; animation-delay: 0.5s; border-radius: 50%; }
.confetti:nth-child(15) { left: 75%; background: #00ffff; animation-duration: 3s; animation-delay: 0.2s; }
.confetti:nth-child(16) { left: 80%; background: #ff8800; animation-duration: 3.4s; animation-delay: 0.3s; border-radius: 50%; }
.confetti:nth-child(17) { left: 85%; background: #0088ff; animation-duration: 2.9s; animation-delay: 0.1s; }
.confetti:nth-child(18) { left: 90%; background: #88ff00; animation-duration: 3.1s; animation-delay: 0.4s; border-radius: 50%; }
.confetti:nth-child(19) { left: 95%; background: #ff0088; animation-duration: 3.3s; animation-delay: 0.2s; }
.confetti:nth-child(20) { left: 8%; background: #0000ff; animation-duration: 2.7s; animation-delay: 0.5s; border-radius: 50%; }

@keyframes confettiFall {
    0% {
        top: -20px;
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        top: 100vh;
        transform: rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

.celebration-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 30px;
    z-index: 1001;
    display: none;
}

.celebration-text.active {
    display: block;
}

.celebration-quote {
    font-size: 2.5em;
    font-weight: 400;
    font-style: italic;
    color: white;
    margin-bottom: 20px;
    animation: quoteAppear 1s ease-out forwards;
    opacity: 0;
}

.celebration-author {
    font-size: 1.5em;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 30px;
    animation: quoteAppear 1s ease-out 0.5s forwards;
    opacity: 0;
}

.celebration-title {
    font-size: 3em;
    font-weight: 900;
    color: #FFD700;
    text-shadow:
        0 0 20px #FFD700,
        0 0 40px #FFA500,
        0 0 60px #FF4500;
    animation: titlePop 0.8s ease-out 1s forwards;
    opacity: 0;
    transform: scale(0);
}

@keyframes quoteAppear {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes titlePop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-10deg);
    }
    70% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Vi?eta animada */
.vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 70px rgba(15, 40, 90, 0.22);
    animation: vignetteBreath 5s ease-in-out infinite;
    will-change: opacity;
}

@keyframes vignetteBreath {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}
/* Estrellas en Settings */
.settings-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: starTwinkle 2s ease-in-out infinite;
}

.star:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
.star:nth-child(2) { top: 25%; left: 80%; animation-delay: 0.3s; }
.star:nth-child(3) { top: 40%; left: 25%; animation-delay: 0.6s; }
.star:nth-child(4) { top: 55%; left: 70%; animation-delay: 0.9s; }
.star:nth-child(5) { top: 70%; left: 40%; animation-delay: 1.2s; }
.star:nth-child(6) { top: 85%; left: 90%; animation-delay: 0.4s; }
.star:nth-child(7) { top: 15%; left: 50%; animation-delay: 0.7s; }
.star:nth-child(8) { top: 60%; left: 10%; animation-delay: 1s; }
.star:nth-child(9) { top: 35%; left: 60%; animation-delay: 0.2s; }
.star:nth-child(10) { top: 80%; left: 30%; animation-delay: 0.8s; }

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}
/* Bottom-right button group (trophy + league) */
.bottom-right-btns {
    position: fixed;
    bottom: max(20px, calc(var(--safe-bottom) + 20px));
    right: max(20px, calc(var(--safe-right) + 20px));
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    z-index: 1000;
}

body.timer-active .bottom-right-btns {
    display: none;
}

/* Trophy Button */
.trophy-btn {
    position: static;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.4);
    transition: all 0.3s;
}

.trophy-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(245, 87, 108, 0.5);
}

/* League Button */
.league-btn {
    position: static;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    box-shadow: 0 8px 25px rgba(255, 210, 0, 0.4);
    transition: all 0.3s;
}

.league-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(255, 210, 0, 0.6);
}

/* ── Normalización de caja: botones circulares de icono ───────────────────
   Todos clonan exactamente el box-model de .icon-btn:
   48×48 px · border-radius:50% · padding:0 · box-sizing:border-box      */
.music-btn,
.darkmode-btn,
.trophy-btn,
.league-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    box-sizing: border-box;
    line-height: 1;
}

/* 🏅 Optical compensation: the medal emoji has a narrower native bounding box
   compared to 🎵 and 🌙. Bump its font-size by ~25 % to match visual weight. */
#trophyBtn {
    font-size: 30px !important;
}

/* ============ ?? WORLD TOP 100 - OLIMPO DEL BOXEO ============ */

#leagueModal .modal-content {
    background: linear-gradient(160deg, rgba(8, 22, 36, 0.92) 0%, rgba(13, 32, 56, 0.90) 60%, rgba(20, 12, 4, 0.92) 100%) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 215, 0, 0.15) !important;
    color: #ffffff !important;
    max-width: 500px;
    width: 95%;
    /* Flexbox column: título + header fijos, lista scrollable, botón fijo abajo */
    height: calc(82vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 22px 20px 20px;
    margin-top: max(12px, env(safe-area-inset-top, 12px));
    box-shadow:
        0 0 0 1px rgba(255, 215, 0, 0.06),
        0 0 60px rgba(255, 215, 0, 0.10),
        0 8px 32px rgba(255, 165, 0, 0.08),
        0 24px 80px rgba(0, 0, 0, 0.85) !important;
}

#leagueModal .modal-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Twemoji Mozilla', emoji, sans-serif;
    color: #FFD700 !important;
    font-size: 1.3em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow:
        0 0 12px rgba(255, 215, 0, 0.55),
        0 0 28px rgba(255, 180, 0, 0.20),
        0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.7) !important;
    margin-bottom: 12px;
    flex-shrink: 0;
}

/* Hero - cintur?n actual del usuario */
.league-user-rank {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #1f1f2e, #111116);
    border: 1px solid #ffb800;
    border-radius: 10px;
    padding: 7px 10px;
    margin-bottom: 6px;
}

.league-belt-icon {
    font-size: 1.6em;
    line-height: 1;
    flex-shrink: 0;
}

.league-rank-name {
    font-size: 1em;
    font-weight: 900;
    color: #ffb800;
    text-shadow: 0 1px 6px rgba(255, 184, 0, 0.4);
}

.league-rank-sub {
    font-size: 0.72em;
    color: #aaaaaa;
    margin-top: 2px;
}

/* Barra de progreso */
.league-progress-wrap {
    margin-bottom: 6px;
}

.league-progress-bar {
    height: 8px;
    background: #2a2a35;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #333340;
}

.league-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f7971e, #ffb800);
    border-radius: 999px;
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(255, 184, 0, 0.5);
}

.league-progress-label {
    text-align: right;
    font-size: 0.72em;
    color: #aaaaaa;
    margin-top: 5px;
}

/* Alerta de ?xido */
.league-rust-alert {
    background: rgba(255, 60, 0, 0.12);
    border: 1px solid #cc3300;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.78em;
    color: #ff6633;
    margin-bottom: 8px;
    font-weight: 700;
}

/* -- Carrusel horizontal de cinturones ------------------- */
.league-belts-list {
    display: flex;
    flex-direction: row;
    gap: 7px;
    padding: 6px 4px 8px;
    margin-bottom: 8px;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* Ocultar scrollbar nativa */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.league-belts-list::-webkit-scrollbar { display: none; }

/* Tarjeta individual */
.belt-card {
    min-width: 86px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3px;
    padding: 8px 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    scroll-snap-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    cursor: default;
}

/* Icono del rango */
.belt-card-icon {
    font-size: 1.45em;
    line-height: 1;
    margin-bottom: 1px;
}

/* Nombre del rango */
.belt-card-name {
    font-size: 0.67em;
    font-weight: 700;
    color: #cccccc;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 82px;
}

/* Requisito */
.belt-card-req {
    font-size: 0.62em;
    color: #666680;
    white-space: nowrap;
}

/* Check / indicador */
.belt-card-check {
    font-size: 0.7em;
    font-weight: 900;
    color: #ffb800;
    min-height: 1em;
}

/* Rangos ya superados */
.belt-card.unlocked {
    opacity: 0.38;
}

/* Rango actual - resaltado dorado */
.belt-card.current-rank {
    background: rgba(255, 215, 0, 0.10);
    border: 1.5px solid #FFD700;
    transform: scale(1.06);
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.18);
}
.belt-card.current-rank .belt-card-name  { color: #FFD700; }
.belt-card.current-rank .belt-card-check { color: #FFD700; font-size: 0.8em; }

/* Barra de supervivencia semanal */
.survival-wrap {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #2a2a35;
    border-radius: 10px;
    padding: 6px 10px;
    margin-bottom: 6px;
}

.survival-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.survival-title {
    font-size: 0.67em;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #ffb800;
    text-transform: uppercase;
}

.survival-quota {
    font-size: 0.64em;
    color: #aaaaaa;
}

.survival-bar-track {
    height: 7px;
    background: #2a2a35;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #333340;
}

.survival-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease, background 0.4s ease;
    /* color din?mico v?a JS con --survival-color */
    background: var(--survival-color, #ff3333);
}

.survival-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.survival-footer span {
    font-size: 0.64em;
    color: #aaaaaa;
}

/* -- Ranking Global Mensual ------------------------------- */
.lb-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 8px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.20);
    flex-shrink: 0;
}

.lb-section-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Twemoji Mozilla', emoji, sans-serif;
    font-size: 0.72em;
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #FFD700;
    text-transform: uppercase;
    text-shadow:
        0 0 8px rgba(255, 215, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.10),
        0 2px 4px rgba(0, 0, 0, 0.6);
}

.lb-section-month {
    font-size: 0.68em;
    color: #b0a060;
    text-transform: capitalize;
}

.league-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Ocupa todo el espacio disponible entre el header y el bot?n */
    flex: 1;
    margin-bottom: 14px;
    /* Scrollbar dorada tenue */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}
.league-leaderboard::-webkit-scrollbar { width: 4px; }
.league-leaderboard::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 4px; }

/* Filas del ranking */
.lb-row {
    display: grid;
    grid-template-columns: 36px 26px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.40);
    border-bottom: 1px solid rgba(255, 215, 0, 0.08);
    font-size: 0.82em;
}

.lb-row:last-child { border-bottom: none; }

.lb-row-me {
    background: rgba(255, 184, 0, 0.13) !important;
    border-left: 3px solid #ffb800;
}

/* Top 3 - diseño premium oro/plata/bronce */
.lb-row-top1 {
    background: linear-gradient(
        90deg,
        rgba(255, 215, 0, 0.22) 0%,
        rgba(255, 195, 0, 0.10) 45%,
        transparent 100%
    ) !important;
    border-left: 3px solid #ffd700 !important;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.04);
}
.lb-row-top1 .lb-pos  { color: #ffd700; font-size: 1.15em; font-weight: 900; }
.lb-row-top1 .lb-name { color: #ffe566; }
.lb-row-top1 .lb-time { color: #ffd700; font-weight: 700; }

.lb-row-top2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.13) 0%, rgba(160, 160, 160, 0.05) 100%) !important;
    border-left: 3px solid #c0c0c0 !important;
}
.lb-row-top2 .lb-pos  { color: #c0c0c0; font-size: 1.05em; }
.lb-row-top2 .lb-name { color: #d8d8d8; }
.lb-row-top2 .lb-time { color: #b0b0b0; }

.lb-row-top3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.14) 0%, rgba(180, 100, 30, 0.05) 100%) !important;
    border-left: 3px solid #cd7f32 !important;
}
.lb-row-top3 .lb-pos  { color: #cd7f32; font-size: 1.0em; }
.lb-row-top3 .lb-name { color: #e8a060; }
.lb-row-top3 .lb-time { color: #cd7f32; }

.lb-pos {
    color: #aaaaaa;
    font-weight: 700;
    font-size: 0.9em;
    text-align: right;
}

.lb-belt {
    text-align: center;
    font-size: 1.1em;
}

.lb-name {
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.lb-row-me .lb-name { color: #ffb800; }

/* Nombre de rango debajo del nombre del jugador */
.lb-rank-tag {
    font-size: 0.68em;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.lb-row-me .lb-rank-tag { color: rgba(255,184,0,0.65); }

.lb-time {
    color: #aaaaaa;
    font-size: 0.88em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.lb-separator {
    text-align: center;
    color: rgba(255, 215, 0, 0.3);
    font-size: 0.8em;
    padding: 5px 0;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

/* Mensaje de estado (error / vac?o / conectando) */
.lb-message {
    padding: 20px;
    text-align: center;
    color: rgba(255, 215, 0, 0.55);
    font-size: 0.82em;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.4);
}

/* Mensaje motivacional fuera del top 100 */
.lb-outside-msg {
    padding: 8px 16px 14px;
    color: #f97316;
    font-size: 0.78em;
    font-weight: 600;
}

/* Skeleton loader */
.lb-skeleton-row {
    display: grid;
    grid-template-columns: 36px 26px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.06);
}

.lb-skel {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #0d1f33 25%, #1a2e40 50%, #0d1f33 75%);
    background-size: 200% 100%;
    animation: lbShimmer 1.4s ease infinite;
}

.lb-skel-pos   { width: 24px; }
.lb-skel-belt  { width: 18px; }
.lb-skel-name  { width: 70%; }
.lb-skel-time  { width: 40px; }

@keyframes lbShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Bot?n cerrar - dorado ol?mpico, siempre al fondo del flex */
#leagueModal .btn-close {
    background: transparent !important;
    border: 1px solid rgba(255, 215, 0, 0.5) !important;
    color: #FFD700 !important;
    font-weight: 700;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    margin-top: auto;
}

#leagueModal .btn-close:hover {
    background: rgba(255, 215, 0, 0.12) !important;
    border-color: #FFD700 !important;
    color: #ffe566 !important;
}
/* ============ ?? LOGROS: PANEL COMPACTO Y PERSONALIZADO ============ */

/* 1. ESTRUCTURA DE LA CAJA — Dark Elite */
#trophyModal .modal-content {
    /* --- TAMA?O Y FORMA --- */
    width: 340px !important;
    max-width: 90% !important;
    height: auto !important;
    max-height: 85vh !important;
    margin: 0 auto !important;

    /* --- VITRINA PREMIUM --- */
    background: linear-gradient(145deg, #0f172a 0%, #020617 100%) !important;
    border: 1px solid rgba(255, 215, 0, 0.2) !important;
    border-radius: 25px !important;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.80) !important;

    /* --- LAYOUT INTERNO --- */
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

/* 2. TÍTULO DEL MODAL — dorado premium */
#trophyModal .modal-title {
    margin-top: 15px !important;
    margin-bottom: 5px !important;
    text-align: center;
    color: #ffd700 !important;
    text-shadow:
        0 0 12px rgba(255, 215, 0, 0.60),
        0 0 30px rgba(255, 215, 0, 0.25) !important;
    letter-spacing: 0.12em;
}

/* 3. CONTENEDOR DE LA REJILLA (Sin Scroll) */
#trophyModal .achievements-grid {
    overflow-y: visible !important; /* QUITAMOS EL SCROLL */
    flex-shrink: 0 !important;      /* Muestra todo sin encogerse */
    min-height: auto !important;
    margin-bottom: 5px !important;
    padding: 0 10px !important;     /* Un poco de margen lateral */
}

/* 4. REJILLA (M?s pegada / Compacta) */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;        /* REDUCIDO: Iconos muy juntos */
    margin: 10px 0;
    justify-items: center;
}

/* 5. ICONOS — Joyas y ranuras */
.achievement {
    width: 38px;
    height: 38px;
    font-size: 1.1em;

    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Desbloqueado por defecto — joya dorada */
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 60%, #92400e 100%);
    box-shadow:
        0 0 15px rgba(255, 215, 0, 0.50),
        inset 0 2px 5px rgba(255, 255, 255, 0.30),
        inset 0 -2px 4px rgba(0, 0, 0, 0.30);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    position: relative;
    opacity: 1;
}

/* Estados — ranura vacía */
.achievement.locked {
    background: rgba(0, 0, 0, 0.50) !important;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.80) !important;
    filter: none;
    opacity: 1;
}
.achievement.locked > * {
    opacity: 0.3;
}

.achievement:hover {
    transform: scale(1.18);
}

.achievement.unlocked {
    animation: achievementPop 0.5s ease-out;
}

@keyframes achievementPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* 6. BOTÓN CERRAR — tema oscuro */
#trophyModal .btn-close {
    margin: 10px auto 15px !important;
    width: fit-content !important;
    align-self: center !important;
    min-width: 100px;

    background: rgba(15, 23, 42, 0.80) !important;
    border: 1px solid rgba(255, 215, 0, 0.20) !important;
    color: #94a3b8 !important;
    border-radius: 15px;
    padding: 8px 20px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
#trophyModal .btn-close:hover {
    background: rgba(30, 41, 59, 0.90) !important;
    border-color: rgba(255, 215, 0, 0.45) !important;
    color: #ffd700 !important;
}

/* 7. TOOLTIP (Mensaje flotante ajustado) */
.achievement-tooltip {
    position: fixed;
    bottom: 380px !important; /* Arriba del panel */
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000 !important; /* Encima de todo */

    background: rgba(10, 10, 20, 0.95);
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.85em;
    text-align: center;
    display: none;
    max-width: 260px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    pointer-events: none;
}

.achievement-tooltip.show {
    display: block;
    animation: tooltipUp 0.2s ease-out;
}

@keyframes tooltipUp {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Estilos internos del tooltip */
.tooltip-icon { font-size: 1.5em; display: block; margin-bottom: 2px; }
.tooltip-name { font-weight: 700; margin-bottom: 2px; }
.tooltip-desc { opacity: 0.8; font-size: 0.9em; }
.tooltip-status { margin-top: 4px; font-weight: 600; font-size: 0.8em; }
.tooltip-status.locked { color: #ff6b6b; }
.tooltip-status.unlocked { color: #51cf66; }
/* ============ NIVELES ============ */
.level-display {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.level-icon {
    font-size: 2.5em;
}

.level-info {
    flex: 1;
}

.level-name {
    font-size: 1.2em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

.level-progress-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.level-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.level-progress-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

/* ============================================
   ??? EFECTOS BREATHE - CIELO
   ============================================ */

/* Contenedor principal - OCULTO por defecto */

/* ============================================
   ??? BREATHE EFFECTS - CSS FINAL CORREGIDO
   ============================================ */

/* Fondo azul cielo SOLO para body.resting */
body.resting {
    background: linear-gradient(180deg, #87CEEB 0%, #5BA3E0 40%, #4A90D9 70%, #3A7CC2 100%) !important;
}

/* Contenedor principal de efectos - OCULTO por defecto */
.breathe-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    display: none;
}

/* Mostrar SOLO en body.resting */
body.resting .breathe-effects {
    display: block;
}

/* Ocultar en otros modos */
body.preparing .breathe-effects,
body.fighting .breathe-effects,
body.finished .breathe-effects {
    display: none !important;
}

/* Sol suave arriba */
.sun-glow {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 200, 0.4) 0%, rgba(255, 255, 200, 0.1) 40%, transparent 70%);
    animation: sunPulse 6s ease-in-out infinite;
}

@keyframes sunPulse {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

/* Nubes */
.clouds-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.cloud {
    position: absolute;
    font-size: 60px;
    opacity: 0.9;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
    animation: cloudFloat linear infinite;
    will-change: transform;
}

.cloud:nth-child(1) { top: 5%; font-size: 80px; animation-duration: 35s; opacity: 0.95; }
.cloud:nth-child(2) { top: 15%; font-size: 50px; animation-duration: 40s; animation-delay: -10s; opacity: 0.8; }
.cloud:nth-child(3) { top: 30%; font-size: 70px; animation-duration: 45s; animation-delay: -20s; opacity: 0.85; }
.cloud:nth-child(4) { top: 55%; font-size: 55px; animation-duration: 38s; animation-delay: -5s; opacity: 0.75; }
.cloud:nth-child(5) { top: 70%; font-size: 65px; animation-duration: 42s; animation-delay: -15s; opacity: 0.8; }
.cloud:nth-child(6) { top: 85%; font-size: 45px; animation-duration: 50s; animation-delay: -25s; opacity: 0.7; }

@keyframes cloudFloat {
    0% { left: 110%; }
    100% { left: -20%; }
}

/* P?jaros */
.birds-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.bird {
    position: absolute;
    font-size: 20px;
    animation: birdFly linear infinite;
    will-change: transform;
}

.bird:nth-child(1) { top: 20%; animation-duration: 12s; }
.bird:nth-child(2) { top: 35%; animation-duration: 15s; animation-delay: -3s; font-size: 16px; }
.bird:nth-child(3) { top: 45%; animation-duration: 10s; animation-delay: -7s; font-size: 18px; }
.bird:nth-child(4) { top: 60%; animation-duration: 14s; animation-delay: -2s; font-size: 14px; }

@keyframes birdFly {
    0% { left: -30px; transform: translateY(0); }
    25% { transform: translateY(-15px); }
    50% { transform: translateY(5px); }
    75% { transform: translateY(-10px); }
    100% { left: calc(100% + 30px); transform: translateY(0); }
}

/* Part?culas de luz */
.sparkles-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, transparent 70%);
    border-radius: 50%;
    animation: sparkleFloat linear infinite;
    will-change: transform, opacity;
}

.sparkle:nth-child(1) { left: 10%; animation-duration: 8s; }
.sparkle:nth-child(2) { left: 20%; animation-duration: 10s; animation-delay: -2s; }
.sparkle:nth-child(3) { left: 35%; animation-duration: 7s; animation-delay: -4s; }
.sparkle:nth-child(4) { left: 50%; animation-duration: 9s; animation-delay: -1s; }
.sparkle:nth-child(5) { left: 65%; animation-duration: 11s; animation-delay: -3s; }
.sparkle:nth-child(6) { left: 80%; animation-duration: 8s; animation-delay: -5s; }
.sparkle:nth-child(7) { left: 90%; animation-duration: 10s; animation-delay: -2s; }

@keyframes sparkleFloat {
    0% { bottom: -10px; opacity: 0; transform: translateX(0) scale(1); }
    20% { opacity: 1; }
    50% { transform: translateX(20px) scale(1.2); }
    80% { opacity: 0.8; }
    100% { bottom: 100vh; opacity: 0; transform: translateX(-15px) scale(0.5); }
}

/* L?neas de viento */
.wind-lines {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.wind-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: windBlow linear infinite;
    will-change: transform;
}

.wind-line:nth-child(1) { top: 25%; width: 100px; animation-duration: 3s; }
.wind-line:nth-child(2) { top: 40%; width: 150px; animation-duration: 4s; animation-delay: -1s; }
.wind-line:nth-child(3) { top: 55%; width: 80px; animation-duration: 2.5s; animation-delay: -2s; }
.wind-line:nth-child(4) { top: 70%; width: 120px; animation-duration: 3.5s; animation-delay: -0.5s; }

@keyframes windBlow {
    0% { left: -200px; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* C?rculo de respiraci?n - CR?TICO: position fixed y display none */
.breath-circle-container {
    position: fixed !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    display: none !important;
}

body.resting .breath-circle-container {
    display: block !important;
}

/* Ocultar c?rculo en otros modos */
body.preparing .breath-circle-container,
body.fighting .breath-circle-container,
body.finished .breath-circle-container {
    display: none !important;
}

.breath-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    box-shadow:
        0 0 40px rgba(255, 255, 255, 0.3),
        0 0 80px rgba(255, 255, 255, 0.1),
        inset 0 0 40px rgba(255, 255, 255, 0.1);
    animation: breatheCircle 5s ease-in-out infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    will-change: transform, box-shadow;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.breath-inner {
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    animation: breatheInner 5s ease-in-out infinite;
}

@keyframes breatheCircle {
    0%, 100% { transform: scale(1);    opacity: 0.7; }
    50%       { transform: scale(1.25); opacity: 1; }
}

@keyframes breatheInner {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.4); opacity: 1; }
}

/* Instrucci?n INHALA/EXHALA */
.breath-instruction {
    position: fixed !important;
    bottom: 20vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 1.5em !important;
    font-weight: 700 !important;
    color: rgba(255, 255, 255, 0.95) !important;
    letter-spacing: 0.3em !important;
    text-transform: uppercase !important;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.15) !important;
    animation: breathInstruction 5s ease-in-out infinite !important;
    z-index: 9999 !important;
    display: none !important;
}

body.resting .breath-instruction {
    display: block !important;
}

body:not(.resting) .breath-instruction {
    display: none !important;
}

@keyframes breathInstruction {
    0%, 45% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateX(-50%) scale(0.98); }
    55%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* Icono de aire ??? */
.air-icon {
    position: fixed !important;
    bottom: 26vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 2em !important;
    animation: airIconFloat 5s ease-in-out infinite !important;
    z-index: 9999 !important;
    display: none !important;
}

body.resting .air-icon {
    display: block !important;
}

body:not(.resting) .air-icon {
    display: none !important;
}

@keyframes airIconFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.7; }
    50% { transform: translateX(-50%) translateY(-10px); opacity: 1; }
}

/* Responsive m?vil */
@media (max-width: 768px) {
    .breath-circle { width: 140px; height: 140px; }
    .cloud { font-size: 40px !important; }
    .bird { font-size: 16px !important; }
}

@media (max-width: 480px) {
    .breath-circle { width: 120px; height: 120px; }
    .breath-instruction { font-size: 1.2em !important; bottom: 22vh !important; }
    .cloud:nth-child(n+5) { display: none; }
    .bird:nth-child(n+3) { display: none; }
    .sparkle { width: 4px; height: 4px; }
}

/* Optimizaci?n de rendimiento */
.cloud,
.bird,
.sparkle,
.wind-line,
.breath-circle,
.breath-inner,
.sun-glow {
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    .cloud,
    .bird,
    .sparkle,
    .wind-line,
    .sun-glow,
    .breath-circle,
    .breath-inner,
    .air-icon,
    .breath-instruction {
        animation: none !important;
    }

    .cloud { left: 20%; }
    .breath-instruction { opacity: 1 !important; transform: translateX(-50%) scale(1) !important; }
}

/* ============================================
   ?? FIX: Ocultar c?rculo BREATHE cuando NO debe aparecer
   ============================================ */

/* Por defecto, TODO oculto */
.breathe-effects,
.breath-circle-container,
.breath-circle,
.breath-instruction,
.sun-glow,
.clouds-container,
.birds-container,
.sparkles-container,
.wind-lines {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Mostrar SOLO cuando body tiene clase "resting" */
body.resting .breathe-effects {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.resting .breath-circle-container {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.resting .breath-circle {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.resting .breath-instruction {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.resting .sun-glow,
body.resting .clouds-container,
body.resting .birds-container,
body.resting .sparkles-container,
body.resting .wind-lines {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Asegurar que est? OCULTO en todos los dem?s estados */
body:not(.resting) .breathe-effects,
body:not(.resting) .breath-circle-container,
body:not(.resting) .breath-circle,
body:not(.resting) .breath-instruction {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body.preparing .breathe-effects,
body.preparing .breath-circle-container,
body.fighting .breathe-effects,
body.fighting .breath-circle-container,
body.finished .breathe-effects,
body.finished .breath-circle-container,
body:not([class*="resting"]) .breathe-effects,
body:not([class*="resting"]) .breath-circle-container {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0) !important;
}

/* Si no hay ninguna clase en el body, tambi?n ocultar */
body:not(.preparing):not(.fighting):not(.resting):not(.finished) .breathe-effects,
body:not(.preparing):not(.fighting):not(.resting):not(.finished) .breath-circle-container {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* ============================================
   ?? ELIMINAR COMPLETAMENTE EL C?RCULO BREATHE
   ============================================ */

/* Ocultar el c?rculo en TODAS las situaciones */
.breath-circle-container,
.breath-circle,
.breath-inner {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(0) !important;
    width: 0 !important;
    height: 0 !important;
}

/* Asegurar que nunca se muestre, incluso en body.resting */
body .breath-circle-container,
body.resting .breath-circle-container,
body.preparing .breath-circle-container,
body.fighting .breath-circle-container,
body.finished .breath-circle-container {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Ocultar tambi?n los elementos relacionados si quieres */
.breathe-effects .breath-circle-container {
    display: none !important;
}


/* ============================================
   ?? OPTIMIZACIONALES CR?TICAS
   ============================================ */

/* 1. MEJORAR ?REAS T?CTILES (44px m?nimo recomendado Apple/Google) */
@media (max-width: 768px) {
    /* mode-btn excluido - su padding compacto se gestiona en la regla principal */
    .btn,
    .icon-btn,
    .float-btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 20px !important;
        touch-action: manipulation !important;
    }

    /* Botones circulares de icono: NUNCA reciben padding horizontal —
       solo width/height fijos + flex-center garantizan que el emoji no se comprima.
       El padding: 0 sobreescribe la regla genérica de arriba para .btn/.icon-btn. */
    .trophy-btn,
    .league-btn,
    .music-btn,
    .darkmode-btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 0 !important;           /* sin padding: el icono ocupa todo el espacio */
        touch-action: manipulation !important;
    }
    .mode-btn {
        min-height: 44px !important;
        touch-action: manipulation !important;
    }

    /* Feedback t?ctil instant?neo */
    .btn:active,
    .icon-btn:active,
    .counter-btn:active,
    .mode-btn:active {
        transform: scale(0.95) !important;
        opacity: 0.8 !important;
        transition: transform 0.1s ease, opacity 0.1s ease !important;
    }

    /* ?reas t?ctiles m?s grandes en inputs */
    input, select, textarea {
        min-height: 44px !important;
        font-size: 16px !important; /* Evita zoom en iOS */
        touch-action: manipulation !important;
    }
}

/* 2. SCROLL SUAVE EN iOS */
body,
.settings-panel,
.modal-content,
.achievements-content {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
}

/* 3. PREVENIR BOUNCE/RUBBER BAND EN iOS */
body {
    overscroll-behavior-y: none !important;
}


/* Prevenir scroll del body cuando modal est? abierto */
body.modal-open {
    overflow: hidden !important;
    /* Quitamos position: fixed que rompe el scroll */
    width: 100% !important;
}

/* 4. OPTIMIZAR FULLSCREEN TIMER EN M?VIL */
@media (max-width: 768px) {
    .fullscreen-timer {
        /* Usar GPU acceleration */
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
        will-change: contents !important;
    }

    /* Textos m?s grandes y legibles */
    .fs-time {
        font-size: clamp(80px, 15vh, 120px) !important;
    }

    body.resting .fs-time {
        font-size: clamp(80px, 15vh, 120px) !important;
    }

    body.preparing .fs-time {
        font-size: clamp(80px, 15vh, 120px) !important;
    }

    .fs-status {
        font-size: clamp(40px, 10vw, 70px) !important;
    }

    body.resting .fs-status {
        font-size: clamp(40px, 10vw, 70px) !important;
    }

    .fs-round {
        font-size: clamp(16px, 4vw, 24px) !important;
    }
}

/* 5. REDUCIR COMPLEJIDAD DE SOMBRAS EN M?VIL */
@media (max-width: 768px) {
    .timer-card,
    .settings-panel,
    .modal-content,
    .btn {
        box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
    }
}

/* 6. OPTIMIZAR CANVAS EN M?VIL */
@media (max-width: 768px) {
    #particleCanvas {
        opacity: 0.7 !important; /* Menos opacidad = menos carga */
    }
}

/* 7. MEJORAR LEGIBILIDAD DE TEXTOS */
@media (max-width: 480px) {
    /* Anti-aliasing optimizado */
    body {
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        text-rendering: optimizeLegibility !important;
    }

    /* Textos m?s grandes en m?viles peque?os */
    .quote-text {
        font-size: 20px !important;
        line-height: 1.5 !important;
    }

    .setting-label {
        font-size: 14px !important;
    }
}

/* 8. PREVENIR SELECCI?N ACCIDENTAL */
.fullscreen-timer,
.timer-card,
.settings-panel {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* 9. OPTIMIZAR MODALES EN M?VIL */
@media (max-width: 768px) {
    /* Modales gen?ricos (no stats/profile): scroll propio */
    .modal-content:not(#statsModal .modal-content):not(#profileModal .modal-content) {
        max-height: calc(100vh - 40px) !important;
        max-height: calc(100dvh - 40px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Stats/Profile: max-height usando dvh para respetar barra Safari */
    #profileModal .modal-content,
    #statsModal .modal-content {
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
    }

    /* Overlay: padding forzado - safe-area ya est? en la regla base */
    .modal-overlay {
        padding: 20px !important;
    }
}

/* 10. SAFE AREAS PARA NOTCH/DYNAMIC ISLAND */
@supports (padding: env(safe-area-inset-top)) {


    .floating-controls {
        padding-bottom: 0 !important;
    }

    .container {
        padding-left: calc(20px + env(safe-area-inset-left)) !important;
        padding-right: calc(20px + env(safe-area-inset-right)) !important;
    }
}

/* 11. LANDSCAPE M?VIL OPTIMIZADO */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reducir padding vertical */
    .container {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    /* Comprimir elementos */
    .timer-card {
        padding: 15px !important;
    }

    .time-display {
        font-size: 60px !important;
    }

    /* Ocultar elementos no cr?ticos */
    .quote-box,
    .ad-space {
        display: none !important;
    }
}

/* 12. REDUCIR MOTION PARA USUARIOS CON PREFERENCIAS */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 13. OPTIMIZAR PARA PANTALLAS PEQUE?AS (iPhone SE, etc) */
@media (max-width: 360px) {
    /* Reducir font-sizes generales */
    html {
        font-size: 16px !important;
    }

    /* Botones m?s compactos */
    .btn {
        padding: 10px 15px !important;
        font-size: 16px !important;
    }

    /* Timer m?s peque?o */
    .time-display {
        font-size: 64px !important;
    }

    /* Counter: escala adicional en pantallas mínimas */
    .counter {
        transform: scale(0.80);
        transform-origin: center;
    }
    .counter-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.72em !important;
    }
    .counter-value {
        font-size: 1.3em !important;
    }
}

/* 14. DARK MODE OPTIMIZATION */
/* Ya manejado completamente por theme-ali.css */

/* 15. HOVER ONLY ON DESKTOP */
@media (hover: hover) and (pointer: fine) {
    /* Efectos hover solo en desktop */
    .btn:hover,
    .icon-btn:hover {
        transform: translateY(-2px) !important;
    }
}

/* 16. EVITAR ZOOM EN INPUTS EN iOS */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px !important; /* iOS no hace zoom si es >= 16px */
    }
}

/* 17. MEJORAR PERFORMANCE DE CONFETTI EN M?VIL */
@media (max-width: 768px) {
    .confetti {
        will-change: auto !important;
        transform: translateZ(0) !important;
    }
}

/* 18. OPTIMIZAR CELEBRACION EN MOVIL */
@media (max-width: 480px) {
    .celebration-text {
        padding: 15px !important;
        width: 90vw !important;
    }

    .celebration-quote {
        font-size: 1.2em !important;
        line-height: 1.4 !important;
        margin-bottom: 15px !important;
    }

    .celebration-author {
        font-size: 1em !important;
        margin-bottom: 20px !important;
    }

    .celebration-title {
        font-size: 1.8em !important;
        word-wrap: break-word !important;
    }
}

/* ============================================
   ?? OPTIMIZACIONTI-LAG
   Elimina lag en PREPARING y FIGHT
   ============================================ */

/* ============================================
   PROBLEMA 1: vignettePulse con gradientes animados
   SOLUCI?N: Desactivar animaci?n de gradientes
   ============================================ */

@keyframes vignettePulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

    /* ?? FIX FINAL M?VIL: Asegurar Grid 2x2 sin romper layout */
    @media (max-width: 480px) {
        /* 1. Forzar contenedor flexible */
        .settings-panel {
            display: flex !important;
            flex-direction: row !important;
            flex-wrap: wrap !important;
            height: auto !important;
            max-height: 85vh !important;
            overflow-y: auto !important;
            -webkit-overflow-scrolling: touch !important;
            overscroll-behavior: contain !important;
            padding-bottom: 20px !important;
        }

    /* 2. Forzar tarjetas al 46% (seguridad matem?tica) */
    .setting-row {
        width: 46% !important;
        margin: 2% !important;
        min-height: 72px !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 8px 5px !important;
    }

    /* Counter: escala el grupo entero si el espacio es justo */
    .counter {
        transform: scale(0.88);
        transform-origin: center;
    }
    .counter-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.78em !important;
    }

    /* 3. Asegurar que ocupen todo el ancho los t?tulos */
    .settings-title,
    .training-summary,
    .mode-buttons,
    .kcal-goal-section {
        width: 100% !important;
        flex-basis: 100% !important;
    }
}


/* ============ ?? FIX FINAL DE ALINEACI?N (GRID 2x2) ============ */

/* 1. Contenedor Maestro */
.settings-panel {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
    align-content: flex-start !important;
    justify-content: space-between !important; /* Distribuye bien el espacio */
}

/* 2. Elementos de ANCHO COMPLETO (T?tulos y Botones Grandes) */
.settings-title,
.training-summary,
.mode-buttons,
.kcal-goal-section,
#installAppBtn,
#installBtn {
    width: 100% !important;
    flex-basis: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 8px !important;
}

/* S?lo los botones de instalaci?n necesitan padding-bottom: 0 */
#installAppBtn,
#installBtn {
    padding-bottom: 0 !important;
}

/* 3. Tarjetas Peque?as (GRID 2x2) */
.setting-row {
    width: 48% !important;
    margin: 0 !important;
    margin-bottom: 8px !important;
    padding-bottom: 4px !important;
}
/* ============ ANUNCIO FLOTANTE (ESTILO AZULADO) ============ */

/* 1. El Contenedor - posici?n superior izquierda, debajo de los botones de icono */
.amazon-ad-wrapper.left-align {
    position: fixed !important;
    /* Debajo del grupo de iconos flotantes (40px bot?n + 10px offset + safe-area) */
    top: max(56px, calc(env(safe-area-inset-top, 0px) + 56px)) !important;
    bottom: auto !important;
    left: max(2px, calc(env(safe-area-inset-left, 0px) + 2px)) !important;
    z-index: 9999 !important;
    margin: 0;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s ease,
                visibility 0.3s ease;
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

/* Ocultar suavemente cuando hay menús o modales superpuestos */
body:has(#langMenu.show) .amazon-ad-wrapper,
body:has(.modal.show) .amazon-ad-wrapper {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
/* body:has(#settingsPanel.show) .amazon-ad-wrapper — ELIMINADO:
   :has() sobre .show dispara un layout-recalc masivo al abrir el panel.
   El ocultado del ad cuando se abre settings se gestiona desde JS
   añadiendo/quitando la clase .ad-hidden directamente en el wrapper. */

.amazon-ad-wrapper.ad-hidden {
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
}

/* Floating controls - botones Reiniciar / Salir (pill-shape) */
.controls-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.controls-row .btn {
    flex: 1;
    padding: 14px 20px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    letter-spacing: 2px !important;
    text-transform: uppercase;
    border-radius: 50px !important;
    background: rgba(10, 15, 25, 0.6) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    transition: all 0.2s ease !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.controls-row .btn .btn-icon {
    font-size: 1.2em;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}

.btn-restart { border-bottom: 2px solid rgba(243, 156, 18, 0.8) !important; }
.btn-restart:active { transform: scale(0.96) !important; box-shadow: 0 0 20px rgba(243, 156, 18, 0.4) !important; }

.btn-exit { border-bottom: 2px solid rgba(231, 76, 60, 0.8) !important; }
.btn-exit:active { transform: scale(0.96) !important; box-shadow: 0 0 20px rgba(231, 76, 60, 0.4) !important; }


/* ============ CENTER ACTION ICON (pop feedback al pausar/reanudar) ============ */
.center-action-icon {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    font-size: 40px;
    color: rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 4px 15px rgba(0,0,0,0.8));
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.center-action-icon.animate-pop {
    animation: popFadeOutBottom 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes popFadeOutBottom {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.8); }
    20%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); filter: brightness(1.5); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-15px) scale(1.4); }
}

/* ============ BODY SCROLL LOCK INDIVIDUAL ============ */
/* Bloquea el fondo SOLO cuando estos modales específicos están abiertos */
body:has(#profileModal.show),
body:has(#statsModal.show),
body:has(#leagueModal.show),
body:has(#trophyModal.show),
body:has(#themeSelectorModal.show) {
    overflow: hidden !important;
    overscroll-behavior-y: none !important;
}

/* ============ SCROLL INTERNO DE LOS MODALES ============ */
/* Asegura que el contenido DENTRO de los modales sí pueda desplazarse en móviles */
#profileModal.show .modal-content,
#statsModal.show .modal-content,
#leagueModal.show .modal-content,
#trophyModal.show .modal-content,
#themeSelectorModal.show .theme-selector-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    max-height: 85vh !important;
    padding-bottom: 30px !important;
}

/* Evita que la grid de logros quede cortada */
#trophyModal.show .achievements-grid {
    overflow-y: visible !important;
    padding-bottom: 20px;
}

/* ============ CLOUD SYNC INDICATOR ============ */
.global-sync-indicator {
    position: fixed;
    top: max(15px, calc(var(--safe-top) + 15px));
    right: 50%;
    transform: translateX(50%) translateY(-20px);
    background: rgba(15, 20, 30, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.2);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.global-sync-indicator.show {
    opacity: 1;
    transform: translateX(50%) translateY(0);
}
.sync-icon.spin {
    display: inline-block;
    animation: syncSpin 1.5s linear infinite;
    filter: drop-shadow(0 0 5px #00e5ff);
}
@keyframes syncSpin { 100% { transform: rotate(360deg); } }


/* 2. La Tarjeta - Glassmorphism */
.brand-card.small {
    width: 110px;
    height: 36px;
    padding: 0 10px;
    background: rgba(15, 30, 50, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    overflow: hidden;
    position: relative;
    /* La rotaci?n del motor JS ya no cambia el borde - se ignora el borderColor inline */
}

/* Feedback t?ctil */
.brand-card.small:active {
    transform: scale(0.95);
    background: rgba(15, 30, 50, 0.65);
}

/* T?tulo de marca */
.brand-card.small .brand-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Twemoji Mozilla', emoji, sans-serif;
    color: #ffffff;
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* CTA */
.brand-card.small .brand-cta {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Twemoji Mozilla', emoji, sans-serif;
    color: #4facfe;
    font-size: 8px;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 4px;
}
.brand-card.small .brand-cta::after { content: ''; } /* quitar flecha est?tica heredada */

/* Etiqueta legal - discreta, casi invisible */
.legal-footer {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 6.5px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 1px;
    margin-left: 0;
    font-family: sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}


/* -- Bot?n Desconectar Google ----------------------------------------------- */
.btn-disconnect-google {
    display: none; /* JS lo muestra solo cuando hay sesi?n Google */
    width: 100%;
    margin-top: 10px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    color: #94a3b8;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    touch-action: manipulation;
}

.btn-disconnect-google:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: #cbd5e1;
    color: #cbd5e1;
}

.btn-disconnect-google:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-delete-account {
    display: none; /* JS lo muestra solo cuando hay sesión Google */
    width: 100%;
    margin-top: 6px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 10px;
    color: #ef4444;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    touch-action: manipulation;
}

.btn-delete-account:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #f87171;
    color: #f87171;
}

.btn-delete-account:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* -- AdMob nativo: oculto en lobby, visible solo durante entrenamiento ----
   Default hidden → solo aparece cuando body tiene timer-active.
   El plugin nativo (AdMobNative.showAd) se gestiona en paralelo desde JS. */
#admob-native-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.timer-active #admob-native-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* -- Ancla invisible para el banner nativo AdMob (solo rounds) ----------- */
#round-ad-placeholder {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 50px;
    opacity: 0;
    pointer-events: none;
    z-index: 9000;
}

/* Anular el borderColor inline que inyecta el motor de rotaci?n JS
   (el glassmorphism usa borde fijo rgba(255,255,255,0.1)) */
#native-ad-template {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ============================================
   BATTLE CARD - Victory Screen
   ============================================ */

#battleCardModal {
    z-index: 9000;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

#battleCardModal.show {
    display: flex;
}

.battle-card-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: linear-gradient(160deg, #0d0d1a 0%, #0a0a14 40%, #0d0d1a 100%);
    border: 2px solid #c9a227;
    border-radius: 20px;
    padding: 28px 24px 24px;
    text-align: center;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(201,162,39,0.25),
        0 0 40px rgba(201,162,39,0.18),
        0 0 80px rgba(201,162,39,0.08),
        0 24px 64px rgba(0,0,0,0.8);
    animation: bcEntrance 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Esquinas decorativas estilo UFC */
.battle-card-content::before,
.battle-card-content::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: #c9a227;
    border-style: solid;
    opacity: 0.6;
}
.battle-card-content::before {
    top: 10px; left: 10px;
    border-width: 2px 0 0 2px;
    border-radius: 4px 0 0 0;
}
.battle-card-content::after {
    bottom: 10px; right: 10px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 4px 0;
}

@keyframes bcEntrance {
    from { opacity: 0; transform: scale(0.88) translateY(30px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Header */
.bc-header {
    position: relative;
    margin-bottom: 18px;
}

.bc-app-logo {
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #c9a227;
    text-transform: uppercase;
    opacity: 0.75;
    margin-bottom: 10px;
}

.bc-victory-label {
    font-size: 2.8em;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #fff;
    text-shadow:
        0 0 20px rgba(201,162,39,0.8),
        0 0 40px rgba(201,162,39,0.4),
        0 2px 0 rgba(0,0,0,0.8);
    will-change: opacity;
    animation: bcTitleGlow 2s ease-in-out infinite alternate;
    line-height: 1;
}

/* GPU via opacity — static text-shadow kept on element above */
@keyframes bcTitleGlow {
    from { opacity: 0.75; }
    to   { opacity: 1; }
}

/* Fighter section */
.bc-fighter-section {
    margin: 20px 0 18px;
}

.bc-belt-icon {
    font-size: 3.2em;
    line-height: 1;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 12px rgba(255,215,0,0.6));
    animation: bcBeltPulse 2.5s ease-in-out infinite;
}

@keyframes bcBeltPulse {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 10px rgba(255,215,0,0.5)); }
    50%       { transform: scale(1.08); filter: drop-shadow(0 0 20px rgba(255,215,0,0.9)); }
}

.bc-fighter-name {
    font-size: 2em;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ffffff;
    line-height: 1.1;
    word-break: break-word;
}

.bc-fighter-tag {
    font-size: 0.85em;
    font-weight: 600;
    color: #c9a227;
    letter-spacing: 0.12em;
    margin-top: 4px;
    opacity: 0.85;
}

/* Stats grid */
.bc-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(201,162,39,0.2);
    border-radius: 12px;
    padding: 16px 8px;
    margin: 0 0 20px;
}

.bc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.bc-stat-sep {
    border-left: 1px solid rgba(201,162,39,0.25);
    padding: 0 8px;
}

.bc-stat-value {
    font-size: 1.9em;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
    letter-spacing: -0.02em;
}

.bc-stat-label {
    font-size: 0.6em;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c9a227;
    opacity: 0.8;
}

/* XP Row — héroe dopamínico */
@keyframes bc-xp-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}
@keyframes bc-xp-glow-pulse {
    0%, 100% { text-shadow: 0 0 12px #f0c040, 0 0 24px rgba(201,162,39,0.5); }
    50%       { text-shadow: 0 0 22px #ffd700, 0 0 44px rgba(201,162,39,0.8), 0 0 64px rgba(201,162,39,0.25); }
}
.bc-xp-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 12px 0 16px;
}
.bc-xp-value {
    font-size: 2.6em;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: -0.02em;
    animation: bc-xp-pop 0.55s cubic-bezier(0.34,1.56,0.64,1) both,
               bc-xp-glow-pulse 2s ease-in-out 0.55s infinite;
}
.bc-xp-label {
    font-size: 0.62em;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #c9a227;
    opacity: 0.85;
}

/* Divider */
.bc-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
    opacity: 0.4;
    margin: 0 0 18px;
}

/* Quote */
.bc-quote {
    font-size: 0.88em;
    font-style: italic;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
    min-height: 2.8em;
    padding: 0 8px;
    margin-bottom: 4px;
}

.bc-quote-author {
    font-size: 0.72em;
    font-weight: 700;
    color: #c9a227;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    opacity: 0.85;
}

/* Watermark */
.bc-watermark {
    font-size: 0.58em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
    margin-bottom: 20px;
}

/* Buttons */
.bc-buttons {
    display: flex;
    gap: 10px;
}

.bc-btn-share,
.bc-btn-close {
    flex: 1;
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.bc-btn-share {
    background: linear-gradient(135deg, #c9a227 0%, #f0c040 50%, #c9a227 100%);
    color: #0a0a14;
    box-shadow: 0 4px 20px rgba(201,162,39,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bc-btn-share:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(201,162,39,0.3);
}

.bc-btn-close {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.12);
}

.bc-btn-close:active {
    transform: scale(0.96);
    background: rgba(255,255,255,0.12);
}

/* Responsive peque?o */
@media (max-width: 360px) {
    .bc-victory-label  { font-size: 2.2em; }
    .bc-fighter-name   { font-size: 1.6em; }
    .bc-belt-icon      { font-size: 2.6em; }
    .bc-stat-value     { font-size: 1.35em; }
    .bc-stat-sep       { padding: 0 5px; }
}

/* ============================================
   FINISHED STATE - Ring of Gold
   Sobreescribe el verde por el tema oscuro/dorado
   ============================================ */

/* Fondo: foco cenital oscuro, casi negro */
body.finished::before {
    background: radial-gradient(
        circle at 50% 10%,
        #2a0800 0%,
        #0a0a0a 70%,
        #000000 100%
    ) !important;
}

/* Badge LUNA - solo visible en estado finished */
.fs-luna-badge {
    display: none;
}
body.finished .fs-luna-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;           /* ocupa todo el espacio entre fs-round y el bottom card */
    margin-bottom: 0;  /* el centrado flex reemplaza el margin */
    opacity: 0.8;
    animation: lunaFadeIn 1.2s ease both;
}

/* fs-center-block vacío en finished (time + status ocultos por JS) — colapsar */
body.finished .fs-center-block {
    display: none;
}

body.finished .fs-luna-badge .luna-icon {
    font-size: 42px;
    text-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    margin-bottom: 8px;
}

body.finished .fs-luna-badge .dmz-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes lunaFadeIn {
    from { opacity: 0; }
    to   { opacity: 0.8; }
}

/* Ocultar la frase flotante en finished - se mueve al panel inferior */
body.finished .fs-quote {
    display: none !important;
}

/* Tipograf?a dorada ?pica en el timer y el estado */
body.finished .fs-time,
body.finished .fs-status {
    color: #ffd700 !important;
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.5),
        0 5px 10px rgba(0, 0, 0, 0.8) !important;
}

/* Ocultar floating-controls completo en finished: los botones de acción
   (REINICIAR/SALIR) viven en .fs-finished-bottom, no aquí */
body.finished .floating-controls {
    display: none !important;
}

/* -- Finished bottom wrapper - un solo ancla, todo fluye dentro -- */
.fs-finished-bottom {
    display: none;
}

body.finished .fs-finished-bottom {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    max-width: 420px;
    animation: fsFinishedIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    z-index: 10;
}

@keyframes fsFinishedIn {
    from { opacity: 0; transform: translateX(-50%) translateY(24px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* -- Stats panel ---------------------------------- */
.fs-finished-panel {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 14px;
    padding: 20px;
    gap: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Fila superior: nombre + kcal */
.fs-finished-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.fs-finished-fighter {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    min-width: 0;
}

.fs-finished-fighter-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    min-width: 0;
}

.fs-finished-belt {
    font-size: 1.6em;
    line-height: 1;
    flex-shrink: 0;
}

.fs-finished-name {
    font-size: 1em;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* MEJORA-B: stats de sesi?n debajo del nombre */
.fs-finished-session-stats {
    font-size: 0.68em;
    font-weight: 600;
    color: rgba(255, 215, 0, 0.6);
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.fs-finished-kcal {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.fs-finished-kcal-value {
    font-size: 1.7em;
    font-weight: 900;
    color: #ffd700;
    line-height: 1;
}

.fs-finished-kcal-unit {
    font-size: 0.6em;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 215, 0, 0.7);
    text-transform: uppercase;
}

/* Fila inferior: frase motivacional */
.fs-finished-quote {
    margin-top: 14px;
    font-style: italic;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    line-height: 1.5;
}

/* -- Action buttons ------------------------------- */
.fs-finished-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.fs-btn-share-glory,
.fs-btn-finish {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.fs-btn-share-glory {
    background: linear-gradient(135deg, #c9a227 0%, #f0c040 50%, #c9a227 100%);
    color: #0a0a14;
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.45);
}

.fs-btn-share-glory:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(201, 162, 39, 0.3);
}

.fs-btn-finish {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #555;
}

.fs-btn-finish:active {
    transform: scale(0.96);
    background: #2a2a2a;
}

@media (max-width: 360px) {
    body.finished .fs-finished-bottom { bottom: 28px; }
    .fs-finished-name { max-width: 110px; }
}

/* ============================================
   WALL OF SHAME - shame-mode
   ============================================ */

/* MEJORA-D: Transici?n de filter en el body - aplica tanto al entrar como al salir del shame */
body {
    transition: filter 0.8s ease;
}

/* Desaturar toda la UI cuando el usuario baja de rango */
body.shame-mode {
    filter: grayscale(100%) contrast(1.05);
}

/* Modales que deben mantenerse a color aunque shame-mode est? activo */
#shameModal,
#battleCardModal {
    filter: none !important;
}

/* -- Shame modal ---------------------------- */
#shameModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#shameModal.show {
    display: flex;
    animation: shameIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes shameIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.shame-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: #0d0d0d;
    border: 2px solid #333;
    border-radius: 20px;
    padding: 36px 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    animation: shameContentIn 0.45s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes shameContentIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.shame-skull {
    font-size: 3.5em;
    line-height: 1;
    filter: grayscale(100%);
    animation: shamePulse 2s ease-in-out infinite;
}

@keyframes shamePulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.08); }
}

.shame-title {
    font-size: 1.4em;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #cccccc;
}

.shame-msg {
    font-size: 0.95em;
    font-weight: 600;
    color: #999;
    line-height: 1.5;
}

.shame-cta {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #555;
}

.shame-close-btn {
    margin-top: 8px;
    padding: 14px 28px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 10px;
    color: #aaa;
    font-size: 0.8em;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.shame-close-btn:active {
    background: #2a2a2a;
    color: #fff;
}

@keyframes moonPop {
    0%   { transform: scale(0) rotate(-40deg); opacity: 0; filter: drop-shadow(0 0 0px transparent); }
    60%  { transform: scale(1.3) rotate(8deg); opacity: 1; filter: drop-shadow(0 0 16px rgba(74,222,128,1)); }
    80%  { transform: scale(0.92) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; filter: drop-shadow(0 0 8px rgba(74,222,128,0.7)); }
}
@keyframes epicTextIn {
    0%   { opacity: 0; transform: scale(0.8) translateY(6px); }
    65%  { opacity: 1; transform: scale(1.06) translateY(-1px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes savedTextOut {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(0.9) translateY(-4px); }
}

/* ============================================================
   IMMERSIVE MODE (CSS-based — reemplaza la Fullscreen API)
   body.timer-active ya oculta container, top-controls, music-btn,
   darkmode-btn y muestra fullscreen-timer.
   body.immersive-mode añade la segunda capa: elimina los botones
   flotantes extras y el sync indicator para foco total.
   Se quita en pausa → league/trophy reaparecen para navegar.
   ============================================================ */

body.immersive-mode .league-btn,
body.immersive-mode .trophy-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.immersive-mode #globalSyncIndicator {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Cuando NO está en immersive-mode, la transición de vuelta también es suave */
.league-btn,
.trophy-btn {
    transition: opacity 0.25s ease, transform 0.3s, box-shadow 0.3s;
}

/* ============================================================
   PRIORIDAD 3 — ONBOARDING & CLARITY
   ============================================================ */

/* -- Belt Progress Hint ------------------------------------ */
.belt-progress-hint {
    margin: 10px 0 4px;
    padding: 9px 13px;
    background: rgba(255,255,255,0.04);
    border-left: 3px solid var(--hint-color, #60a5fa);
    border-radius: 8px;
    font-size: 0.8rem;
    color: #c0c0d8;
    letter-spacing: 0.01em;
    line-height: 1.45;
    transition: border-color 0.3s;
}
.belt-hint-max {
    border-left-color: #ffd700 !important;
    color: #ffd700;
}

/* -- Login CTA (non-Google users) -------------------------- */
.login-cta {
    text-align: center;
    padding: 4px 4px 8px;
    margin-bottom: 4px;
}
.login-cta-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px;
    letter-spacing: 0.02em;
}
.login-cta-desc {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.5);
    margin: 0 0 8px;
    line-height: 1.45;
}

/* -- DnD Warning Toast ------------------------------------- */
.dnd-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    max-width: 340px;
    width: calc(100% - 40px);
    background: rgba(16, 16, 30, 0.96);
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 14px;
    padding: 11px 16px;
    font-size: 0.8rem;
    color: #cac8e8;
    line-height: 1.5;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 6px 28px rgba(0,0,0,0.5), 0 0 0 1px rgba(167,139,250,0.15);
}
.dnd-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.dnd-toast-title {
    font-weight: 700;
    color: #a78bfa;
    margin-right: 3px;
}

/* ============================================================
   PERF: COUNTER-BTN — GPU-ACCELERATED :active (gama baja)
   Sobrescribe todas las reglas duplicadas anteriores.
   Solo transform → compositor thread, cero repaint.
   ============================================================ */
.counter-btn {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0); /* promueve a capa GPU antes del primer tap */
}
.counter-btn:active {
    transform: scale(0.93) translateZ(0) !important;
    /* sin background, sin box-shadow: evita repaint en cada toque */
    opacity: 0.75 !important;
    box-shadow: none !important;
    background: none !important;
    transition: transform 0.08s ease, opacity 0.08s ease !important;
}

/* ============================================================
   NOTIFICATION MANAGER — Toast + Achievement Queue
   ============================================================ */

/* ── Toast: informativo, parte inferior de la pantalla ── */
.nm-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    max-width: 360px;
    width: calc(100% - 40px);
    background: rgba(16, 16, 30, 0.96);
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #d8d6f0;
    line-height: 1.45;
    z-index: 9997;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
    border-left: 4px solid rgba(148, 163, 184, 0.5); /* default: info */
}
.nm-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Colores por tipo */
.nm-toast[data-type="success"] { border-left-color: #4ade80; }
.nm-toast[data-type="warning"] { border-left-color: #fbbf24; }
.nm-toast[data-type="error"]   { border-left-color: #f87171; }
.nm-toast[data-type="info"]    { border-left-color: #818cf8; }

/* ── Achievement: banner celebratorio, parte superior ── */
.nm-achieve {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    max-width: 320px;
    width: calc(100% - 48px);
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.97), rgba(30, 20, 50, 0.97));
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 18px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(167, 139, 250, 0.2);
}
.nm-achieve.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.nm-achieve-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.nm-achieve-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2d9f3;
    letter-spacing: 0.01em;
}

/* ============================================================
   STATS MODAL — Elite v3 (Obsidian + GPU Animations)
   Regla de oro de animaciones: SOLO opacity y transform.
   Nunca animar box-shadow directamente → repaint en cada frame.
   El glow "respira" via opacity en ::before → compositor thread.
   ============================================================ */

/* ── Keyframes GPU-safe ─────────────────────────────────────── */
@keyframes sme-breathe {
    0%,  100% { opacity: 0.20; }
    50%        { opacity: 0.65; }
}
@keyframes sme-card-in {
    from { opacity: 0; transform: translateY(6px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
@keyframes cyberPulse {
    0%   { box-shadow: inset 0 0 10px rgba(0,195,255,0.05), 0 0  5px rgba(0,195,255,0.10), 0 4px 15px rgba(0,0,0,0.50); }
    50%  { box-shadow: inset 0 0 10px rgba(0,195,255,0.10), 0 0 15px rgba(0,195,255,0.30), 0 4px 15px rgba(0,0,0,0.50); }
    100% { box-shadow: inset 0 0 10px rgba(0,195,255,0.05), 0 0  5px rgba(0,195,255,0.10), 0 4px 15px rgba(0,0,0,0.50); }
}

/* ── Modal container ────────────────────────────────────────── */
#statsModal .modal-content {
    background: linear-gradient(135deg, rgba(8,12,24,0.98) 0%, rgba(4,8,18,0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 195, 255, 0.12);
    box-shadow:
        0 0 0 1px rgba(0, 195, 255, 0.04),
        0 28px 64px rgba(0, 0, 0, 0.85),
        inset 0 1px 0 rgba(0, 195, 255, 0.08);
    padding: 20px 16px 12px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

/* Halo cian que respira — solo opacity, cero repaint */
#statsModal .modal-content::before {
    content: '';
    position: absolute;
    top: -35%;
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    height: 70%;
    background: radial-gradient(ellipse, rgba(0, 195, 255, 0.07) 0%, transparent 68%);
    pointer-events: none;
    animation: sme-breathe 5s ease-in-out infinite;
    will-change: opacity;
    z-index: 0;
}

/* Todo el contenido por encima del halo */
#statsModal .modal-content > * { position: relative; z-index: 1; }

/* ── Header ─────────────────────────────────────────────────── */
.sme-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.sme-title {
    font-size: 0.9em;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(0, 212, 255, 0.50);
}

/* ── Grid 2×2 ────────────────────────────────────────────────── */
.sme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.sme-card {
    background: linear-gradient(135deg, rgba(10,15,30,0.85) 0%, rgba(5,10,20,0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 195, 255, 0.15);
    border-radius: 16px;
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow:
        inset 0 0 10px rgba(0, 195, 255, 0.05),
        0 4px 15px rgba(0, 0, 0, 0.50);
    animation: sme-card-in 0.30s ease both;
    will-change: transform, opacity;
}

/* Entrada escalonada de las 4 tarjetas */
.sme-card:nth-child(1) { animation-delay: 0.00s; }
.sme-card:nth-child(2) { animation-delay: 0.05s; }
.sme-card:nth-child(3) { animation-delay: 0.10s; }
.sme-card:nth-child(4) { animation-delay: 0.15s; }

/* Valores numéricos — Cyan eléctrico */
.sme-val {
    font-size: 1.8em;
    font-weight: 900;
    font-family: 'Courier New', monospace;
    color: #00d4ff;
    line-height: 1;
    letter-spacing: -0.02em;
    text-shadow:
        0 0 8px rgba(0, 212, 255, 0.50),
        0 0 22px rgba(0, 212, 255, 0.18);
}

/* Variante para tiempo y racha — mismo cian, idéntico al resto */
.sme-val--gold {
    color: #00d4ff;
    text-shadow:
        0 0 8px rgba(0, 212, 255, 0.50),
        0 0 22px rgba(0, 212, 255, 0.18);
}

.sme-lbl {
    font-size: 0.62em;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
}

/* ── Energy block ───────────────────────────────────────────── */
.sme-energy {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(10,15,30,0.85) 0%, rgba(5,10,20,0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 195, 255, 0.15);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow:
        inset 0 0 10px rgba(0, 195, 255, 0.05),
        0 4px 15px rgba(0, 0, 0, 0.50);
}

.sme-energy-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Divisor cian — encaja en la paleta cyber */
.sme-energy-divider {
    width: 1px;
    height: 44px;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(0, 195, 255, 0.22) 30%,
        rgba(0, 195, 255, 0.22) 70%,
        transparent 100%);
    flex-shrink: 0;
}

.sme-energy-icon { font-size: 1.25em; line-height: 1; }

.sme-energy-val {
    font-size: 1.05em;
    font-weight: 800;
    color: #00d4ff;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.45);
}

.sme-energy-lbl {
    font-size: 0.58em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
}

/* ── Belt card ─────────────────────────────────────────────── */
.sme-belt-card {
    background: linear-gradient(135deg, rgba(10,15,30,0.90) 0%, rgba(5,10,20,0.97) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 195, 255, 0.15);
    border-radius: 16px;
    padding: 14px 16px 12px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    animation: cyberPulse 4s infinite ease-in-out;
}

/* Halo cian que respira — opacity-only, GPU safe */
.sme-belt-card::before {
    content: '';
    position: absolute;
    bottom: -25%;
    right: -5%;
    width: 55%;
    height: 75%;
    background: radial-gradient(ellipse, rgba(0, 195, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
    animation: sme-breathe 6s ease-in-out infinite;
    animation-delay: 2s;
    will-change: opacity;
}

.sme-belt-card .league-user-rank {
    background: none !important;
    border: none !important;
    padding: 0 0 10px !important;
    margin-bottom: 0 !important;
}

.sme-belt-card .league-belt-icon { font-size: 2.1em; }

.sme-belt-card .league-rank-name {
    font-size: 1.05em;
    font-weight: 900;
    color: #00d4ff;
    text-shadow:
        0 0 10px rgba(0, 212, 255, 0.60),
        0 0 26px rgba(0, 212, 255, 0.22);
}

.sme-belt-card .league-rank-sub {
    font-size: 0.68em;
    color: rgba(255, 255, 255, 0.36);
}

.sme-belt-card .league-progress-bar {
    height: 4px;
    background: rgba(0, 195, 255, 0.08);
    border: none !important;
    border-radius: 999px;
}

.sme-belt-card .league-progress-fill {
    background: linear-gradient(90deg, rgba(0,100,180,1) 0%, #00d4ff 70%, #7df9ff 100%);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.55);
}

.sme-belt-card .league-progress-label {
    color: rgba(255, 255, 255, 0.28);
    font-size: 0.66em;
    margin-top: 7px;
}

/* ── Rust alert ─────────────────────────────────────────────── */
#statsModal .league-rust-alert {
    border-radius: 12px;
    margin-bottom: 12px;
    border-color: rgba(204, 51, 0, 0.55);
}

/* ── Survival quota ─────────────────────────────────────────── */
.sme-survival {
    background: linear-gradient(135deg, rgba(10,15,30,0.85) 0%, rgba(5,10,20,0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 195, 255, 0.15);
    border-radius: 16px;
    padding: 13px 16px 11px;
    margin-bottom: 12px;
    animation: cyberPulse 4s infinite ease-in-out;
    animation-delay: 2s; /* desfasado respecto a .sme-belt-card */
}

.sme-survival .survival-header { margin-bottom: 8px; }

.sme-survival .survival-title {
    font-size: 0.63em;
    color: #00d4ff;
    letter-spacing: 0.09em;
    font-weight: 900;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.40);
}

.sme-survival .survival-quota {
    font-size: 0.63em;
    color: rgba(255, 255, 255, 0.28);
}

.sme-survival .survival-bar-track {
    height: 4px;
    background: rgba(0, 195, 255, 0.08);
    border: none;
    border-radius: 999px;
    overflow: hidden;
}

.sme-survival .survival-footer { margin-top: 7px; }

.sme-survival .survival-footer span {
    font-size: 0.62em;
    color: rgba(255, 255, 255, 0.28);
}

/* ── Belt carousel ──────────────────────────────────────────── */
#statsModal .league-belts-list {
    gap: 8px;
    padding: 4px 2px 6px;
    margin-bottom: 4px;
}

#statsModal .belt-card {
    background: linear-gradient(135deg, rgba(10,15,30,0.90) 0%, rgba(5,10,20,0.95) 100%);
    border: 1px solid rgba(0, 195, 255, 0.10);
    border-radius: 14px;
    min-width: 84px;
    padding: 10px 6px;
    gap: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.40);
}

#statsModal .belt-card-name { color: rgba(255, 255, 255, 0.42); }
#statsModal .belt-card-req  { color: rgba(255, 255, 255, 0.20); }
#statsModal .belt-card.unlocked { opacity: 0.28; }

#statsModal .belt-card.current-rank {
    background: linear-gradient(135deg, rgba(0,20,50,0.97) 0%, rgba(0,10,30,0.97) 100%);
    border: 1.5px solid rgba(0, 195, 255, 0.50);
    box-shadow:
        0 0 18px rgba(0, 195, 255, 0.12),
        0 5px 18px rgba(0, 0, 0, 0.50);
    transform: scale(1.04);
}

#statsModal .belt-card.current-rank .belt-card-name { color: #00d4ff; }

/* ── Reduce-motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #statsModal .modal-content::before,
    .sme-belt-card::before { animation: none; opacity: 0.30; }
    .sme-card              { animation: none; }
    .sme-belt-card,
    .sme-survival          { animation: none; box-shadow: inset 0 0 10px rgba(0,195,255,0.05), 0 4px 15px rgba(0,0,0,0.50); }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 400px) {
    .sme-val      { font-size: 1.5em; }
    .sme-card     { padding: 12px 11px 11px; border-radius: 13px; }
    .sme-energy   { padding: 13px 14px; }
    .sme-belt-card,
    .sme-survival { border-radius: 13px; }
}


/* AUDIO MODAL — Light theme override ELIMINADO.
   El modal es siempre oscuro e inmersivo, sin excepción de modo del sistema. */


/* ═══════════════════════════════════════════════════════════════════════
   PERF-FIX-1 — Neutralizar backdrop-filter durante body.fighting
   El conic-gradient 2.5× de fondo hace que blur() sea muy costoso.
   Sustituimos por un fondo sólido oscuro que visualmente no se nota.
   ═══════════════════════════════════════════════════════════════════════ */
body.fighting .modal-overlay,
body.fighting .modal-overlay.show {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.92) !important;
}

body.fighting .settings-panel,
body.fighting .settings-panel.show {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    /* Conserva el aspecto visual con un fondo sólido equivalente */
    background: rgba(10, 10, 30, 0.97) !important;
}

/* Cubre cualquier overlay/card con backdrop-filter no catalogado */
body.fighting [style*="backdrop-filter"] {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════
   PERF-FIX-2 — Scoping de will-change: solo activo cuando anima
   Los elementos ocultos durante el combate liberan sus capas GPU.
   Los elementos del panel de ajustes solo promueven cuando están abiertos.
   ═══════════════════════════════════════════════════════════════════════ */

/* Settings panel: GPU solo cuando está en tránsito (abriéndose/cerrándose).
   La regla base tenía will-change permanente aunque el panel estuviera cerrado. */
.settings-panel {
    will-change: auto;
}
.settings-panel.show {
    will-change: transform, opacity;
}

/* ── Hall of Fame Semanal ──────────────────────────────────────────────────── */
.hof-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(20px, env(safe-area-inset-top, 20px))
             max(16px, env(safe-area-inset-right, 16px))
             max(20px, env(safe-area-inset-bottom, 20px))
             max(16px, env(safe-area-inset-left, 16px));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}
.hof-overlay.hof-visible {
    opacity: 1;
    pointer-events: auto;
}

.hof-box {
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 60%, #0f0f1a 100%);
    border: 1px solid rgba(255, 215, 0, 0.22);
    border-radius: 22px;
    padding: 24px 20px 20px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.12), 0 20px 60px rgba(0,0,0,0.7);
    transform: translateY(18px) scale(0.97);
    transition: transform 0.30s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hof-overlay.hof-visible .hof-box {
    transform: translateY(0) scale(1);
}

/* Header */
.hof-header {
    text-align: center;
    margin-bottom: 18px;
}
.hof-crown {
    font-size: 2.2em;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(255,215,0,0.6));
}
.hof-title {
    font-size: 1.25em;
    font-weight: 800;
    color: #ffd700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 6px;
}
.hof-week-label {
    font-size: 0.72em;
    color: rgba(255,255,255,0.38);
    letter-spacing: 0.08em;
    margin-top: 2px;
    text-transform: uppercase;
}

/* Filas del ranking */
.hof-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}
.hof-row {
    display: grid;
    grid-template-columns: 28px 24px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    font-size: 0.83em;
}
/* Jerarquía visual por posición */
.hof-row-top1 {
    background: linear-gradient(90deg, rgba(255,215,0,0.16) 0%, rgba(255,184,0,0.05) 100%);
    border-color: rgba(255,215,0,0.35);
}
.hof-row-top1 .hof-medal  { color: #ffd700; font-size: 1.15em; }
.hof-row-top1 .hof-name   { color: #ffe566; font-weight: 700; }
.hof-row-top1 .hof-score  { color: #ffd700; }

.hof-row-top2 {
    background: linear-gradient(90deg, rgba(192,192,192,0.13) 0%, rgba(160,160,160,0.03) 100%);
    border-color: rgba(192,192,192,0.28);
}
.hof-row-top2 .hof-medal  { color: #c0c0c0; font-size: 1.08em; }
.hof-row-top2 .hof-name   { color: #d8d8d8; font-weight: 600; }
.hof-row-top2 .hof-score  { color: #b0b0b0; }

.hof-row-top3 {
    background: linear-gradient(90deg, rgba(205,127,50,0.14) 0%, rgba(180,100,30,0.03) 100%);
    border-color: rgba(205,127,50,0.28);
}
.hof-row-top3 .hof-medal  { color: #cd7f32; font-size: 1.0em; }
.hof-row-top3 .hof-name   { color: #e8a060; font-weight: 600; }
.hof-row-top3 .hof-score  { color: #cd7f32; }

.hof-medal { text-align: center; }
.hof-belt  { text-align: center; font-size: 1.05em; }
.hof-name  {
    color: #ffffff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hof-score {
    color: rgba(255,255,255,0.5);
    font-size: 0.86em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Frase de Ali */
.hof-quote {
    text-align: center;
    font-size: 0.8em;
    font-style: italic;
    color: rgba(255,184,0,0.75);
    padding: 10px 8px 0;
    line-height: 1.45;
    letter-spacing: 0.01em;
}

/* Botón CTA */
.hof-cta {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 13px;
    background: linear-gradient(90deg, #c8102e, #ff3333);
    color: #fff;
    font-size: 0.88em;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(200,16,46,0.4);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hof-cta:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(200,16,46,0.3);
}

/* Durante el combate: liberar capas de elementos decorativos no visibles.
   body.timer-active ya oculta el contenedor principal, pero algunos
   navegadores retienen las capas GPU aunque el ancestro esté oculto. */
body.fighting .glove-icon,
body.fighting #startText,
body.fighting .cloud,
body.fighting .bird,
body.fighting .sparkle,
body.fighting .wind-line,
body.fighting .breath-circle,
body.fighting .breath-inner,
body.fighting .sun-glow {
    will-change: auto !important;
    animation: none !important;
}

/* ─── Fix perf: desactivar backdrop-filter en móvil ──────────────────────────
   backdrop-filter:blur() en chips MediaTek/Snapdragon gama baja cuesta 8-16ms
   por capa — con 30+ instancias en el CSS es la causa principal del lag visual.
   En móvil los fondos rgba ya son semitransparentes: el panel se ve idéntico
   sin el blur. En desktop y tablets (≥768px) el efecto glass se mantiene intacto.
────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    * {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* ─── View Transitions API: lobby → timer ────────────────────────────────────
   Sólo se aplica en navegadores que soportan startViewTransition (Chrome 111+,
   Safari 18+). En el resto, las reglas se ignoran completamente (sin coste).
   ::view-transition-old = screenshot del lobby (fade-out + leve scale-down)
   ::view-transition-new = nuevo estado del timer (fade-in + scale-up desde 0.97)
   Efecto neto: sensación de "entrar al ring" sin layout ni paint en JS.
────────────────────────────────────────────────────────────────────────────── */
@keyframes _vt-fade-out {
    to { opacity: 0; scale: 0.97; }
}
@keyframes _vt-fade-in {
    from { opacity: 0; scale: 0.97; }
}

::view-transition-old(root) {
    animation: 160ms ease-in both _vt-fade-out;
}
::view-transition-new(root) {
    animation: 220ms ease-out both _vt-fade-in;
}

/* Fallback de fuente emoji para iconos del UI — garantiza renderizado del
   guante de boxeo y demás emojis en Android WebView (minSdk 24) cuando la
   fuente del sistema no resuelve el glifo desde Inter/Roboto. */
.glove-icon,
.bc-app-logo,
.mode-icon,
.onboarding-icon,
.league-belt-icon,
.belt-card-icon,
.fs-finished-belt {
    font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Twemoji Mozilla', emoji, sans-serif;
}

/* ============ PUSH NOTIFICATIONS TOGGLE — Settings Panel ============ */
.notify-toggle-row {
    width: 100%;
    margin: 14px 0 6px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(20,20,30,0.85), rgba(10,10,20,0.95));
    border: 1px solid rgba(255, 215, 0, 0.18);
    box-shadow: 0 4px 16px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-sizing: border-box;
}
.notify-toggle-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.notify-toggle-icon {
    font-size: 1.4em; flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.35));
}
.notify-toggle-text { display: flex; flex-direction: column; min-width: 0; }
.notify-toggle-title {
    font-size: 0.85em; font-weight: 700;
    color: rgba(255, 255, 255, 0.92); letter-spacing: 0.3px;
}
.notify-toggle-subtitle {
    font-size: 0.7em; color: rgba(255, 255, 255, 0.55);
    margin-top: 2px; line-height: 1.3;
}
.notify-toggle-switch {
    position: relative; width: 50px; height: 28px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(60, 60, 80, 0.6);
    cursor: pointer; flex-shrink: 0; padding: 0;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.notify-toggle-switch[aria-checked="true"] {
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.85), rgba(0, 150, 80, 0.95));
    border-color: rgba(0, 255, 140, 0.5);
    box-shadow: 0 0 12px rgba(0, 230, 120, 0.45);
}
.notify-toggle-switch[disabled] { opacity: 0.5; cursor: not-allowed; }
.notify-toggle-thumb {
    position: absolute; top: 50%; left: 3px;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.notify-toggle-switch[aria-checked="true"] .notify-toggle-thumb { left: 25px; }
.notify-toggle-hint {
    width: 100%; margin: 4px 0 8px; padding: 8px 14px;
    font-size: 0.72em; color: rgba(255, 255, 255, 0.65);
    text-align: center;
    background: rgba(255, 60, 60, 0.08);
    border: 1px solid rgba(255, 60, 60, 0.2);
    border-radius: 8px; box-sizing: border-box;
}








/* ── Privacy & Ads — compact, discrete (bottom of Profile modal) ── */
.privacy-section {
    margin-top: 14px;
    padding: 10px 0 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.privacy-section-title {
    font-size: 0.6em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
    text-align: center;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.privacy-btn-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.privacy-btn {
    flex: 1 1 auto;
    padding: 5px 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.68em;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.3;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.privacy-btn:hover, .privacy-btn:focus-visible {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(116, 185, 255, 0.35);
}
.privacy-btn:active { transform: translateY(1px); }
