/* Modo videojuego: tipografía arcade, pantalla de START, selección de piloto, HUD, logros y consejos. */
.mono { font-family: "Press Start 2P", var(--mono, monospace); font-size: 10px; line-height: 1.9; letter-spacing: .02em; }

/* Pantalla de título */
.juego-logo {
  margin: 0 0 14px; font: 900 clamp(44px, 7.5vw, 88px)/.86 var(--sans); font-stretch: 62%; font-style: italic; text-transform: uppercase;
  letter-spacing: -.02em; color: #fff; -webkit-text-stroke: 2px #000; paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--rojo), 8px 8px 0 #2f6bff, 0 20px 50px rgba(0, 0, 0, .7);
  animation: logo-late 2.4s ease-in-out infinite;
}
.juego-logo span { display: block; margin-top: 14px; font: 400 10px/1.6 "Press Start 2P", monospace; font-style: normal; letter-spacing: .08em; color: #9fb4d8; -webkit-text-stroke: 0; text-shadow: none; }
@keyframes logo-late { 50% { transform: scale(1.03) rotate(-1deg); } }
#largar { font-family: "Press Start 2P", monospace; font-size: 12px; letter-spacing: .04em; padding-inline: 26px; animation: parpadeo 1s steps(2, jump-none) infinite; }
.largada.corriendo #largar { animation: none; }
@keyframes parpadeo { 50% { opacity: .35; } }

/* Elegí tu piloto */
.pilotos { padding: clamp(80px, 14vh, 140px) 0; background: radial-gradient(80% 60% at 50% 0%, rgba(47, 107, 255, .2), transparent 70%), var(--negro); position: relative; }
.pilotos h2 { font-style: italic; text-transform: uppercase; }
.pilotos__grilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 2vw, 28px); margin-top: 36px; }
.piloto {
  box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; min-width: 0; user-select: none; padding: 18px 18px 22px; border-radius: 18px; text-align: left;
  background: linear-gradient(180deg, rgba(47, 107, 255, .16), rgba(255, 255, 255, .03)); border: 2px solid rgba(255, 255, 255, .1);
  transition: transform .2s cubic-bezier(.2, 1.4, .4, 1), border-color .2s, box-shadow .2s;
}
.piloto:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, .35); }
.piloto:focus-visible { outline: 3px solid var(--celeste, #6fb6ff); outline-offset: 3px; }
.piloto[aria-pressed="true"] { border-color: var(--rojo); box-shadow: 0 0 0 4px rgba(255, 45, 45, .25), 0 20px 50px rgba(255, 45, 45, .25); }
.piloto.elegido { animation: elegido .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes elegido { 40% { transform: scale(1.06) rotate(-2deg); } }
.piloto__escena { position: relative; display: block; aspect-ratio: 1000 / 623; margin-top: 30%; }
.piloto__auto { position: absolute; inset: 0; width: 100%; filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .6)); }
.piloto__cara { position: absolute; left: 44.2%; bottom: 53%; width: 40%; translate: -50% 0; transform-origin: 50% 95%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); animation: bambolea 1.4s ease-in-out infinite alternate; }
.piloto:nth-child(2) .piloto__cara { animation-delay: -.5s; }
.piloto:nth-child(3) .piloto__cara { animation-delay: -1s; }
.piloto[aria-pressed="true"] .piloto__cara { animation-duration: .25s; }
.piloto__rol { font: 400 9px/1.6 "Press Start 2P", monospace; color: var(--rojo); text-transform: uppercase; }
.piloto__nombre { font: 800 clamp(20px, 2.2vw, 28px)/1.05 var(--sans); font-stretch: 75%; color: #fff; }
.stats { display: grid; gap: 7px; margin-top: 6px; }
.stat { display: grid; grid-template-columns: 10em 1fr 2.4em; align-items: center; gap: 8px; font: 400 8px/1 "Press Start 2P", monospace; color: #c9d4e8; }
.stat__barra { height: 9px; border-radius: 2px; background: rgba(255, 255, 255, .08); position: relative; overflow: hidden; }
.stat__barra::after { content: ""; position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, #2f6bff, #7fd1ff); transition: transform 1.1s cubic-bezier(.2, .9, .3, 1); }
.pilotos.ve .stat__barra::after { transform: scaleX(var(--v)); }
.stat:nth-child(4) .stat__barra::after { background: linear-gradient(90deg, #ff8a3d, var(--rojo)); }
.stat__v { text-align: right; color: #fff; }
.pilotos__nota { min-height: 2em; margin-top: 22px; color: #fff; }
@media (max-width: 760px) {
  .pilotos__grilla { grid-template-columns: 1fr; gap: 14px; }
  .piloto { grid-template-columns: 42% 1fr; grid-template-rows: auto auto 1fr; column-gap: 14px; padding: 14px; }
  .piloto__escena { grid-row: 1 / 4; margin-top: 34%; align-self: end; }
  .stat { grid-template-columns: 10em 1fr 2.2em; font-size: 7px; }
}

/* HUD */
.hud {
  cursor: pointer; position: fixed; top: 12px; right: 12px; z-index: 40; display: grid; gap: 4px; padding: 9px 12px; border-radius: 10px;
  background: rgba(6, 8, 12, .72); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(6px);
  font: 400 9px/1.3 "Press Start 2P", monospace; color: #c9d4e8; text-align: right;
  opacity: 0; transform: translateY(-10px); transition: opacity .4s, transform .4s;
}
body:not(.abierta) .hud { pointer-events: none; }
body.abierta .hud { opacity: 1; transform: none; }
.hud b { font-weight: 400; color: #fff; }
.hud__vel b { font-size: 16px; color: #7fd1ff; }

/* Logros y consejos */
.avisos { position: fixed; left: 50%; bottom: 14px; z-index: 45; width: min(92vw, 420px); translate: -50% 0; pointer-events: none; display: grid; gap: 8px; }
.aviso {
  display: grid; gap: 6px; padding: 12px 16px; border-radius: 12px; background: #0b0f17; border: 2px solid #2f6bff; color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55); animation: aviso-entra .45s cubic-bezier(.2, 1.5, .4, 1) both;
}
.aviso--logro { border-color: var(--rojo); }
.aviso.sale { animation: aviso-sale .4s ease-in forwards; }
.aviso__tipo { font: 400 8px/1.4 "Press Start 2P", monospace; color: #9fb4d8; text-transform: uppercase; }
.aviso--logro .aviso__tipo { color: #ff8a80; }
.aviso__texto { font: 700 15px/1.3 var(--sans); }
@keyframes aviso-entra { from { opacity: 0; transform: translateY(30px) scale(.9); } }
@keyframes aviso-sale { to { opacity: 0; transform: translateY(30px); } }
.aviso { padding: 9px 14px; }
.aviso__texto { font-size: 14px; }

/* La explosión de stickers no agranda la página */
.explosion { position: fixed; inset: 0; overflow: hidden; contain: paint; pointer-events: none; z-index: 60; }

/* Nada de lo que vuela (autitos, explosión) agranda la página hacia los costados */
html { overflow-x: hidden; }

/* Pantalla de START: lugar para la grilla de autitos debajo del botón */
@media (min-width: 761px) {
  .largada { padding-bottom: clamp(200px, 34vh, 340px); }
  .largada .autito { width: clamp(150px, 21vw, 300px); }
  .largada__pie { margin-top: 26px; }
}
@media (max-height: 760px) and (min-width: 761px) { .juego-logo { font-size: 56px; } }

/* Lluvia de emojis (mate, autos, birretes) */
.gota { position: fixed; top: -60px; left: var(--x); z-index: 61; pointer-events: none; animation: cae var(--t) cubic-bezier(.4, 0, .9, .6) var(--d) both; }
@keyframes cae { from { transform: translateY(0) rotate(0); } to { transform: translateY(calc(100vh + 120px)) rotate(var(--r)); } }

/* DRS: la página tiembla y pasan líneas de velocidad */
body.drs main { animation: sacudon .09s linear infinite; }
body.drs::after {
  content: ""; position: fixed; inset: 0; z-index: 59; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 46px, rgba(127, 209, 255, .22) 46px 48px, transparent 48px 140px);
  animation: viento .25s linear infinite; mix-blend-mode: screen;
}
body.drs .hud { border-color: var(--rojo); box-shadow: 0 0 24px rgba(255, 45, 45, .6); }
body.drs .hud::before { content: "DRS"; color: #fff; background: var(--rojo); padding: 2px 6px; border-radius: 4px; justify-self: end; }
@keyframes sacudon { 25% { translate: 2px -1px; } 50% { translate: -2px 1px; } 75% { translate: 1px 2px; } }
@keyframes viento { to { background-position: -280px 0; } }

/* Box box: botón flotante y el minijuego de pit stop */
.box-boton {
  position: fixed; top: 12px; left: 12px; z-index: 40; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font: 400 10px/1 "Press Start 2P", monospace; text-transform: uppercase; color: #fff; background: var(--rojo); border: 2px solid #000;
  box-shadow: 3px 3px 0 #000; opacity: 0; translate: 0 -10px; pointer-events: none; transition: opacity .4s, translate .4s, transform .15s;
}
body.abierta .box-boton { opacity: 1; translate: 0 0; pointer-events: auto; animation: llama 2.6s ease-in-out 3s infinite; }
.box-boton:hover { transform: translateY(-2px); }
.box-boton:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.box-boton:focus-visible { outline: 3px solid var(--celeste, #6fb6ff); outline-offset: 3px; }
@keyframes llama { 0%, 86%, 100% { rotate: 0deg; } 90% { rotate: -6deg; } 94% { rotate: 6deg; } }
body.en-boxes { overflow: hidden; }
.boxes { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 10, .78); backdrop-filter: blur(6px); }
.boxes[hidden] { display: none; }
.boxes__panel {
  width: min(520px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; padding: 24px 20px; border-radius: 18px;
  background: #0b0f17; border: 2px solid var(--rojo); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: aviso-entra .4s cubic-bezier(.2, 1.5, .4, 1);
}
.boxes__titulo { margin: 0; font: 900 clamp(34px, 7vw, 52px)/.9 var(--sans); font-stretch: 62%; font-style: italic; text-transform: uppercase; color: #fff; text-shadow: 3px 3px 0 var(--rojo), 6px 6px 0 #2f6bff; }
.boxes__texto { margin: 0; min-height: 2.6em; font: 700 16px/1.3 var(--sans); color: #fff; }
.boxes__auto img { width: min(300px, 70vw); filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .6)); }
.boxes__gomas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.goma {
  display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; cursor: pointer; touch-action: manipulation;
  font: 400 8px/1.3 "Press Start 2P", monospace; color: #c9d4e8; background: rgba(47, 107, 255, .14); border: 2px solid rgba(255, 255, 255, .15);
  transition: transform .12s, background .2s, border-color .2s;
}
.goma span { font-size: 30px; line-height: 1; transition: rotate .4s; }
.goma:active { transform: scale(.95); }
.goma.lista { background: rgba(60, 200, 120, .18); border-color: #3cc878; color: #fff; }
.goma.lista span { rotate: 360deg; }
.boxes__reloj { margin: 0; font: 400 12px/1 "Press Start 2P", monospace; color: #c9d4e8; }
.boxes__reloj b { font-weight: 400; font-size: 28px; color: #7fd1ff; }
.boxes__mejor { margin: 0; min-height: 1.4em; font: 400 9px/1.4 "Press Start 2P", monospace; color: #ff8a80; }
.boxes__acciones { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.aviso--radio { border-color: #3cc878; }
.aviso--radio .aviso__tipo { color: #7ee2a8; }
@media (prefers-reduced-motion: reduce) { body.drs main, body.drs::after, .box-boton { animation: none; } }

/* Prueba de reflejos: largada de Fórmula 1 y ranking */
.reaccion { padding: clamp(80px, 14vh, 140px) 0; background: radial-gradient(70% 50% at 50% 100%, rgba(255, 45, 45, .16), transparent 70%), var(--negro); }
.reaccion h2 { font-style: italic; text-transform: uppercase; }
.reaccion__bajada { max-width: 46ch; color: #c9d4e8; }
.reaccion__grilla { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 40px); margin-top: 30px; align-items: start; }
.reaccion__pista {
  display: grid; justify-items: center; gap: 18px; padding: clamp(22px, 4vw, 40px) 16px; border-radius: 20px; cursor: pointer; user-select: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; background: #06080c; border: 2px solid rgba(255, 255, 255, .12); transition: border-color .2s, background .2s;
}
.reaccion__pista:focus-visible { outline: 3px solid var(--celeste, #6fb6ff); outline-offset: 3px; }
.reaccion__pista[data-fase="listo"] { border-color: #3cc878; background: #07130c; }
.reaccion__pista[data-fase="falso"] { border-color: var(--rojo); animation: sacudon .09s linear 5; }
.semaforo { display: flex; gap: clamp(6px, 1.4vw, 14px); padding: 12px; border-radius: 14px; background: #111; border: 2px solid #000; box-shadow: inset 0 0 0 2px #222; }
.semaforo__col { display: grid; gap: 8px; padding: 8px; border-radius: 10px; background: #1b1b1b; }
.semaforo__col i { width: clamp(30px, 6vw, 54px); aspect-ratio: 1; border-radius: 50%; background: #2a0b0b; box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .6); transition: background .05s, box-shadow .05s; }
.semaforo__col.on i { background: radial-gradient(circle at 40% 35%, #ff9a9a, #ff2020 45%, #b00000); box-shadow: 0 0 22px rgba(255, 40, 40, .9), 0 0 50px rgba(255, 40, 40, .45); }
.reaccion__tiempo { min-height: 1em; font: 900 clamp(44px, 8vw, 80px)/1 var(--sans); font-stretch: 62%; font-style: italic; color: #fff; text-shadow: 3px 3px 0 var(--rojo), 6px 6px 0 #2f6bff; }
.reaccion__tiempo:empty { display: none; }
.reaccion__estado { font: 400 11px/1.6 "Press Start 2P", monospace; color: #fff; text-align: center; }
.reaccion__pista[data-fase="listo"] .reaccion__estado { color: #7ee2a8; font-size: 22px; }
.reaccion__form { display: grid; gap: 8px; margin-top: 16px; }
.reaccion__form label { font: 400 9px/1.4 "Press Start 2P", monospace; color: #9fb4d8; }
.reaccion__fila { display: flex; gap: 10px; }
.reaccion__fila input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .2); background: #0b0f17; color: #fff; font: 600 16px var(--sans); }
.reaccion__fila input:focus-visible { outline: 2px solid var(--celeste, #6fb6ff); outline-offset: 2px; }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.reaccion__aviso { min-height: 1.8em; margin-top: 10px; color: #fff; }
.reaccion__tabla { padding: 20px; border-radius: 20px; background: linear-gradient(180deg, rgba(47, 107, 255, .14), rgba(255, 255, 255, .03)); border: 2px solid rgba(255, 255, 255, .1); }
.ranking { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; counter-reset: none; }
.ranking li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); }
.ranking li.es-mio { background: rgba(255, 45, 45, .22); outline: 2px solid var(--rojo); }
.ranking__pos { font: 400 11px/1 "Press Start 2P", monospace; color: #9fb4d8; text-align: center; }
.ranking__nombre { font: 700 16px/1.2 var(--sans); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking__ms { font: 400 10px/1 "Press Start 2P", monospace; color: #7fd1ff; }
.ranking__vacio { display: block !important; color: #c9d4e8; font-size: 15px; }
@media (max-width: 760px) { .reaccion__grilla { grid-template-columns: 1fr; } }
