/* Pantallas táctiles (móvil y tableta) y pantallas pequeñas. Las clases de <html> las pone device.js:
   is-touch, is-mobile, is-portrait / is-landscape; in-fight (touch.js) durante el combate y la pantalla VS.
   En PC sin pantalla táctil nada de esto cambia lo que se ve (salvo las reglas por tamaño de ventana muy pequeña). */

:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }

/* ---------------------------------------------------------------- táctil: general */
.is-touch, .is-touch body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
.is-touch input, .is-touch textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.is-touch img, .is-touch canvas { -webkit-user-drag: none; -webkit-touch-callout: none; }
.is-touch #game { touch-action: manipulation; }
/* Sin zoom por doble toque en ninguna parte (touch-action no se hereda: va en todos los elementos). */
html, body, body * { touch-action: manipulation; }
/* Mejor aún: solo desplazar (ni doble toque ni pellizco). Si el navegador no entiende "pan-x pan-y" se queda
   con manipulation. Las listas desplazables y los controles del combate llevan el suyo más abajo. */
.is-touch, .is-touch body, .is-touch body * { touch-action: pan-x pan-y; }
.is-touch #touch-pad, .is-touch #touch-pad * { touch-action: none; }
.is-touch .screen, .is-touch .board, .is-touch .stats, .is-touch .info-body, .is-touch .pause-moves, .is-touch .pause-box,
.is-touch .snd-pop { overscroll-behavior: contain; }
/* Ayudas de teclado: fuera en táctil */
.is-touch .menu-help, .is-touch [data-i18n^="help."], .is-touch [data-i18n$=".help"], .is-touch .pause-help, .is-touch .snd-hint,
.is-touch .mt-help { display: none !important; }
/* sin efectos de "hover" pegados tras tocar */
@media (hover: none) {
  .is-touch .big-btn:hover { transform: none; }
}

/* ---------------------------------------------------------------- controles del combate */
#touch-pad { position: fixed; inset: 0; z-index: 30; display: none; pointer-events: none; touch-action: none;
  --u: calc(1px * var(--tp-size, 1)); }
#touch-pad.on { display: block; }
.tp-stick { position: absolute; left: 0; bottom: 0; width: 46%; top: 28%; pointer-events: auto; touch-action: none; }
.tp-base { position: absolute; left: calc(var(--sal) + 28px + 64 * var(--u)); top: calc(100% - var(--sab) - 24px - 64 * var(--u));
  width: calc(128 * var(--u)); height: calc(128 * var(--u)); transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,.35) 0 55%, rgba(255,255,255,.06) 56%); border: 3px solid rgba(255,255,255,.35);
  box-shadow: 0 0 0 2px rgba(0,0,0,.6); opacity: var(--tp-op, .55); }
