/* =====================================================================
   Área 1 Color Games · Tablero público (scoreboard)
   Diseño profesional, moderno y amigable para proyectar en pantalla.
   Archivo independiente (se carga con versión para evitar caché).
   ===================================================================== */
:root {
    --tb-bg:      #0d0e1f;
    --tb-card:    rgba(255, 255, 255, .055);
    --tb-card-bd: rgba(255, 255, 255, .10);
    --tb-primary: #7c6cff;
    --tb-accent:  #15e0c0;
    --tb-gold:    #ffd166;
    --tb-text:    #eef1ff;
    --tb-muted:   rgba(238, 241, 255, .62);
}

body.tablero {
    margin: 0;
    min-height: 100vh;
    color: var(--tb-text);
    font-family: 'Poppins', system-ui, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(1100px 600px at 8% -5%, rgba(124,108,255,.28), transparent 60%),
        radial-gradient(1000px 600px at 100% 0%, rgba(21,224,192,.20), transparent 55%),
        radial-gradient(900px 700px at 50% 120%, rgba(255,99,132,.16), transparent 55%),
        var(--tb-bg);
    background-attachment: fixed;
}
.tablero .text-muted2 { color: var(--tb-muted) !important; }
.tablero a { text-decoration: none; }

/* ---------------------------- Topbar ----------------------------- */
.tb-topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .85rem 1.5rem;
    background: rgba(13, 14, 31, .55);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--tb-card-bd);
    position: sticky; top: 0; z-index: 30;
}
.tb-topbar img { height: 40px; }
.tb-live {
    display: inline-flex; align-items: center; gap: .5rem;
    background: rgba(255,71,87,.16);
    border: 1px solid rgba(255,71,87,.4);
    color: #ff6b7a; font-weight: 700; font-size: .8rem;
    padding: .3rem .8rem; border-radius: 50px; letter-spacing: .5px;
}
.tb-dot {
    width: 9px; height: 9px; border-radius: 50%; background: #ff4757;
    box-shadow: 0 0 0 0 rgba(255,71,87,.7); animation: tb-pulse 1.6s infinite;
}
@keyframes tb-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,71,87,.7); }
    70%  { box-shadow: 0 0 0 10px rgba(255,71,87,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,71,87,0); }
}
.tb-chip {
    background: rgba(255,255,255,.07); border: 1px solid var(--tb-card-bd);
    border-radius: 50px; padding: .35rem .85rem; font-size: .82rem; color: var(--tb-muted);
    display: inline-flex; align-items: center; gap: .4rem;
}
.tb-btn {
    background: rgba(255,255,255,.08); border: 1px solid var(--tb-card-bd);
    color: var(--tb-text); border-radius: 12px; width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .2s; font-size: 1.05rem;
}
.tb-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ---------------------------- Hero ------------------------------- */
.tb-hero { text-align: center; padding: 2.2rem 1rem .5rem; }
.tb-hero h1 {
    font-weight: 800; font-size: clamp(1.8rem, 4vw, 3rem); margin: 0;
    background: linear-gradient(120deg, var(--tb-primary), var(--tb-accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tb-hero p { color: var(--tb-muted); margin: .35rem 0 0; }

/* --------------------------- Card base --------------------------- */
.tb-card {
    background: var(--tb-card);
    border: 1px solid var(--tb-card-bd);
    border-radius: 22px;
    padding: 1.4rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 20px 50px rgba(0,0,0,.28);
}
.tb-card h5 {
    font-weight: 800; display: flex; align-items: center; gap: .55rem; margin: 0 0 1rem;
}
.tb-section-title { font-weight: 800; display:flex; align-items:center; gap:.55rem; }

/* ------------------------- Banner líder -------------------------- */
.tb-leader {
    border-radius: 24px; padding: 1.6rem 2rem; position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 1.5rem;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.tb-leader::after {
    content: ""; position: absolute; right: -40px; top: -40px;
    width: 200px; height: 200px; border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.tb-leader .crown { font-size: 2.4rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,.3)); }
.tb-leader .l-logo {
    width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
    border: 4px solid rgba(255,255,255,.8); background: #fff; flex: none;
}
.tb-leader .l-label { text-transform: uppercase; letter-spacing: 2px; font-size: .8rem; opacity: .9; font-weight: 700; }
.tb-leader .l-name { font-size: clamp(1.5rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.05; }
.tb-leader .l-pts { margin-left: auto; text-align: right; z-index: 1; }
.tb-leader .l-pts .n { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; line-height: 1; }
.tb-leader .l-pts .u { opacity: .9; font-weight: 600; }
.tb-leader.empty {
    background: var(--tb-card); border: 1px dashed var(--tb-card-bd);
    justify-content: center; text-align: center; color: var(--tb-muted);
}

/* ----------------------------- Podio ----------------------------- */
.tb-podium {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 1.2rem; margin-top: 1.5rem; flex-wrap: nowrap;
}
.tb-step {
    width: clamp(140px, 22vw, 230px);
    border-radius: 20px 20px 0 0;
    padding: 1.2rem 1rem 1.1rem;
    text-align: center; color: #fff; position: relative;
    box-shadow: 0 -10px 40px rgba(0,0,0,.25) inset, 0 16px 40px rgba(0,0,0,.3);
    animation: tb-rise .6s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes tb-rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.tb-step.p1 { height: 240px; }
.tb-step.p2 { height: 195px; }
.tb-step.p3 { height: 165px; }
.tb-step .crown {
    position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
    font-size: 2rem; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35));
}
.tb-step .pod-logo {
    width: 66px; height: 66px; border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(255,255,255,.85); background: #fff; margin: 0 auto .5rem;
    display: block;
}
.tb-step .pod-rank {
    position: absolute; top: 10px; left: 12px;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(0,0,0,.25); color: #fff; font-weight: 800;
    display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.tb-step .pod-name { font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.tb-step .pod-pts { font-size: 2rem; font-weight: 800; line-height: 1.1; margin-top: .25rem; }
.tb-step .pod-u { font-size: .75rem; opacity: .85; }

/* -------------------------- Tiles stats -------------------------- */
.tb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.tb-stat {
    background: var(--tb-card); border: 1px solid var(--tb-card-bd);
    border-radius: 18px; padding: 1.1rem; text-align: center;
}
.tb-stat .ico { font-size: 1.5rem; opacity: .9; }
.tb-stat .v { font-size: 1.9rem; font-weight: 800; line-height: 1; margin-top: .2rem; }
.tb-stat .l { color: var(--tb-muted); font-weight: 600; font-size: .85rem; }

/* ------------------------ Tabla general -------------------------- */
.tb-row {
    display: flex; align-items: center; gap: .9rem;
    padding: .75rem .9rem; border-radius: 14px; margin-bottom: .6rem;
    background: rgba(255,255,255,.04); border: 1px solid transparent;
    transition: background .3s, border-color .3s;
}
.tb-row.leader { border-color: rgba(255,209,102,.5); background: rgba(255,209,102,.08); }
.tb-row .rk { width: 30px; font-weight: 800; font-size: 1.2rem; color: var(--tb-muted); text-align: center; }
.tb-row .av {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,.25); background: #fff; flex: none;
}
.tb-row .mid { flex: 1; min-width: 0; }
.tb-row .nm { font-weight: 700; }
.tb-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.10); margin-top: .35rem; overflow: hidden; }
.tb-bar > span { display: block; height: 100%; border-radius: 6px; width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.tb-row .pt { font-size: 1.5rem; font-weight: 800; min-width: 56px; text-align: right; }
@keyframes tb-flash { 0% { background: rgba(124,108,255,.35); } 100% { background: rgba(255,255,255,.04); } }
.tb-row.flash { animation: tb-flash 1.1s ease; }

/* ------------------------- Resultados ---------------------------- */
.tb-result {
    background: rgba(255,255,255,.05); border: 1px solid var(--tb-card-bd);
    border-radius: 16px; padding: 1rem; height: 100%;
}
.tb-result .vs { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tb-result .side { flex: 1; text-align: center; }
.tb-result .side .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.tb-result .side .nm { font-weight: 700; font-size: .9rem; margin-top: .2rem; }
.tb-result .sc { font-size: 1.8rem; font-weight: 800; padding: 0 .4rem; white-space: nowrap; }

/* --------------------- Puntos por categoría ---------------------- */
.tb-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: .9rem; }
.tb-cat {
    background: rgba(255,255,255,.05); border: 1px solid var(--tb-card-bd);
    border-radius: 16px; padding: 1rem; position: relative; overflow: hidden;
}
.tb-cat .c-ico {
    width: 40px; height: 40px; border-radius: 12px; display: flex;
    align-items: center; justify-content: center; font-size: 1.2rem; color: #fff;
}
.tb-cat .c-name { font-weight: 700; margin-top: .55rem; }
.tb-cat .c-lead { display: flex; align-items: center; gap: .4rem; margin-top: .35rem; color: var(--tb-muted); font-size: .85rem; }
.tb-cat .c-lead .dot { width: 12px; height: 12px; border-radius: 50%; }
.tb-cat .c-pts { position: absolute; right: 1rem; top: 1rem; font-weight: 800; font-size: 1.3rem; }

/* ------------------------ Próxima actividad ---------------------- */
.tb-next {
    background: linear-gradient(120deg, rgba(124,108,255,.22), rgba(21,224,192,.16));
    border: 1px solid var(--tb-card-bd); border-radius: 20px; padding: 1.3rem 1.5rem;
    display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
}
.tb-next .n-ico { font-size: 2rem; color: var(--tb-accent); }
.tb-next .n-title { font-weight: 800; font-size: 1.2rem; }
.tb-next .n-meta { color: var(--tb-muted); font-size: .9rem; }
.tb-next .n-cd { margin-left: auto; display: flex; gap: .6rem; }
.tb-next .n-cd .box {
    background: rgba(0,0,0,.25); border-radius: 12px; padding: .5rem .7rem; text-align: center; min-width: 64px;
}
.tb-next .n-cd .box b { font-size: 1.7rem; font-weight: 800; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.tb-next .n-cd .box span { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; opacity: .8; }

/* --------------- Carrusel de patrocinadores (← a →) -------------- */
.tb-sponsors {
    background: rgba(0,0,0,.28);
    border-top: 1px solid var(--tb-card-bd);
    border-bottom: 1px solid var(--tb-card-bd);
    padding: 1.3rem 0; margin: 0 0 1.6rem;
}
.tb-sponsors .lbl {
    text-align: center; color: var(--tb-muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: 3px; font-size: .8rem; margin-bottom: 1.1rem;
}
.tb-marquee {
    overflow: hidden; position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.tb-track {
    display: flex; align-items: center; gap: 1.5rem; width: max-content;
    /* Movimiento de IZQUIERDA → DERECHA */
    animation: tb-marquee 32s linear infinite;
}
.tb-marquee:hover .tb-track { animation-play-state: paused; }
@keyframes tb-marquee {
    from { transform: translateX(-50%); }
    to   { transform: translateX(0); }
}
.tb-track .sp {
    background: #fff; border-radius: 16px; padding: .9rem 1.4rem;
    min-width: 170px; height: 92px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.tb-track .sp img { max-height: 64px; max-width: 150px; object-fit: contain; }
.tb-track .sp .sp-name { font-weight: 800; color: #2b2d42; white-space: nowrap; }

/* ----------------------------- Footer ---------------------------- */
.tb-footer { text-align: center; color: var(--tb-muted); padding: 1.5rem; font-size: .85rem; }

/* ------------------------- Estado vacío -------------------------- */
.tb-empty { color: var(--tb-muted); text-align: center; padding: 1.5rem; }

/* ----------------- Aparición suave de secciones ------------------ */
.tb-fade { animation: tb-fade .5s ease both; }
@keyframes tb-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ----------------------------- Responsive ------------------------ */
@media (max-width: 767.98px) {
    .tb-stats { grid-template-columns: repeat(2, 1fr); }
    .tb-leader { flex-wrap: wrap; text-align: center; justify-content: center; }
    .tb-leader .l-pts { margin: 0 auto; text-align: center; }
    .tb-podium { gap: .5rem; }
    .tb-step { padding: 1rem .5rem; }
    .tb-next .n-cd { margin: .5rem 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    .tb-track, .tb-step { animation: none; }
}
