
    /* ============================================================
   NEXOIA - LAS CUATRO EN RAYA
   Diseño encapsulado
   ============================================================ */
    .nexoia-cuatro-raya {
        --nexoia-cr-primary: #2563eb;
        --nexoia-cr-primary-dark: #1d4ed8;
        --nexoia-cr-dark: #172033;
        --nexoia-cr-text: #334155;
        --nexoia-cr-muted: #64748b;
        --nexoia-cr-border: #e2e8f0;
        --nexoia-cr-light: #f8fafc;
        --nexoia-cr-white: #ffffff;
        width: 100%;
        max-width: 1100px;
        margin: 0 auto;
        padding: 20px;
        box-sizing: border-box;
        font-family:
            Arial,
            Helvetica,
            sans-serif;
        color: var(--nexoia-cr-text);
    }
    .nexoia-cuatro-raya *,
    .nexoia-cuatro-raya *::before,
    .nexoia-cuatro-raya *::after {
        box-sizing: border-box;
    }
    /* ============================================================
   CABECERA
   ============================================================ */
    .nexoia-cr-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 20px;
        margin-bottom: 20px;
        padding: 20px 22px;
        background: var(--nexoia-cr-white);
        border: 1px solid var(--nexoia-cr-border);
        border-radius: 18px;
        box-shadow:
            0 5px 18px rgba(15, 23, 42, 0.06);
    }
    .nexoia-cr-title {
        margin: 0;
        color: var(--nexoia-cr-dark);
        font-size: 28px;
        font-weight: 700;
    }
    .nexoia-cr-subtitle {
        margin: 7px 0 0;
        color: var(--nexoia-cr-muted);
        font-size: 14px;
    }
    .nexoia-cr-header-icon {
        width: 64px;
        height: 64px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 17px;
        background:
            linear-gradient(135deg,
                #eff6ff,
                #dbeafe);
        font-size: 31px;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    /* ============================================================
   SELECTOR DE NIVEL
   ============================================================ */
    .nexoia-cr-level-section {
        margin-bottom: 20px;
        padding: 18px;
        background: var(--nexoia-cr-white);
        border: 1px solid var(--nexoia-cr-border);
        border-radius: 18px;
        box-shadow:
            0 5px 18px rgba(15, 23, 42, 0.05);
    }
    .nexoia-cr-level-heading {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        margin-bottom: 14px;
    }
    .nexoia-cr-level-heading-title {
        margin: 0;
        color: var(--nexoia-cr-dark);
        font-size: 16px;
        font-weight: 700;
    }
    .nexoia-cr-level-heading-text {
        margin: 3px 0 0;
        color: var(--nexoia-cr-muted);
        font-size: 12px;
    }
    .nexoia-cr-level-current {
        padding: 6px 11px;
        border-radius: 20px;
        background: #eff6ff;
        color: #1d4ed8;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
    }
    /* TARJETAS DE NIVEL */
    .nexoia-cr-levels {
        display: grid;
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
    .nexoia-cr-level {
        position: relative;
        width: 100%;
        padding: 15px;
        border: 2px solid var(--nexoia-cr-border);
        border-radius: 15px;
        background: #ffffff;
        text-align: left;
        cursor: pointer;
        transition:
            border-color 0.18s ease,
            background 0.18s ease,
            transform 0.18s ease,
            box-shadow 0.18s ease;
        font-family: inherit;
    }
    .nexoia-cr-level:hover {
        transform: translateY(-2px);
        border-color: #bfdbfe;
        box-shadow:
            0 5px 15px rgba(37, 99, 235, 0.08);
    }
    .nexoia-cr-level:focus-visible {
        outline: 3px solid #93c5fd;
        outline-offset: 2px;
    }
    .nexoia-cr-level-active {
        border-color: var(--nexoia-cr-primary);
        background:
            linear-gradient(135deg,
                #eff6ff,
                #ffffff);
        box-shadow:
            0 5px 18px rgba(37, 99, 235, 0.12);
    }
    .nexoia-cr-level-top {
        display: flex;
        align-items: center;
        gap: 11px;
        margin-bottom: 9px;
    }
    .nexoia-cr-level-icon {
        width: 38px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 11px;
        background: var(--nexoia-cr-light);
        font-size: 20px;
    }
    .nexoia-cr-level-active .nexoia-cr-level-icon {
        background: #dbeafe;
    }
    .nexoia-cr-level-name {
        color: var(--nexoia-cr-dark);
        font-size: 14px;
        font-weight: 700;
    }
    .nexoia-cr-level-description {
        margin: 0;
        color: var(--nexoia-cr-muted);
        font-size: 12px;
        line-height: 1.45;
    }
    .nexoia-cr-level-check {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 20px;
        height: 20px;
        display: none;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--nexoia-cr-primary);
        color: white;
        font-size: 12px;
        font-weight: 700;
    }
    .nexoia-cr-level-active .nexoia-cr-level-check {
        display: flex;
    }
    /* ============================================================
   CONTROLES
   ============================================================ */
    .nexoia-cr-controls {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-bottom: 20px;
    }
    .nexoia-cr-button {
        min-height: 42px;
        padding: 9px 17px;
        border: 0;
        border-radius: 10px;
        background:
            var(--nexoia-cr-primary);
        color: white;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition:
            background 0.15s ease,
            transform 0.15s ease,
            box-shadow 0.15s ease;
    }
    .nexoia-cr-button:hover {
        background:
            var(--nexoia-cr-primary-dark);
        transform: translateY(-1px);
        box-shadow:
            0 4px 11px rgba(37, 99, 235, 0.22);
    }
    .nexoia-cr-button:active {
        transform: translateY(0);
    }
    .nexoia-cr-button-secondary {
        background: #475569;
    }
    .nexoia-cr-button-secondary:hover {
        background: #334155;
    }
    /* ============================================================
   ESTADÍSTICAS
   ============================================================ */
    .nexoia-cr-stats {
        display: grid;
        grid-template-columns:
            repeat(4, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }
    .nexoia-cr-stat {
        padding: 14px;
        background:
            var(--nexoia-cr-white);
        border: 1px solid var(--nexoia-cr-border);
        border-radius: 14px;
        text-align: center;
    }
    .nexoia-cr-stat-label {
        display: block;
        margin-bottom: 5px;
        color: var(--nexoia-cr-muted);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    .nexoia-cr-stat-value {
        display: block;
        color: var(--nexoia-cr-dark);
        font-size: 24px;
        font-weight: 700;
    }
    /* ============================================================
   ESTADO
   ============================================================ */
    .nexoia-cr-status {
        margin-bottom: 18px;
        padding: 14px 18px;
        border: 1px solid #bfdbfe;
        border-radius: 14px;
        background: #eff6ff;
        color: #1e40af;
        text-align: center;
        font-size: 14px;
        font-weight: 600;
        transition:
            background 0.2s ease,
            border-color 0.2s ease,
            color 0.2s ease;
    }
    .nexoia-cr-status-success {
        background: #f0fdf4;
        border-color: #bbf7d0;
        color: #166534;
    }
    .nexoia-cr-status-error {
        background: #fef2f2;
        border-color: #fecaca;
        color: #991b1b;
    }
    .nexoia-cr-status-warning {
        background: #fffbeb;
        border-color: #fde68a;
        color: #92400e;
    }
    /* ============================================================
   TABLERO
   ============================================================ */
    .nexoia-cr-main {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    .nexoia-cr-board-wrapper {
        width: min(100%, 650px);
        padding: 15px;
        background:
            linear-gradient(145deg,
                #2563eb,
                #1e40af);
        border-radius: 22px;
        box-shadow:
            0 15px 35px rgba(15, 23, 42, 0.18);
    }
    .nexoia-cr-board {
        display: grid;
        grid-template-columns:
            repeat(7, 1fr);
        gap: 7px;
        width: 100%;
    }
    .nexoia-cr-cell {
        position: relative;
        width: 100%;
        aspect-ratio: 1 / 1;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #dbeafe;
        cursor: pointer;
        box-shadow:
            inset 0 4px 7px rgba(15, 23, 42, 0.16),
            0 2px 3px rgba(15, 23, 42, 0.14);
        transition:
            transform 0.12s ease,
            background 0.15s ease;
        touch-action: manipulation;
    }
    .nexoia-cr-cell:hover:not(:disabled) {
        transform: scale(0.94);
        background: #bfdbfe;
    }
    .nexoia-cr-cell:focus-visible {
        outline: 3px solid #fbbf24;
        outline-offset: 2px;
    }
    .nexoia-cr-cell:disabled {
        cursor: default;
    }
    /* ============================================================
   FICHAS
   ============================================================ */
    .nexoia-cr-piece-player {
        background:
            radial-gradient(circle at 35% 28%,
                #f87171,
                #ef4444 55%,
                #b91c1c);
        box-shadow:
            inset 0 5px 8px rgba(255, 255, 255, 0.28),
            inset 0 -5px 8px rgba(127, 29, 29, 0.32),
            0 2px 4px rgba(15, 23, 42, 0.2);
    }
    .nexoia-cr-piece-computer {
        background:
            radial-gradient(circle at 35% 28%,
                #fde68a,
                #facc15 55%,
                #ca8a04);
        box-shadow:
            inset 0 5px 8px rgba(255, 255, 255, 0.3),
            inset 0 -5px 8px rgba(133, 77, 14, 0.28),
            0 2px 4px rgba(15, 23, 42, 0.2);
    }
    /* ============================================================
   FICHAS GANADORAS
   ============================================================ */
    .nexoia-cr-winning {
        animation:
            nexoiaCuatroRayaGanadora 0.65s ease-in-out infinite alternate;
    }
    @keyframes nexoiaCuatroRayaGanadora {
        from {
            transform: scale(0.92);
        }
        to {
            transform: scale(1.08);
        }
    }
    /* ============================================================
   PIE
   ============================================================ */
    .nexoia-cr-footer {
        margin-top: 18px;
        padding: 13px;
        background:
            var(--nexoia-cr-white);
        border: 1px solid var(--nexoia-cr-border);
        border-radius: 14px;
        color: var(--nexoia-cr-muted);
        font-size: 13px;
        text-align: center;
    }
    /* ============================================================
   MODAL DE RESULTADO
   ============================================================ */
    .nexoia-cr-overlay {
        position: fixed;
        z-index: 99999;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 20px;
        background:
            rgba(15, 23, 42, 0.72);
        backdrop-filter: blur(3px);
    }
    .nexoia-cr-overlay-visible {
        display: flex;
        animation:
            nexoiaCuatroRayaAparecer 0.18s ease-out;
    }
    @keyframes nexoiaCuatroRayaAparecer {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    .nexoia-cr-result {
        width: min(100%, 430px);
        padding: 32px;
        border-radius: 24px;
        background: white;
        box-shadow:
            0 25px 60px rgba(0, 0, 0, 0.28);
        text-align: center;
        animation:
            nexoiaCuatroRayaResultadoEntrada 0.25s ease-out;
    }
    @keyframes nexoiaCuatroRayaResultadoEntrada {
        from {
            opacity: 0;
            transform:
                translateY(15px) scale(0.96);
        }
        to {
            opacity: 1;
            transform:
                translateY(0) scale(1);
        }
    }
    .nexoia-cr-result-icon {
        margin-bottom: 10px;
        font-size: 58px;
        animation:
            nexoiaCuatroRayaIconoResultado 0.7s ease-in-out;
    }
    @keyframes nexoiaCuatroRayaIconoResultado {
        0% {
            transform: scale(0.5);
        }
        65% {
            transform: scale(1.12);
        }
        100% {
            transform: scale(1);
        }
    }
    .nexoia-cr-result-title {
        margin: 0 0 10px;
        color: var(--nexoia-cr-dark);
        font-size: 29px;
    }
    .nexoia-cr-result-text {
        margin: 0 0 23px;
        color: var(--nexoia-cr-muted);
        line-height: 1.55;
    }
    .nexoia-cr-result-button {
        width: 100%;
    }
    /* ============================================================
   RESPONSIVE
   ============================================================ */
    @media (max-width: 760px) {
        .nexoia-cuatro-raya {
            padding: 10px;
        }
        .nexoia-cr-header {
            padding: 16px;
        }
        .nexoia-cr-title {
            font-size: 22px;
        }
        .nexoia-cr-header-icon {
            width: 52px;
            height: 52px;
            font-size: 27px;
        }
        .nexoia-cr-levels {
            grid-template-columns: 1fr;
        }
        .nexoia-cr-level {
            padding: 13px;
        }
        .nexoia-cr-stats {
            grid-template-columns:
                repeat(2, 1fr);
        }
        .nexoia-cr-board-wrapper {
            padding: 9px;
            border-radius: 17px;
        }
        .nexoia-cr-board {
            gap: 4px;
        }
    }
    @media (max-width: 450px) {
        .nexoia-cr-header {
            gap: 10px;
        }
        .nexoia-cr-title {
            font-size: 19px;
        }
        .nexoia-cr-subtitle {
            font-size: 12px;
        }
        .nexoia-cr-level-heading {
            align-items: flex-start;
            flex-direction: column;
        }
        .nexoia-cr-stats {
            gap: 8px;
        }
        .nexoia-cr-stat {
            padding: 12px 8px;
        }
        .nexoia-cr-stat-value {
            font-size: 21px;
        }
        .nexoia-cr-board-wrapper {
            padding: 7px;
        }
        .nexoia-cr-board {
            gap: 3px;
        }
        .nexoia-cr-result {
            padding: 26px 20px;
        }
        .nexoia-cr-result-title {
            font-size: 25px;
        }
    }
