:root {
    --verde-oscuro: #063c2a;
    --verde-mesa: #0a6844;
    --verde-claro: #13a06a;
    --dorado: #e4b94f;
    --dorado-claro: #f6d77d;
    --madera-1: #6d3e1f;
    --madera-2: #3f2111;
    --negro: #101514;
    --blanco: #f6f4ed;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;
}

body {
    background:
        radial-gradient(
            circle at top,
            #174d3a,
            #051b14 72%
        );
    color: white;
}

button,
input,
select {
    font: inherit;
}

button,
select,
input {
    border: 0;
    border-radius: 10px;
}

button {
    cursor: pointer;
    font-weight: 800;
}

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

.app-mesa {
    width: min(1500px, 98vw);
    margin: auto;
    padding: 14px 12px 30px;
}

.cabecera-mesa {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 10px 4px 16px;
}

.marca {
    font-size: clamp(24px, 3.5vw, 42px);
    font-weight: 1000;
    letter-spacing: 2px;
}

.submarca {
    opacity: .65;
    margin-top: 2px;
}

.estado-superior {
    min-width: 82px;
    padding: 9px 15px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 12px;
    text-align: center;
}

.mini-etiqueta {
    font-size: 11px;
    text-transform: uppercase;
    opacity: .60;
}

.dato-superior {
    font-size: 24px;
    font-weight: 900;
}

.panel {
    background: rgba(7, 19, 15, .70);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(0,0,0,.18);
}

.configuracion {
    display: flex;
    gap: 15px;
    align-items: end;
    justify-content: center;
    flex-wrap: wrap;
    padding: 15px;
}

.config-bloque {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-bloque label {
    font-size: 12px;
    text-transform: uppercase;
    opacity: .75;
    font-weight: 800;
}

select,
input {
    min-width: 170px;
    padding: 12px 14px;
    background: #f4f2eb;
    color: #151515;
}

.btn {
    padding: 12px 18px;
    min-height: 44px;
}

.btn-dorado {
    background:
        linear-gradient(
            180deg,
            var(--dorado-claro),
            var(--dorado)
        );
    color: #34270a;
}

.btn-verde {
    background:
        linear-gradient(
            180deg,
            #4ee49b,
            #1aaa6f
        );
    color: #07351f;
}

.btn-rojo {
    background: #d95454;
    color: white;
}

.zona-acceso {
    display: grid;
    grid-template-columns: minmax(180px, 280px) 1fr;
    gap: 12px;
    margin: 12px 0;
}

.codigo-box {
    border-radius: 16px;
    padding: 12px;
    background:
        linear-gradient(
            145deg,
            rgba(228,185,79,.18),
            rgba(255,255,255,.04)
        );
    border: 1px solid rgba(228,185,79,.35);
    text-align: center;
}

.codigo-box span {
    font-size: 11px;
    opacity: .65;
    font-weight: 900;
    letter-spacing: 2px;
}

.codigo-box strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(34px, 5vw, 58px);
    letter-spacing: 9px;
    color: var(--dorado-claro);
}

.qr-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    padding: 9px 18px;
}

.qr-box img {
    width: 92px;
    height: 92px;
    padding: 5px;
    background: white;
    border-radius: 9px;
}

.qr-box strong,
.qr-box small {
    display: block;
}

.qr-box small {
    margin-top: 5px;
    opacity: .60;
}

.marcador {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: stretch;
    margin: 12px 0;
}

.marcador-equipo,
.marcador-centro {
    border-radius: 15px;
    background: rgba(0,0,0,.30);
    border: 1px solid rgba(255,255,255,.10);
    padding: 10px 16px;
    text-align: center;
}

.marcador-equipo span {
    display: block;
    font-size: 13px;
    font-weight: 800;
    opacity: .75;
}

.marcador-equipo strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(32px, 5vw, 54px);
    color: var(--dorado-claro);
}

