:root {
    --bg-dark: #0b1320;
    --bg-panel: #152238;
    --gold: #facc15;
    --gold-dark: #ca8a04;
    --accent: #38bdf8;
    --green-ok: #22c55e;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* TOPBAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 2px solid rgba(250, 204, 21, 0.25);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 10px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-logo { font-size: 1.8rem; }
.brand h1 { font-size: 1.15rem; letter-spacing: 0.5px; color: var(--gold); }
.badge-uy { background: #0284c7; color: #fff; font-size: 0.7rem; padding: 2px 6px; border-radius: 6px; }
.brand small { color: var(--text-muted); font-size: 0.75rem; display: block; }

.main-nav {
    display: flex;
    gap: 8px;
}
.nav-btn {
    background: #1e293b;
    color: var(--text-light);
    border: 1px solid #334155;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.nav-btn:hover {
    background: #334155;
    border-color: #64748b;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.nav-btn.active {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    border-color: var(--gold);
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.35);
}
.nav-btn.active:hover {
    background: linear-gradient(135deg, #fde047 0%, #d97706 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(250, 204, 21, 0.5);
}
.nav-btn:active {
    transform: translateY(0);
}
.nav-admin-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    border: 1px solid #818cf8 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35) !important;
}
.nav-admin-btn:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%) !important;
    border-color: #a5b4fc !important;
    box-shadow: 0 5px 16px rgba(99, 102, 241, 0.55) !important;
    transform: translateY(-2px);
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-icon {
    background: #1e293b;
    border: 1px solid #334155;
    color: #fff;
    padding: 7px 11px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.btn-icon:hover {
    background: #334155;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.25);
}
.gemas-pill {
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 6px 12px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 0.88rem;
    box-shadow: 0 2px 8px rgba(250, 204, 21, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.perfil-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    padding: 4px 12px 4px 6px;
    border-radius: 99px;
    cursor: pointer;
    border: 1px solid #475569;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    user-select: none;
}
.perfil-mini:hover {
    border-color: var(--gold);
    background: #24334a;
    box-shadow: 0 3px 12px rgba(250, 204, 21, 0.25);
    transform: translateY(-1px);
}
.perfil-mini:active {
    transform: translateY(0);
}
.perfil-mini img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--gold);
}
.perfil-mini span {
    font-weight: 700;
    font-size: 0.88rem;
}

/* VISTAS */
.vista { display: none; padding: 12px; max-width: 1200px; margin: 0 auto; }
.vista.activa { display: block; }

/* MESA DE JUEGO */
.mesa-controles-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
    padding: 8px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.modos-grupo { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-modo {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
    padding: 7px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.86rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.btn-modo:hover {
    background: #334155;
    border-color: #64748b;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.btn-modo.activo {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 3px 12px rgba(2, 132, 199, 0.4);
}
.btn-modo.activo:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 5px 16px rgba(2, 132, 199, 0.6);
}
.btn-modo:active {
    transform: translateY(0);
}
.btn-abandonar-mesa {
    background: #450a0a !important;
    border-color: #7f1d1d !important;
    color: #fca5a5 !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-abandonar-mesa:hover {
    background: #7f1d1d !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
}
.Marcador-rapido { font-size: 0.9rem; color: #e2e8f0; }
.Marcador-rapido b { color: var(--gold); }
.sep { margin: 0 6px; color: #475569; }

/* BADGE Y MODAL DE SALAS ONLINE */
.badge-sala-online {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    border: 1px solid #38bdf8;
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
}
.badge-sala-online b {
    color: #facc15;
    letter-spacing: 2px;
}
.btn-copiar-mini, .btn-wa-mini {
    background: #1e293b;
    border: 1px solid #475569;
    color: #f8fafc;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-copiar-mini:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
}
.btn-wa-mini {
    background: #14532d;
    border-color: #22c55e;
    color: #bbf7d0;
}
.btn-wa-mini:hover {
    background: #22c55e;
    color: #052e16;
}

/* MODAL SALA PRIVADA ESPERA */
.caja-codigo-sala {
    background: linear-gradient(135deg, #0b1329 0%, #1e293b 100%);
    border: 3px dashed #facc15;
    border-radius: 16px;
    padding: 16px 20px;
    margin: 14px auto;
    max-width: 280px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.caja-codigo-sala span {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 8px;
    color: #facc15;
    text-shadow: 0 2px 14px rgba(250, 204, 21, 0.5);
    font-family: 'Courier New', monospace;
    user-select: all;
}
.botones-compartir-sala {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 14px 0;
    flex-wrap: wrap;
}
.btn-accion-sala {
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.92rem;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-accion-sala:hover {
    transform: translateY(-2px);
}
.btn-copiar {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}
.btn-copiar:hover {
    background: #0369a1;
}
.btn-whatsapp {
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}
.btn-whatsapp:hover {
    background: #15803d;
}
.estado-espera-rival {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 12px 0 6px;
    font-size: 0.86rem;
    color: #cbd5e1;
}
.spinner-puntos {
    width: 14px;
    height: 14px;
    border: 2px solid #38bdf8;
    border-top-color: transparent;
    border-radius: 50%;
    animation: rotarSpinner 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes rotarSpinner {
    to { transform: rotate(360deg); }
}

.tapete-mesa {
    background: radial-gradient(circle, #1b4332 0%, #081c15 100%);
    border: 5px solid #5c3a21;
    border-radius: 24px;
    padding: 16px;
    min-height: 74vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.65), 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

/* RIVAL */
.zona-rival {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.ficha-jugador {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.82);
    padding: 6px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.15);
}
.ficha-jugador img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--gold);
}
.ficha-datos strong { display: block; font-size: 0.95rem; }
.ficha-datos small { color: var(--accent); font-size: 0.78rem; }

.mano-rival {
    display: flex;
    justify-content: center;
    gap: 6px;
}
.carta-rival-mini {
    width: 48px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0,0,0,0.45);
    background: #fff;
}
.carta-rival-mini img { width: 100%; height: 100%; object-fit: cover; }

/* CENTRO MESA: MAZO Y POZO */
.zona-centro-mesa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 14px 0;
    flex-wrap: wrap;
}
.pila-contenedor {
    text-align: center;
    cursor: pointer;
}
.pila-etiqueta {
    font-size: 0.75rem;
    font-weight: 800;
    color: #e2e8f0;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.carta-mesa {
    width: 96px;
    height: 142px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.55);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid rgba(255,255,255,0.8);
}
.carta-mesa:hover { transform: translateY(-4px) scale(1.03); }
.carta-mesa img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pulso-jugada {
    box-shadow: 0 0 28px 8px var(--gold) !important;
    transform: scale(1.08);
}

.info-turno-centro { text-align: center; max-width: 220px; }
.badge-turno {
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #475569;
}
.badge-turno.mi-turno { border-color: var(--green-ok); color: #86efac; }
.badge-turno.mi-turno-descarte { border-color: var(--gold); color: var(--gold); }

/* MANO DEL JUGADOR */
.zona-jugador { text-align: center; }
.barra-acciones-mano {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.estado-armado {
    background: rgba(15, 23, 42, 0.8);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
}
.estado-armado b { color: var(--gold); font-size: 1.05rem; }

.botones-jugada { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-accion-mesa {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #f8fafc;
    border: 1px solid #475569;
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.86rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-accion-mesa:hover {
    background: #334155;
    border-color: #38bdf8;
    color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}
.btn-accion-mesa:active {
    transform: translateY(0);
}
.btn-cortar {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    border: 2px solid #fca5a5;
    padding: 8px 18px;
    border-radius: 9px;
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-cortar:hover:not(:disabled) {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
    transform: translateY(-2px) scale(1.03);
}
.btn-cortar:active:not(:disabled) {
    transform: translateY(0);
}
.btn-cortar:disabled {
    opacity: 0.45;
    filter: grayscale(0.6);
    cursor: not-allowed;
    border-color: #475569;
    background: #1e293b;
    color: #94a3b8;
    box-shadow: none;
}
.brillo-corte { animation: latidoCorte 0.9s infinite alternate; }
@keyframes latidoCorte {
    from { box-shadow: 0 0 8px #ef4444; transform: scale(1); }
    to { box-shadow: 0 0 24px #facc15; transform: scale(1.06); }
}

.mano-jugador {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 0;
}
.carta-jugador {
    width: 95px;
    height: 140px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
    position: relative;
    border: 2px solid #e2e8f0;
}
.carta-jugador:hover {
    transform: translateY(-12px);
}
.carta-jugador img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}
.btn-armar-juegos {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35) !important;
}
.btn-armar-juegos:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%) !important;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.55) !important;
    transform: translateY(-2px);
}

.carta-jugador.juego-grupo-1 {
    border-color: #facc15 !important;
    box-shadow: 0 0 16px rgba(250, 204, 21, 0.5) !important;
}
.carta-jugador.juego-grupo-2 {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.5) !important;
}

.tag-ligada {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #fff;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 99px;
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    z-index: 2;
}
.tag-ligada.tag-j1 {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    border: 1px solid #fef08a;
}
.tag-ligada.tag-j2 {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: 1px solid #7dd3fc;
}

.pts-suelta-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(15, 23, 42, 0.9);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.5);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    z-index: 2;
}

/* RESALTADO DE CORTE */
.carta-corte-valida {
    border-color: #f87171 !important;
}
.carta-jugador.seleccionar-corte {
    animation: latidoCartaCorte 0.9s infinite alternate;
    cursor: pointer;
    border-color: #ef4444 !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.85) !important;
}
.carta-jugador.desactivada-corte {
    opacity: 0.45;
    filter: grayscale(0.6);
}
.badge-corte-carta {
    position: absolute;
    top: 5px;
    left: 5px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 99px;
    border: 1px solid #fca5a5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    z-index: 3;
    animation: latidoCorte 0.8s infinite alternate;
}

@keyframes latidoCartaCorte {
    from { transform: translateY(-4px) scale(1); box-shadow: 0 0 10px #ef4444; }
    to { transform: translateY(-10px) scale(1.05); box-shadow: 0 0 24px #facc15; }
}

/* DRAG AND DROP EN PC */
.carta-jugador[draggable="true"] {
    cursor: grab;
}
.carta-jugador[draggable="true"]:active {
    cursor: grabbing;
}
.carta-jugador.arrastrando {
    opacity: 0.4 !important;
    transform: scale(0.96) !important;
    border-color: var(--gold) !important;
}
.carta-jugador.drag-over-target {
    transform: translateY(-16px) scale(1.06) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.85) !important;
}
.pozo-drag-hover {
    transform: scale(1.1) !important;
    border-color: #facc15 !important;
    box-shadow: 0 0 32px 10px rgba(250, 204, 21, 0.7) !important;
}
.mano-drag-hover {
    background: rgba(56, 189, 248, 0.08);
    border-radius: 16px;
    outline: 2px dashed var(--accent);
}

.badge-turno.mi-turno-corte {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    border-color: #f87171;
    color: #fef08a;
    animation: latidoCorte 1.1s infinite alternate;
}

.ayuda-jugada {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #cbd5e1;
}

/* AVISO FLOTANTE DE ROBO / DESCARTE */
#aviso-jugada-flotante {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 4000;
}
#aviso-jugada-flotante.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.toast-jugada {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid var(--accent);
    color: #fff;
    padding: 9px 18px;
    border-radius: 99px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* TIENDA EN 3 SISTEMAS SEPARADOS */
.seccion-header { text-align: center; margin-bottom: 18px; }
.seccion-header h2 { color: var(--gold); margin-bottom: 4px; }
.seccion-header p { color: var(--text-muted); font-size: 0.92rem; }

.tienda-sistemas-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.sistema-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-panel);
    border: 2px solid #334155;
    padding: 14px;
    border-radius: 16px;
    color: var(--text-light);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}
