/* Madryn Snake: marcador con las caras, nombres, joystick de vidrio y botón del rayo (sobre las clases de cubos.css) */
.sn-ui .sn-top {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 8px) 8px 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.sn-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; width: 100%; max-width: 440px; }
.sn-pill {
  display: flex; align-items: center; gap: 3px; min-width: 0; padding: 3px 6px 3px 3px; border-radius: 999px;
  background: rgba(10, 42, 74, .8); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16), 0 3px 0 rgba(4, 30, 50, .35);
}
.sn-pill img { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 2.5px var(--c); }
.sn-pill b { flex: 1; text-align: center; font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.sn-pill.me { background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6), 0 3px 0 rgba(4, 30, 50, .35); }
.sn-pill.out { opacity: .55; }
.sn-pill.out img { filter: grayscale(1); }
.sn-clock { padding: 4px 16px 6px; border-radius: 13px; background: rgba(10, 42, 74, .84); color: #fff; box-shadow: 0 3px 0 rgba(4, 30, 50, .35); }
.sn-clock b { font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.sn-clock.low { background: #E63946; }
.sn-sub { display: flex; gap: 6px; margin-top: -2px; }
.sn-sub span { font-size: 12px; font-weight: 700; color: #fff; background: rgba(10, 42, 74, .62); border-radius: 999px; padding: 2px 9px; }
.sn-sub span:empty { display: none; }

/* nombres arriba de cada cabeza, del color de su víbora */
.sn-ui .cb-tag.sn-tag {
  display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; padding: 2px 9px 2px 2px; border-radius: 999px; box-shadow: 0 2px 0 rgba(0, 0, 0, .22);
}
.sn-tag img { width: 20px; height: 20px; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9); }
.sn-tag img:not([src]) { display: none; }
.sn-ui .cb-tag.sn-tag::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--c); border-bottom: 0;
}
.sn-ui .cb-tag.sn-tag.me { background: #fff; color: var(--tinta); box-shadow: 0 0 0 2.5px var(--c), 0 2px 0 rgba(0, 0, 0, .22); }
.sn-ui .cb-tag.sn-tag.me::after { border-top-color: #fff; }

/* joystick de vidrio con flechitas */
.sn-ui .cb-stick.sn-stick {
  width: 156px; height: 156px; opacity: .75;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .42), rgba(220, 238, 248, .22) 70%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .75), inset 0 -10px 20px rgba(10, 60, 100, .18), 0 6px 16px rgba(4, 30, 50, .25);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.sn-ui .cb-stick.sn-stick::before { display: none; }
.sn-stick i { position: absolute; width: 0; height: 0; border: 9px solid transparent; pointer-events: none; opacity: .9; }
.sn-stick i.u { top: 12px; left: 50%; margin-left: -9px; border-bottom: 11px solid #fff; border-top: 0; }
.sn-stick i.d { bottom: 12px; left: 50%; margin-left: -9px; border-top: 11px solid #fff; border-bottom: 0; }
.sn-stick i.l { left: 12px; top: 50%; margin-top: -9px; border-right: 11px solid #fff; border-left: 0; }
.sn-stick i.r { right: 12px; top: 50%; margin-top: -9px; border-left: 11px solid #fff; border-right: 0; }
.sn-ui .sn-stick .cb-knob {
  width: 70px; height: 70px;
  background: radial-gradient(circle at 40% 32%, #FFFFFF 0 30%, #E3EEF5 70%, #C8DCE8);
  box-shadow: 0 5px 0 rgba(10, 60, 100, .28), 0 8px 18px rgba(4, 30, 50, .25);
}
.sn-ui .cb-ui.playing .sn-stick, .sn-ui.playing .cb-stick.sn-stick { opacity: 1; }

/* botón del rayo: amarillo, grande y redondo */
.cb-jump.sn-turbo {
  width: 118px; height: 118px;
  background: radial-gradient(circle at 42% 30%, #FFE680 0 22%, #FFC93C 55%, #F2A900);
  box-shadow: inset 0 -6px 0 rgba(176, 110, 0, .35), 0 6px 0 #C98A00, 0 10px 20px rgba(4, 30, 50, .25);
}
.cb-jump.sn-turbo svg { width: 58px; height: 58px; fill: #fff; stroke: #B87800; stroke-width: 1.6; filter: drop-shadow(0 2px 0 rgba(150, 90, 0, .45)); }
.cb-jump.sn-turbo.on { transform: translateY(4px) scale(.97); box-shadow: inset 0 -4px 0 rgba(176, 110, 0, .35), 0 2px 0 #C98A00; }
.cb-jump.sn-turbo.off { filter: grayscale(.8); }
.cb-ui.playing .cb-jump.sn-turbo.off { opacity: .55; }

/* elegir víbora: los 15 personajes en una grilla de caritas */
.sn-pick .pz-sheet { height: auto; max-height: 52%; overflow-y: auto; }
.sn-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sn-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 10px; border: 0; border-radius: 16px; cursor: pointer;
  background: #EEF6F8; box-shadow: 0 3px 0 #D3E4E8; text-align: center; overflow: hidden; min-height: 92px;
}
.sn-card img { width: 50px; height: 50px; flex: none; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 2.5px var(--c); }
.sn-card b {
  font-family: var(--display); font-weight: 400; font-size: 12px; line-height: 1.02; color: var(--tinta); max-width: 100%; padding: 0 2px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; min-height: 2.04em;
}
.sn-card i { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: repeating-linear-gradient(90deg, var(--c) 0 10px, var(--c2) 10px 20px); }
.sn-card.on { background: #fff; box-shadow: 0 0 0 3px var(--c), 0 4px 0 rgba(10, 52, 84, .25); }
.sn-card:focus-visible { outline: 3px solid var(--tinta); outline-offset: 2px; }
@media (max-width: 340px) { .sn-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* antes de arrancar, el marcador baja un poco para no taparse con "Volver"; el cartel de práctica va debajo */
.sn-ui:not(.playing) .sn-top { padding-top: calc(var(--safe-top) + 58px); }
#stage:has(.sn-ui:not([hidden])) #hud.own { top: calc(var(--safe-top) + 122px); }

/* lo que va pasando en la plaza: arriba a la izquierda, se va solo */
.sn-feed { position: absolute; left: 8px; top: calc(var(--safe-top) + 178px); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.sn-fi {
  display: flex; align-items: center; gap: 5px; max-width: 64vw; padding: 2px 10px 2px 2px; border-radius: 999px;
  background: rgba(10, 42, 74, .8); color: #fff; font-size: 12.5px; font-weight: 700; line-height: 1.15;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .14); animation: snFi .28s cubic-bezier(.2, 1.4, .4, 1) both;
}
.sn-fi img { width: 22px; height: 22px; flex: none; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 2px var(--c); }
.sn-fi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-fi.bye { transition: opacity .4s, transform .4s; opacity: 0; transform: translateX(-12px); }
@keyframes snFi { from { opacity: 0; transform: translateX(-16px) scale(.9); } }

/* fin de ronda: quién ganó, con su cara */
.sn-endc {
  position: absolute; left: 50%; top: 34%; transform: translateX(-50%); width: max-content; min-width: 210px; max-width: min(86%, 340px); box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 20px 12px; border-radius: 22px;
  background: rgba(10, 42, 74, .9); color: #fff; text-align: center; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16), 0 6px 0 rgba(4, 30, 50, .35), 0 14px 30px rgba(4, 30, 50, .3);
  animation: snCard .5s cubic-bezier(.2, 1.5, .4, 1) both;
}
.sn-endc[hidden] { display: none; }
.sn-endc.won { background: linear-gradient(180deg, #FFD54A, #F5A900); color: #4A2E00; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55), 0 6px 0 #B97C00, 0 14px 30px rgba(4, 30, 50, .3); }
.sn-endc-faces { display: flex; justify-content: center; margin-top: -40px; margin-bottom: 2px; }
.sn-endc-faces:empty { display: none; }
.sn-endc-faces img {
  width: 62px; height: 62px; margin: 0 -5px; border-radius: 50%; background: #fff; object-fit: cover;
  box-shadow: 0 0 0 4px var(--c), 0 4px 0 rgba(4, 30, 50, .3); animation: snFace .6s .12s cubic-bezier(.2, 1.6, .4, 1) both;
}
.sn-endc-faces img:nth-child(2) { animation-delay: .2s; }
.sn-endc-faces img:nth-child(3) { animation-delay: .28s; }
.sn-endc b { font-family: var(--display); font-weight: 400; font-size: 27px; line-height: 1.05; letter-spacing: .01em; }
.sn-endc span { font-size: 13px; font-weight: 700; opacity: .85; }
.sn-endc.won span { opacity: 1; font-size: 15px; }
@keyframes snCard { from { opacity: 0; transform: translateX(-50%) scale(.7); } }
@keyframes snFace { from { transform: scale(0) rotate(-20deg); } }

/* puntitos de cómo se juega y de los resultados */
.dot.sn-bolt { background: var(--sol); border-radius: 0; width: 13px; height: 17px; clip-path: polygon(58% 0, 4% 58%, 44% 58%, 34% 100%, 96% 38%, 54% 38%); }
.dot.sn-head { background: radial-gradient(circle at 34% 40%, #fff 0 15%, transparent 17%), radial-gradient(circle at 68% 40%, #fff 0 15%, transparent 17%), #2EC27E; }
.dot.sn-len { width: 22px; height: 12px; border-radius: 999px; background: repeating-linear-gradient(90deg, #2EC27E 0 5.5px, #FFFFFF 5.5px 11px); box-shadow: inset 0 0 0 1.5px #1E9E62; }

@media (prefers-reduced-motion: reduce) { .sn-fi, .sn-endc, .sn-endc-faces img { animation: none; } }