.marcador-centro {
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.marcador-centro span {
    font-weight: 1000;
    letter-spacing: 2px;
}

.marcador-centro small {
    opacity: .65;
    margin-top: 3px;
}

.jugadores-mesa {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 10px 0;
}

.jugador-puesto {
    min-height: 70px;
    padding: 10px;
    border-radius: 13px;
    background: rgba(0,0,0,.27);
    border: 2px solid transparent;
    text-align: center;
    transition: .2s;
}

.jugador-puesto span,
.jugador-puesto strong,
.jugador-puesto small {
    display: block;
}

.jugador-puesto span,
.jugador-puesto small {
    opacity: .60;
}

.jugador-puesto strong {
    margin: 4px 0;
}

.jugador-activo {
    border-color: var(--dorado);
    transform: translateY(-2px);
    box-shadow: 0 0 22px rgba(228,185,79,.26);
}

.tablero-wrap {
    margin-top: 12px;
}

.borde-madera {
    position: relative;
    border-radius: 30px;
    padding: 18px;
    background:
        linear-gradient(
            135deg,
            var(--madera-1),
            #8e552d 45%,
            var(--madera-2)
        );
    box-shadow:
        inset 0 0 0 3px rgba(255,255,255,.06),
        0 20px 50px rgba(0,0,0,.42);
}

.tapete {
    position: relative;
    height: min(64vh, 720px);
    min-height: 380px;
    border-radius: 18px;
    overflow: hidden;
    background:
        radial-gradient(
            ellipse at center,
            #117c53,
            #075638 65%,
            #043f2a
        );
    box-shadow:
        inset 0 0 80px rgba(0,0,0,.50),
        inset 0 0 0 2px rgba(255,255,255,.04);
}

.tapete::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .17;
    background-image:
        repeating-linear-gradient(
            35deg,
            transparent 0 3px,
            rgba(255,255,255,.03) 3px 4px
        );
}

#canvasMesa {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.mesa-vacia {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.48);
    font-size: 20px;
    z-index: 1;
}

.turno-flotante {
    position: absolute;
    z-index: 5;
    top: 6px;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #141a17;
    border: 2px solid var(--dorado);
    border-radius: 999px;
    padding: 9px 22px;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 8px 22px rgba(0,0,0,.35);
}

.acciones-mesa {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 18px 0 0;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0,0,0,.72);
}

.oculto {
    display: none !important;
}

.modal-card {
    width: min(500px, 94vw);
    padding: 28px;
    border-radius: 20px;
    background:
        linear-gradient(
            145deg,
            #173b2f,
            #071812
        );
    border: 1px solid rgba(255,255,255,.12);
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,.55);
}

.modal-card h2 {
    margin-top: 5px;
}

.trofeo {
    font-size: 52px;
}

.puntos-ronda {
    font-size: 45px;
    color: var(--dorado-claro);
    font-weight: 1000;
    margin: 15px 0;
}

/* Jugador */

.body-jugador {
    min-height: 100vh;
}

.jugador-app {
    width: min(900px, 100%);
    margin: auto;
    padding: 12px;
}

.jugador-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 15px;
}

.jugador-header .marca {
    font-size: clamp(22px, 6vw, 36px);
}

.jugador-header small {
    opacity: .65;
}

.mini-marcador {
    min-width: 90px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,.35);
    color: var(--dorado-claro);
    font-size: 22px;
    font-weight: 900;
    text-align: center;
}

.login-jugador {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 14px;
}

.estado-turno {
    margin: 10px 0;
    text-align: center;
    font-size: clamp(20px, 5vw, 30px);
    font-weight: 1000;
}

.mano-panel {
    padding: 12px;
    border-radius: 18px;
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.06),
            rgba(0,0,0,.20)
        );
    border: 1px solid rgba(255,255,255,.10);
}

.mano-titulo {
    text-align: center;
    opacity: .65;
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 900;
}

.mis-fichas {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: end;
    min-height: 170px;
    padding: 20px 5px;
}

.ficha-domino {
    width: 104px;
    height: 54px;
    display: flex;
    flex: 0 0 auto;
    position: relative;
    border: 2px solid #181818;
    border-radius: 9px;
    background:
        linear-gradient(
            145deg,
            #fff,
            #e9e6dd
        );
    box-shadow:
        inset 0 0 5px rgba(0,0,0,.12),
        3px 6px 12px rgba(0,0,0,.42);
    transition: transform .16s, box-shadow .16s;
}

.ficha-vertical {
    width: 54px;
    height: 104px;
    flex-direction: column;
}

.ficha-mitad {
    width: 50%;
    height: 100%;
    position: relative;
}

.ficha-domino:not(.ficha-vertical)
.ficha-mitad:first-child {
    border-right: 2px solid #222;
}

.ficha-vertical .ficha-mitad {
    width: 100%;
    height: 50%;
}

.ficha-vertical
.ficha-mitad:first-child {
    border-bottom: 2px solid #222;
}

.mis-fichas .ficha-domino {
    cursor: pointer;
}

.mis-fichas .ficha-domino:hover {
    transform: translateY(-5px);
}

.ficha-seleccionada {
    transform: translateY(-13px) !important;
    box-shadow:
        0 0 0 4px var(--dorado),
        0 0 26px rgba(228,185,79,.75);
}

