[hidden] { display: none !important; }
html { overflow-anchor: none; }
.marco-tablero { width: min(96rem, calc(100% - 2rem)); margin: 2rem auto; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.025em; }
h1 { font-size: clamp(1.65rem, 4vw, 2.35rem); }
h2 { font-size: 1.3rem; }
p { margin: 0.55rem 0; color: var(--texto-secundario); }
.cabecera-tablero, .grupo-botones, .cabecera-seccion {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}
.cabecera-tablero, .cabecera-seccion { justify-content: space-between; }
.cabecera-tablero { margin-bottom: 1rem; }
.cabecera-seccion h2 { margin-inline-end: auto; }
button, .boton, select, input[type="password"], input[type="text"] {
    min-height: 2.6rem;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--borde);
    border-radius: 8px;
    background: var(--superficie);
    color: var(--tinta);
    font: inherit;
}
button, .boton { background: var(--acento); color: white; cursor: pointer; font-weight: 600; text-decoration: none; }
button:hover, .boton:hover { background: var(--acento-hover); }
button:disabled { opacity: 0.6; cursor: wait; }
.secundario { background: var(--superficie); color: var(--tinta); }
.secundario:hover { background: var(--acento-suave); }
.peligro { background: #a32219; color: white; }
.peligro:hover { background: #861b14; }
.secundario.peligro { background: var(--superficie); color: #a32219; }
.secundario.peligro:hover { background: #fbe5e3; }
.bloque-admin, .tablero-aviso, dialog, .tarjeta-premio {
    padding: 1.2rem;
    border: 1px solid var(--borde);
    border-radius: 12px;
    background: var(--superficie);
    color: var(--tinta);
}
.bloque-admin { margin-block: 1rem; }
.acceso-admin { display: grid; gap: 0.6rem; max-width: 26rem; }
.controles-admin .grupo-botones { margin-top: 0.8rem; }
.controles-admin .reloj-admin {
    width: 100%;
    min-height: clamp(12rem, 48vh, 32rem);
    place-content: center;
    gap: 0.5rem;
    margin: 0.9rem 0 0;
    padding: 1rem 0.25rem;
}
.reloj-admin span { font-size: clamp(1rem, 2.6vw, 1.55rem); }
.reloj-admin strong { font-size: clamp(2.75rem, 12vw, 11rem); font-weight: 750; }
.reloj-admin:not([hidden]) ~ .acciones-ronda { justify-content: center; }
#avance-revelacion { width: min(100%, 20rem); margin-top: 0.8rem; accent-color: var(--acento); }
.cabecera-seccion + .revelacion-destacada { margin-top: 0.8rem; }
dialog { width: min(29rem, calc(100% - 2rem)); }
dialog::backdrop { background: #16213666; }
dialog .grupo-botones { margin-top: 1rem; }
.error { color: #a32219; }
.leyenda-tablero { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.leyenda-icono { display: inline-flex; align-items: center; gap: 0.4rem; }
.globo {
    --color-globo: hsl(var(--tono-globo, 215) 68% 43%);
    position: relative;
    display: inline-block;
    width: 0.9rem;
    height: 1.05rem;
    margin-bottom: 0.35rem;
    border-radius: 50% 50% 48% 48% / 45% 45% 55% 55%;
    background: radial-gradient(circle at 30% 28%, #ffffff70, transparent 28%), var(--color-globo);
}
.globo::before, .globo::after { content: ''; position: absolute; left: 50%; top: 100%; }
.globo::before {
    width: 0.3rem; height: 0.23rem;
    transform: translate(-50%, -1px);
    background: var(--color-globo);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.globo::after {
    width: 0.22rem; height: 0.26rem; margin-top: 0.16rem;
    border-left: 1px solid var(--color-globo);
    border-radius: 45%;
}
.leyenda-icono .globo { font-size: 0.85em; width: 0.72rem; height: 0.86rem; }
.tabla-scroll { position: relative; overflow: auto; isolation: isolate; margin-top: 0.8rem; border: 1px solid var(--borde); border-radius: 10px; }
.contenido-tabla { position: relative; z-index: 0; }
/* La fila animada se pinta sobre la tabla, fuera de sus capas internas. */
.capa-ascenso { position: absolute; left: 0; z-index: 1; pointer-events: none; }
.capa-ascenso .tabla-icpc { table-layout: fixed; }
.tabla-icpc { width: 100%; border-collapse: collapse; background: var(--superficie); font-variant-numeric: tabular-nums; }
.tabla-icpc th, .tabla-icpc td { min-width: 2.65rem; padding: 0.5rem 0.3rem; text-align: center; border-bottom: 1px solid var(--borde); }
.tabla-icpc th:nth-child(4), .tabla-icpc td:nth-child(4) { min-width: 4rem; }
.tabla-icpc thead { background: var(--fondo); }
.tabla-icpc tr:last-child td, .tabla-icpc tbody tr:last-child th { border-bottom: 0; }
.tabla-icpc .nombre-tablero { min-width: 9rem; max-width: 15rem; text-align: left; overflow-wrap: anywhere; }
.tabla-icpc small { display: block; font-size: 0.72rem; }
.tabla-icpc td { white-space: nowrap; }
.tabla-icpc .ac { background: #e6f6ee; color: #185841; }
.tabla-icpc .ac .globo { display: block; margin-inline: auto; }
.estrella { color: #985b08; font-size: 1.2rem; line-height: 1; }
.estrella-primera { display: block; margin-bottom: 0.15rem; }
.estrella-podio {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding-top: 0.14rem;
    background: #985b08;
    color: #fff;
    font-weight: 750;
    line-height: 1;
    clip-path: polygon(50% 0%, 65% 30%, 100% 36%, 75% 61%, 81% 97%, 50% 80%, 19% 97%, 25% 61%, 0% 36%, 35% 30%);
}
.estrella-podio-2 { background: #526278; }
.estrella-podio-3 { background: #895037; }
.indicador-puesto {
    display: inline-grid;
    place-items: center;
    width: 1.65rem;
    height: 1.65rem;
    border: 1.5px solid #22654f;
    border-radius: 50%;
    color: #185841;
    font-weight: 650;
}
.leyenda-icono .indicador-puesto { width: 0.85rem; height: 0.85rem; }
.tabla-icpc .wa { background: #fcebe8; color: #972c26; }
.tabla-icpc .pendiente { background: #fff2d5; color: #785014; }
.tabla-en-revelacion { --ancho-lugar: 3rem; border-collapse: separate; border-spacing: 0; }
.tabla-en-revelacion tbody tr { position: relative; z-index: 0; background: var(--superficie); }
.tabla-en-revelacion .equipo-revelado { z-index: 1; }
.tabla-en-revelacion tbody :is(th, td) { height: 3.45rem; padding-block: 0.25rem; }
.tabla-en-revelacion tr > :nth-child(-n+2) { position: sticky; z-index: 1; background: var(--superficie); }
.tabla-en-revelacion thead tr > :nth-child(-n+2) { background: var(--fondo); }
.tabla-en-revelacion tr > :first-child {
    left: 0; width: var(--ancho-lugar); min-width: var(--ancho-lugar); max-width: var(--ancho-lugar);
}
.tabla-en-revelacion tr > :nth-child(2) {
    left: var(--ancho-lugar); width: 13rem; min-width: 13rem; max-width: 13rem; border-right: 1px solid var(--borde);
}
.tabla-en-revelacion .identidad-tablero { display: flex; align-items: center; gap: 0.35rem; }
.tabla-en-revelacion .nombre-visible, .tabla-en-revelacion .premio-equipo {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tabla-en-revelacion td small { line-height: 1.2; }
.tabla-icpc .equipo-fijo > :nth-child(-n+4) { background: #f2f4f8; }
.tabla-icpc tr:not(.equipo-fijo) + .equipo-fijo > * { border-top: 2px solid var(--borde); }
.tabla-icpc .equipo-revelado > :nth-child(-n+4) { background: #e6f6ee; }
.tabla-icpc .equipo-revelado > :first-child { box-shadow: inset 4px 0 #22654f; }
.tabla-en-revelacion .equipo-en-ascenso-origen { opacity: 0; }
.tabla-icpc .equipo-en-ascenso > * { box-shadow: inset 0 2px #22654f, inset 0 -2px #22654f; }
.tabla-icpc .equipo-en-ascenso > :nth-child(n+5):not(.ac, .wa, .pendiente) { background: #eef8f2; }
.tabla-icpc .equipo-en-ascenso > .revelada { animation: none; }
.tabla-icpc .equipo-en-turno > * { box-shadow: inset 0 2px var(--acento), inset 0 -2px var(--acento); }
.tabla-icpc .equipo-en-turno > :nth-child(-n+4) { background: var(--acento-suave); }
.tabla-icpc .equipo-en-turno > :first-child {
    box-shadow: inset 4px 0 var(--acento), inset 0 2px var(--acento), inset 0 -2px var(--acento);
}
.marca-ascenso { flex: none; color: #185841; font-weight: 800; }
.tabla-icpc .revelada { box-shadow: inset 0 0 0 2px var(--acento); animation: revelar 0.7s ease-out; }
.tabla-icpc .problema-en-turno { background: var(--acento); color: white; }
.tabla-icpc .equipo-en-turno > .celda-en-turno {
    background: var(--acento); color: white; font-size: 1.15rem; font-weight: 750;
}
@keyframes revelar { from { opacity: 0.45; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tabla-icpc .revelada { animation: none; } }
.solo-lectura { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.premio-equipo { color: var(--acento); margin-top: 0.15rem; font-weight: 600; }
.lista-premios { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 0.8rem; margin-block: 1rem; }
.tarjeta-premio { border-color: #e7d4aa; background: #fffdf7; }
.tarjeta-premio p { font-weight: 650; color: var(--tinta); }
.revelacion-destacada {
    --acento-revelacion: var(--acento);
    --fondo-revelacion: var(--acento-suave);
    display: grid;
    gap: 0.22rem;
    overflow-wrap: anywhere;
    padding: 0.7rem 1rem;
    border: 1px solid var(--borde);
    border-radius: 10px;
    background: var(--fondo-revelacion);
}
.revelacion-correcta { --acento-revelacion: #185841; --fondo-revelacion: #def4e7; }
.revelacion-incorrecta { --acento-revelacion: #972c26; --fondo-revelacion: #fbe5e3; }
.revelacion-destacada .etiqueta-revelacion { color: var(--acento-revelacion); font-size: 0.9rem; font-weight: 700; }
.revelacion-destacada .nombre-revelacion { font-size: clamp(1.4rem, 2.9vw, 2.25rem); line-height: 1.1; }
.revelacion-destacada .problema-revelacion { color: var(--tinta); font-size: clamp(1rem, 1.65vw, 1.35rem); font-weight: 600; line-height: 1.25; }
:is(#equipo-revelado, #equipo-revelado-admin) { position: sticky; top: 0.4rem; z-index: 2; }
.celebracion {
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: radial-gradient(ellipse at 50% 42%, #fffdf5, #eaf0fb 74%);
    color: var(--tinta);
    overscroll-behavior: contain;
}
.celebracion-contenido {
    position: relative;
    display: grid;
    place-content: center;
    justify-items: center;
    min-height: 100%;
    padding: 2rem 1rem;
    text-align: center;
}
.celebracion h2 { font-size: clamp(1.35rem, 4vw, 2.5rem); color: #855000; }
.celebracion h2:focus { outline: none; }
.celebracion .celebracion-equipo {
    max-width: 22ch;
    margin: 0.2em 0 0.55em;
    color: inherit;
    font-size: clamp(2.4rem, 8vw, 6.5rem);
    font-weight: 750;
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.celebracion .celebracion-lugar { display: grid; gap: 0.25rem; margin: 0; color: #855000; font-size: clamp(1rem, 3vw, 1.65rem); }
.celebracion-puesto { font-size: clamp(4.25rem, 15vw, 10rem); font-variant-numeric: tabular-nums; line-height: 0.9; }
.celebracion-controles { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }
#error-celebracion { color: #a32219; }
.confeti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confeti span {
    position: absolute;
    top: -1rem;
    left: var(--x);
    width: 0.52rem;
    height: 0.84rem;
    border-radius: 2px;
    background: hsl(var(--tono) 72% 51%);
    animation: caer-confeti 2.7s var(--retraso) ease-in both;
}
@keyframes caer-confeti {
    from { transform: translateY(-1rem) rotate(0); }
    to { transform: translate(var(--deriva), 105vh) rotate(560deg); }
}
@media (prefers-reduced-motion: reduce) { .confeti { display: none; } }
@media (max-width: 540px) {
    .tabla-en-revelacion tr > :nth-child(2) { width: 9rem; min-width: 9rem; max-width: 9rem; }
}