.sistema-card.active, .sistema-card:hover {
    border-color: var(--gold);
    background: linear-gradient(135deg, #1e293b, #334155);
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.25);
}
.sistema-icono { font-size: 2.2rem; }
.sistema-textos strong { display: block; font-size: 1.05rem; color: var(--gold); }
.sistema-textos small { color: var(--text-muted); font-size: 0.8rem; }

.sistema-ventana {
    background: var(--bg-panel);
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 18px;
}
.sistema-ventana-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #334155;
}
.badge-contador {
    background: #0f172a;
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
}

.grid-tienda-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}
.item-tienda-card {
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}
.item-tienda-card.card-equipada {
    border-color: var(--green-ok);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.25);
}
.mazo-abanico-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    cursor: pointer;
    margin-bottom: 8px;
}
.mazo-abanico-preview img {
    width: 68px;
    height: 100px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    margin: 0 -10px;
    transition: transform 0.2s;
}
.mazo-abanico-preview:hover img:nth-child(1) { transform: rotate(-12deg) translateX(-6px); }
.mazo-abanico-preview:hover img:nth-child(3) { transform: rotate(12deg) translateX(6px); }

.btn-ver-mazo {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid #38bdf8;
    color: #38bdf8;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    align-self: center;
}
.btn-ver-mazo:hover {
    background: #38bdf8;
    color: #0f172a;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
}
.tapete-preview-box {
    height: 110px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
    border: 2px solid #5c3a21;
}
.tapete-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview-box {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.avatar-preview-box img {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    border: 3px solid var(--gold);
}
.btn-tienda {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 800;
    font-size: 0.92rem;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.btn-tienda.comprar {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    border-color: #fde047;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.35);
}
.btn-tienda.comprar:hover {
    background: linear-gradient(135deg, #fde047 0%, #d97706 100%);
    box-shadow: 0 6px 18px rgba(250, 204, 21, 0.55);
    transform: translateY(-2px);
}
.btn-tienda.equipar {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.btn-tienda.equipar:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.55);
    transform: translateY(-2px);
}
.btn-tienda.equipado {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: #dcfce7;
    border-color: #4ade80;
    cursor: default;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.btn-tienda:active:not(.equipado) {
    transform: translateY(0);
}

/* RANKINGS GAMER (SIN #) */
.ranking-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.rank-tab {
    background: var(--bg-panel);
    color: var(--text-light);
    border: 1px solid #334155;
    padding: 9px 18px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.rank-tab:hover {
    border-color: #64748b;
    background: #1e293b;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.rank-tab.active {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    border-color: #fde047;
    box-shadow: 0 3px 12px rgba(250, 204, 21, 0.4);
    font-weight: 800;
}
.rank-tab.active:hover {
    background: linear-gradient(135deg, #fde047 0%, #d97706 100%);
    box-shadow: 0 5px 16px rgba(250, 204, 21, 0.55);
}
}

.podio-gamer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    align-items: end;
}
.podio-columna {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 2px solid #475569;
    border-radius: 18px;
    padding: 16px 10px;
    text-align: center;
    position: relative;
}
.podio-columna.puesto-1 {
    background: linear-gradient(145deg, #422006, #713f12);
    border-color: var(--gold);
    box-shadow: 0 0 25px rgba(250, 204, 21, 0.35);
    transform: translateY(-6px);
}
.podio-medalla { font-size: 2rem; }
.podio-posicion-circulo {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    color: var(--gold);
    font-weight: 900;
    margin: 4px 0;
}
.podio-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: block;
    margin: 6px auto;
}
.podio-nombre { display: block; font-size: 1rem; color: #fff; }
.podio-depto { color: #cbd5e1; font-size: 0.78rem; display: block; margin-bottom: 6px; }
.podio-puntaje {
    display: inline-block;
    background: rgba(0,0,0,0.4);
    color: var(--gold);
    padding: 4px 12px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 0.85rem;
}

.lista-ranking-gamer { display: flex; flex-direction: column; gap: 8px; }
.fila-ranking-gamer {
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid #334155;
    padding: 10px 16px;
    border-radius: 14px;
    gap: 12px;
}
.badge-posicion-gamer {
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    border-radius: 50%;
    background: #0f172a;
    color: var(--gold);
    font-weight: 900;
    font-size: 1rem;
    border: 1px solid #475569;
    flex-shrink: 0;
}
.rank-avatar-gamer {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    flex-shrink: 0;
}
.rank-datos-gamer { flex: 1; }
.rank-datos-gamer strong { display: block; font-size: 1rem; }
.rank-datos-gamer small { color: var(--text-muted); font-size: 0.8rem; }
.rank-elo-pill {
    background: rgba(250, 204, 21, 0.14);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 5px 12px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 0.9rem;
}

/* MODALES Y PREVIEW DE MAZO */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 12px;
}
.modal-box {
    background: var(--bg-panel);
    border: 2px solid #475569;
    border-radius: 18px;
    padding: 20px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-box.modal-xl { max-width: 920px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.btn-cerrar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dc2626;
    color: #fff;
    border: 1px solid #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}
.btn-cerrar:hover {
    background: #b91c1c;
    border-color: #f87171;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}
.btn-cerrar:active {
    transform: scale(0.95);
}
.preview-mazo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    gap: 10px;
}
.mini-carta-item {
    background: #0f172a;
    padding: 6px;
    border-radius: 8px;
    text-align: center;
}
.mini-carta-item img { width: 100%; height: 105px; object-fit: contain; background: #fff; border-radius: 4px; }
.mini-carta-item span { display: block; font-size: 0.68rem; margin-top: 4px; color: #cbd5e1; }

/* AUTH SWITCHER Y BOTONES MODAL */
.auth-switch {
    display: flex;
    background: #0f172a;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #334155;
    margin-bottom: 16px;
    gap: 4px;
}
.btn-sw {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.btn-sw:hover:not(.active) {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}
.btn-sw.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
    font-weight: 800;
}

/* BOTONES GLOBALES DE ALTA CALIDAD */
.btn-primario-full {
    width: 100%;
    margin-top: 14px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    border: 1px solid #fde047;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primario-full:hover {
    background: linear-gradient(135deg, #fde047 0%, #d97706 100%);
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.55);
    transform: translateY(-2px);
}
.btn-primario-full:active {
    transform: translateY(0);
}

.btn-secundario {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    color: #f8fafc;
    border: 1px solid #475569;
    padding: 9px 18px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    text-decoration: none;
}
.btn-secundario:hover {
    background: #475569;
    border-color: #94a3b8;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.btn-secundario:active {
    transform: translateY(0);
}

.btn-danger-full {
    width: 100%;
    margin-top: 14px;
    padding: 11px 16px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    border: 1px solid #f87171;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-danger-full:hover {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.55);
    transform: translateY(-2px);
}
.btn-danger-full:active {
    transform: translateY(0);
}

/* BOTONES DE ACCIÓN PARA PANEL ADMIN */
.btn-accion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.25;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.btn-accion:hover {
    transform: translateY(-2px);
}
.btn-accion:active {
    transform: translateY(0);
}
.btn-accion.btn-primario, .btn-primario {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.35);
}
.btn-accion.btn-primario:hover, .btn-primario:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 5px 16px rgba(2, 132, 199, 0.55);
}
.btn-accion.btn-corte, .btn-corte {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    border-color: #86efac;
    box-shadow: 0 3px 10px rgba(34, 197, 94, 0.35);
}
.btn-accion.btn-corte:hover, .btn-corte:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 5px 16px rgba(34, 197, 94, 0.55);
}

/* FORMULARIOS Y ADMIN */
form label { display: block; font-size: 0.85rem; margin: 8px 0 4px; color: #cbd5e1; font-weight: 600; }
form input, form select {
    width: 100%;
    padding: 10px 13px;
    border-radius: 9px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #fff;
    font-size: 0.92rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
form input:focus, form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.card-box {
    background: #152238;
    border: 1px solid #334155;
    padding: 1.5rem;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.card-box h3 {
    color: var(--gold);
    font-size: 1.15rem;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tabla-ranking {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.8rem;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #334155;
}
.tabla-ranking th {
    background: #1e293b;
    color: var(--gold);
    padding: 12px 14px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 2px solid #334155;
}
.tabla-ranking td {
    padding: 12px 14px;
    border-bottom: 1px solid #1e293b;
    font-size: 0.88rem;
    color: #e2e8f0;
    vertical-align: middle;
}
.tabla-ranking tr:hover td {
    background: rgba(56, 189, 248, 0.05);
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.admin-card {
    background: #0f172a;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid #334155;
}
.admin-card h4 {
    color: var(--gold);
    font-size: 1.05rem;
    margin-bottom: 8px;
}
.caja-plancha-info {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--accent);
    padding: 12px;
    border-radius: 10px;
    margin-top: 8px;
}
.fila-2-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #1e293b;
    font-size: 0.88rem;
}
.admin-item-row small { display: block; color: var(--text-muted); font-size: 0.78rem; }
.admin-tabla-scroll {
    max-height: 480px;
    overflow-y: auto;
    margin-top: 10px;
}
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.fila-unir {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.divisor {
    border: 0;
    height: 1px;
    background: #334155;
    margin: 18px 0;
}

/* ACCESO RÁPIDO Y CARDS DE ADMIN */
.admin-login-box {
    max-width: 440px;
    margin: 40px auto;
    background: #152238;
    border: 2px solid #334155;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.5);
    text-align: center;
}
.admin-login-box h2 {
    color: var(--gold);
    margin-bottom: 8px;
    font-size: 1.45rem;
}
.admin-login-box p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 18px;
    line-height: 1.4;
}
.admin-quick-tip {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 10px;
    font-size: 0.82rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.btn-link-admin {
    background: transparent;
    border: none;
    color: var(--gold);
    font-weight: 800;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.82rem;
    padding: 0;
}
.btn-link-admin:hover {
    color: #fde047;
}
.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.86rem;
    text-align: left;
}

/* CELEBRACIÓN DE VICTORIA */
.victoria-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    overflow: hidden;
}
.victoria-card {
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    border: 3px solid var(--gold);
    border-radius: 22px;
    padding: 28px 22px;
    text-align: center;
    max-width: 420px;
    width: 100%;
    z-index: 2;
    box-shadow: 0 0 40px rgba(250, 204, 21, 0.45);
}
.victoria-trofeo { font-size: 4rem; }
.victoria-card.derrota {
    border-color: #f87171;
    box-shadow: 0 0 40px rgba(248, 113, 113, 0.35);
}
.victoria-card.derrota .victoria-titulo { color: #f87171; }
.victoria-titulo { color: var(--gold); font-size: 1.6rem; margin: 8px 0; }
.victoria-sub { color: #e2e8f0; font-size: 0.95rem; margin-bottom: 14px; }
.victoria-puntos-badge {
    background: rgba(250, 204, 21, 0.15);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 8px 14px;
    border-radius: 99px;
    font-weight: 800;
    margin-bottom: 16px;
}
.btn-victoria-continuar {
    background: var(--gold);
    color: #0f172a;
    border: none;
    padding: 11px 24px;
    border-radius: 99px;
    font-weight: 900;
    cursor: pointer;
}
.confeti-pieza {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 18px;
    animation: caerConfeti linear forwards;
}
@keyframes caerConfeti {
    to { transform: translateY(105vh) rotate(720deg); }
}

/* Clases de texto adaptativo de botones */
.btn-txt-corto {
    display: none;
}

/* BANNER DE SERVIDOR LOCAL (FILE://) */
.banner-servidor-local {
    background: linear-gradient(135deg, #7c2d12 0%, #991b1b 100%);
    border-bottom: 2px solid #f87171;
    color: #fef2f2;
    padding: 8px 14px;
    font-size: 0.84rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 1000;
    position: relative;
}
.banner-servidor-contenido {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.banner-servidor-icono {
    font-size: 1.4rem;
}
.banner-servidor-texto {
    flex: 1;
    min-width: 260px;
    line-height: 1.35;
}
.btn-banner-localhost {
    background: #facc15;
    color: #713f12;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.btn-banner-localhost:hover {
    background: #fde047;
    transform: translateY(-1px);
}

/* =========================================================
   ADAPTACIÓN RESPONSIVE CELULAR Y TABLET (MOBILE-FIRST)
   ========================================================= */
@media (max-width: 768px) {
    .app-container {
        padding: 4px;
    }

    .topbar {
        padding: 6px 8px;
        gap: 6px;
    }
    .brand {
        gap: 6px;
    }
    .brand-logo {
        font-size: 1.4rem;
    }
    .brand h1 {
        font-size: 0.95rem;
    }
    .brand small {
        display: none;
    }

    .user-panel {
        gap: 6px;
    }
    .gemas-pill {
        padding: 4px 8px;
        font-size: 0.78rem;
    }
    .perfil-mini {
        padding: 3px 8px;
        gap: 6px;
    }
    .perfil-mini img {
        width: 26px;
        height: 26px;
    }
    #user-name-lbl {
        font-size: 0.78rem;
        max-width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .main-nav {
        order: 3;
        width: 100%;
        gap: 4px;
        margin-top: 4px;
    }
    .nav-btn {
        flex: 1;
        text-align: center;
        padding: 6px 4px;
        font-size: 0.78rem;
        border-radius: 7px;
    }

    /* Mesa de controles compacta */
    .mesa-controles-bar {
        padding: 6px 8px;
        margin-bottom: 6px;
        gap: 6px;
    }
    .modos-grupo {
        gap: 4px;
        flex: 1;
        justify-content: flex-start;
    }
    .btn-modo {
        padding: 5px 8px;
        font-size: 0.74rem;
        border-radius: 7px;
    }
    .Marcador-rapido {
        font-size: 0.78rem;
        white-space: nowrap;
    }
    .Marcador-rapido .limite-lbl {
        display: none;
    }

    /* Paño / Tapete adaptado */
    .tapete-mesa {
        padding: 8px 6px;
        border-width: 3px;
        border-radius: 16px;
        min-height: auto;
        gap: 8px;
    }

    /* Zona rival */
    .zona-rival {
        gap: 6px;
    }
    .ficha-jugador {
        padding: 4px 8px;
        gap: 6px;
    }
    .ficha-jugador img {
        width: 32px;
        height: 32px;
    }
    .ficha-datos strong {
        font-size: 0.78rem;
    }
    .ficha-datos small {
        font-size: 0.68rem;
    }
    .carta-rival-mini {
        width: 24px;
        height: 36px;
        border-radius: 4px;
    }
    .mano-rival {
        gap: 2px;
    }

    /* Zona centro de mesa */
    .zona-centro-mesa {
        gap: 10px;
        margin: 4px 0;
    }
    .carta-mesa {
        width: 62px;
        height: 92px;
        border-radius: 8px;
    }
    .pila-etiqueta {
        font-size: 0.64rem;
        margin-bottom: 3px;
    }
    .badge-turno {
        font-size: 0.74rem;
        padding: 4px 8px;
        line-height: 1.25;
        max-width: 150px;
    }
    .reloj-turno {
        font-size: 0.74rem;
        padding: 2px 6px;
    }

    /* Barra de acciones de la mano */
    .barra-acciones-mano {
        margin-bottom: 6px;
        gap: 6px;
        flex-direction: column;
        align-items: stretch;
    }
    .estado-armado {
        padding: 4px 8px;
        font-size: 0.78rem;
        text-align: center;
        border-radius: 7px;
    }
    .botones-jugada {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        width: 100%;
    }
    .btn-accion-mesa, .btn-cortar {
        padding: 6px 2px;
        font-size: 0.72rem;
        justify-content: center;
        text-align: center;
        border-radius: 7px;
        min-width: 0;
        white-space: nowrap;
    }
    .btn-txt-largo { display: none; }
    .btn-txt-corto { display: inline; }

    /* Mano del jugador: abanico continuo fluido sin desbordar */
    .mano-jugador {
        display: flex;
        justify-content: center;
        align-items: flex-end;
        padding: 10px 4px 4px;
        gap: 0;
        flex-wrap: nowrap;
        overflow-x: visible;
    }
    .carta-jugador {
        width: clamp(48px, 11vw, 68px);
        height: clamp(72px, 16.5vw, 100px);
        max-width: none;
        border-radius: 7px;
        border-width: 1.5px;
        flex-shrink: 0;
        margin-left: -10px;
        transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s, z-index 0.1s;
    }
    .carta-jugador:first-child {
        margin-left: 0;
    }
    .carta-jugador:hover,
    .carta-jugador:active {
        transform: translateY(-16px) scale(1.08);
        z-index: 30;
        box-shadow: 0 8px 24px rgba(0,0,0,0.65);
    }

    /* Badges en cartas pequeñas */
    .tag-ligada {
        top: 2px;
        right: 2px;
        font-size: 0.58rem;
        padding: 1px 4px;
        border-radius: 4px;
    }
    .pts-suelta-badge {
        bottom: 2px;
        right: 2px;
        font-size: 0.58rem;
        padding: 1px 3px;
        border-radius: 4px;
    }
    .badge-corte-carta {
        top: 2px;
        left: 2px;
        font-size: 0.54rem;
        padding: 1px 3px;
        border-radius: 4px;
    }

    .ayuda-jugada {
        font-size: 0.72rem;
        margin-top: 4px;
    }

    /* Tienda y otros módulos */
    .tienda-sistemas-selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .sistema-card {
        padding: 8px 6px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 4px;
        border-radius: 10px;
    }
    .sistema-icono {
        font-size: 1.5rem;
    }
    .sistema-textos strong {
        font-size: 0.78rem;
    }
    .sistema-textos small {
        display: none;
    }
    .grid-tienda-items {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .item-tienda-card {
        padding: 10px 8px;
    }
    .mazo-abanico-preview {
        height: 90px;
    }
    .mazo-abanico-preview img {
        width: 52px;
        height: 78px;
    }
    .podio-gamer {
        grid-template-columns: 1fr;
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }

    /* Modales en móviles */
    .modal-box {
        width: 95%;
        max-width: 95vw;
        padding: 16px 12px;
        max-height: 92vh;
        overflow-y: auto;
    }
}

/* Pantallas móviles muy angostas (< 480px) */
@media (max-width: 480px) {
    .mesa-controles-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .modos-grupo {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
    .btn-modo {
        text-align: center;
        padding: 5px 2px;
        font-size: 0.7rem;
    }
    .Marcador-rapido {
        text-align: center;
        font-size: 0.75rem;
    }

    .carta-mesa {
        width: 54px;
        height: 80px;
    }
    .zona-centro-mesa {
        gap: 6px;
    }

    .carta-jugador {
        width: clamp(42px, 11vw, 56px);
        height: clamp(64px, 16vw, 84px);
        margin-left: -12px;
    }
    .carta-jugador:first-child {
        margin-left: 0;
    }

    .botones-jugada {
        gap: 3px;
    }
    .btn-accion-mesa, .btn-cortar {
        font-size: 0.68rem;
        padding: 5px 1px;
    }
}

/* =========================================================
   PANEL ADMIN PROFESIONAL: TIENDA, TORNEOS E IAs
   ========================================================= */
.admin-tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: rgba(15, 23, 42, 0.9);
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(250, 204, 21, 0.2);
    flex-wrap: wrap;
}
.admin-tab-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: var(--text-light);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.admin-tab-btn:hover {
    background: #334155;
    border-color: #64748b;
    transform: translateY(-1px);
}
.admin-tab-btn.active {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    border-color: var(--gold);
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.35);
}

.admin-section {
    display: none;
    animation: fadeInAdmin 0.25s ease-out;
}
.admin-section.active {
    display: block;
}
@keyframes fadeInAdmin {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* MÉTRICAS */
.metricas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.metrica-card {
    background: #152238;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.metrica-icono {
    font-size: 2.2rem;
}
.metrica-valor {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold);
}
.metrica-titulo {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* FORMULARIO MEJORADO DE TIENDA */
.tienda-form-card {
    background: #152238;
    border: 1px solid rgba(250, 204, 21, 0.3);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    margin-bottom: 24px;
}
.selector-tipo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 10px 0 16px;
}
.btn-tipo-pill {
    background: #0f172a;
    border: 2px solid #334155;
    color: #cbd5e1;
    padding: 12px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.btn-tipo-pill:hover {
    border-color: #64748b;
    background: #1e293b;
}
.btn-tipo-pill.active {
    border-color: var(--gold);
    background: rgba(250, 204, 21, 0.12);
    color: var(--gold);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.25);
}

.gemas-quick-pills {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.gem-pill-btn {
    background: #0f172a;
    border: 1px solid #475569;
    color: #fde047;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.gem-pill-btn:hover {
    background: #ca8a04;
    color: #0f172a;
}

.preview-box-upload {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: #0b1320;
    border: 1px dashed #475569;
    border-radius: 12px;
    margin-top: 10px;
    min-height: 80px;
}
.preview-img-slot {
    width: 60px;
    height: 75px;
    border-radius: 8px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #334155;
    flex-shrink: 0;
}
.preview-img-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* FILTROS Y CUADRÍCULA DE PRODUCTOS EN ADMIN */
.catalogo-filtro-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.catalogo-tabs-sub {
    display: flex;
    gap: 6px;
}
.btn-filtro-cat {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-filtro-cat.active {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
}

.admin-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.admin-item-card {
    background: #152238;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    transition: all 0.2s ease;
}
.admin-item-card:hover {
    border-color: #64748b;
    transform: translateY(-2px);
}
.admin-item-card.oculto {
    opacity: 0.65;
    border-style: dashed;
}
.item-card-top {
    display: flex;
    gap: 12px;
    align-items: center;
}
.item-thumb-box {
    width: 64px;
    height: 84px;
    background: #0b1320;
    border-radius: 8px;
    border: 1px solid #334155;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.item-thumb-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.item-info-meta {
    flex: 1;
    min-width: 0;
}
.item-info-meta strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-tipo-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.tipo-mazo { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.tipo-tapete { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.tipo-avatar { background: rgba(250, 204, 21, 0.2); color: #facc15; }

.item-acciones-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #1e293b;
    gap: 6px;
    flex-wrap: wrap;
}
.btn-sm-admin {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}
.btn-toggle-activo {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid #22c55e;
}
.btn-toggle-activo.inactivo {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid #64748b;
}
.btn-eliminar-item {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid #ef4444;
}

/* =========================================================
   SECCIÓN DE TORNEOS Y PRUEBAS CON IAs
   ========================================================= */
.torneo-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 860px) {
    .torneo-dashboard-grid { grid-template-columns: 1fr; }
    .selector-tipo-grid { grid-template-columns: 1fr; }
}

.torneo-info-card {
    background: #152238;
    border: 1px solid rgba(250, 204, 21, 0.35);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.torneo-stats-fila {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0;
    text-align: center;
}
.torneo-stat-pill {
    background: #0f172a;
    border: 1px solid #334155;
    padding: 10px 8px;
    border-radius: 10px;
}
.torneo-stat-pill span { display: block; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.torneo-stat-pill strong { font-size: 1.15rem; color: var(--gold); }

.torneo-actions-card {
    background: #152238;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 20px;
}
.torneo-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.btn-torneo-accion {
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-ia-bots {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    border-color: #38bdf8;
}
.btn-simular-match {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: #fff;
    border-color: #34d399;
}
.btn-inscribir-admin {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    border-color: #fbbf24;
}
.btn-cerrar-torneo {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    border-color: #f87171;
}

.consola-simulacion {
    background: #090d16;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px 14px;
    font-family: monospace;
    font-size: 0.84rem;
    color: #38bdf8;
    max-height: 180px;
    overflow-y: auto;
    margin-top: 14px;
    display: none;
}
.consola-simulacion.active { display: block; }
.consola-linea { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid #111a2e; }

/* MODAL / TARJETA DE TORNEO EN JUEGO */
.banner-torneo-juego {
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    box-shadow: 0 8px 24px rgba(250, 204, 21, 0.2);
}
.badge-modo-torneo {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #0f172a;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* SELECTOR RÁPIDO DE BARAJA EN MESA */
.btn-selector-baraja {
    background: #1e293b;
    border: 1px solid #eab308 !important;
    color: #fef08a !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-selector-baraja:hover {
    background: #713f12 !important;
    color: #ffffff !important;
    border-color: #facc15 !important;
    box-shadow: 0 4px 14px rgba(234, 179, 8, 0.45);
    transform: translateY(-1px);
}
.selector-baraja-desc {
    color: #cbd5e1;
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.5;
    background: rgba(15, 23, 42, 0.6);
    padding: 10px 14px;
    border-radius: 10px;
    border-left: 4px solid #0284c7;
}
.lista-barajas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 4px;
}
.badge-tatu-oficial {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-block;
    margin-bottom: 8px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* =========================================================
   EDITOR DE ARTÍCULOS (ADMIN)
   ========================================================= */
.btn-editar-item {
    width: 100%;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid #38bdf8;
}
.btn-editar-item:hover { background: #38bdf8; color: #0f172a; }
#form-editar-item label { display: block; margin-top: 8px; }
#form-editar-item input[type="text"],
#form-editar-item input[type="number"],
#form-editar-item select { width: 100%; }
#form-editar-item .chk-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
#form-editar-item .chk-label input { width: auto; margin: 0; }
.editor-grid-cartas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.editor-carta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    transition: border-color 0.15s, transform 0.15s;
}
.editor-carta:hover { border-color: var(--gold); transform: translateY(-2px); }
.editor-carta img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 5px;
    background: #fff;
}
.editor-carta img.falta { background: repeating-linear-gradient(45deg, #450a0a, #450a0a 6px, #7f1d1d 6px, #7f1d1d 12px); }
.editor-carta span { font-size: 0.68rem; color: #cbd5e1; }

/* Las cartas son proporción 2:3: rellenar el hueco sin bandas blancas */
.carta-jugador img,
.carta-mesa img,
.mazo-abanico-preview img,
.mini-carta-item img { object-fit: cover; }

/* =========================================================
   MÓVIL v2: cartas grandes, controles táctiles, menú inferior
   ========================================================= */
@media (max-width: 768px) {
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

    /* Barra superior: solo marca, gemas y perfil */
    .topbar { padding: 6px 10px; flex-wrap: nowrap; }
    .brand h1 { font-size: 0.95rem; white-space: nowrap; }

    /* Menú principal como barra de pestañas inferior tipo app */
    .main-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        margin: 0;
        order: 0;
        z-index: 2500;
        display: flex;
        gap: 0;
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
        background: rgba(11, 19, 32, 0.98);
        border-top: 2px solid rgba(250, 204, 21, 0.3);
        box-shadow: 0 -6px 18px rgba(0,0,0,0.5);
    }
    .main-nav .nav-btn {
        flex: 1;
        flex-direction: column;
        gap: 1px;
        padding: 6px 2px;
        min-height: 54px;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 12px;
        color: #94a3b8;
        font-size: 0.72rem;
    }
    .main-nav .nav-btn:hover { transform: none; box-shadow: none; background: transparent; }
    .main-nav .nav-btn .nav-ico { font-size: 1.45rem; line-height: 1; }
    .main-nav .nav-btn.active {
        color: var(--gold);
        background: rgba(250, 204, 21, 0.12);
        box-shadow: none;
    }

    .vista { padding: 8px; }

    /* Barra de modos: chips deslizables en una sola línea */
    .mesa-controles-bar {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        padding: 6px;
        gap: 6px;
    }
    .modos-grupo, .Marcador-rapido { min-width: 0; }
    .modos-grupo {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .modos-grupo::-webkit-scrollbar { display: none; }
    .btn-modo {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 9px 12px;
        font-size: 0.82rem;
        border-radius: 99px;
        min-height: 40px;
    }
    .Marcador-rapido {
        text-align: center;
        font-size: 0.85rem;
    }

    /* Paño ocupando la pantalla disponible */
    .tapete-mesa {
        min-height: calc(100dvh - 210px);
        padding: 10px 6px;
        gap: 6px;
    }

    /* Rival: dorsos solapados */
    .mano-rival { gap: 0; }
    .carta-rival-mini {
        width: 32px;
        height: 48px;
        margin-left: -12px;
        border-radius: 5px;
        border: 1px solid rgba(255,255,255,0.6);
    }
    .carta-rival-mini:first-child { margin-left: 0; }

    /* Mazo y pozo grandes para tocar fácil */
    .zona-centro-mesa {
        flex-wrap: nowrap;
        gap: 10px;
        margin: 6px 0;
    }
    .carta-mesa {
        width: clamp(70px, 22vw, 100px);
        height: clamp(105px, 33vw, 150px);
        border-radius: 9px;
    }
    .pila-etiqueta { font-size: 0.66rem; }
    .info-turno-centro { flex: 1; min-width: 0; max-width: 180px; }
    .badge-turno {
        font-size: 0.78rem;
        max-width: none;
        padding: 6px 8px;
    }

    /* Mano del jugador: cartas grandes solapadas (se ve el número de la esquina) */
    .mano-jugador {
        --ancho-carta: min(19.5vw, 104px);
        justify-content: center;
        align-items: flex-end;
        padding: 18px 0 4px;
        gap: 0;
        flex-wrap: nowrap;
    }
    .carta-jugador {
        width: var(--ancho-carta);
        height: calc(var(--ancho-carta) * 1.5);
        margin-left: calc(var(--ancho-carta) * -0.5);
        border-radius: 8px;
        border-width: 2px;
    }
    .carta-jugador:first-child { margin-left: 0; }
    .carta-jugador:hover,
    .carta-jugador:active {
        transform: translateY(-14px);
        z-index: 30;
    }
    .tag-ligada, .pts-suelta-badge { font-size: 0.66rem; padding: 1px 5px; }
    .badge-corte-carta { font-size: 0.62rem; }

    /* Botones de jugada: grandes, icono arriba y texto abajo */
    .barra-acciones-mano { flex-direction: column; align-items: stretch; gap: 6px; }
    .estado-armado { font-size: 0.85rem; text-align: center; }
    .botones-jugada {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .btn-accion-mesa, .btn-cortar {
        flex-direction: column;
        gap: 2px;
        min-height: 52px;
        padding: 6px 2px;
        font-size: 0.78rem;
        border-radius: 12px;
        white-space: nowrap;
        justify-content: center;
    }
    .btn-txt-largo { display: none; }
    .btn-txt-corto { display: inline; }
    .ayuda-jugada { font-size: 0.78rem; }

    /* ---------- TIENDA: menú de categorías fijo y grilla de 2 columnas ---------- */
    #vista-tienda .seccion-header { margin-bottom: 8px; }
    #vista-tienda .seccion-header h2 { font-size: 1.15rem; }
    #vista-tienda .seccion-header p { display: none; }
    .tienda-sistemas-selector {
        position: sticky;
        top: 52px;
        z-index: 900;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        padding: 4px;
        margin: 0 -2px 10px;
        background: rgba(11, 19, 32, 0.96);
        border: 1px solid #334155;
        border-radius: 14px;
        box-shadow: 0 6px 16px rgba(0,0,0,0.45);
    }
    .sistema-card {
        flex-direction: row;
        justify-content: center;
        gap: 6px;
        padding: 10px 4px;
        border: none;
        border-radius: 10px;
        background: transparent;
        min-height: 46px;
    }
    .sistema-card.active, .sistema-card:hover {
        background: var(--gold);
        box-shadow: none;
    }
    .sistema-card.active .sistema-textos strong { color: #0f172a; }
    .sistema-icono { font-size: 1.25rem; }
    .sistema-textos strong { font-size: 0.8rem; color: #e2e8f0; }
    .sistema-textos small { display: none; }

    .sistema-ventana { padding: 10px; border-radius: 14px; }
    .sistema-ventana-header { margin-bottom: 10px; }
    .sistema-ventana-header h3 { font-size: 0.95rem; }
    .grid-tienda-items,
    .lista-barajas-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .item-tienda-card { padding: 10px 8px; border-radius: 14px; }
    .item-tienda-info h4 { font-size: 0.88rem; }
    .item-tienda-info p { font-size: 0.74rem; }
    .mazo-abanico-preview { height: 118px; }
    .mazo-abanico-preview img {
        width: 60px;
        height: 90px;
        margin: 0 -14px;
    }
    .mazo-abanico-preview img:nth-child(1) { transform: rotate(-10deg) translateY(4px); }
    .mazo-abanico-preview img:nth-child(2) { position: relative; z-index: 1; }
    .mazo-abanico-preview img:nth-child(3) { transform: rotate(10deg) translateY(4px); }
    .btn-ver-mazo { font-size: 0.74rem; padding: 6px 10px; }
    .btn-tienda { min-height: 44px; font-size: 0.82rem; padding: 8px 6px; }

    .preview-mazo-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .mini-carta-item img { height: auto; aspect-ratio: 2 / 3; }

    /* Modales como hoja inferior */
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal-box, .modal-box.modal-xl {
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        border-radius: 18px 18px 0 0;
        padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
    }
}

/* Celulares angostos */
@media (max-width: 400px) {
    .badge-uy { display: none; }
    #user-name-lbl { max-width: 64px; }
    .btn-accion-mesa, .btn-cortar { font-size: 0.72rem; }
}

/* Celular acostado (poca altura): cartas según la altura */
@media (max-width: 950px) and (max-height: 500px) {
    body { padding-bottom: 0; }
    .topbar { flex-wrap: nowrap; padding: 4px 10px; }
    .brand small, .brand-logo { display: none; }
    .nav-btn { padding: 5px 10px; font-size: 0.8rem; }
    .user-panel { gap: 6px; }
    .vista { padding: 6px; }
    .mesa-controles-bar { padding: 4px 8px; margin-bottom: 4px; }
    .btn-modo { padding: 4px 10px; font-size: 0.78rem; }
    .zona-centro-mesa { margin: 2px 0; gap: 14px; }
    .tapete-mesa { padding: 6px 10px; }
    .main-nav {
        position: static;
        width: auto;
        order: 0;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .main-nav .nav-btn { min-height: 40px; flex-direction: row; }
    .tapete-mesa { min-height: auto; }
    .carta-mesa { width: 13vh; height: 19.5vh; min-width: 52px; min-height: 78px; }
    .mano-jugador {
        --ancho-carta: min(18vh, 9vw, 96px);
        padding-top: 12px;
        gap: 0;
        flex-wrap: nowrap;
        align-items: flex-end;
    }
    .carta-jugador {
        width: var(--ancho-carta);
        height: calc(var(--ancho-carta) * 1.5);
        margin-left: calc(var(--ancho-carta) * -0.3);
    }
    .carta-jugador:first-child { margin-left: 0; }
    .carta-rival-mini { width: 24px; height: 36px; }
    .btn-accion-mesa, .btn-cortar { min-height: 38px; flex-direction: row; }
    .tienda-sistemas-selector { position: static; }
}

/* En pantallas táctiles no dejar "pegado" el efecto hover */
@media (hover: none) {
    .carta-jugador:hover { transform: none; z-index: auto; }
    .carta-jugador:active { transform: translateY(-14px); z-index: 30; }
    .carta-mesa:hover { transform: none; }
}


/* =========================================================
   VISOR DE CARTA EN GRANDE Y DE JUEGOS
   ========================================================= */
.visor-box {
    max-width: 420px;
    text-align: center;
}
.visor-carta-grande {
    width: min(62vw, 240px);
    aspect-ratio: 2 / 3;
    margin: 4px auto 10px;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 14px 34px rgba(0,0,0,0.6);
    border: 3px solid rgba(255,255,255,0.85);
    animation: visorEntrada 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.visor-carta-grande img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes visorEntrada {
    from { transform: scale(0.7) translateY(30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.visor-titulo { color: var(--gold); font-size: 1.15rem; margin-bottom: 4px; }
.visor-info { color: #cbd5e1; font-size: 0.9rem; margin-bottom: 8px; }
.visor-info .tag-ligada { position: static; display: inline-block; }
.visor-grupo {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
}
.visor-mini {
    width: 64px;
    aspect-ratio: 2 / 3;
    border-radius: 7px;
    overflow: hidden;
    background: #fff;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.45);
    cursor: pointer;
}
.visor-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.visor-mini.actual { border-color: var(--gold); box-shadow: 0 0 14px rgba(250, 204, 21, 0.7); }
.visor-grupo-titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 0.95rem;
    margin: 12px 0 8px;
}
.visor-grupo-titulo .tag-ligada { position: static; }
.visor-grupo-titulo small { color: #94a3b8; font-weight: normal; }
#visor-juegos-contenido .visor-grupo { justify-content: flex-start; }
#visor-juegos-contenido .visor-mini { width: clamp(64px, 21vw, 96px); }

.visor-acciones { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.visor-aviso { color: #cbd5e1; font-size: 0.88rem; }
.btn-visor {
    width: 100%;
    min-height: 50px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, filter 0.15s;
}
.btn-visor:active { transform: scale(0.97); }
.btn-visor small { display: block; font-size: 0.75rem; font-weight: 600; opacity: 0.9; }
.btn-visor-cortar {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    border-color: #fca5a5;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5);
    animation: latidoCorte 0.9s infinite alternate;
}
.btn-visor-descartar {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #0f172a;
}
.btn-visor-cerrar {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #475569;
    min-height: 44px;
    font-size: 0.9rem;
}
.carta-jugador.carta-corte-valida {
    border-color: #ef4444 !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.75) !important;
}
.btn-ver-juegos.brillo-corte { border-color: #ef4444; }

.btn-secundario-full {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #475569;
    font-weight: 700;
    cursor: pointer;
}
.btn-secundario-full:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================
   INSTALAR APP (BANNER + GUÍA IPHONE)
   ========================================================= */
.banner-instalar {
    width: min(560px, calc(100% - 16px));
    margin: 8px auto 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    background: rgba(21, 34, 56, 0.98);
    border: 2px solid var(--gold);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.banner-instalar img { width: 44px; height: 44px; border-radius: 10px; }
.banner-instalar-txt { flex: 1; min-width: 0; line-height: 1.2; }
.banner-instalar-txt strong { display: block; color: var(--gold); font-size: 0.95rem; }
.banner-instalar-txt small { color: #94a3b8; font-size: 0.78rem; }
.btn-instalar {
    background: var(--gold);
    color: #0f172a;
    border: none;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.btn-instalar-cerrar {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    padding: 6px;
    cursor: pointer;
}
.guia-ios { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 6px 0 16px; }
.guia-ios li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.95rem; color: #e2e8f0; line-height: 1.4; }
.guia-num {
    flex: 0 0 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold);
    color: #0f172a;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ico-compartir {
    display: inline-flex;
    vertical-align: middle;
    color: #38bdf8;
    background: #0f172a;
    border-radius: 6px;
    padding: 2px 4px;
}

/* Admin: ícono de la app */
.app-icono-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 960px; margin: 10px auto; }
.app-icono-card { background: #152238; border: 1px solid #334155; border-radius: 16px; padding: 22px; }
.app-icono-card label { display: block; margin-top: 6px; }
.app-icono-card input[type="color"] { width: 100%; }
.app-icono-previews { display: flex; align-items: flex-end; justify-content: space-around; gap: 16px; padding: 18px; background: #0f172a; border-radius: 14px; }
.app-icono-previews figure { text-align: center; }
.app-icono-previews img { width: 96px; height: 96px; object-fit: cover; box-shadow: 0 6px 16px rgba(0,0,0,0.5); }
.app-icono-previews figcaption { color: #94a3b8; font-size: 0.8rem; margin-top: 6px; }
@media (max-width: 760px) { .app-icono-grid { grid-template-columns: 1fr; } }

/* =========================================================
   MÓVIL v3: modos compactos
   ========================================================= */
@media (max-width: 768px) {
    .modos-grupo {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        overflow: visible;
        gap: 5px;
    }
    .btn-modo {
        flex-direction: column;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 1px;
        min-height: 48px;
        padding: 5px 3px;
        font-size: 0.74rem;
        border-radius: 12px;
        line-height: 1.15;
        overflow: hidden;
    }
    .btn-modo b, .btn-modo .btn-txt-corto {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .btn-selector-baraja #lbl-baraja-activa { font-size: 0.72rem; }
    .btn-visor { min-height: 54px; }
}


/* =========================================================
   PROMOCIONES: AVISO + BOTÓN FLOTANTE CON CUENTA REGRESIVA
   ========================================================= */
.promo-box {
    position: relative;
    max-width: 400px;
    text-align: center;
    border: 2px solid var(--gold);
    background: radial-gradient(circle at 50% 0%, #3b1d06 0%, #152238 55%);
    box-shadow: 0 0 40px rgba(250, 204, 21, 0.35);
    overflow-x: hidden;
}
.promo-cerrar { position: absolute; top: 10px; right: 10px; z-index: 2; }
.promo-etiqueta {
    display: inline-block;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    font-weight: 900;
    font-size: 0.72rem;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 99px;
    margin: 2px 0 10px;
    animation: latidoCorte 0.9s infinite alternate;
}
.promo-titulo { color: var(--gold); font-size: 1.35rem; line-height: 1.2; margin-bottom: 4px; }
.promo-mensaje { color: #e2e8f0; font-size: 0.9rem; margin-bottom: 10px; }
.promo-mensaje:empty { display: none; }
.promo-preview {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    margin: 6px 0 10px;
}
.promo-preview .mazo-abanico-preview { height: 150px; margin: 0; }
.promo-preview .mazo-abanico-preview img { width: 80px; height: 120px; margin: 0 -16px; }
.promo-preview-avatar img {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--gold);
    box-shadow: 0 0 24px rgba(250, 204, 21, 0.5);
}
.promo-preview-tapete {
    width: 220px;
    height: 130px;
    border-radius: 14px;
    border: 4px solid #5c3a21;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
}
.promo-preview-tapete img { width: 100%; height: 100%; object-fit: cover; }
.promo-descuento {
    position: absolute;
    top: -4px;
    right: 18px;
    z-index: 2;
    background: var(--gold);
    color: #0f172a;
    font-weight: 900;
    font-size: 1.1rem;
    padding: 10px 8px;
    border-radius: 50%;
    min-width: 58px;
    transform: rotate(12deg);
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}
.promo-item-nombre small { display: block; color: #94a3b8; font-size: 0.75rem; }
.promo-item-nombre strong { color: #fff; font-size: 1.05rem; }
.promo-precios { display: flex; justify-content: center; align-items: baseline; gap: 12px; margin: 6px 0; }
.promo-precios s { color: #94a3b8; font-size: 1rem; }
.promo-precios span { color: var(--gold); font-size: 1.6rem; font-weight: 900; }
.promo-cuenta {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #ef4444;
    color: #fecaca;
    border-radius: 12px;
    padding: 8px;
    margin: 8px 0 12px;
    font-size: 0.9rem;
}
.promo-cuenta b { color: #fff; font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.btn-promo-comprar {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #0f172a;
    font-weight: 900;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(250, 204, 21, 0.4);
}
.btn-promo-comprar.ya-tuyo { background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; box-shadow: none; }
.promo-navegacion { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
.promo-navegacion:empty { display: none; }
.promo-navegacion button {
    background: #1e293b;
    color: #fff;
    border: 1px solid #475569;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
}
.promo-navegacion span { width: 8px; height: 8px; border-radius: 50%; background: #475569; }
.promo-navegacion span.activo { background: var(--gold); }

/* Los botones flotantes de ofertas y del desafío están en marca.css (.flotantes-ofertas) */

/* Artículo en promoción dentro de la tienda */
.item-tienda-card.card-promo { position: relative; border-color: #f97316; box-shadow: 0 0 18px rgba(249, 115, 22, 0.35); }
.cinta-promo {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    font-weight: 900;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 8px;
}
.precio-tachado { opacity: 0.65; font-weight: 600; margin-right: 2px; }

/* Admin: promociones */
.promos-admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1100px; margin: 10px auto; }
.promos-admin-grid label { display: block; margin-top: 8px; }
.promos-admin-grid input[type="text"],
.promos-admin-grid input[type="number"],
.promos-admin-grid input[type="datetime-local"],
.promos-admin-grid select { width: 100%; }
.lista-promos { display: flex; flex-direction: column; gap: 10px; max-height: 640px; overflow-y: auto; }
.promo-admin-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #0f172a;
    border: 1px solid #334155;
    border-left: 4px solid #64748b;
    border-radius: 10px;
    padding: 10px 12px;
}
.promo-admin-item small { color: #cbd5e1; }
.promo-admin-item.estado-vigente { border-left-color: #22c55e; }
.promo-admin-item.estado-programada { border-left-color: #38bdf8; }
.promo-admin-item.estado-vencida { opacity: 0.6; }
.promo-admin-top { display: flex; justify-content: space-between; gap: 8px; }
.promo-estado { font-size: 0.78rem; white-space: nowrap; }
.promo-admin-acciones { display: flex; gap: 6px; margin-top: 4px; }
.promo-admin-acciones .btn-editar-item { width: auto; flex: 1; }
@media (max-width: 860px) { .promos-admin-grid { grid-template-columns: 1fr; } }

/* =========================================================
   PANTALLA COMPLETA (APP INSTALADA): respetar notch y bordes
   ========================================================= */
.topbar {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
}
@media (max-width: 768px) {
    .topbar {
        padding-top: max(6px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
    .tienda-sistemas-selector { top: calc(52px + env(safe-area-inset-top)); }
}
@media (display-mode: fullscreen), (display-mode: standalone) {
    /* Sin barra del navegador: evitar el "rebote" y la selección accidental de texto al jugar */
    body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
    input, textarea { -webkit-user-select: text; user-select: text; }
}

/* REGISTRO EN DOS PASOS: GÉNERO PRIMERO */
.reg-pregunta { font-weight: 800; font-size: 1.02rem; color: var(--gold); margin-bottom: 4px; }
.reg-ayuda { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; }
.genero-opciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.genero-opcion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 6px;
    border-radius: 14px;
    border: 2px solid #334155;
    background: #0f172a;
    color: var(--text-light);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.genero-opcion span { font-size: 2.1rem; }
.genero-opcion:hover { border-color: var(--gold); transform: translateY(-2px); }
.reg-genero-elegido {
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #0f172a;
    border: 1px solid #334155;
    font-size: 0.85rem;
}

/* SELECTOR DE AVATARES CON VISTA PREVIA */
.avatar-previa {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 14px;
    background: #0f172a;
    border: 1px solid #334155;
    margin-bottom: 10px;
}
.avatar-previa img {
    width: 92px;
    height: 92px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
}
.avatar-previa strong { display: block; color: var(--gold); font-size: 1.02rem; }
.avatar-previa small { display: block; color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }
.selector-avatares {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding: 2px;
}
.avatar-opcion {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    border-radius: 50%;
    border: 3px solid #334155;
    background: #0f172a;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.avatar-opcion img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-opcion:hover { transform: scale(1.06); }
.avatar-opcion.seleccionado { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.3); }
.avatar-opcion.bloqueado img { filter: grayscale(0.7) brightness(0.65); }
.avatar-precio {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 0 4px;
}
.avatar-check {
    position: absolute;
    top: 2px;
    right: 6px;
    color: var(--green-ok);
    font-weight: 900;
    text-shadow: 0 0 4px #000;
}

/* PERFIL DEL JUGADOR */
.perfil-cabecera { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.perfil-avatar-grande {
    position: relative;
    width: 84px;
    height: 84px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}
.perfil-avatar-grande img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
}
.perfil-avatar-lapiz {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}
.perfil-datos { min-width: 0; }
.perfil-datos strong { font-size: 1.1rem; word-break: break-word; }
.perfil-rol {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 99px;
    padding: 1px 7px;
    margin-left: 4px;
    vertical-align: middle;
}
.perfil-datos small { display: block; color: var(--text-muted); font-size: 0.82rem; margin-top: 3px; }
.perfil-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.perfil-acciones .btn-secundario { flex: 1; min-width: 140px; }
.form-editar-perfil {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 6px 12px 12px;
}
.genero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.genero-chips label { margin: 0; cursor: pointer; }
.genero-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.genero-chips span {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 99px;
    border: 1px solid #475569;
    font-size: 0.82rem;
    font-weight: 700;
    color: #cbd5e1;
}
.genero-chips input:checked + span { background: var(--accent); border-color: var(--accent); color: #0f172a; }
.genero-chips input:focus-visible + span { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35); }
.perfil-cambiar-clave { margin-top: 10px; font-size: 0.85rem; color: #cbd5e1; }
.perfil-cambiar-clave summary { cursor: pointer; font-weight: 700; }
.perfil-cambiar-clave input { margin-top: 8px; }
.perfil-form-botones { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.perfil-form-botones .btn-primario-full { margin-top: 0; flex: 1; }

/* INGRESO CON GOOGLE */
.separador-o {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.separador-o::before, .separador-o::after { content: ''; flex: 1; height: 1px; background: #334155; }
#google-btn-oficial { justify-content: center; }
.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 99px;
    border: 1px solid #475569;
    background: #fff;
    color: #1f2937;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
}
.btn-google:hover { background: #f1f5f9; }
.aviso-google-proximamente, .aviso-google {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
}
.aviso-google-proximamente { background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.4); color: #fde68a; }
.aviso-google { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.45); color: #bbf7d0; margin: 0 0 10px; }

/* AVATAR CON MARCO: el avatar ocupa el 78% central y el marco va encima */
.avatar-marco {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    aspect-ratio: 1;
    border-radius: 50%;
}
.avatar-marco .am-foto {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: none;
}
.avatar-marco.con-marco { border-color: transparent !important; box-shadow: none !important; }
.avatar-marco.con-marco .am-foto { inset: 11%; width: 78%; height: 78%; }
.avatar-marco .am-marco {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    pointer-events: none;
}
.avatar-marco .am-marco[hidden] { display: none; }
.perfil-mini .avatar-marco { width: 34px; height: 34px; border: 1.5px solid var(--gold); }
.perfil-mini .avatar-marco.con-marco { width: 42px; height: 42px; margin: -4px 0; }
.perfil-avatar-grande .avatar-marco { width: 100%; height: 100%; border: 3px solid var(--gold); }
.avatar-previa .avatar-marco { width: 104px; height: 104px; border: 3px solid var(--gold); }
.avatar-previa .avatar-marco.con-marco { width: 116px; height: 116px; margin: -6px; }
.avatar-opcion .avatar-marco { width: 100%; height: 100%; display: block; }
.selector-marcos .avatar-opcion { border-radius: 14px; border-color: transparent; background: #0f172a; padding: 2px; }
.selector-marcos .avatar-opcion.seleccionado { border-color: var(--gold); }
.avatar-preview-box .marco-tienda { width: 104px; height: 104px; }
.podio-avatar.avatar-marco { display: block; }
.podio-avatar.con-marco { width: 72px; height: 72px; margin: 0 auto; }
.rank-avatar-gamer.con-marco { width: 52px; height: 52px; margin: -5px; }

/* TIENDA: PESTAÑA DE MARCOS Y EXCLUSIVOS DE RANKING */
.tienda-sistemas-selector.con-marcos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tienda-sistemas-selector.con-marcos .sistema-card { min-width: 0; }
.card-exclusiva { position: relative; border-color: rgba(250, 204, 21, 0.55); }
.cinta-exclusiva {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: linear-gradient(135deg, #facc15, #b45309);
    color: #1c1917;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 99px;
}
.btn-tienda.exclusivo {
    background: rgba(250, 204, 21, 0.1);
    border-color: rgba(250, 204, 21, 0.45);
    color: #fde68a;
    cursor: default;
}
.btn-primario-full:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }

/* =========================================================
   RANKINGS (podio escalonado, tabla y guerra de departamentos)
   ========================================================= */
#vista-rankings { max-width: 760px; }
.rk-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.rk-cabecera h2 { font-size: 1.6rem; color: #fff; letter-spacing: 0.01em; }
.rk-envivo { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 700; color: #86efac; }
.rk-envivo::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: rk-latido 2s infinite;
}
@keyframes rk-latido { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

.rk-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 12px; background: #0f172a; border: 1px solid #1e293b; }
.rk-tab { padding: 10px 6px; border: none; border-radius: 9px; background: transparent; color: var(--text-muted); font-weight: 700; font-size: 0.92rem; cursor: pointer; }
.rk-tab:hover { color: #fff; }
.rk-tab.active { background: #1e293b; color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }

.rk-vacio { padding: 28px 16px; text-align: center; color: var(--text-muted); border: 1px dashed #334155; border-radius: 14px; }
.rk-vacio-chico { padding: 12px 4px 4px; color: var(--text-muted); font-size: 0.86rem; }
.rk-explicacion { color: var(--text-muted); font-size: 0.86rem; margin-bottom: 12px; }

/* Podio: 2.º | 1.º | 3.º con pedestales de distinta altura */
.rk-podio { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 8px 0 18px; }
.rk-podio-lugar { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.rk-podio-lugar .rk-nombre { margin-top: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; color: #fff; }
.rk-podio-lugar .rk-sub { font-size: 0.76rem; }
.rk-podio-lugar .rk-valor { margin: 4px 0 8px; }
.rk-podio-avatar { width: 64px; height: 64px; border: 3px solid #94a3b8; }
.rk-podio-avatar.con-marco { width: 78px; height: 78px; margin: -7px 0; }
.lugar-1 .rk-podio-avatar { width: 84px; height: 84px; border-color: var(--gold); box-shadow: 0 0 22px rgba(250, 204, 21, 0.35); }
.lugar-1 .rk-podio-avatar.con-marco { width: 100px; height: 100px; margin: -8px 0; }
.lugar-2 .rk-podio-avatar { border-color: #cbd5e1; }
.lugar-3 .rk-podio-avatar { border-color: #d08a52; }
.rk-pedestal {
    width: 100%;
    display: grid;
    place-items: start center;
    padding-top: 8px;
    border-radius: 10px 10px 4px 4px;
    font-weight: 900;
    font-size: 1.5rem;
    color: rgba(15, 23, 42, 0.85);
}
.lugar-1 .rk-pedestal { height: 86px; background: linear-gradient(180deg, #facc15, #a16207); }
.lugar-2 .rk-pedestal { height: 62px; background: linear-gradient(180deg, #e2e8f0, #64748b); }
.lugar-3 .rk-pedestal { height: 46px; background: linear-gradient(180deg, #e0a172, #7c3f17); }
.rk-podio-lugar.es-yo .rk-nombre { color: var(--accent); }

/* Filas de la tabla */
.rk-lista { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rk-fila {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px 9px 10px;
    border-radius: 12px;
    background: var(--bg-panel);
    border: 1px solid #1e293b;
}
.rk-fila.es-yo { border-color: rgba(56, 189, 248, 0.6); background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), transparent 60%), var(--bg-panel); }
.rk-pos { width: 28px; flex-shrink: 0; text-align: center; font-weight: 800; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rk-pos.medalla-1, .rk-pos.medalla-2, .rk-pos.medalla-3 { display: inline-grid; place-items: center; height: 28px; border-radius: 50%; color: #0f172a; }
.rk-pos.medalla-1 { background: var(--gold); }
.rk-pos.medalla-2 { background: #cbd5e1; }
.rk-pos.medalla-3 { background: #d08a52; }
.rk-avatar { width: 40px; height: 40px; border: 2px solid #334155; }
.rk-avatar.con-marco { width: 50px; height: 50px; margin: -5px; }
.rk-jugador { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rk-jugador strong { color: #fff; font-size: 0.97rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-jugador em { font-style: normal; font-size: 0.7rem; font-weight: 800; color: var(--accent); border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; margin-left: 4px; vertical-align: middle; }
.rk-sub { color: var(--text-muted); font-size: 0.8rem; }
.rk-valor { flex-shrink: 0; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.rk-valor small { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); }

/* Guerra de departamentos (acordeón) */
.rk-deptos { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rk-depto { border-radius: 12px; background: var(--bg-panel); border: 1px solid #1e293b; overflow: hidden; }
.rk-depto.es-mio { border-color: rgba(56, 189, 248, 0.45); }
.rk-depto.abierto { border-color: rgba(250, 204, 21, 0.45); }
.rk-depto-fila {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 10px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.rk-depto-fila:hover { background: rgba(255, 255, 255, 0.02); }
.rk-escudo {
    width: 38px;
    height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
    background: linear-gradient(180deg, #f8fafc 0 22%, #75aadb 22% 44%, #f8fafc 44% 66%, #75aadb 66%);
    color: #0f172a;
    font-weight: 900;
    font-size: 0.8rem;
    text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}
.rk-corona { color: var(--gold); font-size: 0.95rem; margin-left: 2px; }
.rk-flecha { width: 9px; height: 9px; flex-shrink: 0; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); margin: -4px 2px 0 2px; transition: transform 0.2s; }
.rk-depto.abierto .rk-flecha { transform: rotate(-135deg); margin-top: 4px; }
.rk-depto-detalle { padding: 4px 12px 12px; border-top: 1px solid #1e293b; }
.rk-lista-depto .rk-fila { background: #0f172a; }
.rk-premios { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.rk-premio {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.12), transparent 75%), #0f172a;
    border: 1px solid rgba(250, 204, 21, 0.35);
}
.rk-premio-img { width: 52px; height: 52px; }
.rk-premio-img.con-marco { width: 60px; height: 60px; margin: -4px; }
.rk-premio span { font-size: 0.82rem; color: var(--text-muted); }
.rk-premio strong { display: block; color: var(--gold); font-size: 0.95rem; }

/* Copa del Finde */
.rk-copa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: linear-gradient(120deg, rgba(250, 204, 21, 0.14), transparent 70%), var(--bg-panel);
    border: 1px solid rgba(250, 204, 21, 0.45);
}
.rk-copa-titulo { display: block; color: var(--gold); font-size: 1.05rem; }
.rk-copa-datos { color: #cbd5e1; font-size: 0.85rem; }
.rk-copa-datos b { color: var(--gold); }
.rk-copa-accion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rk-tickets { font-weight: 700; font-size: 0.85rem; color: var(--accent); }
.rk-tickets.agotados { color: #f87171; }

@media (max-width: 480px) {
    .rk-podio-avatar { width: 54px; height: 54px; }
    .rk-podio-avatar.con-marco { width: 66px; height: 66px; margin: -6px 0; }
    .lugar-1 .rk-podio-avatar { width: 70px; height: 70px; }
    .lugar-1 .rk-podio-avatar.con-marco { width: 84px; height: 84px; margin: -7px 0; }
    .rk-fila, .rk-depto-fila { gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    .rk-envivo::before { animation: none; }
}
.rk-depto .rk-jugador strong { white-space: normal; }