.punto {
    position: absolute;
    width: 9px;
    height: 9px;
    background: #111;
    border-radius: 50%;
}

.punto-tl {
    top: 7px;
    left: 7px;
}

.punto-tr {
    top: 7px;
    right: 7px;
}

.punto-ml {
    top: 50%;
    left: 7px;
    transform: translateY(-50%);
}

.punto-mr {
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
}

.punto-c {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.punto-bl {
    bottom: 7px;
    left: 7px;
}

.punto-br {
    bottom: 7px;
    right: 7px;
}

.controles-jugador {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.doble-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 20px 0;
}

.flecha {
    font-size: 36px;
    color: var(--dorado-claro);
}

@media (max-width: 850px) {
    .cabecera-mesa {
        grid-template-columns: 1fr auto auto;
    }

    .jugadores-mesa {
        grid-template-columns: repeat(2, 1fr);
    }

    .zona-acceso {
        grid-template-columns: 1fr;
    }

    .marcador {
        grid-template-columns: 1fr 90px 1fr;
    }

    .marcador-centro {
        min-width: 0;
        padding: 6px;
    }

    .tapete {
        min-height: 330px;
    }
}

@media (max-width: 520px) {
    .app-mesa {
        padding: 8px 6px 20px;
    }

    .cabecera-mesa {
        gap: 6px;
    }

    .submarca {
        display: none;
    }

    .estado-superior {
        min-width: 60px;
        padding: 6px 8px;
    }

    .dato-superior {
        font-size: 19px;
    }

    .qr-box img {
        width: 75px;
        height: 75px;
    }

    .marcador-equipo {
        padding: 7px;
    }

    .marcador-equipo span {
        font-size: 10px;
    }

    .ficha-domino {
        width: 94px;
        height: 50px;
    }

    .ficha-vertical {
        width: 50px;
        height: 94px;
    }
}


/* Mini mesa visible en celulares */
.mini-mesa-panel {
    margin: 12px 0;
    padding: 12px;
    border-radius: 18px;
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.06),
            rgba(0,0,0,.22)
        );
    border: 1px solid rgba(255,255,255,.10);
}

.mini-mesa-wrap {
    position: relative;
    width: 100%;
    height: 280px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 15px;
    background:
        radial-gradient(
            ellipse at center,
            #128158,
            #07583b 70%,
            #043c29
        );
    box-shadow:
        inset 0 0 35px rgba(0,0,0,.45);
}

#canvasJugadorMesa {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mini-mesa-vacia {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: .52;
    pointer-events: none;
}

.extremos-mesa {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    margin-top: 9px;
    font-size: 14px;
    opacity: .86;
}

.extremos-mesa strong {
    color: var(--dorado-claro);
    font-size: 21px;
}

/* Créditos */
.creditos-dnaplus {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 22px;
    padding: 16px 10px 8px;
    text-align: center;
    color: rgba(255,255,255,.72);
    border-top: 1px solid rgba(255,255,255,.08);
}

.creditos-dnaplus strong {
    color: var(--dorado-claro);
    font-size: 16px;
    letter-spacing: 1px;
}

.creditos-dnaplus span {
    font-size: 13px;
    font-weight: 700;
}

.creditos-dnaplus small {
    opacity: .58;
}

.creditos-jugador {
    margin-top: 18px;
}

@media (max-width: 520px) {
    .mini-mesa-wrap {
        height: 250px;
    }

    .creditos-dnaplus {
        padding-bottom: 4px;
    }
}


.jugador-desconectado {
    border-color: #d95b5b !important;
    opacity: .62;
    box-shadow: 0 0 18px rgba(217,91,91,.18);
}

.aviso-conexion {
    margin: 10px 0;
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(217,91,91,.16);
    border: 1px solid rgba(255,120,120,.45);
    text-align: center;
    font-weight: 700;
}

.estado-conexion-jugador {
    width: fit-content;
    margin: 2px auto 8px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(32,180,108,.15);
    border: 1px solid rgba(70,220,145,.30);
    font-size: 12px;
    font-weight: 800;
}

.estado-conexion-jugador.desconectado {
    background: rgba(217,91,91,.15);
    border-color: rgba(255,120,120,.35);
}


.mini-mesa-wrap {
    min-height: 240px;
}

@media (orientation: landscape) and (max-height: 600px) {
    .mini-mesa-wrap {
        height: 300px;
    }
}

