/* Estilos extra de las pantallas online: /play, /watch y /host */

/* ---- entrar (play) ---- */
#join { padding: max(10px, env(safe-area-inset-top)) 14px 10px; overflow: hidden; }
#join header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#join h1 { margin: 0 0 6px; font-size: 22px; }
.join-body { flex: 1; display: grid; grid-template-columns: 300px 1fr; gap: 14px; min-height: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #8b95a7; }
input[type=text], input[type=number], input[type=password] {
  background: #222733; color: #eceff4; border: 2px solid #3a4152; border-radius: 10px;
  padding: 10px 12px; font-size: 16px; width: 100%; user-select: text; -webkit-user-select: text; touch-action: auto;
}
input:focus { outline: none; border-color: #ffca28; }
.hint { font-size: 12px; color: #8b95a7; line-height: 1.4; margin: 8px 0 0; }
.rules { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: #c4cbd8; }
#join footer { display: flex; justify-content: center; padding-top: 8px; }

/* ---- banner y panel sobre el juego ---- */
#banner {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(max(8px, env(safe-area-inset-top)) + 78px);
  max-width: min(560px, 80vw); background: rgba(0,0,0,.62); padding: 8px 14px; border-radius: 12px;
  font-size: 14px; text-align: center; pointer-events: none; line-height: 1.35;
}
#banner b { color: #ffca28; }
#banner.ok { background: rgba(27,94,32,.78); }
#panel {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,12,16,.7); padding: 16px;
}
#panel .box { background: #1b1f28; border-radius: 16px; padding: 16px 20px; width: min(620px, 94vw); max-height: 92vh; overflow-y: auto; touch-action: pan-y; }
#panel h2 { margin: 0 0 8px; font-size: 20px; }
#panel .sub { color: #8b95a7; font-size: 13px; margin: 4px 0; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill-ready { background: #2e7d32; }
.pill-waiting { background: #8d6e00; }
.pill-racing { background: #1565c0; }
.pill-spectator { background: #455a64; }
#conn { position: absolute; left: 0; right: 0; top: 0; background: #b71c1c; text-align: center; font-size: 13px; padding: 4px; z-index: 5; }

/* ---- espectador (watch) ---- */
#watch-ui { position: absolute; inset: 0; pointer-events: none; font-weight: 600; }
.card-ov {
  position: absolute; background: rgba(12,14,20,.72); border-radius: 14px; padding: 10px 14px;
  backdrop-filter: blur(3px);
}
#board { left: 14px; top: 14px; padding: 6px 8px; }
#board h3 { margin: 0 0 3px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #8b95a7; }
#board ol { margin: 0; padding: 0; list-style: none; font-size: 17px; }
#board ol { display: grid; grid-template-columns: max-content max-content max-content; column-gap: 6px; align-items: baseline; }
#board li { display: contents; }
#board li > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 1px 0; }
#board li .n { color: #8b95a7; text-align: left; }
#board li.human .nm { color: #80deea; }
#board li .car { font-size: 10px; color: #8b95a7; font-weight: 500; text-align: right; }
#info { left: 50%; transform: translateX(-50%); top: 14px; text-align: center; font-size: 18px; }
#info small { display: block; font-size: 12px; color: #8b95a7; font-weight: 500; }
#feed { left: 14px; bottom: 14px; width: min(380px, 40vw); background: transparent; backdrop-filter: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#feed .item { background: rgba(12,14,20,.78); border-left: 4px solid #ffca28; padding: 6px 10px; border-radius: 8px; font-size: 15px; animation: slidein .3s ease-out; }
#feed .item.no { border-color: #78909c; color: #b0bec5; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
#join-card { right: 14px; bottom: 14px; text-align: right; font-size: 16px; max-width: 360px; line-height: 1.4; }
#join-card .url { font-size: 22px; color: #ffca28; word-break: break-all; }
#join-card small { display: block; font-size: 12px; color: #b0bec5; font-weight: 500; }
#big { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; text-shadow: 0 4px 24px rgba(0,0,0,.8); }
#big .t { font-size: 96px; font-weight: 900; }
#big .s { font-size: 28px; }
#watch-results { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,10,14,.62); }
#watch-results .box { background: rgba(20,24,32,.95); border-radius: 18px; padding: 18px 26px; min-width: min(640px, 90vw); }
#watch-results h2 { margin: 0 0 8px; }
#watch-results td, #watch-results th { font-size: 16px; padding: 3px 8px; }

.sound-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(0,0,0,.7); padding: 8px 16px; border-radius: 12px; font-size: 15px; z-index: 4; pointer-events: none; }

/* ---- anfitrión (host) ---- */
body.host { overflow: auto; touch-action: auto; user-select: text; -webkit-user-select: text; }
.host-wrap { max-width: 1100px; margin: 0 auto; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .host-wrap { grid-template-columns: 1fr; } }
.host-wrap section { background: #1b1f28; border-radius: 14px; padding: 14px; }
.host-wrap h1 { grid-column: 1 / -1; margin: 0; font-size: 22px; }
.host-wrap h2 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: #8b95a7; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.row label { font-size: 13px; color: #c4cbd8; display: flex; align-items: center; gap: 6px; }
button.act { background: #2c3140; color: #eceff4; border: 0; border-radius: 10px; padding: 9px 14px; font-size: 14px; cursor: pointer; font-weight: 600; }
button.act.go { background: #ffca28; color: #1b1b1b; }
button.act.danger { background: #7f2a2a; }
button.act:disabled { opacity: .4; cursor: default; }
.host-wrap table { font-size: 13px; }
.host-wrap td button { padding: 2px 8px; font-size: 12px; border-radius: 6px; border: 0; background: #3a4152; color: #eceff4; cursor: pointer; }
.log { max-height: 180px; overflow-y: auto; font-size: 12px; color: #c4cbd8; line-height: 1.5; }
.mono { font-family: ui-monospace, monospace; font-size: 12px; color: #ffca28; word-break: break-all; }

/* sin carrera: el HUD de juego se esconde (queda solo el botón de salir) */
#hud.idle .hud-box, #hud.idle #minimap, #hud.idle #hud-speed { display: none; }

/* garaje y botón de garaje */
#garage-btn { position: absolute; right: 136px; top: max(8px, env(safe-area-inset-top)); pointer-events: auto; }
#garage { z-index: 6; }
.garage-box { background: #1b1f28; border-radius: 16px; padding: 12px 16px; width: min(760px, 96vw); max-height: 94vh; display: flex; flex-direction: column; gap: 4px; }
.garage-box .col { overflow-y: auto; touch-action: pan-y; min-height: 0; padding-bottom: 16px; } /* se desplaza hasta el final */
.garage-head { display: flex; justify-content: space-between; align-items: center; }
.garage-head h2 { margin: 0; font-size: 20px; }
.garage-head .big { padding: 6px 28px; font-size: 16px; }
.garage-box .sub { margin: 0; color: #8b95a7; font-size: 12px; }
.small-big { padding: 6px 18px !important; font-size: 14px !important; }
@media (max-height: 460px) { .garage-box .card canvas { height: 44px; } .garage-box .card .desc { display: none; } }

/* tablero de posiciones del espectador: entran 16 */
#board ol { font-size: clamp(11px, 2.3vh, 17px); }
#watch-results .split table { min-width: 0; }
#watch-results .box:has(.split) { min-width: min(980px, 96vw); }

#install { position: absolute; right: 56px; top: max(8px, env(safe-area-inset-top)); z-index: 3; }

#piloto-btn { position: absolute; right: 178px; top: max(8px, env(safe-area-inset-top)); pointer-events: auto; }
#cam { position: absolute; right: 220px; top: max(8px, env(safe-area-inset-top)); pointer-events: auto; }
#camdist { position: absolute; right: 262px; width: auto; padding: 0 10px; font-size: 14px; top: max(8px, env(safe-area-inset-top)); pointer-events: auto; white-space: nowrap; }
#camdist[hidden] { display: none; }

/* dentro de la app Android: sin botones de pantalla completa/instalar, y espacio para el banner de abajo */
.in-app #fs, .in-app #install, .in-app .fs-btn { display: none !important; }
/* Banner de anuncios (solo en la app, en la sala y los resultados): todo deja libre su alto abajo.
   --ad-h lo pone client/app-ads.js con el alto real; si no llega, 90 px (el máximo del banner adaptable en horizontal). */
body.banner-on #panel { padding-bottom: calc(var(--ad-h, 90px) + 10px); }
body.banner-on #panel .box { max-height: calc(100vh - var(--ad-h, 90px) - 24px); }
body.banner-on #garage, body.banner-on #piloto { justify-content: flex-start; padding: 8px 0 calc(var(--ad-h, 90px) + 8px); }
body.banner-on .garage-box { max-height: calc(100vh - var(--ad-h, 90px) - 18px); }

#join .col #enter { width: 100%; margin: 12px 0 4px; }

#panel .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
#panel .actions button { flex: 1 1 auto; }

#join-card[hidden] { display: none; }

/* tabla de posiciones: clic en una fila = la cámara sigue a ese piloto */
#board { pointer-events: auto; }
#board li { cursor: pointer; }
#board li.sel > .n, #board li.sel > .car { color: #ffeb3b; }
#board li.sel > .nm { color: #ffeb3b; }
#board li:hover > .nm { text-decoration: underline; }

/* podio al terminar la carrera (/watch) */
.podium { text-align: center; min-width: min(640px, 92vw); }
.podium h2 { margin: 0 0 4px; }
.podium .steps { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin-top: 4px; }
.podium .step { display: flex; flex-direction: column; align-items: center; width: clamp(120px, 20vw, 200px); animation: podium-rise .7s ease-out both; }
.podium .s1 { order: 2; animation-delay: .9s; } .podium .s2 { order: 1; animation-delay: .5s; } .podium .s3 { order: 3; animation-delay: .1s; }
.podium canvas { width: min(150px, 17vw); height: auto; }
.podium .nm { font-size: clamp(16px, 2.2vw, 22px); font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .viewer .nm { color: #80deea; }
.podium small { opacity: .75; font-size: 13px; }
.podium .block { width: 100%; margin-top: 6px; border-radius: 10px 10px 0 0; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 900; color: rgba(0,0,0,.55); }
.podium .s1 .block { height: 118px; background: linear-gradient(#ffe066, #d4a017); }
.podium .s2 .block { height: 88px; background: linear-gradient(#e8edf2, #9aa5b1); }
.podium .s3 .block { height: 64px; background: linear-gradient(#e0a070, #a8683a); }
@keyframes podium-rise { from { transform: translateY(46px); opacity: 0; } to { transform: none; opacity: 1; } }

.hint a { color: #f2b705; }

/* progreso: monedas, xp y nivel (resultados y línea de la cuenta) */
#panel .prog { margin: 6px 0 8px; padding: 8px 10px; border-radius: 10px; background: rgba(242,183,5,.12); border: 1px solid rgba(242,183,5,.35); }
#panel .prog.guest { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.15); font-size: 13px; }
#panel .prog .up { font-weight: 800; color: #ffd54f; font-size: 16px; margin-bottom: 2px; }
#panel .prog .gain b { font-size: 16px; margin-right: 8px; }
#panel .prog .gain small { color: #b9c0cc; }
.lvlrow { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#panel .prog .lvlrow { display: flex; margin-top: 4px; }
.lvlrow .lvl { font-weight: 800; }
.lvlrow .xpbar { position: relative; display: inline-block; width: 110px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.15); overflow: hidden; }
.lvlrow .xpbar i { position: absolute; inset: 0 auto 0 0; background: #f2b705; border-radius: 4px; }
.lvlrow .xpnum { font-size: 12px; color: #b9c0cc; }
.lvlrow .coins { font-weight: 700; }

/* galería de autos (garaje y panel del piloto) */
.gal { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 10px; align-items: center; background: #151922; border-radius: 12px; padding: 8px; }
.gal-main { display: flex; align-items: center; gap: 4px; }
.gal-main canvas { flex: 1; min-width: 0; width: 100%; height: auto; aspect-ratio: 420 / 200; object-fit: contain; background: #1f2430; border-radius: 10px; touch-action: pan-y; }
.gal-arrow { flex: none; width: 40px; height: 56px; border-radius: 10px; border: 0; background: #2c3140; color: #fff; font-size: 18px; cursor: pointer; }
.gal-arrow:active { background: #3a4153; }
.gal-head { display: flex; align-items: center; gap: 8px; }
.gal-name { font-size: 17px; }
.gal-count { margin-left: auto; color: #8b95a7; font-size: 12px; }
.gal-desc { color: #8b95a7; font-size: 12px; line-height: 1.25; margin: 2px 0 4px; }
.gal-choose { width: 100%; margin-top: 6px; padding: 8px; font-size: 15px; }
.tag-free { font-size: 11px; background: #2e7d32; color: #e8f5e9; padding: 1px 8px; border-radius: 999px; font-weight: 700; }
.car-stats { display: grid; gap: 3px; }
.car-stats .st { display: grid; grid-template-columns: 128px 1fr; align-items: center; gap: 6px; font-size: 11px; color: #c4cbd8; }
.car-stats .sb { position: relative; height: 7px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.car-stats .sb i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #f2b705, #ffd54f); border-radius: 4px; }
.car-stats .st-nitro .sb i { background: linear-gradient(90deg, #ff7043, #ffab40); } /* nitro de cada auto */
.car-stats .sn b { color: #fff; }
@media (max-width: 560px) { .gal { grid-template-columns: 1fr; } }
@media (max-height: 460px) { .gal-desc { display: none; } .car-stats { gap: 1px; } .gal-choose { padding: 5px; } }

/* panel del piloto */
#piloto { z-index: 5; }
.piloto-box .pausa-line { color: #ffd54f; }
.p-perfil { background: #151922; border-radius: 12px; padding: 10px 12px; margin: 4px 0 6px; }
.p-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.p-name { font-size: 18px; font-weight: 800; }
.p-coins { font-size: 18px; font-weight: 800; white-space: nowrap; }
.p-perfil .lvlrow { margin: 6px 0; }
.p-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.p-stats div { background: #1f2430; border-radius: 8px; padding: 4px; text-align: center; }
.p-stats b { display: block; font-size: 17px; }
.p-stats span { font-size: 11px; color: #8b95a7; }
.p-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.p-actions button { flex: 1 1 auto; }
.status-pill.pill-paused { background: #5d4037; }

/* sala de espera visual: tarjeta de pista o votación + casilleros de pilotos */
#panel .box.sala-box { width: min(980px, 96vw); }
.sala-head { display: flex; align-items: center; gap: 10px; }
.sala-head h2 { margin: 0 !important; }
.sala-cd { margin-left: auto; font-weight: 800; font-size: 16px; background: #f2b705; color: #111; padding: 3px 12px; border-radius: 999px; }
.sala-cd.dim { background: #2c3140; color: #eceff4; }
.sala-st { margin: 6px 0; }
.sala { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 640px) { .sala { grid-template-columns: 1fr; } }
.tc-big { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.tc-big .tc-img, .voto img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; display: block; background: #1f2430; }
.tc-big .tc-img { max-height: 170px; }
.votos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.voto { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 6px; border-radius: 12px; border: 2px solid transparent; background: #151922; color: #eceff4; cursor: pointer; font: inherit; }
.voto:disabled { opacity: .7; cursor: default; }
.voto.lider { border-color: rgba(242,183,5,.5); }
.voto.mio { border-color: #f2b705; background: #2a2614; }
.voto .vn { font-weight: 800; font-size: 13px; line-height: 1.15; }
.voto .vt { font-size: 11px; color: #8b95a7; }
.voto .vc { font-size: 12px; font-weight: 700; color: #ffd54f; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 2px; border-radius: 8px; background: #151922; min-height: 44px; justify-content: center; }
.slot img { width: 100%; max-width: 72px; height: auto; aspect-ratio: 2 / 1; object-fit: contain; }
.slot span { font-size: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c4cbd8; }
.slot.vacio { background: rgba(255,255,255,.03); border: 1px dashed rgba(255,255,255,.12); }
.slot.vacio span { color: #5d6575; }
.slot.yo { outline: 2px solid #f2b705; }
.slot.st-waiting { opacity: .55; }
.slot { animation: slotIn .35s ease-out; }
@keyframes slotIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.slot.vacio { animation: none; }
@media (max-height: 460px) {
  .tc-big { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); align-items: start; }
  .tc-big .tc-img { max-height: 110px; }
  .slot { min-height: 36px; }
  .slot img { max-width: 52px; }
}

/* /watch: sala de espera para el público del live */
#espera { position: absolute; inset: 3vh 3vw; display: flex; flex-direction: column; gap: 1.6vh; background: rgba(16,19,26,.92); border-radius: 22px; padding: 2.4vh 2.4vw; color: #eceff4; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.es-head { display: flex; align-items: center; gap: 1vw; }
.es-logo { font-size: 3.4vh; font-weight: 900; letter-spacing: .02em; }
.es-cd { margin-left: auto; font-size: 3.2vh; font-weight: 900; background: #f2b705; color: #111; padding: .4vh 1.4vw; border-radius: 999px; }
.es-cd.dim { background: #2c3140; color: #eceff4; font-size: 2.4vh; }
.es-cuerpo { flex: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2vw; min-height: 0; }
.es-tit { font-size: 2.4vh; color: #8b95a7; font-weight: 700; margin-bottom: 1vh; }
.es-votos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1vw; }
.es-voto { background: #1b1f28; border-radius: 14px; padding: .8vh .6vw; border: 3px solid transparent; display: flex; flex-direction: column; gap: .3vh; transition: border-color .3s; }
.es-voto.lider { border-color: #f2b705; }
.es-voto img, .es-pista img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }
.es-voto b { font-size: 2.3vh; line-height: 1.1; }
.es-voto small, .es-pista small { display: block; font-size: 1.7vh; color: #8b95a7; }
.es-bar { height: 1.2vh; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: .4vh; }
.es-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2b705, #ffd54f); transition: width .5s ease-out; }
.es-n { font-size: 2.2vh; font-weight: 900; color: #ffd54f; }
.es-pista { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.2vw; align-items: center; }
.es-pista b { display: block; font-size: 3.4vh; margin-bottom: .6vh; }
.es-pista small { margin: .3vh 0; font-size: 2vh; }
.es-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6vw; }
.es-slot { background: #1b1f28; border-radius: 10px; padding: .5vh .3vw; display: flex; flex-direction: column; align-items: center; min-height: 7vh; justify-content: center; animation: slotIn .4s ease-out; }
.es-slot img { width: 80%; height: auto; aspect-ratio: 2 / 1; object-fit: contain; }
.es-slot span { font-size: 1.7vh; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-slot.vacio { background: rgba(255,255,255,.03); border: 1px dashed rgba(255,255,255,.12); animation: none; }
.es-pie { font-size: 2.6vh; text-align: center; color: #c4cbd8; }
.es-pie b { color: #ffd54f; }
#toasts { position: absolute; left: 4vw; bottom: 12vh; display: flex; flex-direction: column; gap: .8vh; z-index: 3; }
.toast { background: rgba(30,34,45,.95); border-left: 4px solid #f2b705; padding: .8vh 1.2vw; border-radius: 10px; font-size: 2.2vh; animation: toastIn .35s ease-out; transition: opacity .6s, transform .6s; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.out { opacity: 0; transform: translateX(-20px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

/* menú principal de /play (pantalla de entrada con tarjetas) */
#join { padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); gap: 8px; }
#join .mm-top { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
#join .mm-top h1 { margin: 0; font-size: 22px; white-space: nowrap; }
#join .mm-top .fs-btn.corner { position: static; }
.mm-yo { margin-left: auto; display: flex; align-items: center; gap: 10px; background: #1b1f28; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.mm-yo .dim { color: #8b95a7; }
.mm-yo a { color: #ffd54f; }
#join-error:not([hidden]) { margin: 0; }
.mm-body { flex: 1; display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 14px; min-height: 0; }
.mm-left { overflow-y: auto; min-height: 0; padding-right: 4px; }
.mm-left .hint { font-size: 12px; margin: 4px 0; }
.mm-auto { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 6px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: #1b1f28; color: #eceff4; cursor: pointer; text-align: left; font: inherit; }
.mm-auto img { width: 84px; height: auto; aspect-ratio: 2 / 1; object-fit: contain; }
.mm-auto b { display: block; font-size: 15px; }
.mm-auto small { color: #8b95a7; font-size: 12px; }
.mm-cards { display: grid; grid-template-columns: 1.4fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; min-height: 0; }
.mm-card { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 16px; border: 0; background: linear-gradient(160deg, #262c3a, #1a1e28); color: #eceff4; text-decoration: none; cursor: pointer; font: inherit; text-align: left; min-height: 0; box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: transform .12s; }
.mm-card:active { transform: scale(.97); }
.mm-card:disabled { opacity: .6; }
.mm-card .mm-t { font-size: 18px; font-weight: 800; position: relative; }
.mm-card small { color: #b9c0cc; font-size: 12px; position: relative; }
.mm-card.hero { grid-row: 1 / span 2; background: #1a1e28; }
.mm-card.hero .mm-t { font-size: 26px; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.mm-card.hero small { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.mm-card.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10,12,16,.85), rgba(10,12,16,0) 60%); }
.mm-card.hero .mm-t, .mm-card.hero small { z-index: 1; }
.mm-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.mm-card.hero { outline: 3px solid #f2b705; outline-offset: -3px; }
#mm-practica { background: linear-gradient(160deg, #2a3b2c, #1a231c); }
#mm-garaje { background: linear-gradient(160deg, #3a2c26, #22191a); }
#mm-panel { background: linear-gradient(160deg, #26304a, #1a1f2e); }
#mm-autos { background: linear-gradient(160deg, #3a2a3e, #211a24); }
.mm-bar { display: flex; gap: 8px; justify-content: center; }
.mm-bar button { background: #1b1f28; color: #eceff4; border: 0; border-radius: 999px; padding: 7px 16px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.mm-bar button:disabled { opacity: .5; cursor: default; }
.mm-bar small { font-weight: 500; color: #8b95a7; }
@media (max-height: 430px) {
  #join .mm-top h1 { font-size: 18px; }
  .mm-left > .hint:nth-of-type(2) { display: none; } /* el texto largo del regalo: las reglas ya lo dicen */
  .mm-card { padding: 8px 12px; border-radius: 12px; }
  .mm-card .mm-t { font-size: 16px; }
  .mm-card.hero .mm-t { font-size: 22px; }
  .mm-bar button { padding: 5px 14px; font-size: 13px; }
}
@media (max-width: 640px) { .mm-body { grid-template-columns: 1fr; overflow-y: auto; } .mm-cards { min-height: 260px; } }

.mm-card[data-ic]::before { content: attr(data-ic); position: absolute; right: 10px; top: 6px; font-size: 54px; opacity: .22; filter: grayscale(.2); pointer-events: none; }
@media (max-height: 430px) { .mm-card[data-ic]::before { font-size: 42px; } }

.mm-bar .mm-bajar { background: #f2b705; color: #111; border-radius: 999px; padding: 7px 16px; font-weight: 800; font-size: 14px; text-decoration: none; }
.mm-bar .mm-bajar[hidden] { display: none; }

/* ranking y récords */
#ranking { z-index: 7; }
body.banner-on #ranking { justify-content: flex-start; padding: 8px 0 calc(var(--ad-h, 90px) + 8px); }
.rk-tabs { display: flex; gap: 6px; margin: 4px 0; }
.rk-tabs button { flex: 1; border: 0; border-radius: 999px; padding: 6px 10px; background: #2c3140; color: #eceff4; font: inherit; font-weight: 700; cursor: pointer; }
.rk-tabs button.on { background: #f2b705; color: #111; }
.rk-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.rk-tabla th { text-align: left; color: #8b95a7; font-weight: 600; font-size: 12px; padding: 3px 6px; }
.rk-tabla td { padding: 4px 6px; border-top: 1px solid rgba(255,255,255,.06); }
.rk-tabla tr.yo td, .rk-box li.yo { background: rgba(242,183,5,.15); }
.rk-yo { font-size: 14px; margin: 8px 0; }
.rk-pistas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.rk-pista { display: grid; grid-template-columns: 96px 1fr; gap: 8px; background: #151922; border-radius: 10px; padding: 6px; font-size: 13px; }
.rk-pista img { width: 96px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.rk-pista ol { margin: 2px 0; padding-left: 18px; }
.rk-pista small { color: #8b95a7; }
.rk-mio { margin: 2px 0; color: #ffd54f; }
.rk-box { margin-top: 6px; background: #151922; border-radius: 10px; padding: 4px 10px 6px; }
.rk-box ol { margin: 2px 0; padding-left: 20px; font-size: 13px; }
.rk-box li { padding: 1px 4px; border-radius: 4px; }
.rk-box li span { display: inline-block; min-width: 60%; }
.tc-rec, .voto .vr { color: #c4cbd8; font-size: 12px; }
#panel .prog .rec { margin-top: 4px; font-weight: 700; color: #8bd68f; }
#panel .prog .rec.dim { color: #b9c0cc; font-weight: 500; }
#panel .prog .rec-pista { color: #ffd54f; font-size: 16px; animation: brillo 1s ease-in-out 3; }
#panel .prog .rk-line { margin-top: 3px; font-size: 13px; }
@keyframes brillo { 50% { text-shadow: 0 0 14px #ffd54f; } }

/* /watch: ranking, récords y aviso grande de récord */
.es-rec { color: #ffd54f !important; }
.es-rk { margin-top: 1.4vh; background: #1b1f28; border-radius: 12px; padding: .8vh 1vw; }
.es-rk ol { margin: 0; padding-left: 2.2vw; font-size: 2vh; }
.es-rk li span { display: inline-block; min-width: 65%; }
.aviso-grande { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(16,19,26,.95); border: 4px solid #f2b705; border-radius: 22px; padding: 2.4vh 3vw; text-align: center; z-index: 5; box-shadow: 0 0 60px rgba(242,183,5,.5); animation: agIn .5s cubic-bezier(.2,1.4,.4,1); transition: opacity .7s, transform .7s; }
.aviso-grande .ag-t { font-size: 6vh; font-weight: 900; color: #ffd54f; }
.aviso-grande .ag-s { font-size: 3.2vh; margin-top: 1vh; }
.aviso-grande.out { opacity: 0; transform: translate(-50%, -60%); }
@keyframes agIn { from { transform: translate(-50%, -50%) scale(.5); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* v159: calendario de misiones del panel */
.cal-sec { grid-column: 1 / -1; }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.cal-mes { min-width: 150px; text-align: center; font-size: 16px; }
.cal-ley { margin-left: auto; font-size: 12px; color: #9aa3b2; display: flex; align-items: center; gap: 6px; }
.cal-ley i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.cal-ley i.man, .cal-grid td.man { background: rgba(255,194,61,.12); }
.cal-ley i.man { background: #ffc23d; }
.cal-ley i.aut { background: #3a4152; }
.cal-grid { overflow-x: auto; }
.cal-grid table { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; min-width: 760px; }
.cal-grid th { font-size: 12px; color: #8b95a7; font-weight: 600; }
.cal-grid td { vertical-align: top; background: #232836; border-radius: 6px; padding: 4px 5px; height: 74px; cursor: pointer; border: 1px solid transparent; }
.cal-grid td:hover { border-color: #5b6478; }
.cal-grid td.man { border-left: 3px solid #ffc23d; }
.cal-grid td.fuera, .cal-grid td.pasado { opacity: .45; }
.cal-grid td.hoy { outline: 2px solid #4fc3f7; }
.cal-grid td.sel { border-color: #ffc23d; }
.cal-grid td .num { font-weight: 700; font-size: 13px; display: block; margin-bottom: 2px; }
.cal-grid td .mi { display: block; font-size: 11px; line-height: 1.25; color: #c9cfda; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-grid td.cal-sem { background: #1f2a3a; }
.cal-grid td.cal-sem .mi { white-space: normal; }
.cal-grid td.cal-sem small { color: #ffc23d; }
.cal-editor { margin-top: 10px; background: #232836; border-radius: 10px; padding: 10px 12px; }
.cal-editor h3 { margin: 0 0 6px; font-size: 15px; }
.cal-fila { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 5px 0; }
.cal-fila select, .cal-fila input { padding: 3px 5px; }
.cal-fila .cal-vista { flex-basis: 100%; font-size: 12px; color: #9aa3b2; margin-top: -2px; }

/* v160: secciones del panel en acordeón */
.host-wrap section > h2.acc-h { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; margin: 0; }
.host-wrap section > h2.acc-h::after { content: '▾'; margin-left: auto; font-size: 14px; transition: transform .15s; }
.host-wrap section:not(.cerrada) > h2.acc-h { margin-bottom: 8px; }
.host-wrap section.cerrada > h2.acc-h::after { transform: rotate(-90deg); }
.host-wrap section.cerrada > :not(h2.acc-h) { display: none !important; }
.host-wrap section.cerrada { padding-top: 10px; padding-bottom: 10px; align-self: start; }
.host-wrap section { align-self: start; }
.cal-vista .cal-err, .cal-vista .cal-av { display: block; }
.cal-err { color: #ff8a80; }
.cal-av { color: #ffd54f; }
.cal-msg { margin: 6px 0 0; }
.host-version { margin-left: auto; float: right; font-size: 13px; font-weight: 600; color: #9aa3b2; background: #232836; border-radius: 8px; padding: 4px 10px; }
.cal-grid td.cal-sem .mi.ta { margin-top: 4px; color: #9aa3b2; }
.cal-grid td.cal-sem .mi.ta.man { color: #ffc23d; }
