/* Piezas comunes de las pantallas de los modos nuevos (2 VS 2 y su grupo online, TORNEO, mapas de SMASH PIXELS),
   al nivel del menú principal: la escena animada del menú detrás (estas pantallas están en MENU_MODES), el título con
   su raya dorada de .sub-screen, paneles .panel, botones .mbtn y estas piezas:
   - .mode-scr: la pantalla (fondo translúcido sobre la escena, cabecera compacta en el móvil apaisado).
   - .mode-label: rótulo de sección pequeño con raya.
   - .stepper: [◄ valor ►] con flechas pixel (selector de luchador, mapa, CPU, reglas).
   - .mode-port: retrato con bisel dorado (o del color del equipo con --tc), como los de la pantalla de carga.
   - .mode-empty: hueco libre con borde a trazos que late.
   - .mode-dots: "buscando" con tres puntos que saltan; .mode-scan: barra que barre.
   - .team-blue / .team-red: colores de equipo (--tc, --tl, --td). */
:root { --blue: #4fb4ff; --blue-l: #b4e0ff; --blue-d: #1b4f9a; --red: #ff5a5a; --red-l: #ffb8b0; --red-d: #8a1a24; }
.team-blue { --tc: var(--blue); --tl: var(--blue-l); --td: var(--blue-d); }
.team-red { --tc: var(--red); --tl: var(--red-l); --td: var(--red-d); }

/* ---- pantalla */
.screen.mode-scr { justify-content: flex-start; gap: clamp(10px, 1.8vh, 18px); padding: 72px 16px 18px;
  background: radial-gradient(ellipse at 50% 30%, rgba(42,58,110,.42) 0%, rgba(8,10,24,.8) 60%, rgba(5,7,16,.92) 100%); }
.mode-scr > h2 { flex: none; }
.mode-scr > .back-btn { min-height: 38px; }
.mode-label { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: normal; font-size: 8px; letter-spacing: 2px; color: var(--gold);
  text-shadow: 2px 2px 0 #000; }
.mode-label::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(255,216,74,.6), transparent); }
/* botones .mbtn fuera del menú: con su sonido y sin la flecha de selección del menú */
.mode-scr .mbtn::after { display: none; }
.mode-scr .mbtn[disabled] { filter: grayscale(.8) brightness(.6); cursor: default; pointer-events: none; }
.mode-scr .mbtn.hero .lbl { font-size: clamp(12px, 2.2vh, 22px); letter-spacing: 3px; }
.mode-scr .mbtn .lbl { font-size: clamp(8px, 1.3vh, 13px); }
.mode-scr .mbtn small { font-size: clamp(6px, .95vh, 9px); }
.mode-scr .mbtn:not(:has(small:not([hidden]))) .lbl { grid-row: 1 / span 2; }
.mode-scr .mbtn:not(:has(.ico)) { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
/* botón de cancelar (buscando partida) */
.mode-scr .mbtn.mini.cancel { --b: #ff6a5a; --l: #ffb0a8; --g: rgba(255,106,90,.5); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #ff6a5a, 0 4px 0 #000; }
.mode-scr .mbtn.mini.cancel:hover, .mode-scr .mbtn.mini.cancel:focus-visible { background: linear-gradient(180deg, #ffb0a8, #ff6a5a 55%, #a8281e); }
/* pantallas cortas (grupo, torneo): centradas en vertical */
#party.mode-scr, #tour.mode-scr { justify-content: safe center; }

@keyframes arrow-nudge-y { 50% { transform: translateY(-3px); } }

/* ---- selector ◄ valor ► */
.stepper { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stepper > b, .stepper .st-val { flex: 1; min-width: 70px; font-weight: normal; font-size: clamp(8px, 1vw, 11px); color: #fff; text-align: center; letter-spacing: 1px;
  text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-arrow { flex: none; width: 30px; height: 30px; padding: 0; border: 0; cursor: pointer; display: grid; place-items: center; font-size: 0; color: transparent;
  background: linear-gradient(#1d2850, #121a36); box-shadow: inset 0 0 0 2px #3b4c86, 0 0 0 2px #000, 0 3px 0 #000; transition: transform .08s steps(2); }
.st-arrow::before { content: ""; width: 8px; height: 10px; background: var(--gold); clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.st-arrow.next::before, .st-arrow[data-d="1"]::before, .st-arrow[data-map="1"]::before, .st-arrow[data-lvl="1"]::before { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.st-arrow:hover, .st-arrow:focus-visible { outline: none; background: linear-gradient(#fff07a, #ffd84a); box-shadow: inset 0 0 0 2px #b38f00, 0 0 0 2px #000, 0 3px 0 #000, 0 0 14px rgba(255,216,74,.45); }
.st-arrow:hover::before, .st-arrow:focus-visible::before { background: #14141c; }
.st-arrow:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px #b38f00, 0 0 0 2px #000; }

/* ---- retrato con bisel */
.mode-port { --tc: var(--gold); --tl: #fff3b0; --td: #d9961c; position: relative; flex: none; box-sizing: border-box; aspect-ratio: 4 / 3; padding: 3px; overflow: hidden;
  display: grid; place-items: center; background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 40%, #1a2246), #0b0e22);
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--tl), inset 0 0 0 4px var(--td), 3px 3px 0 #000; }
.mode-port img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.mode-port .tm-q, .mode-port > span:only-child { font-size: clamp(14px, 2vw, 24px); color: var(--gold); text-shadow: 2px 2px 0 #b3261e, 4px 4px 0 #000; }
.mode-port.pop img { animation: port-pop .35s steps(3) both; }
@keyframes port-pop { 0% { filter: brightness(3.5); transform: translateY(-3px) scale(1.06); } 100% { filter: none; } }

/* ---- hueco libre */
.mode-empty { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; box-sizing: border-box;
  color: #8d99c6; font-size: 7px; letter-spacing: 1px; line-height: 1.8; background: rgba(8,10,26,.55);
  outline: 2px dashed rgba(159,179,230,.4); outline-offset: -6px; box-shadow: 0 0 0 2px #000; }
.mode-empty::before { content: "+"; font-size: 18px; line-height: 1; color: rgba(255,216,74,.75); text-shadow: 2px 2px 0 #000; animation: empty-pulse 1.4s steps(2) infinite; }
@keyframes empty-pulse { 50% { opacity: .35; } }

/* ---- buscando */
.mode-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.mode-dots i { width: 6px; height: 6px; background: currentColor; box-shadow: 1px 1px 0 #000; animation: dot-hop .9s steps(3) infinite; }
.mode-dots i:nth-child(2) { animation-delay: .15s; }
.mode-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot-hop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-5px); } }
.mode-scan { position: relative; height: 6px; overflow: hidden; background: #0a0d20; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #2d3b66; }
.mode-scan::after { content: ""; position: absolute; top: 1px; bottom: 1px; left: 0; width: 30%; background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: translateX(-100%); animation: scan-run 1.3s linear infinite; }
@keyframes scan-run { to { transform: translateX(340%); } }

/* ---- estado bajo los botones (avisos y errores) */
.mode-status { min-height: 16px; font-size: 8px; letter-spacing: 1px; line-height: 1.8; text-align: center; color: #c9d3ee; text-shadow: 2px 2px 0 #000; }
.mode-status:not(:empty) { padding: 6px 12px; background: rgba(0,0,0,.35); box-shadow: inset 3px 0 0 var(--gold); }
.mode-status.err { color: #ff8a6a; box-shadow: inset 3px 0 0 #ff6a5a; }

/* ---- móvil apaisado: cabecera en la fila del VOLVER, todo en una pantalla, objetivos de 44 px */
@media (orientation: landscape) and (max-height: 500px) {
  .screen.mode-scr { gap: 8px; padding: 12px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
  .mode-scr > h2 { font-size: 15px; padding-bottom: 8px; margin: 2px 0 0; }
  .mode-scr > h2::after { height: 3px; }
  .mode-scr > .back-btn { top: 8px; left: max(12px, env(safe-area-inset-left)); min-height: 44px; font-size: 9px; padding: 0 12px; }
  .st-arrow { width: 44px; height: 40px; }
  .mode-label { font-size: 7px; }
}
@media (pointer: coarse) { .stepper > .st-arrow { min-width: 44px; min-height: 40px; } }
@media (prefers-reduced-motion: reduce) {
  .mode-empty::before, .mode-dots i, .mode-scan::after, .mode-port.pop img { animation: none; }
}

/* ---------------------------------------------------------------- panel de vista previa del menú (menus.js, MENU_PEEK)
   Solo en pantallas anchas con ratón o teclado: ficha pixel a la derecha (colores planos, borde duro, imágenes sin suavizar). */
.menu-peek { display: none; }
@media (min-width: 1100px) and (min-height: 560px) and (hover: hover) {
  .menu-peek { position: fixed; right: max(24px, 3vw); top: 50%; width: clamp(250px, 22vw, 330px); transform: translateY(-50%); z-index: 3; box-sizing: border-box;
    padding: 14px; background: #10143a; border: 4px solid var(--mc, #ffd84a); box-shadow: 0 0 0 4px #05060c, 8px 8px 0 4px #05060c; pointer-events: none;
    font-family: "Press Start 2P", monospace; visibility: hidden; display: block; }
  .menu-peek.on { visibility: visible; }
  .menu-peek .mp-art { position: relative; height: clamp(150px, 26vh, 230px); margin: -4px -4px 12px; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--mc) 40%, #10143a) 0 12px, color-mix(in srgb, var(--mc) 22%, #10143a) 12px 24px); border: 4px solid #05060c; overflow: hidden; }
  .menu-peek .mp-art img { position: absolute; top: 0; bottom: 0; height: 100%; width: 52%; object-fit: cover; object-position: 50% 15%; image-rendering: pixelated; }
  .menu-peek .mp-art .a { left: 0; border-right: 4px solid #05060c; } .menu-peek .mp-art .b { right: 0; }
  .menu-peek h3 { margin: 0 0 10px; font-weight: normal; font-size: clamp(11px, 1.15vw, 15px); color: var(--mc); text-shadow: 2px 2px 0 #000; letter-spacing: 1px; }
  .menu-peek p { margin: 0; font-size: clamp(7px, .72vw, 9px); line-height: 1.9; color: #dfe6ff; text-shadow: 1px 1px 0 #000; }
  .menu-peek.pop { animation: mp-pop .24s steps(4) 1; }
  @keyframes mp-pop { from { transform: translateY(-50%) translateX(24px); } to { transform: translateY(-50%) translateX(0); } }
}
@media (prefers-reduced-motion: reduce) { .menu-peek.pop { animation: none; } }