.tp-base.live { opacity: calc(var(--tp-op, .55) + .3); }
.tp-knob { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 12%, #c9d3ee 13% 60%, #6a789e 61%); border: 3px solid #000; will-change: transform; }
.tp-base .ar { position: absolute; width: 0; height: 0; border: 8px solid transparent; opacity: .5; }
.tp-base .ar.u { left: 50%; top: 6px; margin-left: -8px; border-bottom-color: #fff; border-top-width: 0; }
.tp-base .ar.d { left: 50%; bottom: 6px; margin-left: -8px; border-top-color: #fff; border-bottom-width: 0; }
.tp-base .ar.l { top: 50%; left: 6px; margin-top: -8px; border-right-color: #fff; border-left-width: 0; }
.tp-base .ar.r { top: 50%; right: 6px; margin-top: -8px; border-left-color: #fff; border-right-width: 0; }
.tp-base.up .ar.u { border-bottom-color: #ffd84a; opacity: 1; }
.tp-base.down .ar.d { border-top-color: #ffd84a; opacity: 1; }
.tp-base.left .ar.l { border-right-color: #ffd84a; opacity: 1; }
.tp-base.right .ar.r { border-left-color: #ffd84a; opacity: 1; }

.tp-btns { position: absolute; right: calc(var(--sar) + 14px); bottom: calc(var(--sab) + 12px); width: calc(200 * var(--u)); height: calc(226 * var(--u)); pointer-events: none; }
#touch-pad .tb { position: absolute; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; overflow: hidden;
  width: calc(66 * var(--u)); height: calc(66 * var(--u)); background: rgba(10,14,30,.55); border: 3px solid var(--bc, #c9d3ee);
  box-shadow: 0 0 0 2px rgba(0,0,0,.7), inset 0 -5px 0 rgba(0,0,0,.35); opacity: var(--tp-op, .55); pointer-events: auto; touch-action: none;
  color: #fff; text-shadow: 2px 2px 0 #000; font-family: "Press Start 2P", monospace; transition: transform .05s; }
#touch-pad .tb b { font-weight: normal; font-size: calc(16 * var(--u)); color: var(--bc); position: relative; z-index: 1; }
#touch-pad .tb span { font-size: max(7px, calc(6.5 * var(--u))); position: relative; z-index: 1; letter-spacing: -.02em; }
#touch-pad .tb .fill { position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 0%); background: color-mix(in srgb, var(--bc) 35%, transparent); }
#touch-pad .tb:not(.ult):not(.abl) .fill { display: none; }
#touch-pad .tb.on { transform: scale(.9); opacity: 1; background: color-mix(in srgb, var(--bc) 45%, rgba(10,14,30,.6)); }
#touch-pad .tb.light { --bc: #ffd84a; left: 0; bottom: calc(52 * var(--u)); }
#touch-pad .tb.heavy { --bc: #ff7a4a; left: calc(66 * var(--u)); bottom: calc(104 * var(--u)); }
#touch-pad .tb.special { --bc: #7fd0ff; left: calc(132 * var(--u)); bottom: calc(52 * var(--u)); }
#touch-pad .tb.grab { --bc: #5fe08a; left: calc(71 * var(--u)); bottom: 0; width: calc(56 * var(--u)); height: calc(56 * var(--u)); }
#touch-pad .tb.ult, #touch-pad .tb.abl { width: calc(48 * var(--u)); height: calc(48 * var(--u)); }
#touch-pad .tb.ult b, #touch-pad .tb.abl b { font-size: max(8px, calc(8 * var(--u))); }
#touch-pad .tb.u1 { --bc: #5ab4ff; left: 0; bottom: calc(150 * var(--u)); }
#touch-pad .tb.u2 { --bc: #c084fc; left: calc(152 * var(--u)); bottom: calc(150 * var(--u)); }
#touch-pad .tb.abl { --bc: #ffb547; left: calc(75 * var(--u)); bottom: calc(178 * var(--u)); }
#touch-pad .tb.off { opacity: calc(var(--tp-op, .55) * .35); filter: grayscale(1); }
#touch-pad .tb.ready { opacity: 1; border-color: #fff; animation: tp-ready .7s ease-in-out infinite; }
#touch-pad .tb.ready b { color: #fff; }
@keyframes tp-ready { 50% { box-shadow: 0 0 0 2px #000, 0 0 16px var(--bc), inset 0 0 12px var(--bc); } }
/* tableta: algo más grandes */
.is-touch:not(.is-mobile) #touch-pad { --u: calc(1.2px * var(--tp-size, 1)); }

/* salir del online (allí no hay pausa) */
#touch-leave { display: none; position: fixed; z-index: 31; top: calc(var(--sat) + 8px); left: 50%; transform: translateX(-50%) translateY(calc(min(100vh, 56.25vw) * .19));
  width: 44px; height: 36px; font: 14px "Press Start 2P", monospace; color: #fff; background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.45); }
#touch-leave.on { display: block; }
/* pausa en SMASH PIXELS (su marcador va abajo y no tiene el "II" del lienzo): arriba en el centro, fuera del notch */
#touch-pause { display: none; position: fixed; z-index: 31; top: calc(var(--sat) + 6px); left: 50%; transform: translateX(-50%);
  width: 48px; height: 38px; padding: 0; font: 12px "Press Start 2P", monospace; letter-spacing: 2px; color: #fff; background: rgba(10,14,32,.6);
  border: 2px solid rgba(255,255,255,.5); box-shadow: 0 0 0 2px rgba(0,0,0,.6); }
#touch-pause.on { display: block; }
#touch-pause:active { background: #ffd23a; color: #1a1a1a; }

/* aviso de girar el móvil (combate en vertical) */
/* (el aviso de girar el móvil, #touch-rotate, va en el CSS crítico de index.html: tiene que salir antes que nada) */

/* en combate táctil el botón de sonido estorba a los pulgares: fuera (se ajusta desde los menús) */
.is-touch.in-fight .sound-ctl { display: none; }

/* ajustes de los controles (dentro del panel de sonido) */
.tp-set { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid #2d3b66; }
.tp-set h4 { margin: 0; font-weight: normal; font-size: 9px; color: #ffd84a; letter-spacing: 1px; }
.tp-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 8px; font-size: 8px; line-height: 1.4; color: #c9d3ee; }
.tp-row div { display: flex; gap: 4px; margin-left: auto; }
.tp-row button { min-width: 44px; min-height: 44px; padding: 4px 6px; font: 8px "Press Start 2P", monospace; color: #9fb3e6; background: #121a33; border: 2px solid #2d3b66; }
.tp-row button.on { color: #1a1a1a; background: #ffd84a; border-color: #000; }

/* ---------------------------------------------------------------- pantallas: táctil (objetivos de 44 px, zonas seguras) */
.is-touch .back-btn { min-height: 44px; min-width: 44px; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px); }
.is-touch .snd-btn, .is-touch .lang-cur, .is-touch .lang-list button { min-height: 44px; }
.is-touch .snd-row .mute { width: 40px; height: 36px; }
.is-touch .snd-row input[type=range] { height: 32px; }
.is-touch .sound-ctl { right: calc(var(--sar) + 10px); top: calc(var(--sat) + 10px); }
.is-touch body:not([data-shell="menu"]) .sound-ctl { top: auto; bottom: calc(var(--sab) + 10px); }
.is-touch .menu-tools { top: calc(var(--sat) + 10px); right: calc(var(--sar) + 64px); }
.is-touch .screen { padding-left: var(--sal); padding-right: var(--sar); padding-bottom: max(24px, var(--sab)); overflow-x: hidden; }
.is-touch .sub-screen { padding-top: calc(var(--sat) + 72px); }
.is-touch .acc-tabs button, .is-touch .info-tabs button, .is-touch .big-btn, .is-touch .pause-items button { min-height: 44px; }
/* iOS amplía la página al enfocar un campo con letra de menos de 16 px */
.is-touch #acc-form input, .is-touch #onl-join-form input { font-size: 16px; }
.is-touch .board, .is-touch .stats, .is-touch .info-body, .is-touch .pause-moves { -webkit-overflow-scrolling: touch; }
.is-touch .board { overflow-x: auto; }
.is-touch .info-faces img { width: 44px; height: 33px; }
.is-touch #char-cards .card:hover img, .is-touch #char-cards .card:hover canvas { opacity: .78; }
.is-touch #char-cards .card.active img, .is-touch #char-cards .card.active canvas { opacity: 1; }
.is-touch #char-cards .card.is-locked:hover img { opacity: .55; }
.is-touch #char-cards .card.is-locked.active img { opacity: .8; }
.is-touch .sel-lockbar .buy, .is-touch .sel-modal button { min-height: 44px; }

/* ---------------------------------------------------------------- móvil en horizontal (poco alto) */
@media (orientation: landscape) and (max-height: 500px) {
  .menu-head { margin-bottom: 1.2vh; }
  .menu-logo { font-size: clamp(18px, 7.5vh, 40px); }
  .menu-main { width: min(560px, 64vw); gap: 8px; }
  .mgroup { gap: 8px; }
  .menu-main .mbtn { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
  .is-touch .menu-main .mbtn { min-height: 44px; }   /* objetivos de 44 px para el dedo */
  .is-touch #menu .art-pick { display: none; }   /* ACTUAL / RETRO también está en OPCIONES: abajo a la izquierda tapaba el menú */
  .menu-main .mbtn .lbl { font-size: 9px; }
  .menu-main .mbtn.mini, .menu-main .mbtn.mini .lbl { font-size: 8px; }
  .mbtn.hero { padding-top: 8px; padding-bottom: 8px; }
  .mbtn.hero .lbl { font-size: 18px; }
  .mbtn.hero .ico { width: 34px; height: 34px; }
  .menu-foot { margin-top: 10px; }
  /* selección: la rejilla ocupa casi todo el ancho y la mitad de abajo; nombres y skin más compactos */
  #chars { --grid-w: .9; --grid-h: .48; --tile-max: 76; padding-bottom: max(6px, var(--sab)); }
  #chars .sel-head { top: calc(var(--sat) + 8px); }
  #chars .sel-head h2 { font-size: 13px; }
  #chars .sel-head .sub, #chars .sel-dock .blink, #chars .sel-info .ttl { display: none; }
  #chars .sel-band { margin-bottom: 8px; padding: 0 calc(var(--sar) + 14px) 0 calc(var(--sal) + 14px); }
  #chars .sel-info { gap: 4px; }
  #chars .sel-info .bigname { font-size: calc(min(4.4vw, 9vh) * var(--k, 1)); }
  #chars .sel-info .chip, #chars .sel-info .meta { font-size: 7px; }
  #chars .skin-pick { font-size: 7px; padding: 0 .5em; }
  #chars .skin-pick .sk-arr { min-height: 30px; min-width: 30px; }
  /* el nombre, el lema y la categoría a lo ancho; la skin y la barra de bloqueo (sin el texto largo) en la misma fila */
  #chars .sel-info { flex-direction: row; flex-wrap: wrap; align-items: center; align-content: flex-end; }
  #chars .sel-info.p2 { justify-content: flex-end; }
  #chars .sel-info > .chip, #chars .sel-info > .bigname, #chars .sel-info > .meta { flex: 0 0 auto; }
  #chars .sel-info > .bigname, #chars .sel-info > .meta { width: 100%; }
  #chars .sel-info > .chip, #chars .skin-pick .sk-lab, #chars .skin-pick .sk-n { display: none; }   /* J1 / J2 ya lo dicen el título y el cursor */
  #chars .sel-lockbar { font-size: 7px; padding: 3px 4px 3px 8px; gap: 6px; max-width: 47vw; flex-wrap: nowrap; }
  #chars .sel-lockbar .tx { display: none; }
  #chars .sel-lockbar .tx:only-child { display: block; }
  #chars .sel-lockbar .buy { min-height: 30px; padding: .4em .8em; }
  .sub-screen { gap: 12px; padding-top: calc(var(--sat) + 62px); }
  .sub-screen h2 { font-size: 16px; padding-bottom: 10px; }
  .board, .stats, .info-body { max-height: none; }
  .pause-box { max-height: calc(100vh - 16px); }
  .pause-left { overflow-y: auto; }
  .pause-left h2 { font-size: 16px; }
  .pause-items { gap: 6px; }
  .pause-items button { padding: 8px 10px; }
  .pause-items button.primary { padding: 10px; }
  .pause-items button.danger { margin-top: 4px; }
}

/* ---------------------------------------------------------------- móvil en vertical (estrecho) */
@media (max-width: 600px) and (orientation: portrait) {
  #menu { padding-top: calc(var(--sat) + 62px); }
  .menu-logo { font-size: min(6.6vw, 44px); }
  .menu-main { width: calc(100vw - 32px); }
  .menu-main .mbtn { min-height: 52px; }
  .menu-main .mbtn .lbl { font-size: 10px; }
  .menu-main .mbtn small { font-size: 7px; }
  .menu-main .mbtn.mini, .menu-main .mbtn.mini .lbl { font-size: 8px; }
  .ticker { white-space: normal; text-align: center; line-height: 1.8; max-width: 92vw; padding: 7px 12px; }
  .sub-screen h2 { font-size: 15px; max-width: 70vw; }
  .acc-box { width: calc(100vw - 24px); padding: 16px 14px; }
  .board table { font-size: 8px; }
  .board th, .board td { padding: 6px 4px; }
  .stats { padding: 10px 12px; width: calc(100vw - 20px); }
  .stats .grid { grid-template-columns: 1fr; }
  .stats .match { flex-wrap: wrap; }
  .info-body { width: calc(100vw - 20px); padding: 12px 12px; max-height: none; }
  .info-tabs { flex-wrap: wrap; justify-content: center; padding: 0 8px; }
  .info-tabs button { font-size: 8px; padding: 9px 10px; }
  .controls { grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px; font-size: 8px; }
  .controls > :nth-child(3n) { display: none; }   /* columna de J2 (teclado): fuera */
  .moves { grid-template-columns: 1fr; gap: 2px; }
  .moves .in { margin-top: 6px; }
  .char-head .nm { font-size: 14px; }
  /* selección: rejilla más grande abajo, ilustración arriba */
  #chars { --grid-w: .94; --grid-h: .36; --tile-max: 64; }
  #chars .sel-head { top: calc(var(--sat) + 62px); }
  #chars .sel-head h2 { font-size: 12px; }
  #chars .sel-head .sub { display: none; }
  .sel-band { padding: 0 12px; }
  .sel-info .bigname { font-size: calc(min(9vw, 6vh) * var(--k, 1)); }
  .sel-info { max-width: 92vw; }
  .sel-bg.p1, .sel-bg.p2 { clip-path: none; }
  .sel-bg.p2.on ~ .sel-bg.p1 { opacity: .25; }
  .sel-band { flex-direction: column; align-items: stretch; }
  .sel-info.p1:not(.ready), .sel-info.p2 { max-width: 92vw; }
  .sel-info.ready { display: none; }
  .sel-lockbar { padding: 6px 10px; gap: 8px; max-width: 92vw; }
  .sel-modal .box { max-width: 92vw; padding: 20px 14px; }
  #stages { padding-top: calc(var(--sat) + 64px); }
  .st-big { width: 92vw; }
  #stage-cards .card { width: 28vw; }
  .st-name { font-size: calc(9vw * var(--k)); }
  .pause-box { flex-direction: column; width: 94vw; max-height: 92vh; overflow-y: auto; }
  .pause-left { width: 100%; }
  .pause-moves { max-height: 40vh; flex: none; }
}

/* ---------------------------------------------------------------- tableta en vertical */
@media (min-width: 601px) and (orientation: portrait) {
  .menu-main { width: min(560px, 80vw); }
  .menu-main .mbtn .lbl { font-size: 12px; }
  .menu-main .mbtn small { font-size: 8px; }
  #chars { --grid-w: .92; --grid-h: .34; }
  .st-big { width: 84vw; }
  #stage-cards .card { width: 20vw; }
  .pause-box { flex-direction: column; max-height: 92vh; }
  .pause-left { width: 100%; }
  .pause-moves { max-height: 46vh; }
}

/* Controles e info: la fila de caras solo ocupa sitio en la pestaña de personajes (en pantallas estrechas ocupa varias filas) */
@media (max-width: 900px) { .info-faces[style*="hidden"] { display: none; } }
@media (max-width: 600px) and (orientation: portrait) { #stages { justify-content: flex-start; } }

/* ---------------------------------------------------------------- ajustes finales del menú en móvil
   Horizontal: todo en una pantalla (modos en una fila de 4, configuración en una fila de 4, sin subtítulos).
   Vertical: los textos largos parten en dos líneas en vez de cortarse con "…". */
@media (orientation: landscape) and (max-height: 500px) {
  #menu { padding-top: calc(var(--sat, 0px) + 8px); }
  .menu-head { margin-bottom: 4px; }
  .menu-logo { font-size: clamp(16px, 6.5vh, 30px); }
  .menu-main { width: min(720px, 70vw); gap: 6px; }
  .mgroup { gap: 6px; }
  .mgroup.modes, .mgroup.config { grid-template-columns: repeat(4, 1fr); }
  .mgroup.modes.three { grid-template-columns: repeat(3, 1fr); }
  .menu-main .mbtn { min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
  .menu-main .mbtn small { display: none; }
  .menu-main .mbtn .lbl { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.5; letter-spacing: .04em; font-size: 8px; }
  .mbtn.hero { min-height: 48px; }
  .mbtn.hero .lbl { font-size: 16px; }
  .mbtn.hero .ico { width: 28px; height: 28px; }
  .menu-main .mbtn .ico { width: 22px; height: 22px; flex: none; }
  .menu-foot { margin-top: 4px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .menu-main .mbtn .lbl, .menu-main .mbtn small { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.6; letter-spacing: .04em; }
  .menu-main .mbtn .lbl { font-size: 9px; }
  .menu-main .mbtn small { font-size: 6px; }
  .menu-main .mbtn { min-height: 56px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .mgroup.modes .mbtn .ico, .mgroup.config .mbtn .ico { display: none; }
  .mgroup.modes .mbtn, .mgroup.config .mbtn { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding-left: 4px; padding-right: 4px; column-gap: 0; }
  .mgroup.modes .mbtn .lbl, .mgroup.config .mbtn .lbl { font-size: 7px; letter-spacing: 0; overflow-wrap: anywhere; }
}

/* ================================================================ móvil pulido
   Controles para zurdos, pausa con ajustes y leyenda, ayuda táctil en "Controles e info", menú en horizontal
   a dos columnas, cabeceras compactas y zonas seguras (notch). */

/* ---- controles del combate: para zurdos (joystick a la derecha, botones a la izquierda) */
#touch-pad.lefty .tp-stick { left: auto; right: 0; }
#touch-pad.lefty .tp-base { left: calc(100% - var(--sar) - 28px - 64 * var(--u)); }
#touch-pad.lefty .tp-btns { right: auto; left: calc(var(--sal) + 14px); }
/* pulsado: que se note bajo el dedo */
#touch-pad .tb.on { box-shadow: 0 0 0 2px #000, 0 0 14px var(--bc), inset 0 0 10px color-mix(in srgb, var(--bc) 60%, transparent); }
#touch-pad .tb.on b, #touch-pad .tb.on span { color: #fff; }
/* teléfonos muy bajos (≤ 360 px de alto en horizontal): botones algo más pequeños para no tapar a los luchadores */
/* En móviles bajos el tamaño XL / L se limita: si no, la fila de definitivas taparía las barras del HUD. */
@media (orientation: landscape) and (max-height: 430px) { .is-mobile #touch-pad { --u: calc(1px * min(var(--tp-size, 1), 1.12)); } }
@media (orientation: landscape) and (max-height: 360px) { .is-mobile #touch-pad { --u: calc(.88px * min(var(--tp-size, 1), 1.05)); } }

/* ---- botón de sonido / ajustes en la pausa (en combate no se ve: estorba a los pulgares) */
.is-touch.in-fight.tp-paused .sound-ctl { display: block; opacity: 1; top: calc(var(--sat) + 8px); bottom: auto; right: calc(var(--sar) + 8px); left: auto; }
.is-touch.tp-paused .snd-pop { top: calc(100% + 8px); bottom: auto; }
.is-touch .snd-pop { max-height: calc(var(--app-h, 100vh) - var(--sat) - var(--sab) - 70px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.is-touch .snd-btn { min-width: 44px; }
/* en las pantallas secundarias del móvil el botón de sonido tapaba el contenido de abajo: solo en menú y pausa */
.is-mobile body[data-shell="other"] .sound-ctl { display: none; }

/* ---- pausa táctil */
.is-touch #pause { padding: var(--sat) var(--sar) var(--sab) var(--sal); box-sizing: border-box; }
.is-touch .pause-items button { min-height: 44px; font-size: 10px; }
.tp-legend { display: none; }
.is-touch .tp-legend { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(10,14,32,.85); border: 2px solid #2d3b66; font-family: "Press Start 2P", monospace; }
.tp-legend h4 { margin: 0; font-weight: normal; font-size: 8px; color: #ffd84a; letter-spacing: 1px; }
.tp-legend .tp-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px 10px; }
.tp-legend .tp-keys span { display: flex; align-items: center; gap: 6px; font-size: 8px; color: #c9d3ee; white-space: nowrap; }
.tp-legend .kk { font-style: normal; color: #fff; min-width: 14px; }
.tp-legend p { margin: 0; font-size: 7px; line-height: 1.7; color: #9fb3e6; }
/* fichas con el color de cada botón táctil (pausa y ayuda) */
.tp-chip { --bc: #c9d3ee; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; border-radius: 11px;
  font-weight: normal; font-size: 8px; color: var(--bc); background: rgba(10,14,30,.7); border: 2px solid var(--bc); box-shadow: 0 0 0 1px #000; white-space: nowrap; }
.tp-chip.light { --bc: #ffd84a; } .tp-chip.heavy { --bc: #ff7a4a; } .tp-chip.special { --bc: #7fd0ff; } .tp-chip.grab { --bc: #5fe08a; }
.tp-chip.u1 { --bc: #5ab4ff; } .tp-chip.u2 { --bc: #c084fc; } .tp-chip.abl { --bc: #ffb547; } .tp-chip.stick { --bc: #e6ebff; } .tp-chip.pause { --bc: #e6ebff; border-radius: 3px; }
@media (orientation: landscape) and (max-height: 500px) {
  .is-touch .pause-box { height: calc(var(--app-h, 100vh) - var(--sat) - var(--sab) - 16px); max-height: none; width: calc(100vw - var(--sal) - var(--sar) - 20px); gap: 12px; }
  .is-touch .pause-left { width: min(300px, 38vw); overflow-y: auto; gap: 8px; padding: 2px 4px 2px 2px; }
  .is-touch .pause-left h2 { font-size: 16px; line-height: 1.3; padding-top: 2px; }
  .is-touch .pause-items button { padding: 8px 10px; font-size: 9px; }
  .is-touch .pause-items button.primary { font-size: 12px; }
  .is-touch .pause-moves { padding: 10px 56px 10px 12px; }   /* a la derecha, el botón de ajustes */
}

/* ---- "Controles e info": controles táctiles en vez de la tabla del teclado */
.tp-help { display: none; }
.is-touch .tp-help { display: flex; flex-direction: column; gap: 10px; }
.is-touch #info section[data-page="controles"] .controls, .is-touch #info section[data-page="controles"] .info-note { display: none; }
.tp-help h3 { margin: 0 0 4px; font-weight: normal; font-size: 11px; color: #ffd84a; letter-spacing: 1px; }
.tp-hrow { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 8px; line-height: 1.7; color: #e6ebff; }
.tp-hc { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.tp-chip .k { font-size: 12px; line-height: 1; vertical-align: 0; color: inherit; }
.tp-chip.knob { width: 26px; height: 26px; border-radius: 50%; }
.tp-chip.knob::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 15%, #c9d3ee 16% 60%, #6a789e 61%); box-shadow: 0 0 0 1px #000; }
.tp-help .tp-tip { margin: 6px 0 0; font-size: 8px; line-height: 1.8; color: #9fb3e6; }

/* ---- pantallas secundarias: la cabecera no se mete bajo el botón VOLVER ni bajo el notch */
.is-touch #board { padding-top: calc(var(--sat) + 66px); }
.is-touch .sub-screen > h2 { max-width: calc(100vw - 2 * var(--sal) - 24px); overflow-wrap: anywhere; }
.is-touch .sub-screen > h2::after { width: 100%; }   /* al 120 % se salía de la pantalla (scroll lateral) */
@media (orientation: landscape) and (max-height: 500px) {
  /* el título va en la misma fila que VOLVER: se gana el alto que falta */
  .is-touch .sub-screen, .is-touch #board { padding-top: calc(var(--sat) + 12px); gap: 10px; }
  .is-touch .sub-screen > h2, .is-touch #board > h2 { font-size: 14px; letter-spacing: 2px; min-height: 36px; display: flex; align-items: center;
    justify-content: center; max-width: calc(100vw - 2 * (var(--sal) + 150px)); padding-bottom: 8px; text-align: center; }
  .is-touch .info-tabs button { padding-top: 8px; padding-bottom: 8px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .is-touch .sub-screen > h2, .is-touch #board > h2 { font-size: 14px; letter-spacing: 2px; }
}

/* ---- menú principal en horizontal (móvil): panel del jugador a la izquierda y botones a la derecha */
@media (orientation: landscape) and (max-height: 500px) {
  .is-touch #menu { --pw: clamp(186px, 27vw, 250px); --side: calc(var(--sal) + var(--pw) + 22px);
    padding: calc(var(--sat) + 14px) calc(var(--sar) + 10px) calc(var(--sab) + 30px) var(--side); overflow-y: auto; pointer-events: auto; }
  .is-touch #menu .menu-main { width: min(600px, calc(100vw - var(--side) - var(--sar) - 20px)); }
  .is-touch #menu .menu-head { margin-bottom: 8px; }
  .is-touch #menu .menu-logo { font-size: clamp(16px, 6.4vh, 28px); }
  .is-touch #menu .mbtn.hero { min-height: 50px; padding-top: 6px; padding-bottom: 6px; }
  .is-touch #menu .mbtn.hero .lbl { font-size: 16px; }
  .is-touch #menu .mbtn.hero small { display: block; font-size: 7px; }
  .is-touch #menu .mgroup.meta2 .mbtn { min-height: 44px; }
  .is-touch #menu .mbtn.mini { min-height: 44px; }
  .is-touch #menu .score-panel { position: absolute; order: 0; margin: 0; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px);
    width: var(--pw); max-height: calc(var(--app-h, 100vh) - var(--sat) - var(--sab) - 20px); overflow-y: auto; padding: 9px; gap: 8px; }
  .is-touch #menu .score-panel .pc-res { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch #menu .score-panel .pc-ava { width: 48px; }
  .is-touch #menu .score-panel .pc-rank .rk b { font-size: 7px; letter-spacing: 0; }
  .is-touch #menu .score-panel .pc-rank .login { padding: 8px 6px; min-height: 36px; }
  /* idioma y sonido abajo a la izquierda, bajo el panel (arriba chocaban con el logo y JUGAR); abren hacia arriba */
  .is-touch #menu .menu-tools { top: auto; bottom: calc(var(--sab) + 10px); left: calc(var(--sal) + 62px); right: auto; }
  .is-touch #menu .lang-list { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
  .is-touch body[data-shell="menu"] .sound-ctl { top: auto; bottom: calc(var(--sab) + 10px); left: calc(var(--sal) + 10px); right: auto; }
  .is-touch body[data-shell="menu"] .snd-pop { top: auto; bottom: calc(100% + 10px); left: 0; right: auto; }
  .is-touch #menu .score-panel { max-height: calc(var(--app-h, 100vh) - var(--sat) - var(--sab) - 76px); }
  .is-touch #menu .menu-foot { left: calc(var(--side) + (100vw - var(--side) - var(--sar)) / 2); bottom: calc(var(--sab) + 4px); max-width: calc(100vw - var(--side) - 10px); }
  .is-touch #menu .ticker { padding: 5px 16px; font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; box-sizing: border-box; }
}
/* vertical: nada bajo la barra de gestos */
@media (max-width: 600px) and (orientation: portrait) {
  .is-touch #menu { padding-bottom: calc(var(--sab) + 18px); }
}
/* 320-360 px: sin iconos en las rejillas de dos columnas, para que ENTRENAMIENTO o CLASIFICACION quepan enteros */
@media (max-width: 360px) and (orientation: portrait) {
  .is-touch #menu .menu-main { width: calc(100vw - 24px - var(--sal) - var(--sar)); }
  .is-touch #menu .mgroup .mbtn .ico { display: none; }
  .is-touch #menu .mgroup .mbtn { grid-template-columns: minmax(0, 1fr); padding-left: 8px; padding-right: 8px; }
  .is-touch #menu .mgroup .mbtn .lbl { font-size: 8px; letter-spacing: 0; }
  .is-touch #menu .mgroup .mbtn small { font-size: 6px; }
  .is-touch #menu .menu-logo { font-size: 6.2vw; letter-spacing: 0; }
}

/* ---- botones: respuesta inmediata al tocar (sin hover, que en táctil se queda pegado) */
@media (hover: none) {
  .is-touch .mbtn:hover:not(.sel) { transform: none; }
  .is-touch .mbtn:active, .is-touch .big-btn:active, .is-touch .back-btn:active, .is-touch .pause-items button:active, .is-touch .tp-row button:active {
    transform: translateY(2px) scale(.98); filter: brightness(1.2); transition: none; }
}

/* ---------------------------------------------------------------- controles táctiles: distribución en rombo
   Los 4 botones principales en rombo (como un mando: F arriba, L izquierda, E derecha, A abajo) sin solaparse, y
   las definitivas y la aptitud en pequeño encima. Más pequeños y transparentes para no tapar a los luchadores. */
#touch-pad { --u: calc(.86px * var(--tp-size, 1)); }
.is-touch:not(.is-mobile) #touch-pad { --u: calc(1.05px * var(--tp-size, 1)); }
.tp-btns { width: calc(200 * var(--u)); height: calc(242 * var(--u)); }
#touch-pad .tb { width: calc(60 * var(--u)); height: calc(60 * var(--u)); background: rgba(10,14,30,.42); border-width: 2px; }
#touch-pad .tb.grab { left: calc(70 * var(--u)); bottom: 0; width: calc(60 * var(--u)); height: calc(60 * var(--u)); }
#touch-pad .tb.light { left: 0; bottom: calc(66 * var(--u)); }
#touch-pad .tb.special { left: calc(140 * var(--u)); bottom: calc(66 * var(--u)); }
#touch-pad .tb.heavy { left: calc(70 * var(--u)); bottom: calc(132 * var(--u)); }
#touch-pad .tb.ult, #touch-pad .tb.abl { width: calc(42 * var(--u)); height: calc(42 * var(--u)); }
#touch-pad .tb.u1 { left: calc(4 * var(--u)); bottom: calc(162 * var(--u)); }
#touch-pad .tb.u2 { left: calc(154 * var(--u)); bottom: calc(162 * var(--u)); }
#touch-pad .tb.abl { left: calc(79 * var(--u)); bottom: calc(200 * var(--u)); }
#touch-pad .tb span { font-size: max(6px, calc(5.5 * var(--u))); }
#touch-pad .tb b { font-size: calc(15 * var(--u)); }
.tp-base { width: calc(118 * var(--u)) !important; height: calc(118 * var(--u)) !important; }

/* ---------------------------------------------------------------- menú en móvil horizontal: más compacto
   Todo cabe sin desplazar: botones más bajos, configuración en 3 columnas y las herramientas (estética, idioma,
   sonido) en una fila bajo el panel del jugador. */
@media (orientation: landscape) and (max-height: 500px) {
  .menu-main { gap: 5px !important; }
  .menu-main .mbtn { min-height: 34px !important; padding-top: 3px !important; padding-bottom: 3px !important; }
  .menu-main .mbtn.hero { min-height: 40px !important; }
  .menu-main .mbtn.hero .lbl { font-size: 14px !important; }
  .menu-main .mbtn.feat { min-height: 40px !important; }
  .menu-main .mbtn.feat .lbl { font-size: 10px !important; }
  .mgroup.config { grid-template-columns: repeat(3, 1fr) !important; }
  .is-touch .menu-tools { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px; }
  .menu-logo { font-size: clamp(14px, 5.5vh, 24px) !important; }
}

/* ================================================================ selección de luchador en móvil
   La rejilla de ~60 retratos no cabe en pantalla: va en un cuadro con scroll vertical (todos alcanzables, retratos
   grandes para el dedo) y la cabecera / nombre / skin quedan fijos encima, sin taparse. */
.is-touch #char-cards > * { flex: none; }
.is-touch #char-cards { justify-content: flex-start; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; box-sizing: border-box; }
@media (orientation: landscape) and (max-height: 500px) {
  .is-touch #chars { --tile: 64px; --dock: 0px; }
  .is-touch #chars .sel-art { display: none; }
  .is-touch #chars .sel-head { top: calc(var(--sat, 0px) + 6px); }
  .is-touch #chars .sel-head h2 { font-size: 11px; }
  .is-touch .sel-band { padding: 0 max(12px, var(--sar, 0px)) 0 max(136px, calc(var(--sal, 0px) + 136px)); margin-bottom: 2px; }   /* a la derecha del botón VOLVER */
  .is-touch .sel-info { gap: 3px; max-width: 44vw; }
  .is-touch .sel-info .bigname { font-size: calc(min(5.6vw, 9.4vh, 24px) * var(--k, 1)); }
  .is-touch .sel-info .chip, .is-touch .sel-info .meta, .is-touch .skin-pick { font-size: 7px; }
  .is-touch .sel-dock { gap: 2px; padding-bottom: calc(var(--sab, 0px) + 2px); }
  .is-touch .sel-lockbar { min-height: 26px; font-size: 7px; }
  .is-touch #char-cards { max-height: calc(var(--app-h, 100vh) - 146px); padding: 8px max(10px, var(--sar, 0px)) 8px max(10px, var(--sal, 0px)); }
  .is-touch #char-cards .sel-top { gap: 10px 14px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .is-touch #chars { --tile: min(15vw, 64px); --dock: 0px; }
  .is-touch #chars .sel-art { display: none; }
  .is-touch #chars .sel-head { top: calc(var(--sat, 0px) + 10px); left: 64px; right: 64px; }
  .is-touch .sel-band { margin-bottom: 4px; }
  .is-touch .sel-info .bigname { font-size: calc(min(8vw, 5vh) * var(--k, 1)); }
  .is-touch #char-cards { max-height: calc(var(--app-h, 100vh) - 210px); padding: 8px 0; }
}
/* menú: en horizontal estrecho (667) el botón INICIAR SESIÓN tapaba el texto de rango; en vertical el selector de idioma tapaba el logo */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 760px) {
  .is-touch .pc-rank { flex-wrap: wrap; gap: 4px; }
  .is-touch .pc-rank .login { flex: 1 1 100%; min-width: 0; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .is-touch #menu { padding-top: calc(var(--sat, 0px) + 92px); }
}
/* Barra de desplazamiento de la rejilla de personajes: fina y del estilo del juego (no la blanca del sistema). */
.is-touch #char-cards { scrollbar-width: thin; scrollbar-color: #ffd84a rgba(0,0,0,.35); }
.is-touch #char-cards::-webkit-scrollbar { width: 6px; }
.is-touch #char-cards::-webkit-scrollbar-track { background: rgba(0,0,0,.35); }
.is-touch #char-cards::-webkit-scrollbar-thumb { background: #ffd84a; border-radius: 3px; }

/* Tutorial de /play (welcome.js): el botón (o el joystick) que toca usar brilla y late */
#touch-pad .tb.tut { opacity: 1; animation: tp-tut .7s ease-in-out infinite alternate; z-index: 2;
  box-shadow: 0 0 0 3px #fff, 0 0 18px 6px var(--bc); }
@keyframes tp-tut { from { transform: scale(1); } to { transform: scale(1.14); } }
#touch-pad .tp-stick.tut .tp-base { opacity: 1; border-color: #ffd84a; animation: tp-tut-glow .7s ease-in-out infinite alternate; }
#touch-pad .tp-stick.tut .tp-base .ar { opacity: 1; }
@keyframes tp-tut-glow { from { box-shadow: 0 0 0 2px rgba(0,0,0,.6), 0 0 6px 2px rgba(255,216,74,.4); } to { box-shadow: 0 0 0 4px #fff, 0 0 22px 8px rgba(255,216,74,.7); } }

/* tableta en horizontal (táctil, no móvil): el menú era demasiado estrecho y cortaba los textos (PASE DE BAT…) */
@media (min-width: 900px) and (max-width: 1300px) and (orientation: landscape) {
  .is-touch:not(.is-mobile) .menu-main { width: min(520px, 48vw); }
}

/* ---------------------------------------------------------------- mando de pelea (rediseño)
   Joystick a la izquierda; a la derecha botones redondos grandes (hasta 72 px, 14,5 vh) en rejilla de 2 columnas, cada
   uno con su color y la PALABRA de la acción, pegados al borde con las zonas seguras. De abajo arriba: LIGERO | FUERTE,
   ESPECIAL | AGARRE, DEF 1 | DEF 2 (algo más pequeños) y APT. Pulsado: se hunde, se enciende y brilla. */
#touch-pad { --bs: calc(max(58px, min(72px, 14.5vh)) * var(--tp-size, 1)); }
/* en móviles bajos el tamaño XL / L se limita (si no, los botones taparían el HUD del rival) */
@media (orientation: landscape) and (max-height: 430px) { #touch-pad { --bs: calc(max(58px, min(72px, 14.5vh)) * min(var(--tp-size, 1), 1.12)); } }
@media (orientation: landscape) and (max-height: 360px) { #touch-pad { --bs: calc(max(58px, min(72px, 14.5vh)) * min(var(--tp-size, 1), 1.05)); } }
#touch-pad .tp-btns { right: calc(var(--sar) + 6px); bottom: calc(var(--sab) + 6px); width: auto; height: auto; display: grid;
  grid-template-columns: repeat(2, var(--bs)); grid-template-rows: repeat(4, auto); gap: calc(var(--bs) * .09); justify-items: center; align-items: center; }
#touch-pad.lefty .tp-btns { right: auto; left: calc(var(--sal) + 6px); }
#touch-pad .tp-btns .tb { position: relative; left: auto; bottom: auto; width: var(--bs); height: var(--bs); border-width: 4px; min-width: 0;
  /* pixel: colores planos, sombra y luz a saltos (sin degradados ni desenfoques) */
  background: color-mix(in srgb, var(--bc) 38%, #0a0e1e); border-color: var(--bc); opacity: calc(var(--tp-op, .55) + .25);
  box-shadow: 0 0 0 3px #05060c, inset 0 -6px 0 rgba(0,0,0,.45), inset 0 6px 0 rgba(255,255,255,.2); }
#touch-pad .tp-btns .tb b { font-size: calc(var(--bs) * .115); color: #fff; letter-spacing: -.03em; text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 2px 2px 0 #000; max-width: 94%; text-align: center; line-height: 1.15; }
/* pulsado: baja un escalón, se llena del color y gana un aro duro (sin brillo difuminado) */
#touch-pad .tp-btns .tb.on { transform: translateY(4px); opacity: 1; background: var(--bc); border-color: #fff;
  box-shadow: 0 0 0 3px #05060c, 0 0 0 7px var(--bc), inset 0 4px 0 rgba(0,0,0,.35); }
#touch-pad .tp-btns .tb.on b { color: #fff; }
#touch-pad .tp-btns .tb.light { --bc: #ffcf2e; grid-area: 4 / 1; }
#touch-pad .tp-btns .tb.heavy { --bc: #ff6a3a; grid-area: 4 / 2; }
#touch-pad .tp-btns .tb.special { --bc: #3fb0ff; grid-area: 3 / 1; }
#touch-pad .tp-btns .tb.grab { --bc: #46d684; grid-area: 3 / 2; }
#touch-pad .tp-btns .tb.u1 { --bc: #4a8cff; grid-area: 2 / 1; }
#touch-pad .tp-btns .tb.u2 { --bc: #b46cff; grid-area: 2 / 2; }
#touch-pad .tp-btns .tb.abl { --bc: #ff9a2e; grid-area: 1 / 2; }
#touch-pad .tp-btns .tb.ult, #touch-pad .tp-btns .tb.abl { width: calc(var(--bs) * .72); height: calc(var(--bs) * .72); }
#touch-pad .tp-btns .tb.ult b, #touch-pad .tp-btns .tb.abl b { font-size: calc(var(--bs) * .125); }
#touch-pad .tp-btns .tb.off { opacity: calc(var(--tp-op, .55) * .4); }
#touch-pad .tp-btns .tb.ready { opacity: 1; border-color: #fff; }
#touch-pad .tp-btns .tb.tut { opacity: 1; }
/* esquinas: atrás, sonido y pantalla completa de 44 px para el pulgar; en pelea se apartan (sonido solo en pausa) */
.is-touch .back-btn, .is-touch .snd-btn { min-width: 44px; min-height: 44px; }

/* ---------------------------------------------------------------- aviso de iPhone / iPad (device.js, #ios-hint)
   Safari de iOS no deja poner la web a pantalla completa: se explica cómo añadirla a la pantalla de inicio. */
#ios-hint { position: fixed; z-index: 260; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; pointer-events: none;
  padding: 0 max(12px, var(--sar)) max(12px, var(--sab)) max(12px, var(--sal)); animation: ih-in .35s steps(4) both; }
#ios-hint .ih-card { pointer-events: auto; display: flex; gap: 14px; align-items: flex-start; width: min(560px, 100%); box-sizing: border-box;
  padding: 14px 16px; background: #141a2e; border: 3px solid #ffd23a; box-shadow: 0 6px 0 #000, 0 0 0 3px #000; color: #f4ecd8; }
#ios-hint .ih-ico { flex: none; width: 48px; height: 48px; image-rendering: pixelated; border: 2px solid #000; }
#ios-hint .ih-body { min-width: 0; flex: 1; }
#ios-hint b { display: block; font-weight: normal; font-size: 11px; color: #ffd23a; letter-spacing: 1px; line-height: 1.5; }
#ios-hint p { margin: 6px 0 8px; font-size: 8px; line-height: 1.8; color: #c9d6f6; }
#ios-hint ol { margin: 0 0 10px; padding-left: 18px; font-size: 8px; line-height: 2.1; }
#ios-hint li small { color: #9fb3e6; font-size: 7px; }
#ios-hint .ih-share { width: 14px; height: 16px; vertical-align: -4px; margin: 0 2px; color: #7fd0ff; }
#ios-hint .ih-btns { display: flex; gap: 10px; flex-wrap: wrap; }
#ios-hint button { font: inherit; font-size: 9px; min-height: 44px; padding: 0 14px; border: 3px solid #000; cursor: pointer; }
#ios-hint .ih-ok { background: #ffd23a; color: #1a1200; box-shadow: 0 4px 0 #8a6a00; }
#ios-hint .ih-never { background: transparent; color: #9fb3e6; border-color: #3a4670; }
@keyframes ih-in { from { transform: translateY(100%); } to { transform: none; } }
/* en horizontal (poco alto): más compacto, sin el icono */
@media (max-height: 460px) {
  #ios-hint .ih-card { padding: 10px 12px; width: min(680px, 100%); }
  #ios-hint .ih-ico { display: none; }
  #ios-hint p { margin: 4px 0 4px; }
  #ios-hint ol { display: flex; flex-wrap: wrap; gap: 2px 18px; padding-left: 0; margin-bottom: 6px; list-style-position: inside; }
  #ios-hint button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { #ios-hint { animation: none; } }

/* ---------------------------------------------------------------- tableta: combate
   El lienzo (16:9) va arriba y el mando aprovecha lo que sobra debajo. En horizontal (1024x768, 1366x1024...) la banda
   de abajo crece y los botones apenas pisan el escenario; en VERTICAL ahora se juega (antes salía "GIRA EL MÓVIL" y
   con el bloqueo de giro del iPad no había forma de pelear): lienzo a lo ancho arriba y un mando grande debajo. */
.is-touch:not(.is-mobile).in-fight #wrap { align-items: flex-start; padding-top: var(--sat); box-sizing: border-box; }
.is-touch:not(.is-mobile).is-portrait #touch-pad { --u: calc(1.7px * var(--tp-size, 1)); --bs: calc(min(112px, 13.5vw) * var(--tp-size, 1)); }
.is-touch:not(.is-mobile).is-portrait #touch-pad .tp-stick { top: calc(var(--sat) + 56.25vw + 12px); width: 50%; }
.is-touch:not(.is-mobile).is-portrait #touch-pad .tp-base { left: calc(var(--sal) + 40px + 64 * var(--u)); top: 58%; }
.is-touch:not(.is-mobile).is-portrait #touch-pad.lefty .tp-base { left: calc(100% - var(--sar) - 40px - 64 * var(--u)); }
.is-touch:not(.is-mobile).is-portrait #touch-pad .tp-btns { right: calc(var(--sar) + 24px); bottom: calc(var(--sab) + 32px); }
.is-touch:not(.is-mobile).is-portrait #touch-pad.lefty .tp-btns { right: auto; left: calc(var(--sal) + 24px); }
/* (el botón de salir del online se coloca respecto al lienzo, que ahora empieza arriba) */
.is-touch:not(.is-mobile).is-portrait #touch-leave { transform: translateX(-50%) translateY(calc(56.25vw * .19)); }

/* ---------------------------------------------------------------- cola del ranked en táctil
   Botón CANCELAR abajo en el centro (el lienzo ya no pone "ESC CANCELAR"); arriba a la izquierda tapaba la ficha de la liga. */
.is-touch #queue-back.tp-cancel { top: auto; bottom: calc(var(--sab) + 8px); left: 50%; transform: translateX(-50%); min-height: 44px; padding: 0 18px; white-space: nowrap; }
.is-touch #queue-back.tp-cancel:active { transform: translateX(-50%) translateY(2px); }

/* ================================================================ MENÚ PRINCIPAL en móvil apaisado (rediseño de la distribución)
   Dos columnas sin solapes: a la izquierda la identidad (logo pequeño y panel del jugador; debajo quedan libres los
   luchadores de la escena) y a la derecha una rejilla limpia de botones de 44-50 px para el pulgar:
     JUGAR (grande) + sonido e idioma | RANKED · SMASH · 2 VS 2 · TORNEO | ARCADE · ENTRENAMIENTO · AMIGO
     PASE · TIENDA · MISIONES · PELEA DEL DÍA | CPU · CLASIFICACIÓN · ESTADÍSTICAS / INFO · OPCIONES · FEEDBACK
   El logo ya no queda bajo la luna (está a la derecha del cielo), las insignias van dentro de su botón y sonido e
   idioma ya no tapan a los luchadores. Va al final de touch.css (y con html.is-touch) para mandar sobre las capas de
   antes, algunas con !important. En escritorio y tableta no cambia nada. */
@media (orientation: landscape) and (max-height: 500px) {
  html.is-touch #menu { --pw: clamp(184px, 25vw, 250px); --side: calc(var(--sal) + var(--pw) + 22px); --gap: 6px;
    --row: clamp(44px, calc((var(--app-h, 100vh) - var(--sat) - var(--sab) - 78px) / 6), 50px);
    padding: calc(var(--sat) + 8px) calc(var(--sar) + 12px) calc(var(--sab) + 24px) var(--side); justify-content: flex-start; overflow-y: auto; }
  html.is-touch #menu .menu-main { width: auto !important; max-width: 760px; align-self: stretch; gap: var(--gap) !important; margin: 0 auto 0 0; }
  html.is-touch #menu .mgroup { gap: var(--gap) !important; }
  /* logo: arriba a la izquierda, sobre el panel (a lo ancho de la columna) */
  html.is-touch #menu .menu-head { position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px); width: var(--pw); margin: 0; align-items: center; }
  html.is-touch #menu .menu-logo { font-size: calc(var(--pw) / 15) !important; letter-spacing: 0; white-space: nowrap; }
  html.is-touch #menu .score-panel { top: calc(var(--sat) + 22px + var(--pw) / 15); max-height: calc(var(--app-h, 100vh) - var(--sat) - var(--sab) - 40px - var(--pw) / 15); }
  /* JUGAR: la fila de arriba, con sonido e idioma a su derecha */
  html.is-touch #menu .mbtn.hero { min-height: var(--row) !important; margin-right: 140px; padding-top: 4px !important; padding-bottom: 4px !important; }
  html.is-touch #menu .mbtn.hero .lbl { font-size: 16px !important; }
  html.is-touch #menu .mbtn.hero small { display: block; font-size: 7px; }
  html.is-touch #menu .menu-tools { top: calc(var(--sat) + 8px); bottom: auto; right: calc(var(--sar) + 12px + 44px + 6px); left: auto; flex-wrap: nowrap; }
  html.is-touch #menu .lang-cur { height: var(--row); width: 84px; box-sizing: border-box; justify-content: center; }
  html.is-touch #menu .lang-list { top: calc(100% + 8px); bottom: auto; right: 0; left: auto; }
  html.is-touch body[data-shell="menu"] .sound-ctl { top: calc(var(--sat) + 8px); bottom: auto; right: calc(var(--sar) + 12px); left: auto; }
  html.is-touch body[data-shell="menu"] .snd-btn { height: clamp(44px, calc((var(--app-h, 100vh) - var(--sat) - var(--sab) - 78px) / 6), 50px); }
  html.is-touch body[data-shell="menu"] .snd-pop { top: calc(100% + 8px); bottom: auto; right: 0; left: auto; }
  /* filas: todas del mismo alto, de 44 px como mínimo */
  html.is-touch #menu .menu-main .mbtn:not(.hero) { min-height: var(--row) !important; padding-top: 3px !important; padding-bottom: 3px !important; }
  html.is-touch #menu .mgroup.featured, html.is-touch #menu .mgroup.featured.with-team { grid-template-columns: none; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; }
  html.is-touch #menu .mgroup.featured .mbtn.feat { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding-left: 4px; padding-right: 4px; }
  html.is-touch #menu .mgroup.featured .mbtn.feat .ico, html.is-touch #menu .mgroup.featured .mbtn.feat small, html.is-touch #menu .mgroup.featured .feat-tag { display: none; }
  html.is-touch #menu .mgroup.featured .mbtn.feat .lbl { font-size: 9px !important; letter-spacing: 0; white-space: normal; line-height: 1.4; }
  /* PASE, TIENDA, MISIONES y PELEA DEL DÍA en una sola fila (icono + nombre, el nombre en dos líneas si hace falta) */
  html.is-touch #menu .mgroup.meta2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html.is-touch #menu .mgroup.meta2 .mbtn { grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; padding-left: 6px; padding-right: 6px; }
  html.is-touch #menu .mgroup.meta2 .mbtn small { display: none; }
  html.is-touch #menu .mgroup.meta2 .mbtn .lbl { grid-row: 1 / span 2; font-size: 7px !important; letter-spacing: 0; white-space: normal; line-height: 1.5; overflow-wrap: anywhere; }
  html.is-touch #menu .mgroup.meta2 .mbtn .ico { width: 22px; height: 22px; }
  html.is-touch #menu .mgroup.meta2 .mbtn.daily .dd-faces { --fw: 18px; width: 30px; height: 24px; }
  /* panel más bajo (deja ver a los luchadores de la escena): monedas, cajas, estrellas y trofeos en una fila (si no caben, parten) */
  html.is-touch #menu .score-panel .pc-res { display: flex; flex-wrap: wrap; gap: 4px; }
  html.is-touch #menu .score-panel .pc-chip { flex: 1 1 auto; padding: 4px 4px; gap: 3px; font-size: 7px; }
  html.is-touch #menu .score-panel .pc-chip svg { width: 10px; height: 10px; }
  html.is-touch #menu .score-panel { gap: 6px; }
  /* panel: INICIAR SESIÓN en su propia fila (pisaba "RANKED · SIN CUENTA") y de 44 px */
  html.is-touch #menu .pc-rank { flex-wrap: wrap; gap: 4px 8px; }
  html.is-touch #menu .score-panel .pc-rank .login { flex: 1 1 100%; min-width: 0; min-height: 44px; }
  html.is-touch #menu .mgroup.modes .mbtn .lbl, html.is-touch #menu .mgroup.config .mbtn .lbl { font-size: 8px !important; }
  html.is-touch #menu .mgroup.config { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  /* insignias (1, 9+, +300...) dentro de la esquina de su botón: antes se salían y pisaban al de al lado */
  html.is-touch #menu .mbtn .badge { top: 2px; right: 2px; left: auto; padding: 3px 4px 2px; font-size: 7px; min-width: 8px; }
  html.is-touch #menu .menu-foot { left: calc(var(--side) + (100vw - var(--side) - var(--sar) - 12px) / 2); bottom: calc(var(--sab) + 4px); max-width: calc(100vw - var(--side) - var(--sar) - 16px); }
  html.is-touch #menu .menu-foot .ticker { padding: 3px 12px; }
}
/* tableta (táctil, no móvil): botones del menú de 44 px, sin el selector de estética (está en OPCIONES; tapaba el logo)
   y, fuera del menú, el botón de sonido arriba a la derecha (abajo tapaba ELEGIR / CONFIRMAR de la selección) */
html.is-touch:not(.is-mobile) #menu .art-pick { display: none; }
html.is-touch:not(.is-mobile) #menu .menu-main .mbtn { min-height: 44px; }
html.is-touch:not(.is-mobile) body[data-shell="other"] .sound-ctl { top: calc(var(--sat) + 10px); bottom: auto; right: calc(var(--sar) + 10px); }
html.is-touch:not(.is-mobile) body[data-shell="other"] .snd-pop { top: calc(100% + 8px); bottom: auto; }
/* táctil (móvil y tableta): insignias dentro de la esquina de su botón y INICIAR SESIÓN de 44 px */
html.is-touch #menu .mbtn .badge { top: 3px; right: 3px; left: auto; }
html.is-touch #menu .pc-rank { flex-wrap: wrap; gap: 4px 8px; }
html.is-touch #menu .score-panel .pc-rank .login { flex: 1 1 100%; min-width: 0; min-height: 44px; }