.mini-mesa-panel::after {
    content: "La mesa muestra la misma disposición del TV";
    display: block;
    text-align: center;
    margin-top: 7px;
    font-size: 10px;
    opacity: .42;
    letter-spacing: .4px;
}


/* V7: recorrido continuo tipo mesa real */
.tapete {
    min-height: 430px;
}

@media (max-width: 520px) {
    .mini-mesa-wrap {
        height: 270px;
    }
}


#iniciarSiguienteRonda {
    min-width: 230px;
    box-shadow:
        0 0 0 2px rgba(228,185,79,.22),
        0 7px 20px rgba(0,0,0,.22);
}


/* ==========================================================
   DOMINÓ DNA PLUS V9 - ARENA
   Capa visual premium. No altera el motor del juego.
   ========================================================== */

:root {
    --arena-cyan: #42e7ff;
    --arena-cyan-soft: rgba(66, 231, 255, .24);
    --arena-blue: #087fa5;
    --arena-bg-1: #08111f;
    --arena-bg-2: #0a2130;
    --arena-panel: rgba(7, 20, 31, .90);
    --arena-red: #ff6b61;
}

body {
    background:
        radial-gradient(circle at 50% -10%, rgba(45, 182, 217, .22), transparent 36%),
        radial-gradient(circle at 15% 40%, rgba(36, 80, 180, .16), transparent 30%),
        linear-gradient(160deg, var(--arena-bg-2), var(--arena-bg-1) 72%);
    background-attachment: fixed;
}

.app-mesa {
    width: min(1760px, 99vw);
    padding-top: 10px;
}

.cabecera-mesa {
    position: relative;
    min-height: 86px;
    padding: 12px 18px;
    border: 1px solid rgba(66, 231, 255, .16);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(12, 34, 49, .94), rgba(4, 15, 25, .90));
    box-shadow:
        0 0 34px rgba(66, 231, 255, .08),
        inset 0 0 30px rgba(66, 231, 255, .025);
}

.marca-arena {
    color: #f4fdff;
    text-shadow:
        0 0 8px rgba(66, 231, 255, .65),
        0 0 26px rgba(66, 231, 255, .18);
}

.cabecera-mesa .submarca {
    color: var(--arena-cyan);
    letter-spacing: 2px;
    font-size: 12px;
    font-weight: 800;
}

.arena-live {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 210px;
    padding: 10px 16px;
    border: 1px solid rgba(66, 231, 255, .48);
    border-radius: 999px;
    background: rgba(4, 20, 30, .88);
    color: #dffbff;
    box-shadow:
        0 0 18px rgba(66, 231, 255, .16),
        inset 0 0 12px rgba(66, 231, 255, .06);
    font-size: 12px;
    letter-spacing: 1.2px;
}

.arena-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #6bffb3;
    box-shadow: 0 0 12px #6bffb3;
}

.estado-superior {
    border-color: rgba(66, 231, 255, .18);
    background: rgba(4, 19, 30, .88);
}

.dato-superior {
    color: var(--arena-cyan);
}

.configuracion-arena {
    margin-top: 12px;
    border-color: rgba(66, 231, 255, .18);
    background:
        linear-gradient(135deg, rgba(9, 29, 42, .92), rgba(4, 15, 25, .92));
}

.zona-acceso {
    position: relative;
    z-index: 20;
}

.codigo-box,
.qr-box {
    border-color: rgba(66, 231, 255, .22);
    background: rgba(5, 20, 31, .88);
}

.codigo-box strong {
    color: var(--arena-cyan);
    text-shadow: 0 0 14px rgba(66, 231, 255, .34);
}

.marcador {
    position: relative;
    z-index: 30;
    margin: 12px auto 22px;
    width: min(900px, 96%);
}

.marcador-equipo,
.marcador-centro {
    border-color: rgba(66, 231, 255, .20);
    background:
        linear-gradient(180deg, rgba(11, 35, 49, .96), rgba(3, 16, 25, .96));
    box-shadow:
        inset 0 0 18px rgba(66, 231, 255, .035);
}

.marcador-equipo strong {
    color: #f8feff;
    text-shadow:
        0 0 7px rgba(66, 231, 255, .75),
        0 0 22px rgba(66, 231, 255, .18);
}

.marcador-centro span {
    color: var(--arena-cyan);
}

/* ----- Arena stage ----- */

.arena-stage {
    position: relative;
    min-height: 760px;
    margin: 4px 0 0;
    padding: 92px 245px 80px;
    isolation: isolate;
}

