/* =========================================================================
 * gallery.css — Galerías de sección: tarjetas de algoritmos con
 * mini-animaciones SVG. Cada tarjeta lleva un <svg class="ms ms-<escena>">
 * cuyo vocabulario visual (barras, celdas, nodos, aristas) se anima aquí.
 * Complementa shared/css/base.css. El color de acento llega por --hc.
 * ========================================================================= */

/* ============================== disposición ============================ */
.gal { max-width: 1080px; margin: 0 auto; padding: 34px 20px 60px; position: relative; z-index: 1; }

.gal-back {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 20px;
  font-size: 12px; font-weight: 600; color: #6366f1; text-decoration: none;
  border: 1.5px solid #d5d3f7; background: rgba(255, 255, 255, .9);
  border-radius: 999px; padding: 7px 14px;
  transition: all .15s;
}
.gal-back:hover { background: #6366f1; color: #fff; }
.gal-back svg { width: 13px; height: 13px; }

.gal-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.gal-logo {
  width: 50px; height: 50px; border-radius: 15px; flex: none;
  background: linear-gradient(140deg, var(--hc, #6366f1), color-mix(in srgb, var(--hc, #6366f1) 60%, #8b5cf6));
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--hc, #6366f1) 35%, transparent);
}
.gal-logo svg { width: 26px; height: 26px; }
.gal-brand-name { text-align: left; }
.gal-brand-name h1 { margin: 0; font-size: clamp(20px, 3.6vw, 28px); letter-spacing: -.5px; }
.gal-brand-name p {
  margin: 2px 0 0; font-size: 10.5px; font-weight: 700; letter-spacing: 2.5px;
  color: #64748b; text-transform: uppercase;
}
.gal-sub {
  text-align: center; max-width: 74ch; margin: 8px auto 30px;
  color: #475569; font-size: 14px; line-height: 1.65;
}

.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.gal-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(140deg, rgba(233, 250, 239, .9), rgba(255, 255, 255, .92) 45%, rgba(252, 238, 243, .85));
  border-radius: 22px; padding: 16px 16px 15px;
  box-shadow: 0 12px 32px rgba(30, 41, 59, .09);
  text-decoration: none; color: inherit;
  transition: transform .18s ease, box-shadow .18s ease;
}
.gal-card:hover { transform: translateY(-4px); box-shadow: 0 18px 44px rgba(30, 41, 59, .14); }
.gal-card:hover .gal-go { background: var(--hc, #6366f1); color: #fff; }

.gal-anim {
  height: 132px; border-radius: 15px; overflow: hidden;
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(148, 163, 184, .2);
  display: flex; align-items: center; justify-content: center;
}
.gal-card h2 { margin: 4px 2px 0; font-size: 16.5px; letter-spacing: -.2px; }
.gal-card p { margin: 0 2px; font-size: 12px; line-height: 1.5; color: #475569; flex: 1; }
.gal-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; padding: 0 2px; }
.gal-badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--hc, #6366f1);
  background: #fff; border: 1.5px solid color-mix(in srgb, var(--hc, #6366f1) 28%, white);
  border-radius: 999px; padding: 4px 11px;
  box-shadow: 0 2px 8px rgba(30, 41, 59, .05);
}
.gal-go {
  width: 32px; height: 32px; border-radius: 10px;
  background: #fff; color: var(--hc, #6366f1);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(30, 41, 59, .08);
  transition: background .18s, color .18s;
}
.gal-go svg { width: 15px; height: 15px; }

.gal-footer { margin-top: 38px; text-align: center; font-size: 11px; color: #94a3b8; letter-spacing: 1px; }

/* --------------------------- entrada en cascada ------------------------ */
@keyframes gal-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gal-back, .gal-brand, .gal-sub, .gal-grid > *, .gal-footer {
  animation: gal-in 1s cubic-bezier(.16, 1, .3, 1) both;
}
.gal-back  { animation-delay: .05s; }
.gal-brand { animation-delay: .12s; }
.gal-sub   { animation-delay: .26s; }
.gal-grid > *:nth-child(1) { animation-delay: .40s; }
.gal-grid > *:nth-child(2) { animation-delay: .50s; }
.gal-grid > *:nth-child(3) { animation-delay: .60s; }
.gal-grid > *:nth-child(4) { animation-delay: .70s; }
.gal-grid > *:nth-child(5) { animation-delay: .80s; }
.gal-grid > *:nth-child(6) { animation-delay: .90s; }
.gal-grid > *:nth-child(n+7) { animation-delay: 1s; }
.gal-footer { animation-delay: 1.15s; }
@media (prefers-reduced-motion: reduce) {
  .gal-back, .gal-brand, .gal-sub, .gal-grid > *, .gal-footer { opacity: 1; animation: none; }
  .ms * { animation: none !important; }
}

/* ============================= mini-escenas ============================ */
.ms { width: 100%; height: 100%; display: block; }
.ms * { transform-box: fill-box; transform-origin: center; }

/* vocabulario base */
.ms .bar  { fill: color-mix(in srgb, var(--hc) 16%, white); stroke: color-mix(in srgb, var(--hc) 42%, white); stroke-width: 1.5; transform-origin: center bottom; }
.ms .cell { fill: #fff; stroke: #dbe1ea; stroke-width: 1.6; }
.ms .nodo { fill: #fff; stroke: #cfd6e2; stroke-width: 2; }
.ms .edge { stroke: #d3d9e4; stroke-width: 2; fill: none; }
.ms .ring { fill: none; stroke: var(--hc); stroke-width: 2.4; }
.ms .chip { fill: color-mix(in srgb, var(--hc) 20%, white); stroke: var(--hc); stroke-width: 1.6; }

/* estados por keyframes reutilizables */
@keyframes ms-ok       { 0%, 40% { fill: #fff; stroke: #dbe1ea; } 55%, 88% { fill: #22c55e; stroke: #22c55e; } 100% { fill: #fff; stroke: #dbe1ea; } }
@keyframes ms-dim      { to { opacity: .22; } }
@keyframes ms-pop      { 50% { transform: scale(1.25); } }
@keyframes ms-fadeout  { to { opacity: 0; } }

/* ====================== ordenamiento: barras =========================== */
/* cada barra escala a su altura "ordenada" (--s) a mitad de ciclo y vuelve */
@keyframes mso-sort {
  0%, 18% { transform: scaleY(1); }
  55%, 84% { transform: scaleY(var(--s, 1)); }
  98%, 100% { transform: scaleY(1); }
}
.ms-sort .bar { animation: mso-sort 5.6s cubic-bezier(.45, 0, .25, 1) infinite; }

/* escáner que recorre las barras */
.ms .scan { fill: color-mix(in srgb, var(--hc) 12%, transparent); rx: 8; }
@keyframes mso-scan-lr {
  0% { transform: translateX(0); opacity: 0; }
  6% { opacity: 1; }
  46% { transform: translateX(132px); opacity: 1; }
  52% { opacity: 0; }
  56% { transform: translateX(0); opacity: 0; }
  62% { opacity: 1; }
  88% { transform: translateX(132px); opacity: 1; }
  94%, 100% { opacity: 0; }
}
.ms-bubble .scan { animation: mso-scan-lr 5.6s ease-in-out infinite; }

@keyframes mso-scan-lrl {
  0% { transform: translateX(0); opacity: 0; }
  6% { opacity: 1; }
  44% { transform: translateX(132px); }
  84% { transform: translateX(0); opacity: 1; }
  92%, 100% { transform: translateX(0); opacity: 0; }
}
.ms-cocktail .scan { animation: mso-scan-lrl 5.6s ease-in-out infinite; }

@keyframes mso-scan-gnome {
  0% { transform: translateX(0); opacity: 0; }
  5% { opacity: 1; }
  16% { transform: translateX(33px); }
  26% { transform: translateX(66px); }
  38% { transform: translateX(33px); }   /* el gnomo retrocede */
  50% { transform: translateX(66px); }
  62% { transform: translateX(99px); }
  74% { transform: translateX(66px); }
  86% { transform: translateX(132px); opacity: 1; }
  94%, 100% { transform: translateX(132px); opacity: 0; }
}
.ms-gnome .scan { animation: mso-scan-gnome 5.6s ease-in-out infinite; }

/* inserción: una tarjeta se levanta, viaja y cae en su hueco */
.ms-insertion .card { fill: #fff; stroke: #dbe1ea; stroke-width: 1.6; }
.ms-insertion .key { fill: #fef6e7; stroke: #f59e0b; stroke-width: 1.8; }
@keyframes msi-key {
  0%, 8% { transform: translate(0, 0); }
  20% { transform: translate(0, -36px); }
  52% { transform: translate(-84px, -36px); }
  66%, 88% { transform: translate(-84px, 0); }
  96%, 100% { transform: translate(0, 0); opacity: 0; }
}
.ms-insertion .key { animation: msi-key 5.6s cubic-bezier(.5, 0, .3, 1) infinite; }
@keyframes msi-shift {
  0%, 26% { transform: translateX(0); }
  46%, 86% { transform: translateX(28px); }
  96%, 100% { transform: translateX(0); }
}
.ms-insertion .sh { animation: msi-shift 5.6s cubic-bezier(.5, 0, .3, 1) infinite; }

/* mezcla: dos mitades se separan y se entrelazan ordenadas */
@keyframes msm-split-l {
  0%, 10% { transform: translate(0, 0); }
  28%, 42% { transform: translate(-13px, 0); }
  64%, 88% { transform: translate(var(--tx, 0), 0) scaleY(var(--s, 1)); }
  98%, 100% { transform: translate(0, 0); }
}
@keyframes msm-split-r {
  0%, 10% { transform: translate(0, 0); }
  28%, 42% { transform: translate(13px, 0); }
  64%, 88% { transform: translate(var(--tx, 0), 0) scaleY(var(--s, 1)); }
  98%, 100% { transform: translate(0, 0); }
}
.ms-merge .ml { animation: msm-split-l 6s cubic-bezier(.45, 0, .25, 1) infinite; }
.ms-merge .mr { animation: msm-split-r 6s cubic-bezier(.45, 0, .25, 1) infinite; }

/* ========================= búsqueda: celdas ============================ */
/* anillo que se desplaza por pasos (lineal) */
@keyframes msb-step {
  0%, 10% { transform: translateX(0); opacity: 1; }
  18%, 26% { transform: translateX(29px); }
  34%, 42% { transform: translateX(58px); }
  50%, 58% { transform: translateX(87px); }
  66%, 86% { transform: translateX(116px); }
  94%, 100% { transform: translateX(116px); opacity: 0; }
}
.ms-lineal .ring { animation: msb-step 5.6s ease-in-out infinite; }
@keyframes msb-hit-lineal { 0%, 62% { fill: #fff; stroke: #dbe1ea; } 70%, 90% { fill: #22c55e; stroke: #22c55e; } 100% { fill: #fff; stroke: #dbe1ea; } }
.ms-lineal .hit { animation: msb-hit-lineal 5.6s ease infinite; }

/* binaria: mitades que se descartan */
@keyframes msb-dim-1 { 0%, 24% { opacity: 1; } 32%, 92% { opacity: .2; } 100% { opacity: 1; } }
@keyframes msb-dim-2 { 0%, 52% { opacity: 1; } 60%, 92% { opacity: .2; } 100% { opacity: 1; } }
.ms-binaria .d1 { animation: msb-dim-1 5.6s ease infinite; }
.ms-binaria .d2 { animation: msb-dim-2 5.6s ease infinite; }
@keyframes msb-ring-bin {
  0%, 14% { transform: translateX(0); opacity: 0; }
  20%, 44% { transform: translateX(0); opacity: 1; }     /* mid 1 */
  56%, 84% { transform: translateX(58px); opacity: 1; }  /* mid 2 */
  92%, 100% { transform: translateX(58px); opacity: 0; }
}
.ms-binaria .ring { animation: msb-ring-bin 5.6s ease-in-out infinite; }
@keyframes msb-hit-bin { 0%, 62% { fill: #fff; stroke: #dbe1ea; } 70%, 90% { fill: #22c55e; stroke: #22c55e; } 100% { fill: #fff; stroke: #dbe1ea; } }
.ms-binaria .hit { animation: msb-hit-bin 5.6s ease infinite; }

/* saltos: brincos de √n y remate lineal dentro del bloque */
@keyframes msb-jump {
  0%, 8% { transform: translate(0, 0); opacity: 1; }
  15% { transform: translate(29px, -26px); }
  22%, 30% { transform: translate(58px, 0); }
  37% { transform: translate(87px, -26px); }
  44%, 52% { transform: translate(116px, 0); }
  62%, 86% { transform: translate(87px, 0); }   /* retrocede dentro del bloque */
  94%, 100% { transform: translate(87px, 0); opacity: 0; }
}
.ms-saltos .ring { animation: msb-jump 6s cubic-bezier(.5, 0, .4, 1) infinite; }
@keyframes msb-hit-salto { 0%, 68% { fill: #fff; stroke: #dbe1ea; } 76%, 92% { fill: #22c55e; stroke: #22c55e; } 100% { fill: #fff; stroke: #dbe1ea; } }
.ms-saltos .hit { animation: msb-hit-salto 6s ease infinite; }

/* ===================== listas / pilas / colas ========================== */
.ms .lnode { fill: #fff; stroke: #cfd6e2; stroke-width: 1.8; }
.ms .larrow { stroke: #b9c2d0; stroke-width: 2; fill: none; }

/* insertar: se abre un hueco y el nodo nuevo cae en él */
@keyframes msl-open { 0%, 18% { transform: translateX(0); } 34%, 86% { transform: translateX(26px); } 96%, 100% { transform: translateX(0); } }
.ms-lins .op { animation: msl-open 5.6s cubic-bezier(.5, 0, .3, 1) infinite; }
@keyframes msl-drop {
  0%, 30% { transform: translateY(-56px); opacity: 0; }
  40% { opacity: 1; }
  52%, 86% { transform: translateY(0); opacity: 1; }
  96%, 100% { transform: translateY(-56px); opacity: 0; }
}
.ms-lins .nuevo { fill: color-mix(in srgb, #22c55e 15%, white); stroke: #22c55e; animation: msl-drop 5.6s cubic-bezier(.4, 0, .3, 1.25) infinite; }

/* buscar: el anillo sigue los enlaces */
@keyframes msl-walk {
  0%, 10% { transform: translateX(0); opacity: 1; }
  22%, 32% { transform: translateX(48px); }
  44%, 84% { transform: translateX(96px); }
  92%, 100% { transform: translateX(96px); opacity: 0; }
}
.ms-lbus .ring { animation: msl-walk 5.2s ease-in-out infinite; }
@keyframes msl-hit { 0%, 48% { fill: #fff; stroke: #cfd6e2; } 58%, 88% { fill: #22c55e; stroke: #22c55e; } 100% { fill: #fff; stroke: #cfd6e2; } }
.ms-lbus .hit { animation: msl-hit 5.2s ease infinite; }

/* eliminar: un nodo se puentea, cae y la lista se cierra */
@keyframes msl-die {
  0%, 26% { transform: translateY(0); opacity: 1; fill: #fff; stroke: #cfd6e2; }
  36% { fill: color-mix(in srgb, #e5484d 14%, white); stroke: #e5484d; transform: translateY(0); opacity: 1; }
  54%, 88% { transform: translateY(34px); opacity: 0; }
  96%, 100% { transform: translateY(0); opacity: 1; fill: #fff; stroke: #cfd6e2; }
}
.ms-ldel .del { animation: msl-die 5.6s ease-in-out infinite; }
@keyframes msl-close { 0%, 44% { transform: translateX(0); } 62%, 88% { transform: translateX(-48px); } 96%, 100% { transform: translateX(0); } }
.ms-ldel .cl { animation: msl-close 5.6s cubic-bezier(.5, 0, .3, 1) infinite; }

/* invertir: los nodos se cruzan y las flechas giran */
@keyframes msl-swap-a { 0%, 16% { transform: translateX(0); } 48%, 84% { transform: translateX(var(--tx)); } 96%, 100% { transform: translateX(0); } }
.ms-linv .sw { animation: msl-swap-a 5.6s cubic-bezier(.55, 0, .25, 1) infinite; }
@keyframes msl-flip { 0%, 20% { transform: scaleX(1); } 46%, 84% { transform: scaleX(-1); } 96%, 100% { transform: scaleX(1); } }
.ms-linv .larrow { animation: msl-flip 5.6s ease-in-out infinite; }

/* pila: push y pop por arriba */
@keyframes msp-push {
  0% { transform: translateY(-58px); opacity: 0; }
  8% { opacity: 1; }
  20%, 55% { transform: translateY(0); opacity: 1; }
  68% { transform: translateY(-58px); opacity: 1; }   /* pop */
  76%, 100% { transform: translateY(-58px); opacity: 0; }
}
.ms-pila .top { fill: color-mix(in srgb, var(--hc) 18%, white); stroke: var(--hc); animation: msp-push 5s cubic-bezier(.4, 0, .3, 1.2) infinite; }
@keyframes msp-glow { 0%, 14% { stroke: #cfd6e2; } 22%, 60% { stroke: var(--hc); } 72%, 100% { stroke: #cfd6e2; } }
.ms-pila .base2 { animation: msp-glow 5s ease infinite; }

/* cola: entra por el final, sale por el frente y todos avanzan */
@keyframes msq-in {
  0% { transform: translateX(56px); opacity: 0; }
  10% { opacity: 1; }
  24%, 52% { transform: translateX(0); opacity: 1; }
  72%, 90% { transform: translateX(-48px); opacity: 1; }
  98%, 100% { transform: translateX(56px); opacity: 0; }
}
@keyframes msq-out {
  0%, 44% { transform: translateX(0); opacity: 1; }
  62%, 96% { transform: translateX(-56px); opacity: 0; }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes msq-shift {
  0%, 52% { transform: translateX(0); }
  72%, 90% { transform: translateX(-48px); }
  98%, 100% { transform: translateX(0); }
}
.ms-cola .qin { fill: color-mix(in srgb, var(--hc) 18%, white); stroke: var(--hc); animation: msq-in 5s cubic-bezier(.4, 0, .3, 1) infinite; }
.ms-cola .qout { animation: msq-out 5s cubic-bezier(.5, 0, .4, 1) infinite; }
.ms-cola .qs { animation: msq-shift 5s cubic-bezier(.5, 0, .4, 1) infinite; }

/* =========================== árboles =================================== */
/* aparición secuencial (delay por elemento con --d) */
@keyframes mst-visit {
  0%, 12% { fill: #fff; stroke: #cfd6e2; }
  20%, 82% { fill: var(--hc); stroke: var(--hc); }
  94%, 100% { fill: #fff; stroke: #cfd6e2; }
}
.ms-tree .vis { animation: mst-visit 6s ease infinite; animation-delay: var(--d, 0s); }

@keyframes mst-edge-on {
  0%, 12% { stroke: #d3d9e4; }
  20%, 82% { stroke: color-mix(in srgb, var(--hc) 65%, white); }
  94%, 100% { stroke: #d3d9e4; }
}
.ms-tree .eon { animation: mst-edge-on 6s ease infinite; animation-delay: var(--d, 0s); }

/* insertar: el nodo nuevo aparece al final del descenso */
@keyframes mst-new {
  0%, 46% { opacity: 0; transform: scale(.4); }
  56%, 84% { opacity: 1; transform: scale(1); fill: color-mix(in srgb, #22c55e 18%, white); stroke: #22c55e; }
  94%, 100% { opacity: 0; transform: scale(.4); }
}
.ms-tins .nuevo { animation: mst-new 6s cubic-bezier(.3, 0, .3, 1.3) infinite; }

/* buscar: el objetivo termina en verde */
@keyframes mst-found {
  0%, 40% { fill: #fff; stroke: #cfd6e2; }
  52%, 84% { fill: #22c55e; stroke: #22c55e; }
  94%, 100% { fill: #fff; stroke: #cfd6e2; }
}
.ms-tbus .found { animation: mst-found 6s ease infinite; }

/* ============================ grafos ==================================== */
@keyframes msg-node {
  0%, 8% { fill: #fff; stroke: #cfd6e2; }
  16%, 80% { fill: var(--hc); stroke: var(--hc); }
  92%, 100% { fill: #fff; stroke: #cfd6e2; }
}
.ms-graph .gv { animation: msg-node 6s ease infinite; animation-delay: var(--d, 0s); }
@keyframes msg-edge {
  0%, 8% { stroke: #d3d9e4; }
  16%, 80% { stroke: color-mix(in srgb, var(--hc) 60%, white); }
  92%, 100% { stroke: #d3d9e4; }
}
.ms-graph .ge { animation: msg-edge 6s ease infinite; animation-delay: var(--d, 0s); }

/* halo expansivo del BFS */
@keyframes msg-halo {
  0%, 6% { transform: scale(.4); opacity: 0; }
  12% { opacity: .55; }
  46% { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}
.ms-bfs .halo { fill: none; stroke: var(--hc); stroke-width: 2; animation: msg-halo 6s ease-out infinite; }

/* dijkstra: el camino corto se dibuja en verde */
.ms-dij .path { stroke: #22c55e; stroke-width: 3; fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; }
@keyframes msg-draw {
  0%, 30% { stroke-dashoffset: 1; opacity: 1; }
  62%, 84% { stroke-dashoffset: 0; opacity: 1; }
  94%, 100% { stroke-dashoffset: 1; opacity: 0; }
}
.ms-dij .path { animation: msg-draw 6s cubic-bezier(.5, 0, .3, 1) infinite; }
@keyframes msg-reject { 0%, 40% { opacity: 1; } 58%, 84% { opacity: .18; } 94%, 100% { opacity: 1; } }
.ms-dij .rej { animation: msg-reject 6s ease infinite; }
@keyframes msg-endpoints {
  0%, 34% { fill: #fff; stroke: #cfd6e2; }
  60%, 84% { fill: #22c55e; stroke: #22c55e; }
  94%, 100% { fill: #fff; stroke: #cfd6e2; }
}
.ms-dij .pathnode { animation: msg-endpoints 6s ease infinite; animation-delay: var(--d, 0s); }

/* prim: el árbol se dibuja arista a arista */
.ms-prim .te { stroke: var(--hc); stroke-width: 2.6; fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; }
@keyframes msg-grow {
  0% { stroke-dashoffset: 1; }
  14%, 82% { stroke-dashoffset: 0; }
  94%, 100% { stroke-dashoffset: 1; }
}
.ms-prim .te { animation: msg-grow 6s ease infinite; animation-delay: var(--d, 0s); }

/* ============================ mapas hash ================================ */
.ms .bslot { fill: rgba(148, 163, 184, .1); stroke: #dbe1ea; stroke-width: 1.4; stroke-dasharray: 4 3; }
.ms .bidx { fill: #eef1f6; stroke: none; }
.ms .occ { fill: #eef1f6; }

/* encadenamiento: la clave cae a su cubeta; la segunda se encadena */
@keyframes msh-drop1 {
  0% { transform: translate(0, -64px); opacity: 0; }
  8% { opacity: 1; }
  22%, 88% { transform: translate(0, 0); opacity: 1; }
  96%, 100% { transform: translate(0, -64px); opacity: 0; }
}
@keyframes msh-drop2 {
  0%, 36% { transform: translate(-28px, -64px); opacity: 0; }
  44% { opacity: 1; }
  58%, 88% { transform: translate(0, 0); opacity: 1; }
  96%, 100% { transform: translate(0, 0); opacity: 0; }
}
.ms-hcha .k1 { animation: msh-drop1 5.6s cubic-bezier(.4, 0, .3, 1.2) infinite; }
.ms-hcha .k2 { animation: msh-drop2 5.6s cubic-bezier(.4, 0, .3, 1.2) infinite; }
@keyframes msh-linkin { 0%, 56% { opacity: 0; } 66%, 88% { opacity: 1; } 96%, 100% { opacity: 0; } }
.ms-hcha .klink { animation: msh-linkin 5.6s ease infinite; }

/* sondeo lineal: rebota en celdas ocupadas hasta hallar hueco */
@keyframes msh-probe {
  0% { transform: translate(0, -58px); opacity: 0; }
  8% { opacity: 1; }
  18%, 24% { transform: translate(0, 0); }              /* celda ocupada */
  32%, 38% { transform: translate(33px, 0); }           /* siguiente: ocupada */
  46%, 86% { transform: translate(66px, 0); }           /* hueco: se queda */
  94%, 100% { transform: translate(66px, 0); opacity: 0; }
}
.ms-hson .probe { animation: msh-probe 5.6s cubic-bezier(.45, 0, .3, 1) infinite; }
@keyframes msh-occupied1 { 0%, 16% { stroke: #dbe1ea; } 20%, 28% { stroke: #e5484d; } 34%, 100% { stroke: #dbe1ea; } }
@keyframes msh-occupied2 { 0%, 30% { stroke: #dbe1ea; } 34%, 42% { stroke: #e5484d; } 48%, 100% { stroke: #dbe1ea; } }
@keyframes msh-free { 0%, 42% { stroke: #dbe1ea; fill: #fff; } 50%, 86% { stroke: #22c55e; fill: color-mix(in srgb, #22c55e 10%, white); } 94%, 100% { stroke: #dbe1ea; fill: #fff; } }
.ms-hson .oc1 { animation: msh-occupied1 5.6s ease infinite; }
.ms-hson .oc2 { animation: msh-occupied2 5.6s ease infinite; }
.ms-hson .free { animation: msh-free 5.6s ease infinite; }
