/* Madryn Kart: usa los carteles, nombres y botones de Madryn Cubos (cubos.css); acá lo propio */
.kt-top {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 8px) 10px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: start;
}
.kt-place { display: flex; flex-direction: column; align-items: flex-start; color: #fff; text-shadow: 0 2px 0 rgba(10, 40, 70, .55); line-height: 1; }
.kt-place b { font-family: var(--display); font-weight: 400; font-size: 50px; letter-spacing: 0; display: inline-block; transform-origin: 30% 70%; }
.kt-place b.kt-plpop { animation: ktPlace .5s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes ktPlace { 0% { transform: scale(1.45) rotate(-6deg); } 100% { transform: none; } }
.kt-place span { font-size: 13px; font-weight: 600; margin-top: -2px; opacity: .9; }
.kt-place.first b { color: var(--sol); }
.kt-place { transition: transform .25s ease; }
.kt-ui.ready .kt-place { transform: translateY(46px); }          /* en "listo" el botón Volver ocupa esa esquina */
.kt-place span { display: flex; align-items: center; gap: 5px; }
.kt-worth {
  font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-shadow: none;
  background: rgba(255, 255, 255, .92); color: var(--tinta); font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.kt-place.first .kt-worth { background: var(--sol); }
.kt-worth.bump { animation: ktBump .45s ease-out; }
@keyframes ktBump { 40% { transform: scale(1.25); } }
.kt-place .kt-lap {
  font-style: normal; font-size: 12px; font-weight: 700; margin-top: 6px; padding: 3px 9px; border-radius: 999px;
  background: rgba(11, 53, 84, .78); text-shadow: none;
}
.kt-place .kt-lap.last { background: var(--sol); color: var(--tinta); animation: ktBump .45s ease-out; }
.kt-mid { min-width: 96px; }
.kt-map { justify-self: end; width: 92px; height: 92px; background: rgba(11, 53, 84, .55); border-radius: 18px; }
.kt-map path { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 5; stroke-linejoin: round; }
.kt-map .kt-start0 { stroke: #1D2433; stroke-width: 3.2; stroke-linecap: butt; }
.kt-map .kt-start1 { stroke: #FFFFFF; stroke-width: 3.2; stroke-dasharray: 1.6 1.6; stroke-linecap: butt; }
.kt-dot { stroke: #fff; stroke-width: 1.5; }
.kt-dot.me { stroke: #0B3554; stroke-width: 2; }

/* volante: mitad izquierda o derecha de la pantalla; las flechas se prenden al apretar */
.kt-zone { position: absolute; top: 18%; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
.kt-zone.l { left: 0; } .kt-zone.r { right: 0; }
.kt-pad {
  position: absolute; bottom: calc(var(--safe-bottom) + 22px); width: 112px; height: 112px; border-radius: 34px;
  display: grid; place-items: center; background: rgba(255, 255, 255, .28); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .7), 0 5px 0 rgba(10, 76, 112, .22);
  pointer-events: none; transition: transform .08s, background .08s; opacity: .7;
}
.kt-pad.l { left: 14px; } .kt-pad.r { right: 14px; }
.kt-pad svg { width: 58px; height: 58px; fill: none; stroke: #fff; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 0 rgba(10, 60, 90, .45)); }
.kt-pad.on { background: rgba(255, 255, 255, .55); transform: translateY(3px) scale(.96); opacity: 1; }
.cb-ui.playing .kt-pad { opacity: .95; }

/* objeto */
.cb-jump.kt-item { left: 50%; right: auto; margin-left: -58px; width: 116px; height: 116px; bottom: calc(var(--safe-bottom) + 20px); background: #FF4D7A; color: #fff; box-shadow: 0 6px 0 #B0204A; z-index: 2; }
.cb-jump.kt-item i { font-style: normal; font-size: 40px; line-height: 1; display: grid; place-items: center; height: 50px; }
.cb-jump.kt-item i svg { width: 52px; height: 52px; display: block; filter: drop-shadow(0 2px 0 rgba(120, 10, 50, .35)); }
.cb-jump.kt-item span { font-size: 12px; }
.cb-jump.kt-item.on { transform: translateY(4px); box-shadow: 0 2px 0 #B0204A; }
.cb-jump.kt-item.off { background: rgba(255, 255, 255, .3); box-shadow: 0 4px 0 rgba(10, 76, 112, .25); color: #fff; }
.cb-jump.kt-item.got { animation: ktGot .5s ease-out; }
@keyframes ktGot { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.cb-jump.kt-item.off i svg { filter: none; }
/* ruleta del objeto: los dibujos pasan como en una tragamonedas */
.cb-jump.kt-item.roll i { overflow: hidden; }
.cb-jump.kt-item.roll i svg { animation: ktSlot .075s linear infinite; }
@keyframes ktSlot { 0% { transform: translateY(-10px); opacity: .55; } 50% { opacity: 1; } 100% { transform: translateY(10px); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .cb-jump.kt-item.got, .cb-jump.kt-item.roll i svg { animation: none; } }

/* cuenta de largada: el número grande, de rojo a verde */
.kt-count {
  position: absolute; left: 0; right: 0; top: 31%; text-align: center; pointer-events: none; opacity: 0;
  font-family: var(--display); font-size: 140px; line-height: 1; color: #fff;
  text-shadow: 0 7px 0 rgba(10, 40, 70, .38), 0 0 34px rgba(255, 255, 255, .45);
}
.kt-count.c3 { color: #FF4D4D; } .kt-count.c2 { color: #FF9A3C; } .kt-count.c1 { color: #FFD23F; }
.kt-count.c0 { color: #3BE07A; font-size: 112px; }
.kt-count.on { animation: ktCount .95s cubic-bezier(.2, .9, .3, 1.15) both; }
.kt-count.c0.on { animation-duration: 1.1s; }
@keyframes ktCount {
  0% { opacity: 0; transform: scale(2.3); } 16% { opacity: 1; transform: scale(.9); } 28% { transform: scale(1.06); }
  40% { transform: scale(1); } 72% { opacity: 1; } 100% { opacity: 0; transform: scale(.72); }
}

/* consejos: abajo, arriba de los botones */
.kt-tips { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 158px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.kt-ui.outro .kt-tips { display: none; }

/* carteles propios */
.cb-bn.pass, .cb-bn.lostpos, .cb-bn.mini {
  font-size: 19px; font-weight: 700; text-shadow: none; padding: 7px 16px; border-radius: 999px; max-width: 88%;
}
.cb-bn.pass { background: #2F6FE0; box-shadow: 0 4px 0 rgba(10, 40, 110, .35); font-size: 22px; }
.cb-bn.pass.first { background: var(--sol); color: var(--tinta); box-shadow: 0 4px 0 rgba(140, 90, 0, .4); }
.cb-bn.lostpos { background: rgba(11, 53, 84, .78); font-size: 15px; font-weight: 600; }
.cb-bn.mini { background: #3AA8FF; box-shadow: 0 4px 0 rgba(10, 60, 120, .35); }
.cb-bn.mini.super { background: #FF8A1F; box-shadow: 0 4px 0 rgba(130, 50, 0, .35); }
.cb-pop.school { color: #FFE3EC; }
.cb-pop.mini { color: #BFE6FF; } .cb-pop.super { color: #FFD3A8; }

/* aviso sobre el lobo marino */
.cb-tag.kt-lobo-tag { --c: #E2483F; font-size: 13px; font-weight: 800; padding: 3px 10px 4px; animation: ktWarn .5s ease-in-out infinite alternate; }
.cb-tag.kt-lobo-tag::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-top-color: #E2483F; border-bottom: 0;
}
@keyframes ktWarn { to { filter: brightness(1.25); } }

/* llegada: bandera a cuadros que barre la pantalla y el podio con las caras */
.kt-ui.outro .kt-pad, .kt-ui.outro .kt-item, .kt-ui.outro .kt-zone { display: none; }
.kt-flag {
  position: absolute; top: -20%; bottom: -20%; left: 0; width: 70%; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(#1D2433 0 25%, #FFFFFF 0 50%) 0 0 / 34px 34px;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .5); transform: translateX(-120%) skewX(-14deg);
}
.kt-flag.on { animation: ktFlag .85s cubic-bezier(.5, 0, .5, 1) both; }
@keyframes ktFlag { 0% { opacity: 1; transform: translateX(-130%) skewX(-14deg); } 100% { opacity: 1; transform: translateX(190%) skewX(-14deg); } }
.kt-podium {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 34px); width: 318px; margin-left: -159px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.kt-steps { display: flex; align-items: flex-end; gap: 6px; }
.kt-pod { display: flex; flex-direction: column; align-items: center; width: 98px; }
.kt-face {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: #fff; overflow: hidden; font-size: 30px;
  box-shadow: 0 0 0 3.5px var(--c), 0 4px 0 rgba(10, 40, 70, .3);
}
.kt-face .mf-face { width: 100%; height: 100%; object-fit: cover; }
.kt-pod.p1 .kt-face { width: 70px; height: 70px; }
.kt-pod b {
  margin-top: 6px; font-size: 13px; font-weight: 700; color: #fff; background: var(--c); border-radius: 999px; padding: 2px 9px;
  max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kt-pod.me b { background: #fff; color: var(--tinta); box-shadow: 0 0 0 2px var(--c); }
.kt-pod i {
  display: grid; place-items: center; width: 100%; margin-top: 6px; border-radius: 12px 12px 4px 4px; font-style: normal;
  font-family: var(--display); font-size: 26px; color: #fff; background: rgba(11, 53, 84, .86); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18);
}
.kt-pod.p1 i { height: 66px; background: linear-gradient(#FFD45E, #F0A818); color: var(--tinta); }
.kt-pod.p2 i { height: 48px; background: linear-gradient(#E8EEF5, #B9C6D4); color: var(--tinta); }
.kt-pod.p3 i { height: 34px; background: linear-gradient(#F2B58A, #C97A45); }
.kt-pod4 { font-size: 13px; font-weight: 700; color: #fff; background: rgba(11, 53, 84, .82); border-radius: 999px; padding: 3px 12px; }
.kt-podium.on .kt-pod { animation: ktPod .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.kt-podium.on .kt-pod.p2 { animation-delay: .12s; } .kt-podium.on .kt-pod.p3 { animation-delay: .24s; }
.kt-podium.on .kt-pod4 { animation: ktPod .5s .4s both; }
@keyframes ktPod { from { opacity: 0; transform: translateY(40px) scale(.8); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .kt-count.on, .kt-flag.on, .kt-podium.on .kt-pod, .kt-podium.on .kt-pod4, .kt-worth.bump, .cb-tag.kt-lobo-tag, .kt-place b.kt-plpop, .kt-place .kt-lap.last { animation-duration: .01s; }
  .kt-count.on { animation: ktCountR .95s steps(1, end) both; }
  @keyframes ktCountR { 0% { opacity: 1; } 100% { opacity: 0; } }
}

/* turbo en celulares sin desenfoque: rayas y bordes claros por CSS (lo prende el juego) */
.kt-speed {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background:
    radial-gradient(ellipse 62% 44% at 50% 62%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, .34) 100%),
    repeating-conic-gradient(from 0deg at 50% 22%, rgba(255, 255, 255, 0) 0deg 4.2deg, rgba(255, 255, 255, .5) 4.5deg, rgba(255, 255, 255, 0) 4.8deg 9.5deg);
  -webkit-mask: radial-gradient(ellipse 58% 40% at 50% 64%, transparent 60%, #000 100%);
  mask: radial-gradient(ellipse 58% 40% at 50% 64%, transparent 60%, #000 100%);
}
@media (prefers-reduced-motion: reduce) { .kt-speed { display: none; } }