.arena-stage::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 52%;
    width: min(1280px, 82vw);
    height: 610px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background:
        radial-gradient(ellipse at center,
            rgba(66, 231, 255, .035) 0 47%,
            rgba(66, 231, 255, .09) 48% 49%,
            transparent 50% 61%,
            rgba(66, 231, 255, .24) 62% 62.8%,
            rgba(7, 26, 39, .70) 63% 100%);
    box-shadow:
        0 0 45px rgba(66, 231, 255, .14);
    z-index: -3;
}

.arena-ring {
    position: absolute;
    left: 50%;
    top: 53%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -2;
}

.arena-ring-1 {
    width: min(1210px, 78vw);
    height: 560px;
    border: 3px solid rgba(66, 231, 255, .38);
    box-shadow:
        0 0 16px rgba(66, 231, 255, .38),
        inset 0 0 18px rgba(66, 231, 255, .10);
}

.arena-ring-2 {
    width: min(1300px, 84vw);
    height: 650px;
    border: 1px solid rgba(66, 231, 255, .20);
}

.tablero-wrap {
    position: relative;
    z-index: 3;
    margin: 0;
}

.borde-arena {
    padding: 16px;
    border-radius: 28px;
    background:
        linear-gradient(145deg, #5c321c, #9a6038 35%, #452112 78%);
    border: 2px solid rgba(66, 231, 255, .48);
    box-shadow:
        0 0 20px rgba(66, 231, 255, .24),
        0 25px 55px rgba(0, 0, 0, .58),
        inset 0 0 0 3px rgba(255,255,255,.055);
}

.arena-table-title {
    position: absolute;
    z-index: 6;
    left: 50%;
    top: -13px;
    transform: translateX(-50%);
    min-width: min(480px, 65%);
    padding: 7px 18px;
    border: 1px solid rgba(66, 231, 255, .72);
    border-radius: 999px;
    background: #071b27;
    color: #dffbff;
    text-align: center;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.1px;
    box-shadow:
        0 0 13px rgba(66, 231, 255, .35);
}

.tapete-arena {
    height: min(58vh, 620px);
    min-height: 430px;
    background:
        radial-gradient(ellipse at center, #126949, #074431 66%, #032b21);
    border: 1px solid rgba(66, 231, 255, .13);
}

/* ----- Player HUDs ----- */

.jugadores-arena {
    position: absolute;
    inset: 0;
    display: block;
    margin: 0;
    pointer-events: none;
    z-index: 8;
}

.jugador-puesto {
    pointer-events: auto;
}

.jugadores-arena .jugador-puesto {
    position: absolute;
    width: 220px;
    min-height: 142px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(66, 231, 255, .50);
    background:
        linear-gradient(155deg, rgba(12, 38, 54, .96), rgba(4, 17, 27, .97));
    box-shadow:
        0 0 18px rgba(66, 231, 255, .17),
        0 16px 30px rgba(0, 0, 0, .42);
    text-align: left;
    overflow: hidden;
}

.jugadores-arena .jugador-puesto::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(110deg, transparent 0 70%, rgba(66, 231, 255, .07));
    pointer-events: none;
}

.jugadores-arena .puesto-1 {
    left: 8px;
    bottom: 90px;
}

.jugadores-arena .puesto-2 {
    left: 8px;
    top: 92px;
}

.jugadores-arena .puesto-3 {
    right: 8px;
    top: 92px;
}

.jugadores-arena .puesto-4 {
    right: 8px;
    bottom: 90px;
}

.jugador-hud-top {
    display: flex;
    gap: 11px;
    align-items: center;
}

.jugador-avatar {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 25%, #45dff4, #125671 62%, #072b3b);
    border: 2px solid rgba(66, 231, 255, .68);
    color: white;
    font-size: 21px;
    font-weight: 1000;
    text-shadow: 0 1px 4px rgba(0,0,0,.6);
    box-shadow: 0 0 12px rgba(66, 231, 255, .18);
}

.jugador-hud-info {
    min-width: 0;
    flex: 1;
}

.jugador-hud-numero {
    color: var(--arena-cyan);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.1px;
}

.jugador-hud-nombre {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
    color: #fff;
}

.jugador-hud-equipo {
    margin-top: 2px;
    color: rgba(255,255,255,.55);
    font-size: 10px;
    font-weight: 800;
}

.jugador-hud-bottom {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(66, 231, 255, .10);
}

.fichas-restantes {
    font-size: 13px;
    font-weight: 800;
    color: #eefcff;
}

.estado-jugador {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 900;
    color: #7dffc0;
}

.estado-jugador::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.jugador-activo {
    transform: translateY(-3px) scale(1.025);
    border-color: #72f6ff !important;
    box-shadow:
        0 0 8px rgba(66, 231, 255, .88),
        0 0 30px rgba(66, 231, 255, .34) !important;
}

.jugador-activo::after {
    content: "TU TURNO";
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--arena-cyan);
    color: #03212c;
    font-size: 8px;
    font-weight: 1000;
    letter-spacing: .8px;
}

