/* Cuenta regresiva: tablero de segmentos que se dan vuelta (estilo cronometraje deportivo). Archivo propio. */
:root {
  --at-flip-lbl: #1e82e6;
  --at-seg-on: #c8f000;
  --at-seg-on-2: #d4ff1a;
  --at-seg-off: #0c0c0b;
}

.at-flip-slot {
  display: none;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px 12px;
  background: transparent;
  border: 0;
}
.at-flip-slot.on { display: block; }

/* caja negra del tablero */
.at-flip {
  --w: 28px;
  --h: 50px;
  --t: 6px;
  --g: 1px;
  --p: 5px;
  --gap: 18px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--gap);
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 14px 14px 10px;
  background: #020202;
  border: 1px solid #16170f;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px #000, 0 2px 8px rgba(0, 0, 0, .5);
}
.at-flip-unidad {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.at-flip-par {
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.at-flip-lbl {
  color: var(--at-flip-lbl);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1;
}

/* ---- dígito de 7 segmentos: cada segmento es una paleta con dos caras ---- */
.at-flip-dig {
  position: relative;
  display: block;
  width: var(--w);
  height: var(--h);
  flex: 0 0 var(--w);
  perspective: 170px;
  -webkit-perspective: 170px;
}
.at-seg {
  position: absolute;
  display: block;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform .13s cubic-bezier(.45, 0, .55, 1);
  will-change: transform;
}
.at-flip-dig.quieto .at-seg { transition: none; }
.at-seg::before,
.at-seg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* cara apagada: negro mate, apenas se ve el contorno sobre el fondo */
.at-seg::before { background: var(--at-seg-off); }
/* cara encendida: amarillo-verde fluorescente */
.at-seg::after { background: linear-gradient(135deg, var(--at-seg-on-2), var(--at-seg-on)); }

/* segmentos horizontales (a, d, g): giran sobre su eje largo horizontal */
.at-seg.h {
  left: var(--g);
  width: calc(var(--w) - 2 * var(--g));
  height: var(--t);
}
.at-seg.h::before,
.at-seg.h::after {
  clip-path: polygon(calc(var(--t) / 2) 0, calc(100% - var(--t) / 2) 0, 100% 50%, calc(100% - var(--t) / 2) 100%, calc(var(--t) / 2) 100%, 0 50%);
}
.at-seg.h::after { transform: rotateX(180deg); }
.at-seg.h.on { transform: rotateX(180deg); }
.at-seg-a { top: 0; }
.at-seg-g { top: calc(var(--h) / 2 - var(--t) / 2); }
.at-seg-d { top: calc(var(--h) - var(--t)); }

/* segmentos verticales (b, c, e, f): giran sobre su eje largo vertical */
.at-seg.v {
  width: var(--t);
  height: calc(var(--h) / 2 - var(--t) / 2 - 2 * var(--g));
}
.at-seg.v::before,
.at-seg.v::after {
  clip-path: polygon(50% 0, 100% calc(var(--t) / 2), 100% calc(100% - var(--t) / 2), 50% 100%, 0 calc(100% - var(--t) / 2), 0 calc(var(--t) / 2));
}
.at-seg.v::after { transform: rotateY(180deg); }
.at-seg.v.on { transform: rotateY(180deg); }
.at-seg-f, .at-seg-b { top: calc(var(--t) / 2 + var(--g)); }
.at-seg-e, .at-seg-c { top: calc(var(--h) / 2 + var(--g)); }
.at-seg-f, .at-seg-e { left: 0; }
.at-seg-b, .at-seg-c { right: 0; }

/* punto de paleta entre unidades */
.at-seg-punto {
  top: calc(var(--h) - var(--p));
  left: calc(var(--gap) / -2 - var(--p) / 2);
  width: var(--p);
  height: var(--p);
}
.at-seg-punto::before,
.at-seg-punto::after { clip-path: circle(50%); }
.at-seg-punto::after { transform: rotateY(180deg); }
.at-seg-punto.on { transform: rotateY(180deg); }

.at-flip-nota,
.at-flip-estado {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #9aa3b2;
  text-align: center;
}
.at-flip-estado.at-flip-vivo {
  color: #ffc300;
  font-size: 15px;
  letter-spacing: .12em;
  margin-top: 0;
  padding: 8px 0 2px;
}
.at-flip-estado.at-flip-espera {
  color: #ffc300;
  font-size: 13px;
  letter-spacing: .08em;
  margin-top: 0;
  padding: 8px 0 2px;
  text-transform: uppercase;
}
.at-flip-estado.at-flip-fin {
  color: #8b93a2;
  font-size: 13px;
  letter-spacing: .1em;
  margin-top: 0;
  padding: 8px 0 2px;
}
.at-flip-vivo-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 195, 0, .55);
  background: rgba(255, 195, 0, .12);
}
.at-flip-vivo-btn:focus-visible { outline: 2px solid #ffc300; outline-offset: 2px; }

/* Mini en tarjetas de Próximos: centrado arriba, sobre la foto, más chico, sin franja */
article.tarjeta > .at-flip-mini-caja,
.at-flip-mini-caja {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  margin: 0;
  padding: 0;
  width: max-content;
  max-width: calc(100% - 176px);
  box-sizing: border-box;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
  font-weight: inherit;
  color: inherit;
  pointer-events: none;
}
.at-flip-mini-caja .at-flip {
  margin: 0 auto;
  pointer-events: none;
}
.at-flip.at-flip-mini {
  --w: 9px;
  --h: 16px;
  --t: 2px;
  --g: .4px;
  --p: 2px;
  --gap: 5px;
  padding: 4px 6px 3px;
  border-radius: 5px;
  gap: var(--gap);
}
.at-flip-mini .at-flip-par { gap: 1px; }
.at-flip-mini .at-flip-dig { perspective: 50px; -webkit-perspective: 50px; }
.at-flip-mini .at-seg { transition-duration: .13s; }
.at-flip-mini .at-flip-lbl { font-size: 5.5px; letter-spacing: .04em; }
.at-flip-mini .at-flip-unidad { gap: 2px; }
.at-flip-mini .at-flip-nota,
.at-flip-mini-caja .at-flip-nota {
  margin-top: 4px;
  font-size: 10px;
  color: #f5c766;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
}

@media (max-width: 359px) {
  .at-flip:not(.at-flip-mini) { --w: 24px; --h: 44px; --t: 5px; --gap: 14px; }
  article.tarjeta .at-flip.at-flip-mini {
    --w: 8px;
    --h: 14px;
    --t: 1.8px;
    --g: .4px;
    --p: 1.8px;
    --gap: 4px;
    padding: 3px 5px 2px;
  }
  article.tarjeta .at-flip-mini .at-flip-lbl { font-size: 5px; }
}
@media (min-width: 420px) {
  .at-flip:not(.at-flip-mini) { --w: 34px; --h: 60px; --t: 7px; --gap: 22px; --p: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .at-seg { transition: none !important; }
}

html.tema-claro .at-flip-nota,
html.tema-auto.tema-sistema-claro .at-flip-nota { color: #5a6270; }
html.tema-claro .tarjeta-cuenta .at-flip-nota,
html.tema-auto.tema-sistema-claro .tarjeta-cuenta .at-flip-nota {
  color: #b8860b;
  text-shadow: none;
}

#at-flip-demo {
  display: block;
  padding: 18px 12px 16px;
  background: #0b0d12;
  border-bottom: 1px solid #1f2430;
}
