/* Carreras de tractores (/tractores): pantalla completa, apaisado en móvil. Todo va en em sobre el tamaño de
   .tr-app, que sale del alto de la ventana: así cabe igual en un móvil tumbado que en un monitor. */
body.tr-inmersivo { overflow: hidden; background: #8fd0f7; }
/* Móvil en vertical: la página de fuera solo enseña el marco girado con el juego apaisado (lo coloca juego.js) */
html.tr-solo-marco, html.tr-solo-marco body { overflow: hidden; overscroll-behavior: none; background: #2a1a0e; height: 100%; }
html.tr-solo-marco body > *:not(.tr-marco):not(.tr-marco-giro) { display: none !important; }
/* «Gira el móvil» encima del juego girado: arriba, pequeño, sin recibir toques (el juego se puede usar igual) */
.tr-marco-giro { position: fixed; z-index: 1001; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 10px; border-radius: 999px; background: rgba(42, 26, 14, .88); color: #fff4dc; font: 800 16px/1.1 'Baloo 2', 'Fredoka', system-ui, sans-serif; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.tr-marco-giro[hidden] { display: none !important; }
.tr-marco-giro svg { width: 22px; height: 22px; color: #ffb531; animation: tr-gira 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tr-marco-giro svg { animation: none; } }
.tr-marco { position: fixed; top: 0; left: 0; border: 0; margin: 0; padding: 0; z-index: 1000; transform-origin: 0 0; background: #8fd0f7; }
/* Enlace de los anuncios: el aviso de cookies no tapa la tarjeta (sin elegir, solo valen las necesarias) */
body.tr-es-directo .consentimiento, body:has(.tr-directo-velo) .consentimiento { display: none !important; }
/* Corriendo, el aviso de cookies no tapa el marcador (sale en la portada y los menús; sin elegir, solo valen las necesarias) */
body:has(.tr-app[data-pantalla="carrera"]) .consentimiento { display: none !important; }
.tr-directo .boton[disabled] { opacity: .7; }
/* (el menú de detrás no se usa mientras está la tarjeta: se oscurece para que solo se lea ella) */
/* (por encima de la portada y sus botones: mientras está la tarjeta no se ve nada más) */
.tr-directo-velo { background: rgba(42, 26, 14, .93); z-index: 40; }
.tr-app:has(.tr-directo-velo) #tr-portada { visibility: hidden; }
.tr-directo { justify-items: center; text-align: center; }
.tr-directo .tr-directo-logo { width: 7.5em; height: 7.5em; object-fit: contain; margin: -.3em 0 -.5em; }
.tr-directo .tr-h { font-size: 1.5em; color: var(--tinta); }
.tr-directo .tr-sub { font-size: 1.05em; }
.tr-directo-gira { display: none; align-items: center; justify-content: center; gap: .4em; font-weight: 800; color: var(--tinta); }
.tr-directo-gira svg { width: 1.5em; height: 1.5em; color: #e08a00; animation: tr-gira 1.6s ease-in-out infinite; }
/* Móvil en vertical (el juego va en el marco girado 90°): la tarjeta se gira al revés para leerse de frente; su ancho
   es el alto del marco (= el ancho de la pantalla). La clase la pone la página (tractorrush.php) */
html.tr-girado .tr-directo-gira { display: flex; }
html.tr-girado .tr-dialogo .tr-directo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); width: 88vh; max-width: none; max-height: none; overflow: visible; animation: none; font-size: 1.25em; padding: 1em 1.1em 1.2em; gap: .8em; }
/* Pista de mandos de la primera carrera: el pomo va y viene solo y un rótulo dice qué hacer */
.tr-palanca.pista i { animation: tr-pista 1.8s ease-in-out infinite; }
.tr-palanca.pista::after { content: attr(data-pista); position: absolute; left: 50%; bottom: calc(100% + .5em); transform: translateX(-50%); white-space: nowrap; padding: .3em .8em; border-radius: 99em;
  background: rgba(42, 26, 14, .88); color: #fff4dc; font-family: var(--titulos); font-weight: 800; font-size: 1.15em; }
@keyframes tr-pista { 0%, 100% { transform: translate(-50%, -50%) translateX(-3.6em); } 50% { transform: translate(-50%, -50%) translateX(3.6em); } }
@media (prefers-reduced-motion: reduce) { .tr-palanca.pista i, .tr-directo-gira svg { animation: none; } }
body.tr-inmersivo .cabecera-juego, body.tr-inmersivo .dock, body.tr-inmersivo .fondo { display: none; }
/* El fondo de feria de la web nunca se ve aquí (lo tapa el juego): oculto desde el principio para no descargarlo */
body.tractores .fondo { display: none; }
/* Tarjeta de los anuncios pintada por la página antes de que llegue el juego: el texto según dedo o ratón */
.tr-pre-raton { display: none; }
@media (pointer: fine) { .tr-pre-raton { display: block; } .tr-pre-tactil { display: none; } }
body.tr-inmersivo .pagina { padding: 0; max-width: none; }
/* --alto es la altura que se ve DE VERDAD (la pone juego.js): hay navegadores de móvil que cuentan en 100vh la barra
   escondida y todo se salía por abajo */
.tr-app {
  position: fixed; left: 0; top: 0; right: 0; bottom: auto; height: var(--alto, 100vh); z-index: 50; overflow: hidden; background: #8fd0f7; color: var(--tinta);
  font-size: clamp(8px, min(calc(var(--alto, 100vh) * .041), 2.1vw), 19px); line-height: 1.25; user-select: none; -webkit-user-select: none; touch-action: none;
}
.tr-lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tr-app [hidden] { display: none !important; }
.tr-app svg { width: 1.3em; height: 1.3em; flex: none; }
.tr-app .boton { font-size: 1.05em; padding: .55em 1.1em; border-radius: .9em; gap: .4em; }
.tr-app .boton.grande { font-size: 1.45em; padding: .5em 1.2em; border-radius: .8em; }

/* ---------- Marcador ---------- */
.tr-hud { position: absolute; inset: 0; pointer-events: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.tr-hud > * { position: absolute; }
.tr-puesto { left: max(1em, env(safe-area-inset-left)); top: .5em; font-family: var(--titulos); font-weight: 800; color: #fff; line-height: 1; display: flex; align-items: baseline;
  -webkit-text-stroke: .32em var(--canto); paint-order: stroke fill; text-shadow: 0 .16em 0 rgba(0,0,0,.35); transform-origin: left top; will-change: transform; }
.tr-puesto.tr-calienta { opacity: .001; pointer-events: none; will-change: auto; }
.tr-puesto b { font-size: 4.6em; }
.tr-puesto i { font-style: normal; font-size: 2.2em; }
.tr-puesto small { font-size: 1.5em; margin-left: .3em; opacity: .92; }
.tr-puesto[data-pos="1"] b, .tr-puesto[data-pos="1"] i { color: #FFD34D; }
.tr-puesto[data-pos="2"] b, .tr-puesto[data-pos="2"] i { color: #E9EEF5; }
.tr-puesto[data-pos="3"] b, .tr-puesto[data-pos="3"] i { color: #F2A65E; }
.tr-puesto.bota { animation: tr-bota .45s var(--muelle); }
@keyframes tr-bota { 0% { transform: scale(1.45); } 100% { transform: scale(1); } }
.tr-mapa { left: calc(max(.8em, env(safe-area-inset-left)) + 2.4em); top: 5.6em; width: 8em; height: 8em; }
.tr-cima { right: max(.8em, env(safe-area-inset-right)); top: .6em; display: flex; flex-direction: column; align-items: flex-end; gap: .45em; }
.tr-sup { order: -1; display: flex; gap: .4em; pointer-events: auto; }
.tr-mini { width: 2.6em; height: 2.6em; display: grid; place-items: center; border-radius: 50%; border: .16em solid var(--canto); background: var(--crema); color: var(--tinta);
  box-shadow: 0 .22em 0 var(--canto); cursor: pointer; padding: 0; transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.tr-mini:active { transform: translateY(.22em); box-shadow: 0 0 0 var(--canto); }
.tr-datos { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .35em; max-width: 19em; }
.tr-datos > span { white-space: nowrap; }
.tr-datos .tr-ic { width: 1.5em; height: 1.5em; margin: -.3em -.1em -.3em -.35em; object-fit: contain; }
.tr-datos .tr-quien { width: 1.5em; height: 1.5em; margin: -.25em -.45em -.25em .1em; border-radius: 50%; border: .1em solid var(--canto); object-fit: cover; background: #fff; }
.tr-vuelta svg { color: var(--peligro); } .tr-propia svg { color: #f59c00; }
#tr-vueltas { opacity: .65; font-size: .85em; }
.tr-datos > span { display: inline-flex; align-items: center; gap: .35em; padding: .22em .75em; border-radius: 99em; background: var(--crema); border: .14em solid var(--canto); box-shadow: 0 .18em 0 var(--canto);
  font-family: var(--titulos); font-weight: 800; font-size: 1.15em; font-variant-numeric: tabular-nums; }
.tr-datos svg { width: 1em; height: 1em; color: var(--cielo-hondo); }
.tr-maiz img { width: 1.5em; height: 1.5em; margin: -.3em -.15em -.3em -.3em; object-fit: contain; }
.tr-maiz.bota { animation: tr-bota .3s var(--muelle); }
.tr-maiz-barra { display: inline-grid; grid-template-columns: repeat(10, .42em); gap: .1em; padding: .12em; border-radius: .3em; background: rgba(74, 47, 23, .18); }
.tr-maiz-barra i { height: .9em; border-radius: .15em; background: rgba(255, 255, 255, .65); transition: background .2s; }
.tr-maiz-barra i.on { background: linear-gradient(180deg, #ffe066, #f2b705); }
.tr-datos > .tr-maiz.llena { background: linear-gradient(180deg, #fff3c4, #ffcf33); }
.tr-maiz.llena .tr-maiz-barra i { background: linear-gradient(180deg, #ff9a3c, #e8590c); animation: tr-late2 .9s ease-in-out infinite; }
.tr-orden { left: max(.7em, env(safe-area-inset-left)); top: 5.7em; display: flex; flex-direction: column; gap: .16em; padding: .22em; border-radius: 99em; background: rgba(74, 47, 23, .5); font-size: .78em; }
/* Retrovisor: el marco es HTML fijo; la imagen la pinta WebGL justo debajo (mismo sitio, ver medirRetro) */
.tr-retro { position: absolute; left: 50%; top: .45em; width: min(21vw, 12.5em); height: 3.3em; transform: translateX(-50%); border: .24em solid var(--canto); border-radius: .55em;
  box-shadow: 0 .25em 0 rgba(74, 47, 23, .5), inset 0 0 0 .12em rgba(255, 244, 220, .55); pointer-events: none; display: none; }
.tr-retro.ver { display: block; }
.tr-orden span { width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--crema); border: .13em solid var(--canto); overflow: hidden; display: block; }
.tr-orden span.yo { border-color: var(--oro); box-shadow: 0 0 0 .16em var(--oro); }
.tr-orden img, .tr-cara { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Velocímetro: abajo a la derecha (en táctil, encima del derrape). Esfera fija + aguja que solo gira */
.tr-velo { right: max(1em, env(safe-area-inset-right)); bottom: max(.9em, env(safe-area-inset-bottom)); width: 7.6em; height: 7.6em; border-radius: 50%; box-shadow: 0 .35em 0 rgba(74, 47, 23, .55); }
.tr-app .tr-velo-esfera { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr-velo-turbo { opacity: 0; transition: opacity .15s; }
.tr-velo.turbo .tr-velo-turbo { opacity: 1; }
.tr-velo-aguja { position: absolute; left: 50%; bottom: 50%; width: .42em; height: 38%; margin-left: -.21em; border-radius: .3em .3em .1em .1em; background: #e8312a; border: .08em solid #4A2F17;
  transform-origin: 50% 100%; transform: rotate(-120deg); will-change: transform; transition: transform .08s linear; }
.tr-velo b { position: absolute; left: 0; right: 0; top: 62%; text-align: center; font-family: var(--titulos); font-weight: 800; font-size: 1.45em; line-height: 1; color: var(--tinta); font-variant-numeric: tabular-nums; }
.tr-velo small { position: absolute; left: 0; right: 0; top: 80%; text-align: center; font-weight: 800; font-size: .62em; color: rgba(61, 36, 19, .75); }
body.tr-tactil .tr-velo { width: 6.6em; height: 6.6em; bottom: calc(max(.8em, env(safe-area-inset-bottom)) + 4.9em); right: max(.9em, env(safe-area-inset-right)); }
body.tr-tactil .tr-velo b { font-size: 1.25em; }
/* Hueco del objeto: abajo a la derecha (en táctil, encima del derrape) */
.tr-objeto { right: calc(max(1em, env(safe-area-inset-right)) + 8.6em); bottom: max(1.2em, env(safe-area-inset-bottom)); width: 6.2em; height: 6.2em; border-radius: 1.5em; border: .24em solid var(--canto); padding: 0;
  background: radial-gradient(circle at 35% 28%, #fffdf6, #ffe9b8 70%); box-shadow: 0 .4em 0 var(--canto), 0 .9em 1.4em rgba(0,0,0,.28); pointer-events: auto; cursor: pointer; display: grid; place-items: center;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.tr-objeto:active { transform: translateY(.3em); box-shadow: 0 .1em 0 var(--canto); }
/* Arrastrado hacia abajo: va a salir hacia atrás (el botón baja y el objeto se da la vuelta) */
.tr-objeto.atras { transform: translateY(.9em); box-shadow: 0 .1em 0 var(--canto); }
.tr-objeto.atras img { transform: rotate(180deg); }
.tr-objeto img { width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 .14em 0 rgba(0,0,0,.25)); }
.tr-objeto.lleno { border-color: #c77a00; background: radial-gradient(circle at 35% 28%, #fff7c8, #ffcf4a 75%); }
.tr-objeto::after { content: ''; position: absolute; inset: -.5em; border-radius: 1.6em; border: .5em solid rgba(255, 211, 77, .45); opacity: 0; pointer-events: none; will-change: opacity, transform; }
.tr-objeto.lleno::after { animation: tr-late 1s ease-in-out infinite; }
.tr-objeto.bota img { animation: tr-bota .4s var(--muelle); }
@keyframes tr-late { 0%, 100% { opacity: 0; transform: scale(.92); } 50% { opacity: 1; transform: scale(1); } }
.tr-usos { position: absolute; right: -.5em; top: -.6em; font-family: var(--titulos); font-weight: 800; font-size: 1.5em; color: #fff; -webkit-text-stroke: .22em var(--canto); paint-order: stroke fill; }
.tr-objeto small { position: absolute; left: -.5em; bottom: -.5em; min-width: 1.9em; height: 1.9em; padding: 0 .35em; display: grid; place-items: center; border-radius: .5em; background: var(--tinta); color: #fff4dc; font-weight: 800; font-size: .95em; border: .12em solid #fff4dc; }
body.tr-tactil .tr-objeto small { display: none; }
/* En táctil: el objeto encima del derrape (más pequeño) y los datos en una fila, para que no se pisen */
body.tr-tactil .tr-objeto { bottom: calc(max(.8em, env(safe-area-inset-bottom)) + 6.2em); width: 4.6em; height: 4.6em; right: calc(max(.9em, env(safe-area-inset-right)) + 7.4em); border-radius: 1.1em; }
body.tr-tactil .tr-datos > span { font-size: 1em; padding: .2em .6em; }
.tr-objeto-nombre { left: 50%; top: 6.6em; transform: translate(-50%, .6em) scale(.95); opacity: 0; text-align: center; padding: .35em 1em; border-radius: 1em; background: var(--crema); border: .16em solid var(--canto);
  box-shadow: 0 .22em 0 var(--canto); transition: opacity .16s var(--ease), transform .16s var(--ease); white-space: nowrap; }
.tr-objeto-nombre.ver { opacity: 1; transform: translate(-50%, 0) scale(1); transition-duration: .32s; }
.tr-objeto-nombre b { display: block; font-family: var(--titulos); font-weight: 800; font-size: 1.2em; }
.tr-objeto-nombre small { font-size: .9em; color: var(--tinta-suave); }

/* ---------- Mandos táctiles ---------- */
.tr-mandos { position: absolute; inset: 0; pointer-events: none; display: none; }
body.tr-tactil .tr-mandos { display: block; }
.tr-m { position: absolute; pointer-events: auto; border-radius: 50%; border: .18em solid var(--canto); background: rgba(255, 244, 220, .88); color: var(--tinta); box-shadow: 0 .3em 0 var(--canto); padding: 0;
  display: grid; place-items: center; touch-action: none; transition: transform .08s var(--ease), box-shadow .08s var(--ease), background .08s; }
.tr-m.pulsado { transform: translateY(.34em); box-shadow: 0 .06em 0 var(--canto); background: #ffd98a; }
.tr-m svg { width: 2em; height: 2em; }
.tr-m small { position: absolute; bottom: .55em; font-family: var(--titulos); font-weight: 800; font-size: .85em; }
/* Barra de dirección (por defecto): fija abajo a la izquierda; la zona que responde es más grande que el dibujo */
.tr-zona-palanca { position: absolute; left: 0; bottom: 0; width: 44%; height: 46%; pointer-events: auto; touch-action: none; }
.tr-palanca { position: absolute; left: max(1.2em, env(safe-area-inset-left)); bottom: max(1em, env(safe-area-inset-bottom)); width: 14em; height: 4.6em;
  border-radius: 99em; border: .2em solid var(--canto); background: rgba(255, 244, 220, .6); box-shadow: 0 .3em 0 rgba(74, 47, 23, .55); display: flex; align-items: center; justify-content: space-between; padding: 0 .7em;
  color: rgba(61, 36, 19, .65); pointer-events: none; }
.tr-palanca::before { content: ''; position: absolute; left: 50%; top: 22%; bottom: 22%; width: .16em; margin-left: -.08em; border-radius: 1em; background: rgba(61, 36, 19, .3); }
.tr-palanca.activa { background: rgba(255, 244, 220, .85); }
.tr-app .tr-palanca svg { width: 1.6em; height: 1.6em; }
.tr-palanca i { position: absolute; left: 50%; top: 50%; width: 3.9em; height: 3.9em; border-radius: 50%; transform: translate(-50%, -50%); border: .2em solid var(--canto);
  background: radial-gradient(circle at 35% 30%, #fff3c4, #ffb531 72%); box-shadow: 0 .25em 0 var(--canto); will-change: transform; transition: transform .16s cubic-bezier(.34, 1.4, .64, 1); }
.tr-palanca.activa i { transition: none; }
/* Flechas (opcional, se elige en la pausa): una pastilla, cada mitad un lado */
.tr-flechas { position: absolute; left: max(1.2em, env(safe-area-inset-left)); bottom: max(.9em, env(safe-area-inset-bottom)); width: 11.5em; height: 5.2em; display: none; gap: .5em; pointer-events: auto; touch-action: none; }
.tr-flechas span { flex: 1; display: grid; place-items: center; border-radius: 1.2em; border: .2em solid var(--canto); background: rgba(255, 244, 220, .85); color: var(--tinta); box-shadow: 0 .3em 0 var(--canto); }
.tr-app .tr-flechas svg { width: 2.4em; height: 2.4em; }
.tr-flechas.pisa-izq .izq, .tr-flechas.pisa-der .der { background: #ffd34d; transform: translateY(.22em); box-shadow: 0 .08em 0 var(--canto); }
.tr-con-flechas .tr-flechas { display: flex; }
.tr-con-flechas .tr-zona-palanca { display: none; }
.tr-m-derrape { width: 4.4em; height: 4.4em; right: max(1.1em, env(safe-area-inset-right)); bottom: max(.8em, env(safe-area-inset-bottom)); background: rgba(255, 211, 77, .94); }
.tr-m-derrape svg { width: 1.5em; height: 1.5em; margin-top: -.5em; }
.tr-m-derrape small { font-size: .6em; bottom: .4em; }
.tr-m-freno { width: 3.5em; height: 3.5em; right: calc(max(1.1em, env(safe-area-inset-right)) + 5.2em); bottom: max(1em, env(safe-area-inset-bottom)); }
/* El freno, en rojo (como las luces de freno) y con su nombre, para que no haya duda de qué es */
.tr-m-freno { background: rgba(226, 59, 46, .93); color: #fff; }
/* Claxon: pequeño, a la izquierda del freno */
.tr-m-claxon { width: 3em; height: 3em; right: calc(max(1.1em, env(safe-area-inset-right)) + 9.3em); bottom: max(1.2em, env(safe-area-inset-bottom)); }
.tr-m-claxon svg { width: 1.4em; height: 1.4em; }
.tr-m-freno svg { width: 1.45em; height: 1.45em; margin: -.5em 0 0; }
.tr-m-freno small { font-size: .56em; bottom: .42em; }

/* ---------- Avisos ---------- */
.tr-aviso { position: absolute; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; opacity: 0; font-family: var(--titulos); font-weight: 800; color: #fff; }
.tr-aviso.ver { opacity: 1; animation: tr-entra .42s var(--muelle); }
.tr-aviso.fuera { opacity: 0; transform: scale(.96); transition: opacity .18s var(--ease), transform .18s var(--ease); }
@keyframes tr-entra { 0% { opacity: 0; transform: translateY(1.2em) scale(.9); } 100% { opacity: 1; transform: none; } }
.tr-aviso b { display: block; -webkit-text-stroke: .3em var(--canto); paint-order: stroke fill; text-shadow: 0 .14em 0 rgba(0,0,0,.4); line-height: 1; }
.tr-aviso .tr-num { font-size: 9em; color: #FFD34D; }
.tr-aviso .tr-num.ya { color: #7BE04A; font-size: 7.5em; }
.tr-aviso .tr-rot { font-size: 3.6em; }
.tr-aviso .tr-rot.rojo { color: #FF8266; }
.tr-aviso small { display: inline-block; margin-top: .5em; padding: .2em .9em; border-radius: 99em; background: var(--tinta); color: #fff4dc; font-size: 1.25em; }
.tr-toasts { position: absolute; left: 50%; top: 3.4em; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .35em; pointer-events: none; }
.tr-toasts.con-fijo::before { content: attr(data-fijo); order: -1; padding: .3em 1.1em; border-radius: 99em; background: var(--peligro); color: #fff; border: .16em solid var(--canto); box-shadow: 0 .2em 0 var(--canto);
  font-family: var(--titulos); font-weight: 800; font-size: 1.5em; animation: tr-late2 .7s ease-in-out infinite; }
@keyframes tr-late2 { 50% { transform: scale(1.06); } }
.tr-toast { display: flex; align-items: center; gap: .45em; padding: .25em .9em .25em .35em; border-radius: 99em; background: var(--crema); border: .15em solid var(--canto); box-shadow: 0 .2em 0 var(--canto);
  font-family: var(--titulos); font-weight: 800; font-size: 1em; white-space: nowrap; animation: tr-entra .32s var(--muelle); padding-left: .9em; }
.tr-toast:has(.tr-cara) { padding-left: .3em; }
.tr-toast .tr-cara { width: 1.9em; height: 1.9em; border-radius: 50%; border: .1em solid var(--canto); background: #fff; }
.tr-toast.rojo { background: #ffd9cf; } .tr-toast.verde { background: #d9f7c4; } .tr-toast.oro { background: #ffe9a6; }
.tr-toast.fuera { opacity: 0; transform: translateY(-.5em) scale(.96); transition: opacity .2s var(--ease), transform .2s var(--ease); }
/* Rayas de velocidad con el turbo y destellos de golpe y tormenta */
/* Líneas de velocidad: lienzo pintado una vez (juego.js · dibujarLineas); solo se animan opacidad y giro */
.tr-lineas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .001; transition: opacity .25s var(--ease); will-change: opacity, transform; transform: translateZ(0); }
.tr-lineas.rebufo { opacity: .32; }
.tr-lineas.ver { opacity: 1; animation: tr-rayas .16s steps(2) infinite; }
@keyframes tr-rayas { 50% { transform: rotate(2.7deg) scale(1.04); } }
/* Tomatazo en el parabrisas (29-11-2026): manchas rojas que tapan media pantalla mientras dura */
.tr-mancha { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 3; }
.tr-mancha i { position: absolute; width: 11em; height: 9em; border-radius: 48% 52% 44% 56% / 55% 45% 58% 42%;
  background: radial-gradient(circle at 38% 35%, #ff7a5c 0 12%, #e2321f 30%, #b81f12 70%, transparent 72%);
  box-shadow: 2.2em 1.4em 0 -2.6em #d22a18, -2em 2.6em 0 -3em #c92514, 0.4em -2em 0 -3.2em #e2321f; filter: drop-shadow(0 0.2em 0.3em rgba(80, 10, 0, .35)); }
.tr-mancha i:nth-child(2) { width: 14em; height: 10em; }
.tr-mancha i:nth-child(3) { width: 8em; height: 8em; }
.tr-mancha i:nth-child(4) { width: 12em; height: 11em; }
.tr-mancha i:nth-child(5) { width: 9em; height: 7em; }
.tr-destello { position: absolute; inset: 0; pointer-events: none; opacity: .001; will-change: opacity; }
.tr-destello.golpe { background: radial-gradient(ellipse at center, transparent 40%, rgba(242, 92, 63, .7)); }
.tr-destello.rayo { background: #fff; }
.tr-destello.golpe.ver { animation: tr-destello .5s ease-out; }
.tr-destello.rayo.ver { animation: tr-destello .45s ease-out; }
@keyframes tr-destello { 0% { opacity: .9; } 100% { opacity: .001; } }
.tr-confeti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tr-confeti i { position: absolute; top: -4%; width: .7em; height: 1.1em; border-radius: .15em; animation: tr-cae linear both; }
@keyframes tr-cae { to { transform: translateY(110vh) rotate(var(--giro)); } }

/* ---------- Capas de menú ---------- */
.tr-capa { position: absolute; inset: 0; display: grid; place-items: center; padding: max(.8em, env(safe-area-inset-top)) max(1em, env(safe-area-inset-right)) max(.8em, env(safe-area-inset-bottom)) max(1em, env(safe-area-inset-left)); touch-action: auto; }
.tr-capa.tr-pausa, .tr-capa.tr-dialogo { background: rgba(42, 26, 14, .6); animation: aparece .2s var(--ease); z-index: 5; }
.tr-capa.fuera { opacity: 0; transition: opacity .16s var(--ease); }
.tr-salir { position: absolute; left: max(.9em, env(safe-area-inset-left)); top: max(.7em, env(safe-area-inset-top)); z-index: 2; text-decoration: none; }
.tr-sonido-portada { position: absolute; right: max(.9em, env(safe-area-inset-right)); top: max(.7em, env(safe-area-inset-top)); display: flex; gap: .5em; z-index: 2; }
.tr-mini.apagado { opacity: .7; background: #e9dfca; }
.tr-pausa-sonido { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .45em; margin-top: .1em; }
.tr-pausa-sonido .tr-interruptor { font-size: .88em; padding: .4em .3em; white-space: nowrap; min-width: 0; }
.tr-interruptor { display: flex; align-items: center; justify-content: center; gap: .35em; padding: .45em .5em; border-radius: .8em; border: .15em solid var(--canto); background: var(--tarjeta); box-shadow: 0 .2em 0 var(--canto);
  font-family: var(--titulos); font-weight: 800; font-size: .95em; color: var(--tinta); cursor: pointer; }
.tr-interruptor b { min-width: 1.6em; padding: .05em .35em; border-radius: .5em; background: var(--hierba); color: #fff; }
.tr-interruptor b:empty { display: none; }
.tr-interruptor b:where(:not(:empty)) { }
.tr-interruptor svg { width: 1.1em; height: 1.1em; }
.tr-tarjeta { position: relative; background: var(--crema); border: .2em solid var(--canto); border-radius: 1.5em; box-shadow: 0 .4em 0 var(--canto), 0 1.2em 2em rgba(0,0,0,.28); padding: .8em 1em 1em; }
.tr-h { margin: 0; font-family: var(--titulos); font-weight: 800; font-size: 1.05em; text-transform: uppercase; letter-spacing: .06em; color: var(--tinta-suave); text-align: center; }

/* Portada */
.tr-portada { background: linear-gradient(180deg, rgba(20, 60, 100, .15), rgba(42, 26, 14, .0) 35%, rgba(42, 26, 14, .5)); }
.tr-titular { text-align: center; animation: sube .5s var(--muelle); display: flex; flex-direction: column; align-items: center; }
.tr-emblema { height: 10.5em; width: auto; max-width: none; margin-bottom: -2.2em; filter: drop-shadow(0 .5em .6em rgba(0,0,0,.35)); animation: tr-emblema 3.2s ease-in-out infinite; }
@keyframes tr-emblema { 50% { transform: translateY(-.35em) rotate(-1.5deg); } }
.tr-sobre { display: inline-block; padding: .2em 1em; border-radius: 99em; background: var(--tinta); color: #FFD34D; font-family: var(--titulos); font-weight: 800; font-size: 1.25em; letter-spacing: .08em; text-transform: uppercase; }
.tr-logo { position: relative; margin: 0; font-family: var(--titulos); font-weight: 800; font-size: 5.4em; white-space: nowrap; line-height: .95; color: #FFD34D; letter-spacing: .01em;
  -webkit-text-stroke: .16em var(--canto); paint-order: stroke fill; text-shadow: 0 .07em 0 var(--canto), 0 .13em 0 #c77a00, 0 .22em .3em rgba(0,0,0,.4); transform: rotate(-2deg); }
.tr-lema { margin: .45em 0 .7em; font-family: var(--titulos); font-weight: 800; font-size: 1.5em; color: #fff; text-shadow: 0 .12em 0 rgba(0,0,0,.45), 0 0 1em rgba(0,0,0,.35); }
.tr-portada-botones { display: flex; gap: .7em; justify-content: center; align-items: center; flex-wrap: wrap; }

/* Elección de tractor, circuito y rivales */
.tr-panel { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1em; width: min(100%, 68em); height: min(100%, 27em); align-items: stretch; }
.tr-capa.tr-ajustes { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
/* Móviles muy bajos (barra del navegador visible): todo un punto más pequeño y la tarjeta crece lo que necesite */
@media (max-height: 380px) { .tr-panel { font-size: .82em; height: auto; min-height: min(100%, 27em); } }
@media (max-height: 320px) { .tr-panel { font-size: .74em; } }
.tr-panel { font-size: .9em; }
.tr-panel > * { animation: sube .45s var(--muelle) both; }
/* Escaparate: el tractor elegido se ve en 3D detrás, girando; aquí solo van la placa, las flechas y la ficha */
.tr-expo { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.tr-placa { align-self: flex-start; margin-left: 3.4em; padding: .25em 1em; border-radius: 99em; background: var(--tinta); color: #FFD34D; letter-spacing: .08em; box-shadow: 0 .2em 0 rgba(0,0,0,.25); }
.tr-pilotos { align-self: stretch; display: flex; justify-content: flex-end; gap: .28em; padding-left: 3.6em; }
.tr-pilotos button { flex: 0 1 2.9em; aspect-ratio: 1; min-width: 0; padding: 0; border-radius: 50%; border: .15em solid var(--canto); background: var(--crema); overflow: hidden; cursor: pointer; box-shadow: 0 .18em 0 var(--canto);
  transition: transform .12s var(--ease); }
.tr-pilotos button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tr-pilotos button.on { border-color: var(--oro); box-shadow: 0 0 0 .18em var(--oro), 0 .18em 0 .18em var(--canto); transform: scale(1.12); }
.tr-pilotos button:active { transform: scale(.94); }
.tr-expo-hueco { position: relative; flex: 1; width: 100%; min-height: 6em; }
.tr-expo-ficha { width: 100%; padding: .5em .9em .7em; background: rgba(255, 244, 220, .94); }
.tr-expo-ficha .tr-nombre { display: block; margin: 0; font-size: 1.6em; }
.tr-expo-ficha .tr-sub { min-height: 0; margin-bottom: .3em; }
.tr-expo-ficha .tr-barras { gap: .2em; }
.tr-expo-ficha .tr-barras li { grid-template-columns: 6.4em 1fr; font-size: .84em; }
.tr-expo-ficha .tr-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-expo-ficha.cambia { animation: tr-ficha .3s var(--muelle); }
@keyframes tr-ficha { 0% { transform: translateY(.5em) scale(.97); opacity: .5; } 100% { transform: none; opacity: 1; } }
.tr-expo .tr-flecha { width: 2.9em; height: 2.9em; margin-top: -1.45em; left: 0; }
.tr-expo .tr-flecha.der { left: auto; right: 0; }
.tr-panel .tr-tarjeta { display: flex; flex-direction: column; gap: .3em; min-width: 0; padding: .7em .9em .9em; }
.tr-panel .tr-tarjeta:nth-child(2) { animation: sube .4s var(--muelle) .05s both; }
.tr-panel .tr-tarjeta:nth-child(3) { animation: sube .4s var(--muelle) .1s both; }
.tr-foto { position: relative; height: 7em; border-radius: 1em; background: radial-gradient(circle at 50% 30%, #dff4ff, #a9dbf7 65%, #8cc86a 66%, #6fb84a); border: .14em solid var(--canto); display: grid; place-items: center; overflow: hidden; }
.tr-foto img, .tr-foto canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.tr-foto img { transform: scale(1.3); animation: tr-foto .35s var(--muelle); }
@keyframes tr-foto { 0% { transform: scale(1.05); opacity: .4; } 100% { transform: scale(1.3); opacity: 1; } }
.tr-t-circuito .tr-foto { background: radial-gradient(circle at 50% 40%, #a5dd7b, #6fb84a); }
.tr-flecha { position: absolute; z-index: 1; left: .35em; top: 50%; width: 2.3em; height: 2.3em; margin-top: -1.15em; border-radius: 50%; border: .15em solid var(--canto); background: var(--crema); box-shadow: 0 .2em 0 var(--canto);
  display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--tinta); transition: transform .1s var(--ease), box-shadow .1s var(--ease); }
.tr-flecha.der { left: auto; right: .35em; }
.tr-flecha:active { transform: translateY(.2em); box-shadow: 0 0 0 var(--canto); }
.tr-nombre { font-family: var(--titulos); font-weight: 800; font-size: 1.4em; line-height: 1.1; text-align: center; margin-top: .15em; }
.tr-sub { margin: 0; text-align: center; font-size: .92em; color: var(--tinta-suave); line-height: 1.2; }
.tr-barras { list-style: none; margin: .2em 0 0; padding: 0; display: grid; gap: .28em; }
.tr-barras li { display: grid; grid-template-columns: 6.2em 1fr; align-items: center; font-weight: 800; font-size: .92em; }
.tr-barra { display: grid; grid-template-columns: repeat(5, 1fr); gap: .2em; }
.tr-barra i { height: .72em; border-radius: .3em; background: rgba(107, 68, 35, .16); }
.tr-barra i.on { background: linear-gradient(180deg, #ffcf4a, #f59c00); box-shadow: inset 0 -.12em 0 rgba(0,0,0,.18); }
.tr-largo { display: inline-flex; align-items: center; gap: .3em; margin-left: .4em; padding: .1em .55em; border-radius: 1em; background: rgba(107, 68, 35, .1); white-space: nowrap; }
/* En la sala, la longitud va dentro de la foto del circuito (no ocupa una fila) */
.tr-foto-sala { position: relative; }
.tr-foto-sala canvas { inset: .2em auto .2em .3em; width: 40%; height: calc(100% - .4em); }
.tr-foto-sala .tr-largo { position: absolute; right: .4em; top: 50%; transform: translateY(-50%); bottom: auto; margin: 0; max-width: 58%; white-space: nowrap; background: rgba(255, 244, 220, .9); font-weight: 800; font-size: .8em; }
.tr-largo svg { width: 1em; height: 1em; }
.tr-largo small { font-weight: 700; opacity: .75; }
.tr-nivel, .tr-record { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3em .5em; font-weight: 800; font-size: .95em; margin-top: .3em; }
.tr-estrellas { display: inline-flex; gap: .25em; }
.tr-estrellas i { width: 1.1em; height: 1.1em; border-radius: 50%; background: rgba(107, 68, 35, .18); }
.tr-estrellas i.on { background: var(--peligro); box-shadow: inset 0 -.14em 0 rgba(0,0,0,.2); }
.tr-record { padding: .35em .7em; border-radius: .8em; background: rgba(255, 181, 49, .22); margin-top: auto; }
.tr-record svg { color: #c77a00; }
.tr-chips { display: grid; grid-template-columns: 1fr 1fr; gap: .4em; margin-top: .25em; }
.tr-chips.cuatro { grid-template-columns: repeat(4, 1fr); }
.tr-chip { padding: .42em .3em; border-radius: .8em; border: .15em solid var(--canto); background: var(--tarjeta); box-shadow: 0 .2em 0 var(--canto); font-family: var(--titulos); font-weight: 800; font-size: 1.05em; cursor: pointer; color: var(--tinta);
  transition: transform .1s var(--ease), box-shadow .1s var(--ease), background .15s; }
.tr-chip:active { transform: translateY(.2em); box-shadow: 0 0 0 var(--canto); }
.tr-chip.on { background: linear-gradient(180deg, #ffd34d, #ffb531); }
.tr-h2 { margin-top: .5em; }
.tr-t-carrera .boton.grande { margin-top: auto; }

/* Pausa, ayuda y final */
/* Pausa: una sola columna que NO crece con su contenido (si no, una fila ancha saca todos los botones de la tarjeta),
   y con desplazamiento propio si la pantalla es muy baja */
.tr-pausa-tarjeta { width: min(94%, 25em); max-height: 96%; overflow-y: auto; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr); gap: .55em; animation: sube .3s var(--muelle); }
.tr-pausa-tarjeta .boton { min-width: 0; }
@media (max-height: 430px) {
  .tr-pausa-tarjeta { gap: .38em; padding-top: .6em; padding-bottom: .7em; }
  .tr-pausa-tarjeta .boton { padding-top: .32em; padding-bottom: .32em; }
  .tr-pausa-tarjeta .boton.grande { font-size: 1.25em; }
}
.tr-dialogo .tr-tarjeta { width: min(96%, 46em); max-height: 96%; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: .6em; animation: sube .3s var(--muelle); }
.tr-rk-lista li.tr-rk-sep { background: none; box-shadow: none; justify-content: center; font-weight: 800; text-transform: uppercase; font-size: .8em; opacity: .7; padding: .5em 0 .1em; }
.tr-rk-lista li.tr-rk-ult i { width: auto; padding: 0 .4em; font-size: .85em; }
.tr-rk-lista li span svg { width: 1em; height: 1em; vertical-align: -.12em; margin-right: .15em; color: #c77a00; }
.tr-titular.con-cartel .tr-emblema { height: 7.4em; margin-bottom: -1.7em; }
.tr-titular.con-cartel .tr-logo { font-size: 4.4em; }
.tr-titular.con-cartel .tr-lema { margin: .15em 0 .35em; font-size: 1.25em; }
/* Cartel de la próxima carrera programada (portada) y reloj de su sala */
.tr-cartel { display: flex; align-items: center; gap: .7em; margin: .1em auto .7em; padding: .4em .5em .4em .8em; border-radius: 1em; border: .18em solid var(--canto); background: rgba(255, 244, 220, .94); color: var(--tinta);
  box-shadow: 0 .3em 0 var(--canto); font: inherit; cursor: pointer; pointer-events: auto; text-align: left; }
.tr-cartel[hidden] { display: none; }
.tr-cartel:active { transform: translateY(.2em); box-shadow: 0 .1em 0 var(--canto); }
.tr-cartel-ic { display: grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 50%; background: #e23b2e; color: #fff; flex: none; }
.tr-cartel-txt, .tr-cartel-hora { display: flex; flex-direction: column; line-height: 1.15; }
.tr-cartel small { font-weight: 800; font-size: .72em; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.tr-cartel b { font-family: var(--titulos); font-weight: 800; font-size: 1.15em; }
.tr-cartel-hora { align-items: center; padding: 0 .7em; border-left: .14em solid rgba(74, 47, 23, .2); }
.tr-cartel-hora b { font-size: 1.5em; font-variant-numeric: tabular-nums; }
.tr-cartel-ir { padding: .45em .9em; border-radius: .7em; background: #58c22e; color: #fff; font-family: var(--titulos); font-weight: 800; box-shadow: 0 .2em 0 #2e7a14; }
.tr-sale { display: flex; flex-direction: column; align-items: center; margin: .2em 0; padding: .3em; border-radius: .8em; background: rgba(255, 211, 77, .35); }
.tr-sale small { font-weight: 800; text-transform: uppercase; font-size: .8em; opacity: .75; }
.tr-sale b { font-family: var(--titulos); font-weight: 800; font-size: 2.6em; line-height: 1; font-variant-numeric: tabular-nums; }
.tr-unir { display: flex; gap: .5em; align-items: stretch; }
.tr-unir input { flex: 1; min-width: 0; text-align: center; text-transform: uppercase; letter-spacing: .18em; font-family: var(--titulos); font-weight: 800; font-size: 1.5em; padding: .3em .4em; border-radius: .6em; border: .14em solid var(--canto); background: #fff; color: var(--tinta); }
.tr-unir input::placeholder { letter-spacing: 0; font-size: .7em; color: rgba(61, 36, 19, .45); }
.tr-unir input.mal { animation: tr-mal .35s; border-color: var(--peligro); }
.tr-ayuda { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5em .8em; }
.tr-ayuda li { display: flex; align-items: center; gap: .55em; font-size: .92em; line-height: 1.2; color: var(--tinta-suave); }
.tr-ayuda li b { display: block; color: var(--tinta); font-family: var(--titulos); font-size: 1.12em; }
.tr-ayuda img { width: 2.8em; height: 2.8em; flex: none; object-fit: contain; }
.tr-tecla-ic { flex: none; min-width: 2.8em; height: 2.3em; padding: 0 .5em; display: inline-flex; align-items: center; justify-content: center; gap: .1em; border-radius: .6em; background: var(--tinta); color: #fff4dc; font-weight: 800; font-size: .95em; box-shadow: 0 .18em 0 #1d1108; }
.tr-tecla-ic svg { width: 1.1em; height: 1.1em; }
.tr-final { justify-items: end; padding-right: max(2em, env(safe-area-inset-right)); }
.tr-final-tarjeta { width: min(94%, 27em); display: grid; gap: .55em; animation: sube .45s var(--muelle); max-height: calc(var(--alto, 100vh) - 1.4em); grid-template-rows: auto minmax(0, 1fr) auto auto; }
/* Con muchos (carreras con amigos): filas más bajas y, si aun así no cabe, la lista se desplaza; el botón siempre se ve */
.tr-final-tarjeta .tr-clasif, .tr-final-tarjeta .tr-marcas { overflow-y: auto; min-height: 0; }
.tr-clasif:has(li:nth-child(6)) li { padding-top: .02em; padding-bottom: .02em; font-size: .86em; }
.tr-clasif:has(li:nth-child(6)) .tr-cara { width: 1.6em; height: 1.6em; }
.tr-final-cab { text-align: center; margin: -1.5em -.4em 0; padding: .35em .8em .45em; border-radius: 1em; background: var(--tinta); color: #fff4dc; border: .18em solid var(--canto); box-shadow: 0 .25em 0 var(--canto); }
.tr-final-cab { position: relative; }
.tr-final-cab img { position: absolute; left: -.9em; top: -1.3em; width: 4.6em; height: 4.6em; object-fit: contain; filter: drop-shadow(0 .2em 0 rgba(0,0,0,.3)); transform: rotate(-8deg); animation: tr-bota .5s var(--muelle) .2s both; }
.tr-final-cab img.cara { border-radius: 50%; border: .2em solid var(--canto); width: 3.8em; height: 3.8em; top: -.9em; left: -.6em; }
.tr-final-cab b { display: block; font-family: var(--titulos); font-weight: 800; font-size: 2.1em; line-height: 1.05; }
.tr-final-cab[data-pos="1"] { background: linear-gradient(180deg, #ffd34d, #ffb531); color: var(--tinta); }
.tr-final-cab span { font-size: .9em; opacity: .85; }
.tr-clasif { list-style: none; margin: 0; padding: 0; display: grid; gap: .22em; }
.tr-clasif li { display: grid; grid-template-columns: 1.5em 2em 1fr auto; align-items: center; gap: .1em .5em; padding: .16em .6em .16em .35em; border-radius: .7em; background: rgba(107, 68, 35, .09); font-weight: 800; animation: tr-entra .3s var(--ease) both; }
.tr-clasif li:nth-child(2) { animation-delay: .04s; } .tr-clasif li:nth-child(3) { animation-delay: .08s; } .tr-clasif li:nth-child(4) { animation-delay: .12s; } .tr-clasif li:nth-child(n+5) { animation-delay: .16s; }
.tr-clasif li.llega span { animation: tr-bota .4s var(--muelle); color: var(--tinta); }
.tr-clasif li.yo { background: linear-gradient(180deg, #fff3c4, #ffd860); box-shadow: inset 0 0 0 .13em var(--canto); }
.tr-clasif i { font-style: normal; font-family: var(--titulos); font-size: 1.3em; text-align: center; }
.tr-clasif .tr-cara { width: 2em; height: 2em; border-radius: 50%; border: .1em solid var(--canto); background: #fff; grid-row: span 1; }
.tr-clasif b { font-family: var(--titulos); font-size: 1.1em; line-height: 1; }
.tr-clasif small { display: none; }
.tr-clasif span { font-variant-numeric: tabular-nums; font-size: .95em; color: var(--tinta-suave); }
.tr-final-datos { display: flex; flex-wrap: wrap; gap: .4em 1em; justify-content: center; font-weight: 800; font-size: .95em; }
.tr-final-datos span { display: inline-flex; align-items: center; gap: .35em; }
.tr-final-datos svg { width: 1.1em; height: 1.1em; color: var(--cielo-hondo); }
.tr-nuevo { color: #a86200; } .tr-nuevo svg { color: #c77a00 !important; }
.tr-final-botones { display: flex; gap: .7em; justify-content: center; align-items: center; }
/* Ofertas del final (retar a un amigo, la app o la cuenta): abajo a la izquierda, en el hueco bajo el podio */
.tr-final-extra { position: absolute; left: max(1em, env(safe-area-inset-left)); bottom: max(.9em, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-start; gap: .5em; z-index: 2; animation: sube .45s var(--muelle) .5s both; }
.tr-final-extra .boton { font-size: .95em; text-decoration: none; white-space: nowrap; }
.tr-app .boton.naranja { background: #ff8a3c; color: #fff; }
.tr-aviso-app .tr-tarjeta { width: min(92%, 24em); text-align: center; display: grid; gap: .6em; justify-items: center; position: relative; padding-top: 2.2em; }
.tr-aviso-app .tr-tarjeta > img { position: absolute; top: -2.2em; width: 4.4em; height: 4.4em; object-fit: contain; filter: drop-shadow(0 .2em 0 rgba(0,0,0,.3)); animation: tr-bota .5s var(--muelle) .15s both; }
.tr-aviso-app .boton { text-decoration: none; }
/* Podio en 3D detrás de la clasificación: los nombres van en HTML y siguen a cada tractor */
.tr-podio-nombres { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tr-podio-nombre { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: .35em; padding: .12em .7em .16em .3em; border-radius: 99em; background: #fff7e3; border: .13em solid var(--canto);
  box-shadow: 0 .16em 0 var(--canto); font-family: var(--titulos); font-weight: 800; font-size: .95em; white-space: nowrap; color: var(--tinta); will-change: transform; }
.tr-podio-nombre b { display: grid; place-items: center; min-width: 1.9em; height: 1.5em; padding: 0 .3em; border-radius: 99em; background: var(--canto); color: #fff7e3; font-size: .82em; }
.tr-podio-nombre.yo { background: #ffb531; }
.tr-final .tr-final-tarjeta { position: relative; z-index: 1; }
/* Con el podio a la vista sobran el puesto, el mapa y el resto de la carrera */
.tr-con-podio .tr-hud, .tr-con-podio .tr-lineas { visibility: hidden; }
/* Podio para compartir: la imagen entera a la vista, con los botones debajo */
.tr-dialogo .tr-podio { width: auto; max-width: 96%; justify-items: center; padding: .7em; }
.tr-podio img { display: block; height: calc(var(--alto, 100vh) - 8.5em); max-height: 30em; width: auto; max-width: 100%; border-radius: 1em; border: .16em solid var(--canto); }
.tr-app[data-pantalla="final"] .tr-objeto, .tr-app[data-pantalla="final"] .tr-velo, .tr-app[data-pantalla="final"] .tr-cima, .tr-app[data-pantalla="final"] .tr-orden, .tr-app[data-pantalla="final"] .tr-toasts { display: none; }

/* Quien viene pegado por detrás: cara con flechita abajo */
/* Medidor del derrape: abajo en el centro. Solo se anima la escala del relleno y la opacidad */
.tr-derrape { position: absolute; left: 50%; bottom: max(1.1em, env(safe-area-inset-bottom)); width: 15em; margin-left: -7.5em; display: flex; align-items: center; gap: .5em; opacity: .001; transition: opacity .12s; pointer-events: none; will-change: opacity; }
.tr-derrape.ver { opacity: 1; }
.tr-derrape-barra { position: relative; flex: 1; height: 1.15em; border-radius: 1em; border: .18em solid var(--canto); background: rgba(255, 244, 220, .85); overflow: hidden; }
.tr-derrape-zona, .tr-derrape-top { position: absolute; top: 0; bottom: 0; }
.tr-derrape-zona { left: 44%; width: 21.6%; background: rgba(92, 191, 74, .55); }
.tr-derrape-top { left: 65.6%; right: 0; background: rgba(232, 49, 42, .5); }
.tr-derrape-barra b { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: #8a8a8a; will-change: transform; }
.tr-derrape.bueno .tr-derrape-barra b { background: #3fae2f; }
.tr-derrape.perfecto .tr-derrape-barra b { background: #e8312a; }
.tr-derrape-luces { display: flex; gap: .2em; }
.tr-derrape-luces i { width: .8em; height: .8em; border-radius: 50%; border: .14em solid var(--canto); background: rgba(255, 244, 220, .7); }
.tr-derrape.c1 .tr-derrape-luces i:nth-child(-n+1), .tr-derrape.c2 .tr-derrape-luces i:nth-child(-n+2), .tr-derrape.c3 .tr-derrape-luces i { background: #ffb531; }
.tr-app[data-pantalla="final"] .tr-derrape { display: none; }
.tr-detras { position: absolute; left: 0; right: 0; bottom: 4.6em; height: 0; pointer-events: none; }
.tr-detras > div { position: absolute; left: 50%; bottom: 0; display: flex; flex-direction: column; align-items: center; will-change: transform, opacity; }
.tr-detras img { width: 2.6em; height: 2.6em; border-radius: 50%; border: .16em solid var(--canto); background: #fff; object-fit: cover; box-shadow: 0 .2em 0 rgba(0,0,0,.3); }
.tr-detras i { width: 0; height: 0; margin-top: .1em; border-left: .7em solid transparent; border-right: .7em solid transparent; border-top: .8em solid var(--peligro); animation: tr-flecha .6s ease-in-out infinite; }
@keyframes tr-flecha { 50% { transform: translateY(.25em); } }
.tr-app[data-pantalla="final"] .tr-detras { display: none; }

/* Contrarreloj: sin puesto ni orden de carrera, y la lista de marcas */
.tr-mejor, .tr-solo-crono { display: none !important; }
.tr-app[data-modo="crono"][data-pantalla="carrera"] .tr-mejor { display: inline-flex !important; }
.tr-app[data-modo="crono"][data-pantalla="carrera"] .tr-solo-crono { display: grid !important; }
.tr-aviso .tr-rot.gris { color: #fff4dc; }
.tr-datos > .tr-batir { background: linear-gradient(180deg, #fff3c4, #ffd860); }

.tr-rk { width: min(96%, 34em); max-height: 96%; display: grid; gap: .55em; grid-template-rows: auto auto minmax(0, 1fr) auto auto; animation: sube .3s var(--muelle); }
.tr-rk-circuitos { display: flex; gap: .35em; overflow-x: auto; padding-bottom: .35em; }
.tr-rk-circuitos .tr-chip { flex: none; padding: .35em .7em; font-size: .9em; white-space: nowrap; }
.tr-rk-lista { overflow-y: auto; align-content: start; min-height: 6em; }
.tr-app[data-modo="crono"] .tr-puesto, .tr-app[data-modo="crono"] .tr-orden { display: none; }
.tr-app[data-modo="crono"] .tr-mapa { top: .8em; }
.tr-modos { display: grid; grid-template-columns: 1fr 1fr; gap: .4em; }
.tr-marcas { list-style: none; margin: .2em 0 0; padding: 0; display: grid; gap: .2em; }
.tr-marcas li { display: grid; grid-template-columns: 1.6em 1.8em 1fr auto; align-items: center; gap: .45em; padding: .14em .6em .14em .3em; border-radius: .7em; background: rgba(107, 68, 35, .09); font-weight: 800; font-size: .95em; }
.tr-marcas li.yo { background: linear-gradient(180deg, #fff3c4, #ffd860); box-shadow: inset 0 0 0 .13em var(--canto); }
.tr-marcas li.vacio { display: block; text-align: center; color: var(--tinta-suave); padding: .5em; font-weight: 700; }
.tr-marcas i { font-style: normal; font-family: var(--titulos); text-align: center; }
.tr-marcas img { width: 1.8em; height: 1.8em; border-radius: 50%; border: .1em solid var(--canto); background: #fff; object-fit: cover; }
.tr-marcas b { font-family: var(--titulos); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-marcas span { font-variant-numeric: tabular-nums; color: var(--tinta-suave); }
.tr-marcas li.sep { background: none; padding: 0; height: .3em; }
.tr-cuenta { text-align: center; font-size: .92em; font-weight: 800; }
.tr-cuenta a { color: var(--cielo-hondo); }

/* Con amigos: la sala */
/* La sala nunca crece más que la pantalla: con la lista llena (8 filas), la que desliza es la lista */
.tr-panel-sala { grid-template-rows: minmax(0, 1fr); max-height: calc(var(--alto, 100vh) - 1.8em); }
.tr-panel-sala > * { min-height: 0; }
/* Si a quien manda no le cabe todo (móviles muy bajos), desliza su columna: «¡Arrancar!» nunca se queda cortado */
.tr-panel-sala .tr-t-carrera { overflow-y: auto; scrollbar-width: none; }
.tr-panel-sala .tr-t-carrera .boton.grande { position: sticky; bottom: 0; flex: none; z-index: 1; }
.tr-panel-sala.quieta > * { animation: none; }
.tr-t-sala { gap: .45em; }
.tr-codigo { display: block; text-align: center; font-family: var(--titulos); font-weight: 800; font-size: 2.2em; letter-spacing: .14em; line-height: 1; color: var(--tinta); }
.tr-jugadores { list-style: none; margin: 0; padding: 0; display: grid; gap: .25em; overflow-y: auto; min-height: 0; }
.tr-jugadores li { position: relative; display: grid; grid-template-columns: 2em 1fr; grid-template-rows: auto auto; column-gap: .5em; align-items: center; padding: .2em .6em .2em .25em; border-radius: .8em; background: rgba(107, 68, 35, .09); }
.tr-jugadores li.yo { background: linear-gradient(180deg, #fff3c4, #ffd860); box-shadow: inset 0 0 0 .13em var(--canto); }
.tr-jugadores li.caido { opacity: .45; }
/* Copa: selector de cuántas carreras (quien manda) o rótulo (los demás), y los puntos en cada fila */
.tr-copa { display: flex; align-items: center; justify-content: center; gap: .4em; flex: none; }
.tr-copa[hidden] { display: none; }
.tr-copa b { flex: 1; display: flex; align-items: center; justify-content: center; gap: .35em; font-family: var(--titulos); font-size: .92em; white-space: nowrap; min-width: 0; overflow: hidden; }
.tr-copa b svg { width: 1.1em; height: 1.1em; color: #c77a00; flex: none; }
.tr-copa .tr-chip { flex: none; width: 2.1em; padding: .12em 0; font-size: 1.15em; line-height: 1; }
.tr-copa .tr-chip:disabled { opacity: .4; }
.tr-copa-va { font-style: normal; padding: .05em .5em; border-radius: 99em; background: var(--canto); color: #fff4dc; font-size: .82em; }
.tr-pts { color: #b56a00; }
/* Frases rápidas de la sala: tira que desliza a lo ancho y bocadillo sobre la fila de quien habla */
.tr-frases-boton { flex: none; margin-top: auto; display: flex; align-items: center; justify-content: center; gap: .4em; padding: .3em .7em; font-size: .9em; }
.tr-frases-boton svg { width: 1.1em; height: 1.1em; }
/* El cuadro de frases se abre encima de la tarjeta, pegado abajo: caben todas sin deslizar */
.tr-frases { position: absolute; left: .5em; right: .5em; bottom: .5em; z-index: 3; display: flex; flex-wrap: wrap; gap: .35em; justify-content: center; padding: .55em; border-radius: 1em; background: var(--crema);
  border: .16em solid var(--canto); box-shadow: 0 .3em 0 var(--canto), 0 .8em 1.4em rgba(0,0,0,.28); animation: tr-bocadillo .2s var(--ease); }
.tr-frases[hidden] { display: none; }
.tr-frases .tr-chip { flex: none; white-space: nowrap; padding: .32em .7em; font-size: .86em; }
.tr-bocadillo { position: absolute; right: .4em; top: .32em; transform-origin: 100% 100%; max-width: 70%; padding: .25em .7em; border-radius: 1em 1em .2em 1em; background: #fff; border: .12em solid var(--canto);
  font-weight: 800; font-size: .86em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 .18em 0 var(--canto); animation: tr-bocadillo .3s var(--muelle); pointer-events: none; z-index: 2; }
@keyframes tr-bocadillo { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
.tr-jugadores li.bot { background: rgba(107, 68, 35, .05); }
.tr-jugadores li.bot b { color: var(--tinta-suave); }
/* Mi fila, si puedo cambiarme el nombre: lápiz delante del nombre y toda la fila se puede tocar */
.tr-jugadores li.editable { cursor: pointer; }
.tr-jugadores li.editable b svg { width: .85em; height: .85em; vertical-align: -.08em; margin-right: .3em; opacity: .75; }
.tr-jugadores li.esta-listo { box-shadow: inset 0 0 0 .13em var(--hierba); }
.tr-listo-marca { position: absolute; right: .45em; top: 50%; transform: translateY(-50%); width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--hierba); color: #fff; display: grid; place-items: center; animation: tr-bota .35s var(--muelle); }
.tr-listo-marca svg { width: 1em; height: 1em; }
.tr-arrancar-sala { flex-direction: column; gap: 0; line-height: 1.1; }
.tr-arrancar-sala small { font-family: var(--texto); font-size: .5em; font-weight: 800; opacity: .9; }
.tr-ficha-cab { display: flex; align-items: center; justify-content: center; gap: .5em; }
.tr-ficha-cab .tr-nombre { margin: 0; }
.tr-puntos { display: inline-flex; gap: .22em; }
.tr-puntos i { width: .5em; height: .5em; border-radius: 50%; background: rgba(107, 68, 35, .25); }
.tr-puntos i.on { background: var(--oro); box-shadow: 0 0 0 .1em var(--canto); }
.tr-jugadores li.nuevo { animation: tr-entra .3s var(--ease) both; }
.tr-jugadores li.cambia img { animation: tr-bota .35s var(--muelle); }
.tr-jugadores img { grid-row: span 2; width: 2em; height: 2em; border-radius: 50%; border: .1em solid var(--canto); object-fit: cover; background: #fff; }
.tr-jugadores b { font-family: var(--titulos); line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-jugadores small { font-size: .78em; color: var(--tinta-suave); line-height: 1.1; }
.tr-corona { position: absolute; right: .5em; top: 50%; transform: translateY(-50%); color: #c77a00; }
.tr-corona svg { width: 1.1em; height: 1.1em; }
.tr-circ-sala { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .4em; }
.tr-circ-sala b { text-align: center; font-family: var(--titulos); font-size: 1.15em; line-height: 1.1; }
.tr-circ-sala .tr-flecha { position: static; margin: 0; }
.tr-chips.cinco { grid-template-columns: repeat(5, 1fr); }
.tr-paso { display: grid; grid-template-columns: 1fr 2.4em 1.8em 2.4em; align-items: center; gap: .35em; margin-top: .45em; }
.tr-paso .tr-h { text-align: left; }
.tr-paso .tr-chip { padding: .2em 0; font-size: 1.2em; line-height: 1; }
.tr-paso .tr-chip:disabled { opacity: .4; }
.tr-paso b { text-align: center; font-family: var(--titulos); font-size: 1.4em; }
.tr-foto-sala { flex: none; height: 5.4em; background: radial-gradient(circle at 50% 40%, #a5dd7b, #6fb84a); }
/* Móviles bajos: la columna de quien crea la sala, más apretada para que «¡Arrancar!» se vea siempre */
@media (max-height: 430px) {
  .tr-panel-sala .tr-t-carrera { gap: .1em; padding-top: .5em; padding-bottom: .6em; }
  /* (solo a quien manda, que es quien tiene la columna llena; los demás ven el dibujo a su tamaño) */
  .tr-panel-sala .tr-t-carrera:has(.tr-circ-sala) .tr-foto-sala { height: 2.5em; }
  .tr-panel-sala .tr-t-carrera:has(.tr-circ-sala) .tr-foto-sala canvas { width: 22%; }
  .tr-panel-sala .tr-t-carrera:has(.tr-circ-sala) .tr-foto-sala .tr-largo { max-width: 76%; font-size: .72em; }
  .tr-panel-sala .tr-t-carrera .tr-h2 { margin-top: 0; }
  .tr-panel-sala .tr-paso { margin-top: .15em; }
  .tr-panel-sala .tr-chip { padding-top: .28em; padding-bottom: .28em; }
}
.tr-t-sala .boton svg, .tr-portada-botones .boton svg { width: 1.2em; height: 1.2em; }
.tr-espera { margin-top: auto; padding: .7em .6em; border-radius: .9em; background: rgba(255, 181, 49, .22); text-align: center; font-weight: 800; }
.tr-espera span { white-space: nowrap; }
.tr-espera i { display: inline-block; width: .45em; height: .45em; margin: 0 .12em; border-radius: 50%; background: var(--tinta); animation: tr-punto 1.2s ease-in-out infinite; }
.tr-espera i:nth-of-type(2) { animation-delay: .15s; } .tr-espera i:nth-of-type(3) { animation-delay: .3s; }
@keyframes tr-punto { 50% { transform: translateY(-.35em); opacity: .4; } }
.tr-dialogo .tr-nombre-tarjeta { width: min(92%, 25em); }
.tr-nombre-tarjeta input { font: inherit; font-weight: 800; font-size: 1.3em; text-align: center; padding: .45em .6em; border-radius: .7em; border: .16em solid var(--canto); background: #fff; color: var(--tinta); }
.tr-nombre-tarjeta input.mal { animation: tr-mal .35s; border-color: var(--peligro); }
@keyframes tr-mal { 25% { transform: translateX(-.4em); } 75% { transform: translateX(.4em); } }

/* Girar el móvil */
.tr-girar { position: absolute; inset: 0; z-index: 30; background: rgba(42, 26, 14, .94); color: #fff4dc; display: grid; place-content: center; justify-items: center; gap: .4em; text-align: center; font-size: 1.6em; padding: 1em; }
.tr-girar b { font-family: var(--titulos); font-weight: 800; font-size: 1.6em; }
.tr-girar p { margin: 0; opacity: .85; }
.tr-girar-movil { color: var(--oro); animation: tr-gira 1.6s ease-in-out infinite; }
.tr-girar-movil svg { width: 4em; height: 4em; }
@keyframes tr-gira { 0%, 25% { transform: rotate(0); } 55%, 100% { transform: rotate(90deg); } }

/* Ventanas altas y estrechas en PC: las tres tarjetas, una debajo de otra */
@media (max-aspect-ratio: 1/1) {
  body:not(.tr-tactil) .tr-panel { grid-template-columns: 1fr; width: min(100%, 24em); }
  body:not(.tr-tactil) .tr-capa.tr-ajustes { overflow-y: auto; place-items: start center; padding-top: 4em; }
  body:not(.tr-tactil) .tr-logo { font-size: 3.4em; }
  body:not(.tr-tactil) .tr-ayuda { grid-template-columns: 1fr 1fr; }
  body:not(.tr-tactil) .tr-final { justify-items: center; padding-right: 1em; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-lineas.ver, .tr-objeto.lleno, .tr-girar-movil { animation: none; }
}