.jugador-desconectado {
    border-color: rgba(255, 107, 97, .65) !important;
    opacity: .74;
}

.jugador-desconectado .estado-jugador {
    color: var(--arena-red);
}

/* ----- Turn badge ----- */

.turno-flotante {
    top: -3px;
    border-color: var(--arena-cyan);
    background: #061923;
    color: #e9fdff;
    box-shadow:
        0 0 14px rgba(66, 231, 255, .38),
        0 10px 24px rgba(0,0,0,.38);
}

.acciones-arena {
    position: relative;
    z-index: 25;
    margin-top: -42px;
    padding-bottom: 22px;
}

.btn-verde {
    background:
        linear-gradient(180deg, #76f5ff, #27bbd3);
    color: #06303a;
}

.btn-dorado {
    box-shadow: 0 7px 18px rgba(0,0,0,.20);
}

/* ----- Modal arena ----- */

.modal-card {
    border-color: rgba(66, 231, 255, .32);
    background:
        linear-gradient(145deg, #0d3041, #06131e);
    box-shadow:
        0 0 34px rgba(66, 231, 255, .16),
        0 30px 80px rgba(0,0,0,.62);
}

.creditos-dnaplus {
    color: rgba(225, 248, 252, .78);
}

/* Two-player Arena positions */
.jugadores-arena.modo-2 .puesto-1 {
    left: 18px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.jugadores-arena.modo-2 .puesto-2 {
    right: 18px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
}

.jugadores-arena.modo-2 .jugador-activo {
    transform: translateY(-50%) scale(1.025);
}

/* Responsive Arena */
@media (max-width: 1180px) {
    .arena-stage {
        padding-left: 180px;
        padding-right: 180px;
    }

    .jugadores-arena .jugador-puesto {
        width: 170px;
    }

    .jugador-avatar {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .jugador-hud-nombre {
        font-size: 15px;
    }
}

@media (max-width: 850px) {
    .arena-live {
        display: none;
    }

    .arena-stage {
        min-height: auto;
        padding: 10px 0 0;
    }

    .arena-stage::before,
    .arena-ring {
        display: none;
    }

    .jugadores-arena {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 10px;
    }

    .jugadores-arena .jugador-puesto,
    .jugadores-arena.modo-2 .jugador-puesto {
        position: relative;
        inset: auto;
        width: auto;
        min-height: 110px;
        transform: none;
    }

    .jugadores-arena .jugador-activo,
    .jugadores-arena.modo-2 .jugador-activo {
        transform: translateY(-2px);
    }

    .acciones-arena {
        margin-top: 14px;
    }
}

.configuracion input {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 9px;
    border: 1px solid rgba(66,231,255,.28);
    background: rgba(4,18,28,.92);
    color: #fff;
    font-weight: 800;
}


/* =========================================================
 * MANO PRIVADA - V9.5.1
 * Filas de 7, pegadas y verticales.
 * No modifica la mesa ni el estilo general.
 * ========================================================= */

.mis-fichas {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 7px;
    justify-content: center;
    align-items: center;
    min-height: 138px;
    padding: 12px 3px;
}

.fila-fichas-jugador {
    display: grid;
    grid-template-columns:
        repeat(7, 1fr);
    gap: 1px;
    justify-content: center;
    align-items: end;
    width: min(100%, 420px);
    margin: 0 auto;
}

.fila-fichas-jugador
.ficha-domino {
    width: 48px;
    height: 92px;
    border-radius: 7px;
    margin: 0;
    box-shadow:
        inset 0 0 4px rgba(0,0,0,.12),
        1px 3px 6px rgba(0,0,0,.34);
}

.fila-fichas-jugador
.ficha-vertical {
    width: 48px;
    height: 92px;
}

.fila-fichas-jugador
.ficha-mitad {
    width: 100%;
    height: 50%;
}

.fila-fichas-jugador
.ficha-mitad:first-child {
    border-right: 0;
    border-bottom: 2px solid #222;
}

.fila-fichas-jugador
.punto {
    width: 7px;
    height: 7px;
}

.fila-fichas-jugador
.punto-tl {
    top: 5px;
    left: 5px;
}

.fila-fichas-jugador
.punto-tr {
    top: 5px;
    right: 5px;
}

.fila-fichas-jugador
.punto-ml {
    left: 5px;
}

.fila-fichas-jugador
.punto-mr {
    right: 5px;
}

.fila-fichas-jugador
.punto-bl {
    bottom: 5px;
    left: 5px;
}

.fila-fichas-jugador
.punto-br {
    bottom: 5px;
    right: 5px;
}

.fila-fichas-jugador
.ficha-domino:hover {
    transform:
        translateY(-4px);
}

.fila-fichas-jugador
.ficha-seleccionada {
    transform:
        translateY(-10px) !important;
    box-shadow:
        0 0 0 3px var(--dorado),
        0 0 18px rgba(228,185,79,.65);
}

@media (max-width: 380px) {
    .fila-fichas-jugador {
        width: 100%;
    }

    .fila-fichas-jugador
    .ficha-domino,
    .fila-fichas-jugador
    .ficha-vertical {
        width: 44px;
        height: 86px;
    }
}


/* =========================================================
 * CREAR PARTIDA DESDE CELULAR - V9.6
 * ========================================================= */

.selector-modo-jugador {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.selector-modo-jugador .btn {
    width: 100%;
}

.selector-modo-jugador .btn:not(.activo) {
    opacity: .62;
}

.panel-acceso-jugador {
    display: grid;
    gap: 10px;
    width: 100%;
}

.panel-acceso-jugador.oculto {
    display: none !important;
}

.panel-acceso-jugador select {
    width: 100%;
}

.label-config-jugador {
    font-size: 12px;
    font-weight: 800;
    opacity: .75;
    margin-bottom: -5px;
}

.anfitrion-jugador {
    display: grid;
    gap: 10px;
    text-align: center;
}

.anfitrion-jugador.oculto {
    display: none !important;
}

.codigo-anfitrion {
    font-size: 18px;
}

.codigo-anfitrion strong {
    font-size: 28px;
    letter-spacing: 4px;
}

.acciones-header-jugador {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sonido-jugador {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.20);
    color: #fff;
    font-size: 19px;
    cursor: pointer;
}


#cerrarMesaJugador {
    margin-top: 4px;
}


/* =========================================================
 * VINCULAR TV - V9.7
 * ========================================================= */

.modal-tv-card {
    max-width: 520px;
}

.tv-icono-grande {
    font-size: 64px;
    line-height: 1;
    text-align: center;
}

.codigo-tv-grande {
    font-size: clamp(38px, 11vw, 64px);
    font-weight: 1000;
    letter-spacing: 8px;
    text-align: center;
    color: var(--dorado);
    margin: 12px 0;
}

.url-tv-jugador {
    background: rgba(0,0,0,.22);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
    word-break: break-all;
    text-align: center;
}

.estado-tv-jugador {
    text-align: center;
    font-weight: 900;
    margin: 12px 0;
}

.pantalla-vincular-tv {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background:
        radial-gradient(
            circle at center,
            #0b684b,
            #032a20 70%
        );
}

.pantalla-vincular-tv.oculto {
    display: none !important;
}

.tv-vincular-card {
    width: min(620px, 94vw);
    padding: 36px;
    border-radius: 24px;
    background:
        rgba(4,37,28,.96);
    border:
        2px solid rgba(228,185,79,.65);
    box-shadow:
        0 24px 80px rgba(0,0,0,.55);
    color: #fff;
    text-align: center;
}

.tv-vincular-card input {
    width: 100%;
    max-width: 380px;
    display: block;
    margin: 20px auto;
    text-align: center;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 6px;
}

.mensaje-vincular-tv {
    min-height: 24px;
    margin-top: 14px;
    opacity: .85;
}


.aviso-cuenta-personal{
    padding:10px 12px;
    border-radius:10px;
    background:rgba(228,185,79,.11);
    border:1px solid rgba(228,185,79,.28);
    font-size:12px;
    line-height:1.4;
}
.aviso-cuenta-personal a{
    color:var(--dorado);
    font-weight:900;
}


/* =========================================================
 * CHAT DE MESA - V10.3
 * ========================================================= */

.chat-mesa-panel{
    position:fixed;
    right:12px;
    bottom:12px;
    z-index:9000;
    width:min(420px,calc(100vw - 24px));
    max-height:72vh;
    display:flex;
    flex-direction:column;
    gap:9px;
    padding:14px;
    border-radius:18px;
    background:rgba(4,42,31,.97);
    border:1px solid rgba(228,185,79,.45);
    box-shadow:0 18px 55px rgba(0,0,0,.5);
    backdrop-filter:blur(8px);
}
.chat-mesa-panel.oculto{
    display:none!important;
}
.chat-mesa-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}
.chat-mesa-header strong{
    color:#fff;
    font-size:16px;
}
.chat-mesa-header small{
    display:block;
    color:#c5d5cd;
    margin-top:2px;
}
.chat-header-actions{
    display:flex;
    gap:6px;
}
.mini-chat-btn{
    width:36px;
    height:36px;
    border-radius:50%;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(255,255,255,.05);
    color:#fff;
    cursor:pointer;
}
.chat-mensajes{
    min-height:180px;
    max-height:300px;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:7px;
    padding:10px;
    border-radius:12px;
    background:rgba(0,0,0,.16);
}
.chat-item{
    max-width:86%;
    align-self:flex-start;
    padding:8px 10px;
    border-radius:12px 12px 12px 4px;
    background:rgba(255,255,255,.08);
}
.chat-item.propio{
    align-self:flex-end;
    border-radius:12px 12px 4px 12px;
    background:rgba(228,185,79,.18);
}
.chat-item strong{
    display:block;
    font-size:11px;
    color:#e4b94f;
    margin-bottom:3px;
}
.chat-item span{
    display:block;
    font-size:14px;
    color:#fff;
    line-height:1.35;
}
.chat-reaccion-item{
    align-self:center;
    color:#fff;
    font-size:13px;
    opacity:.9;
}
.chat-frases-rapidas,
.chat-reacciones{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
}
.chat-frases-rapidas button,
.chat-reacciones button{
    border:1px solid rgba(255,255,255,.1);
    background:rgba(255,255,255,.06);
    color:#fff;
    border-radius:999px;
    padding:7px 10px;
    font-size:11px;
    cursor:pointer;
}
.chat-reacciones button{
    font-size:20px;
    padding:5px 9px;
}
.chat-input-row{
    display:grid;
    grid-template-columns:1fr auto;
    gap:8px;
}
.chat-input-row input{
    width:100%;
    min-width:0;
    height:42px;
    border-radius:10px;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(0,0,0,.2);
    color:#fff;
    padding:0 12px;
}
.chat-tv-overlay{
    position:fixed;
    left:50%;
    bottom:42px;
    transform:translateX(-50%);
    z-index:99998;
    min-width:280px;
    max-width:min(70vw,760px);
    padding:14px 22px;
    border-radius:16px;
    background:rgba(0,0,0,.72);
    color:#fff;
    text-align:center;
    box-shadow:0 12px 40px rgba(0,0,0,.45);
    pointer-events:none;
}
.chat-tv-overlay.oculto{
    display:none!important;
}
.chat-tv-overlay strong{
    color:#e4b94f;
    margin-right:8px;
}
.chat-tv-overlay span{
    font-size:20px;
}
.chat-tv-overlay .emoji-tv{
    font-size:46px;
    display:block;
    margin-top:4px;
}
@media(max-width:480px){
    .chat-mesa-panel{
        right:6px;
        bottom:6px;
        width:calc(100vw - 12px);
        max-height:78vh;
    }
}


/* =========================================================
 * CONTROLES RÁPIDOS DEL ANFITRIÓN - V10.3.1
 * ========================================================= */

.controles-rapidos-anfitrion{
    position:sticky;
    top:8px;
    z-index:8500;
    width:min(760px,calc(100% - 12px));
    margin:8px auto 12px;
    padding:10px;
    border-radius:14px;
    background:rgba(3,47,35,.96);
    border:1px solid rgba(228,185,79,.42);
    box-shadow:0 8px 28px rgba(0,0,0,.28);
    backdrop-filter:blur(7px);
}

.controles-rapidos-anfitrion.oculto{
    display:none!important;
}

.controles-rapidos-titulo{
    text-align:center;
    color:#e4b94f;
    font-size:12px;
    font-weight:900;
    letter-spacing:.7px;
    margin-bottom:8px;
}

.controles-rapidos-botones{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:7px;
}

.controles-rapidos-botones .btn{
    width:100%;
    min-height:42px;
    font-size:12px;
}

@media(max-width:520px){
    .controles-rapidos-anfitrion{
        position:sticky;
        top:4px;
        width:calc(100% - 8px);
        padding:7px;
    }

    .controles-rapidos-titulo{
        display:none;
    }

    .controles-rapidos-botones{
        grid-template-columns:1fr 1fr 1fr;
        gap:4px;
    }

    .controles-rapidos-botones .btn{
        padding:7px 4px;
        font-size:10px;
        min-height:38px;
    }
}
