/* Minibólidos. Página de juego de inJuegos. Hereda fondo, marca, botones y baldosas de injuegos.com.es/assets/estilo.css */
body { -webkit-tap-highlight-color: transparent; }

.pagina-juego {
  display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px;
  max-width: 1400px; margin: 0 auto; padding: 0 16px; align-items: start;
}

.marco {
  background: #2a1a6e; border-radius: 24px; padding: 12px; box-shadow: 0 16px 40px rgba(29, 17, 66, .35);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.marco:fullscreen { justify-content: center; border-radius: 0; padding: 16px; }
.marco:fullscreen { --ancho: min(100%, calc((100vh - 150px) * 1.6)); }

:root { --ancho: min(100%, calc((100vh - 280px) * 1.6)); }
.hud { display: flex; gap: 8px; width: 100%; max-width: var(--ancho); }
.pill { flex: 1; min-width: 0; background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 5px 8px; text-align: center; color: #fff; }
.pill small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #b9b0ec; }
.pill b { font: 700 21px/1.15 var(--titulo); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.turbo { flex: 1.3; display: flex; flex-direction: column; justify-content: center; }
.barra { display: block; height: 12px; margin: 5px 4px 2px; background: rgba(0, 0, 0, .35); border-radius: 99px; overflow: hidden; }
.relleno { display: block; height: 100%; width: 0; border-radius: 99px; background: #6c5fc7; transition: width .08s linear; }
.relleno.n1 { background: linear-gradient(90deg, #ff8a2a, #ffd23f); }
.relleno.n2 { background: linear-gradient(90deg, #3fa9f5, #bfe9ff); box-shadow: 0 0 12px #7fd4ff; }
.relleno.turbo { background: linear-gradient(90deg, #ff5d6c, #ffd23f, #fff); animation: brillo .25s linear infinite alternate; }
@keyframes brillo { to { filter: brightness(1.4); } }

.tablero { position: relative; width: 100%; max-width: var(--ancho); aspect-ratio: 16 / 10; min-width: 260px; }
canvas#lienzo { display: block; width: 100%; height: 100%; border-radius: 18px; touch-action: none; background: #1b1430; }

.aviso {
  position: absolute; left: 50%; top: 12%; transform: translate(-50%, -10px) scale(.9); opacity: 0; pointer-events: none;
  background: rgba(20, 10, 50, .85); color: #fff; font: 700 clamp(16px, 2.6vw, 26px)/1.1 var(--titulo);
  padding: 10px 22px; border-radius: 999px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
  border: 2px solid rgba(255, 210, 63, .7); transition: opacity .2s, transform .2s;
}
.aviso.vivo { opacity: 1; transform: translate(-50%, 0) scale(1); }

.capa {
  position: absolute; inset: 0; border-radius: 18px; overflow: hidden auto; padding: 18px;
  background: rgba(24, 12, 66, .86); backdrop-filter: blur(4px); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; text-align: center; gap: 8px;
}
.capa.oculta, .oculta { display: none; }
.capa h2 { margin: 0; font-size: 30px; }
.capa-inicio { padding: 0; background: #2a1a6e; }
.capa-inicio .portada { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.capa-inicio .abajo {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 16px 18px;
  background: linear-gradient(transparent, rgba(20, 8, 60, .92) 55%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.boton.grande { font-size: 24px; padding: 14px 40px; animation: pulso 1.8s ease-in-out infinite; }
@keyframes pulso { 50% { transform: scale(1.05); } }
.cuenta { font-size: 14px; color: #ddd7ff; margin: 0; max-width: 460px; }
.cuenta a { color: #ffd76a; font-weight: 800; }
.cuenta.suave { color: #b9b0ec; font-size: 13px; }

/* menú */
.capa-menu { background: rgba(24, 12, 66, .62); backdrop-filter: blur(2px); gap: 10px; justify-content: safe center; }
.modos { display: flex; gap: 6px; background: rgba(0, 0, 0, .25); padding: 5px; border-radius: 999px; }
.modos button { font: 700 15px var(--titulo); background: transparent; color: #ddd7ff; border: 0; padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.modos .activa { background: #fff; color: var(--violeta); box-shadow: 0 3px 0 #d9d0ff; }
.desc { margin: 0; font-size: 14px; color: #efeaff; max-width: 560px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.circuitos { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.circuito {
  width: 128px; padding: 5px 5px 7px; border-radius: 14px; border: 3px solid transparent; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: transform .12s;
}
.circuito:hover { transform: translateY(-2px); }
.circuito.activa { border-color: #ffd23f; background: rgba(255, 210, 63, .2); }
.mini-pista { width: 100%; height: auto; border-radius: 9px; display: block; }
.circuito b { font: 600 13px/1.1 var(--titulo); }
.circuito .rec { font-size: 10.5px; line-height: 1.15; color: #ddd7ff; min-height: 24px; }
.fila-coches { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.fila-coches small { font: 700 12px var(--titulo); color: #ffd76a; letter-spacing: .3px; }
.coches { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.coche { width: 74px; padding: 2px 2px 4px; border-radius: 12px; border: 3px solid transparent; background: rgba(255, 255, 255, .1); cursor: pointer; color: #fff; }
.coche canvas { width: 60px; height: 36px; display: block; margin: 0 auto; }
.coche small { font: 600 11px var(--titulo); }
.coche.activa { border-color: #ffd23f; background: rgba(255, 210, 63, .2); }

.cargando { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font: 600 18px var(--titulo); background: rgba(24, 12, 66, .7); border-radius: 18px; }
.cargando.oculta { display: none; }
.cargando span { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: #ffd23f; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.capa-fin { background: radial-gradient(circle at 50% 30%, rgba(108, 76, 245, .9), rgba(24, 12, 66, .95) 70%); }
.gran { font: 700 56px/1 var(--titulo); margin: 0; text-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.sello {
  background: var(--sol); color: var(--tinta); font: 700 15px var(--titulo); padding: 5px 14px; border-radius: 999px;
  transform: rotate(-4deg); box-shadow: 0 4px 0 #d99a00; animation: pulso 1s ease-in-out infinite;
}
.fichas { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 620px; }
.fichas span { background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.botones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.confeti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confeti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: caer linear forwards; }
@keyframes caer { to { transform: translateY(110vh) rotate(720deg); } }
.resultados:empty { display: none; }
.resultados { max-width: 360px; width: 100%; }
.resultados li i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }

.pestanas { display: flex; gap: 6px; margin-bottom: 4px; }
.pestanas button { font: 700 14px var(--titulo); background: rgba(255, 255, 255, .1); color: #ddd7ff; border: 0; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.pestanas .activa { background: #fff; color: var(--violeta); }
.podio.oscuro { width: 100%; max-width: 340px; flex: none; }
.podio.oscuro li { background: rgba(255, 255, 255, .1); color: #fff; }
.podio.oscuro .pts { color: #ffd76a; }
.podio li.yo { outline: 2px solid var(--menta); }

.barra-juego { display: flex; align-items: center; gap: 12px; width: 100%; max-width: var(--ancho); background: #fff; border-radius: 16px; padding: 8px 10px; }
.barra-juego .mini { width: 46px; height: 46px; border-radius: 12px; }
.barra-juego .titulo { flex: 1; min-width: 0; }
.barra-juego h1 { margin: 0; font-size: 22px; }
.barra-juego .titulo span { font-size: 13px; color: var(--suave); font-weight: 700; }
.controles { display: flex; gap: 6px; }
.redondo { width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; font-size: 18px; background: #f1edff; color: var(--violeta); box-shadow: 0 3px 0 #d9d0ff; }
.redondo:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9d0ff; }
.redondo.apagado { opacity: .45; }

.lateral { display: flex; flex-direction: column; gap: 16px; }
.lateral .b-ranking { min-height: 300px; }
.b-reglas { padding: 16px; }
.b-reglas h3 { margin: 0 0 8px; font-size: 19px; }
.b-reglas ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; color: #3c3560; }
.b-reglas li { display: flex; gap: 10px; align-items: flex-start; }
.ficha { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; color: #fff; font-size: 13px; background: var(--f); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.record-inicio { font: 700 15px var(--titulo); color: #ffd76a; margin: 0; }
.teclas { font-size: 12.5px; color: var(--suave); margin: 12px 0 0; line-height: 1.45; }

/* mandos táctiles */
.mandos { display: none; width: 100%; max-width: var(--ancho); justify-content: space-between; gap: 10px; user-select: none; -webkit-user-select: none; }
.mandos .grupo { display: flex; gap: 10px; }
.mandos button {
  width: 76px; height: 64px; font-size: 26px; background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 18px;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .25); touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.mandos button small { font: 700 10px var(--titulo); text-transform: uppercase; letter-spacing: .4px; opacity: .8; margin-top: 2px; }
.mandos button.pulsado { background: rgba(255, 255, 255, .3); transform: translateY(2px); }
.mandos .freno { background: rgba(255, 93, 108, .35); }
.mandos .derrape { background: rgba(255, 176, 32, .35); }
.tactil .mandos { display: flex; }

@media (max-width: 1000px) {
  .pagina-juego { grid-template-columns: 1fr; }
  .lateral { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .pagina-juego { padding: 0 8px; }
  .cabeza { padding: 10px 16px; }
  .chip-cuenta { display: none; }
  .marco { padding: 8px; border-radius: 20px; gap: 8px; }
  .hud { gap: 5px; }
  .pill { padding: 4px; border-radius: 12px; }
  .pill small { font-size: 9px; letter-spacing: .2px; }
  .pill b { font-size: 17px; }
  .tablero { aspect-ratio: 1 / 1; }
  :root { --ancho: 100%; }
  .lateral { grid-template-columns: 1fr; }
  .barra-juego h1 { font-size: 19px; }
  .redondo { width: 38px; height: 38px; font-size: 16px; }
  .gran { font-size: 44px; }
  .boton.grande { font-size: 20px; padding: 12px 30px; }
  .circuitos, .coches { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; max-width: 100%; padding-bottom: 4px; scrollbar-width: thin; }
  .circuito { width: 104px; flex: none; }
  .circuito b { font-size: 12px; }
  .circuito .rec { display: none; }
  .coche { width: 64px; flex: none; }
  .coche canvas { width: 52px; height: 31px; }
  .desc { display: none; }
  .capa-menu { gap: 8px; justify-content: flex-start; }
  .capa-menu .botones { margin-top: 2px; }
  .barra-juego .titulo span { display: none; }
  .mandos button { width: 25%; flex: 1; }
  .mandos .grupo { flex: 1; }
  .modos button { font-size: 13px; padding: 7px 9px; }
  .desc { font-size: 12.5px; }
  .capa { padding: 12px; }
}
