/* ============================================================================
   ORBYUM GAMING — css/gaming-duelo-hud.css  ·  HUD COMÚN de los 5 duelos (clases .dk-*)
   (rediseño 2026-11-12: game_designer §2.5/§2.8/§2.10, gameplay_designer §2.3/§2.10)

   Se carga DESPUÉS del CSS de cada juego y ANTES de css/gaming-duelo.css (cabecera_juego_css()).
   Usa los tokens --dk-* de css/tokens.css. No sustituye a gaming-duelo.css (equipo UX): solo se
   apoya en sus estados de <body> dj-lobby / dj-jugando / dj-resultado.
   Clases de estado que pone juego/orby_duelo_kit.js:
     <body>: dk-touch · dk-movil · dk-vertical · dk-inmersivo · dk-en-partida · dk-zurdo
     raíz del juego: dk-jugando (el HUD .dk-hud entra animado)
   Piezas: .dk-hud · .dk-card (+ .dk-bar) · .dk-centro · .dk-turno · .dk-pill · .dk-mute · .dk-hint
           .dk-flash · .dk-accion · .dk-pasos · .dk-resultado (+ .dk-otra) · .dk-girar
   Letra mínima: 12 px en el HUD del móvil, 11 px solo en etiquetas. CSP: sin inline.

   FASE 4 (2026-11-12, 20_DECISIONES_FASE4.md · impl_fase4_kit.md):
     · B1: la tarjeta mide lo que deja libre el grupo central (--dk-centro-w lo pone el kit, OrbyKit.hud());
       si no cabe, body.dk-hud-apilado baja el grupo central bajo las tarjetas.
     · K2: con «Mandos para zurdos» (o .dk-lado-izq) la Revancha/¡Otra! del resultado va a la izquierda.
     · Botón de acción: nunca por debajo de 84 px; su texto cabe (15 px / 14 px en alto ≤ 380).
     · «Gira el móvil»: la línea de estado es TEXTO (sin borde); tableta en vertical jugable (dk-vertical-ok).
     · Nuevas piezas comunes: .dk-modos (fila de modos de la entrada), .dk-ventana (ayuda «?»),
       .dk-ajuste (casillas «Mandos para zurdos» / «Vibración»), .dk-salir («¿Salir del duelo?» en vivo).
   ============================================================================ */

/* ---- HUD: solo durante la partida, entra/sale animado ----------------------- */
.dk-hud {
  position: absolute; z-index: 20;
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .35s ease, transform .55s var(--dk-ease), visibility 0s linear .55s;
}
.dk-jugando .dk-hud {
  opacity: 1; visibility: visible;
  transition: opacity .35s ease, transform .55s var(--dk-ease), visibility 0s;
}

/* ---- Tarjeta de jugador (arriba a los lados) ---------------------------------- */
/* B1: ancho = el hueco entre el borde y el grupo central (medido por el kit en --dk-centro-w; si el
   juego no llama al kit, 380 px de reserva). Los juegos ya NO fijan width en vw a sus .dk-card. */
.dk-card {
  top: max(14px, env(safe-area-inset-top));
  width: clamp(150px, calc(50vw - var(--dk-centro-w, 380px) / 2 - 14px - max(16px, env(safe-area-inset-left))), 320px); min-width: 0;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 16px;
  background: var(--dk-cristal); border: 2px solid var(--dk-yo);
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
  font-family: var(--dk-ui);
}
.dk-card--yo    { left: max(16px, env(safe-area-inset-left)); transform: translateX(-40px); }
.dk-card--rival { right: max(16px, env(safe-area-inset-right)); transform: translateX(40px); flex-direction: row-reverse; text-align: right; border-color: var(--dk-rival); border-style: dashed; }
.dk-jugando .dk-card { transform: none; transition-delay: .12s, .12s, 0s; }
.dk-card-orb {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff 0 8%, #8dffb0 14%, var(--dk-yo-osc) 58%, #001400 100%);
  box-shadow: 0 0 16px rgba(57,255,20,.45);
}
.dk-card--rival .dk-card-orb { background: radial-gradient(circle at 65% 32%, #fff 0 8%, #ffd0a0 14%, var(--dk-rival-osc) 58%, #2a0800 100%); box-shadow: 0 0 16px rgba(255,91,61,.45); }
.dk-card-info { position: relative; flex: 1 1 auto; min-width: 0; }
.dk-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dk-card--rival .dk-card-head { flex-direction: row-reverse; }
.dk-card-name { font-weight: 700; font-size: 17px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-card-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; color: var(--dk-papel-2); }
.dk-card-sub { font-size: 12px; font-weight: 600; color: #bfc6d8; margin: 1px 0 6px; min-height: 15px; }
/* barra (vida / progreso). --seg: por segmentos (10) */
.dk-bar { position: relative; height: 12px; border-radius: 3px; background: rgba(255,255,255,0.12); display: flex; overflow: hidden; }
.dk-card--rival .dk-bar { justify-content: flex-end; }
.dk-bar--seg {
  overflow: visible;
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%);
          mask-image: repeating-linear-gradient(90deg, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%);
}
.dk-bar-fill { height: 100%; width: 100%; transition: width .45s ease; background: linear-gradient(90deg, var(--dk-yo-2), var(--dk-yo)); }
.dk-card--rival .dk-bar-fill { background: linear-gradient(90deg, #ff7a3d, var(--dk-rival-2)); }

/* ---- Grupo central: turno + píldora del juego + silencio ---------------------- */
.dk-centro {
  top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -30px);
  display: flex; align-items: center; gap: 8px; pointer-events: none; font-family: var(--dk-ui);
}
.dk-jugando .dk-centro { transform: translate(-50%, 0); transition-delay: .05s, .05s, 0s; }
.dk-jugando .dk-centro .dk-mute { pointer-events: auto; }
.dk-turno {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; max-width: min(300px, 34vw);
  font-weight: 700; font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 16px; border-radius: 999px;
  border: 2px solid var(--dk-yo); color: #c8ffb8; background: rgba(57,255,20,0.14);
  box-shadow: 0 0 18px rgba(57,255,20,.25);
  transition: color .25s, border-color .25s, box-shadow .25s, background .25s;
}
.dk-turno.is-rival { color: #ffd0c4; border-color: var(--dk-rival); border-style: dashed; background: rgba(255,91,61,0.16); box-shadow: 0 0 18px rgba(255,91,61,.3); }
.dk-turno > :last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* «Turno de <nombre largo>» */
.dk-turno-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: dk-pulso 1.1s ease-in-out infinite; }
@keyframes dk-pulso { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .55; } }
.dk-pill {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  font-size: 14px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-variant-numeric: tabular-nums;
  color: #dff4ff; background: var(--dk-cristal);
  border: 2px solid rgba(90,200,255,.55); border-radius: 999px; padding: 7px 15px 7px 12px;
}
.dk-mute {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 40px; font-size: 17px; line-height: 1; cursor: pointer;
  background: var(--dk-cristal); color: #fff;
  border: 1px solid var(--dk-linea); border-radius: 999px;
}
.dk-mute::after { content: ""; position: absolute; inset: -4px; }   /* zona táctil ≥ 44 px */
.dk-mute:hover { border-color: var(--dk-yo); }
.dk-mute:focus-visible { outline: 2px solid var(--dk-yo); outline-offset: 2px; }
.dk-ayuda-btn { font-weight: 700; color: var(--dk-yo); font-family: var(--dk-ui); }   /* «?» del HUD (mismo botón redondo) */
/* ---- Botones de MÚSICA (nota) y EFECTOS (altavoz) — OrbyKit.sonido.pintarBoton (2026-11-19) ----------
   mismo botón redondo .dk-mute (40 px; zona táctil ≥ 44 px con ::after); apagado = icono TACHADO + gris + borde discontinuo */
.dk-son { padding: 0; }
.dk-son .dk-son-ico { width: 20px; height: 20px; display: block; pointer-events: none; }
.dk-mute.dk-son.is-off { color: #b5b0c8; border-style: dashed; }
body.dk-movil .dk-son .dk-son-ico { width: 17px; height: 17px; }
/* el texto del juego en la píldora que sobra en pantallas justas («Viento»): fuera en móvil */
body.dk-movil .dk-pill-lbl { display: none; }
@media (max-width: 1100px) { .dk-pill-lbl { display: none; } }

/* B1 · HUD APILADO (lo pone el kit si ni con tarjetas estrechas cabe el grupo central entre ellas):
   las tarjetas a lo ancho de su mitad y el grupo central justo debajo */
body.dk-hud-apilado .dk-card { width: clamp(150px, calc(50vw - 24px - max(16px, env(safe-area-inset-left))), 320px); }
body.dk-hud-apilado .dk-centro { top: calc(max(14px, env(safe-area-inset-top)) + 80px); }
body.dk-hud-apilado .dk-hint { top: calc(max(14px, env(safe-area-inset-top)) + 136px); }

/* ---- Pista corta (4-6 palabras, se calla tras 2 turnos) ----------------------- */
.dk-hint {
  position: absolute; z-index: 19; left: 50%; top: 70px; transform: translateX(-50%);
  max-width: min(92%, 560px); text-align: center;
  font: 600 13px/1.3 var(--dk-ui); color: #fff;
  background: rgba(8,4,20,0.72); border: 1px solid var(--dk-linea); border-radius: 999px;
  padding: 7px 16px; pointer-events: none; transition: opacity .25s;
}
.dk-hint.is-hidden { opacity: 0; }

/* ---- Rótulo central de evento («TU TURNO», «¡Corto!», «¡TOCADO!»…) ------------- */
.dk-flash { position: absolute; inset: 0; z-index: 22; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
.dk-flash.is-on { animation: dk-flashin 1.1s ease forwards; }
.dk-flash-text {
  font: 700 clamp(26px, 5vw, 52px)/1.05 var(--dk-ui); letter-spacing: .01em; color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 24px rgba(0,0,0,.4); text-align: center; padding: 0 14px;
}
.dk-flash-text.is-turno { color: var(--dk-yo); text-transform: uppercase; text-shadow: 0 0 22px rgba(57,255,20,.45), 0 3px 0 rgba(0,0,0,.6); }
.dk-flash-text.is-rival { color: #ffb4a3; text-transform: uppercase; text-shadow: 0 0 24px rgba(255,91,61,.3), 0 3px 0 rgba(0,0,0,.6); }
.dk-flash-text.is-hit   { color: var(--dk-yo); text-shadow: 0 0 20px rgba(57,255,20,.3), 0 3px 0 rgba(0,0,0,.6); }
.dk-flash-text.is-near  { color: var(--dk-casi); text-shadow: 0 0 20px rgba(255,215,0,.5), 0 3px 0 rgba(0,0,0,.6); }
.dk-flash-text.is-miss  { color: #9fdcff; text-shadow: 0 0 20px rgba(56,189,248,.5), 0 3px 0 rgba(0,0,0,.6); }
.dk-flash-cifra { display: block; margin-top: 4px; font-size: .5em; font-variant-numeric: tabular-nums; opacity: .92; }
@keyframes dk-flashin { 0% { opacity: 0; transform: scale(.7); } 25% { opacity: 1; transform: scale(1.06); } 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }

/* ---- BOTÓN DE ACCIÓN (¡FUEGO!, ¡DISPARA!, ¡GOLPEA!…) abajo a la derecha ----------
   PC: píldora 190×66 · tableta táctil: 200×72 · móvil: círculo de 84 px SIEMPRE (decisión 14: nunca < 84).
   Estados: .is-pressed (mismo fotograma) · [disabled]/.is-espera (ESPERA legible, no «roto») ·
   .dk-cancela (deslizó fuera) · .dk-guarda (bloqueo corto al empezar tu turno) · .dk-pop (se libera).
   Zurdos: body.dk-zurdo lo pasa a la izquierda salvo .dk-lado-fijo · .dk-lado-izq lo fuerza a la izquierda. */
.dk-accion {
  right: max(20px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateY(50px) scale(.8);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 190px; height: 66px; padding: 0 26px; border-radius: 33px; border: 0; cursor: pointer;
  font: 700 27px/1 var(--dk-ui); letter-spacing: .02em; text-transform: uppercase;
  color: #052a03; background: linear-gradient(180deg, #7dff5c, var(--dk-yo) 55%, #22c40a);
  box-shadow: 0 0 26px rgba(57,255,20,.55), 0 8px 0 #157a05, 0 14px 28px rgba(0,0,0,.45);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.dk-jugando .dk-accion { transform: none; transition-delay: .26s, .26s, 0s; animation: dk-respira 2.2s ease-in-out infinite; }
@keyframes dk-respira { 50% { box-shadow: 0 0 40px rgba(57,255,20,.85), 0 8px 0 #157a05, 0 14px 28px rgba(0,0,0,.45); } }
.dk-accion:active, .dk-accion.is-pressed { translate: 0 5px; box-shadow: 0 0 20px rgba(57,255,20,.5), 0 3px 0 #157a05, 0 8px 18px rgba(0,0,0,.45); }
.dk-accion:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.dk-accion.dk-cancela { animation: none; filter: saturate(.5); }
.dk-accion-txt, .dk-accion-espera { display: block; pointer-events: none; }
.dk-accion-espera { display: none; font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: none; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ESPERA: botón oscuro con borde (del rival si es su turno) y un texto que dice por qué */
.dk-accion[disabled], .dk-accion.is-espera {
  animation: none !important; cursor: default; translate: none;
  color: #e9e4f5; background: rgba(14,10,30,.86);
  box-shadow: inset 0 0 0 2px rgba(57,255,20,.45), 0 6px 0 rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.35);
}
.dk-accion[disabled] .dk-accion-txt, .dk-accion.is-espera .dk-accion-txt { opacity: .55; font-size: .62em; }
.dk-accion.is-espera .dk-accion-espera { display: block; }
.dk-accion.is-espera .dk-accion-txt { display: none; }
.dk-accion.is-espera-rival { color: #ffd6cc; box-shadow: inset 0 0 0 2px var(--dk-rival), 0 6px 0 rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.35); }
.dk-accion.dk-guarda { pointer-events: none; filter: saturate(.35) brightness(.85); animation: none; }
.dk-accion.dk-pop { animation: dk-pop .32s var(--dk-ease); }
@keyframes dk-pop { 0% { transform: scale(.88); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
body.dk-zurdo .dk-accion:not(.dk-lado-fijo), .dk-accion.dk-lado-izq { right: auto; left: max(20px, env(safe-area-inset-left)); }
/* tableta táctil */
body.dk-touch:not(.dk-movil) .dk-accion { min-width: 200px; height: 72px; border-radius: 36px; }
/* móvil: círculo para el pulgar */
body.dk-movil .dk-accion {
  right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  min-width: 0; width: var(--dk-accion-d); height: var(--dk-accion-d); padding: 0 4px; border-radius: 50%;
  font-size: 15px; letter-spacing: -.01em;
  box-shadow: 0 0 22px rgba(57,255,20,.55), 0 5px 0 #157a05, 0 10px 20px rgba(0,0,0,.45);
}
/* el texto cabe en el círculo (decisión 14): si lleva espacio, pasa a 2 líneas («Turno de / la máquina») */
body.dk-movil .dk-accion .dk-accion-txt { max-width: 100%; white-space: normal; text-align: center; line-height: 1.05; }
body.dk-movil .dk-accion .dk-accion-espera { font-size: 12px; white-space: normal; text-align: center; }
body.dk-movil.dk-zurdo .dk-accion:not(.dk-lado-fijo), body.dk-movil .dk-accion.dk-lado-izq { right: auto; left: max(16px, env(safe-area-inset-left)); }
@media (max-height: 380px) { body.dk-movil .dk-accion { font-size: 14px; } }

/* ---- Pasos finos ±1 (táctil): 2×2 de 48 px junto al botón de acción ------------ */
.dk-pasos {
  display: none; z-index: 21; grid-template-columns: 48px 48px; grid-auto-rows: 48px; gap: 8px;
  right: calc(max(16px, env(safe-area-inset-right)) + var(--dk-accion-d) + 16px); bottom: max(16px, env(safe-area-inset-bottom));
}
body.dk-touch .dk-pasos { display: grid; }
/* móvil (poco alto): en UNA fila por debajo de la línea del suelo, para no tapar al rival ni a su fuerte */
body.dk-movil .dk-pasos { grid-template-columns: repeat(4, 48px); }
body.dk-movil .dk-paso:nth-child(3) { margin-inline-start: 8px; }
/* GP C2: con la acción a la izquierda, los pasos se leen de dentro hacia fuera igual que a la derecha */
.dk-pasos.dk-lado-izq { direction: rtl; }
.dk-pasos.dk-lado-izq .dk-paso { direction: ltr; }
body.dk-touch:not(.dk-movil) .dk-pasos { right: calc(max(20px, env(safe-area-inset-right)) + 200px + 16px); bottom: max(14px, env(safe-area-inset-bottom)); }
.dk-pasos.dk-lado-izq { right: auto; left: calc(max(16px, env(safe-area-inset-left)) + var(--dk-accion-d) + 16px); }
body.dk-touch:not(.dk-movil) .dk-pasos.dk-lado-izq { right: auto; left: calc(max(20px, env(safe-area-inset-left)) + 200px + 16px); }
.dk-paso {
  width: 48px; height: 48px; padding: 0; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 15px/1 var(--dk-ui); font-variant-numeric: tabular-nums; color: #fff;
  background: var(--dk-cristal); border: 1.5px solid var(--dk-linea);
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.dk-paso[data-eje="a"] { color: #c8ffb8; }
.dk-paso[data-eje="f"] { color: #ffe7a0; }
.dk-paso.is-pressed { translate: 0 3px; box-shadow: 0 1px 0 rgba(0,0,0,.35); background: rgba(57,255,20,.16); border-color: var(--dk-yo); }
.dk-paso:focus-visible { outline: 2px solid var(--dk-yo); outline-offset: 2px; }
.dk-paso[disabled] { opacity: .45; cursor: default; }
.dk-pasos.dk-resalta .dk-paso { border-color: var(--dk-casi); box-shadow: 0 0 14px rgba(255,215,90,.45), 0 4px 0 rgba(0,0,0,.35); }

/* ---- RESULTADO: tarjeta legible (cristal fuerte) sobre la escena del final -------
   Sin transform (los hijos .dk-otra pueden ir fijos en el sitio del botón de acción en táctil).
   Sus hijos son directos (juego/orby_serie.js mete su caja justo antes de la fila de botones). */
.dk-resultado {
  position: absolute; inset: 0; margin: auto; z-index: var(--z-overlay, 5000);
  width: min(460px, calc(100% - 24px)); height: -webkit-fit-content; height: fit-content; max-height: calc(100% - 24px);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 9px; padding: 20px 22px; border-radius: 20px; text-align: center; overflow-y: auto;
  background: var(--dk-cristal-fuerte); border: 1px solid var(--dk-linea); box-shadow: 0 20px 60px rgba(0,0,0,.5);
  isolation: isolate; font-family: var(--dk-ui);
  animation: dk-aparece .35s ease both;
}
.dk-resultado::before {   /* desenfoque del fondo en una capa aparte (no crea bloque contenedor para .dk-otra) */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.dk-resultado.is-hidden { animation: none; }
@keyframes dk-aparece { 0% { opacity: 0; } 100% { opacity: 1; } }
.dk-resultado .dk-veredicto { font: 700 clamp(30px, 6vw, 54px)/1.02 var(--dk-ui); margin: 0; animation: dk-veredicto .45s var(--dk-ease) both; }
.dk-resultado .dk-veredicto.is-win  { color: var(--dk-yo); text-shadow: 0 0 20px rgba(57,255,20,.3); }
.dk-resultado .dk-veredicto.is-lose { color: var(--dk-rival); text-shadow: none; }
@keyframes dk-veredicto { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.dk-resultado .dk-res-linea { margin: 2px 0 0; font-size: 12px; line-height: 1.4; color: var(--dk-papel-2); }
.dk-resultado .dk-res-linea a { color: var(--dk-yo); font-weight: 700; }
/* botón principal: Revancha / ¡Otra! (con foco automático tras el bloqueo) */
.dk-otra { position: relative; overflow: hidden; }
.dk-otra.dk-bloqueado[disabled] { opacity: .9; cursor: progress; transform: none; }
.dk-otra.dk-bloqueado::after {
  content: ""; position: absolute; left: 16%; right: 16%; bottom: 7px; height: 4px; border-radius: 2px;
  background: currentColor; opacity: .55; transform-origin: 0 50%; transform: scaleX(0);
  animation: dk-llena var(--dk-bloqueo, 700ms) linear forwards;
}
@keyframes dk-llena { to { transform: scaleX(1); } }
.dk-otra.dk-listo { animation: dk-pop .32s var(--dk-ease); }
/* PC: el botón principal del resultado con el mismo tamaño en los 5 (M-2) */
body:not(.dk-touch) .dk-resultado .dk-otra { min-width: 220px; min-height: 56px; }
/* táctil: la tarjeta deja libre la esquina del pulgar y el botón principal va donde estaba la acción */
@media (orientation: landscape) {
  body.dk-touch .dk-resultado { right: calc(232px + env(safe-area-inset-right)); width: min(460px, calc(100% - 256px - env(safe-area-inset-right))); }
  /* K2: zurdos (o acción a la izquierda) → la esquina libre es la de la izquierda */
  body.dk-touch.dk-zurdo .dk-resultado:not(.dk-lado-fijo), body.dk-touch .dk-resultado.dk-lado-izq {
    left: calc(232px + env(safe-area-inset-left)); right: 0; width: min(460px, calc(100% - 256px - env(safe-area-inset-left)));
  }
}
@media (orientation: portrait) {
  body.dk-touch .dk-resultado { bottom: calc(116px + env(safe-area-inset-bottom)); max-height: calc(100% - 140px); }
}
body.dk-touch .dk-resultado .dk-otra {
  position: fixed; z-index: 2; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  min-width: 200px; height: 84px; padding: 0 28px; border-radius: 42px; font-size: 22px; font-weight: 700;
  box-shadow: 0 0 26px rgba(57,255,20,.5), 0 6px 0 #157a05, 0 12px 24px rgba(0,0,0,.45);
}
body.dk-touch.dk-zurdo .dk-resultado .dk-otra:not(.dk-lado-fijo), body.dk-touch .dk-resultado .dk-otra.dk-lado-izq {
  right: auto; left: max(16px, env(safe-area-inset-left));
}
@media (max-height: 380px) { body.dk-touch .dk-resultado .dk-otra { min-width: 190px; font-size: 20px; } }   /* nunca < 84 de alto */

/* ---- «Gira el móvil» común (solo jugando, en vertical, en táctil) -------------- */
.dk-girar {
  position: fixed; inset: 0; z-index: var(--z-modal, 10000); display: none;
  place-items: center; padding: 24px; text-align: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(26,12,61,.84), rgba(8,4,25,.95) 70%);
  /* sin backdrop-filter (rendimiento 2026-11-13): el fondo ya tapa el escenario al 84-95 % */
  font-family: var(--dk-ui);
}
body.dk-touch.dk-vertical.dk-en-partida:not(.dk-vertical-ok) .dk-girar { display: grid; }   /* tableta que se lee bien en vertical: se juega así */
.dk-girar-caja { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 320px; margin: 0 auto; }
.dk-girar-ico { position: relative; width: 96px; height: 96px; display: grid; place-items: center; color: var(--dk-yo); margin-bottom: 6px; }
.dk-girar-movil {
  position: relative; width: 44px; height: 76px; border: 3px solid #fff; border-radius: 9px; box-sizing: border-box;
  box-shadow: inset 0 0 0 2px rgba(57,255,20,.22), 0 0 18px rgba(57,255,20,.25);
  animation: dk-girar 2s ease-in-out infinite;
}
.dk-girar-movil::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 12px; height: 3px; margin-left: -6px; border-radius: 2px; background: #fff; opacity: .7; }
.dk-girar-flecha { position: absolute; left: 0; top: 0; width: 96px; height: 96px; opacity: .9; }
.dk-girar-txt { margin: 0; font: 700 24px/1.15 var(--dk-ui); color: #fff; }
.dk-girar-sub { margin: 0; font: 500 15px/1.35 var(--dk-ui); color: var(--dk-papel-2); }
/* línea de estado: TEXTO (no píldora: no debe parecer un trozo del HUD que se ha quedado ahí) */
.dk-girar-estado { margin: 6px 0 0; padding: 0; border: 0; background: none; font: 700 16px/1.3 var(--dk-ui); letter-spacing: 0; text-transform: none; color: var(--dk-yo); }
.dk-girar-estado.is-rival { color: #ffb4a3; }
.dk-girar-estado[hidden] { display: none; }
@keyframes dk-girar { 0%, 25% { transform: rotate(0); } 55%, 100% { transform: rotate(90deg); } }

/* ---- Aviso de invitado (_aviso_invitado.php): nunca tapa la partida ni el resultado.
   En la entrada sigue a la vista; en el resultado su llamada va en una línea dentro de la tarjeta. */
body.dj-jugando .oav, body.dj-resultado .oav, body.dk-en-partida .oav { display: none; }

/* ---- Móvil (táctil y pantallas bajas): mínimos de letra -------------------------- */
body.dk-movil .dk-card {
  top: max(8px, env(safe-area-inset-top)); min-width: 0; padding: 0; gap: 0; border: 0; background: none; box-shadow: none;
  width: clamp(96px, calc(50vw - var(--dk-centro-w, 330px) / 2 - 10px - max(12px, env(safe-area-inset-left))), 260px);
}
body.dk-movil.dk-hud-apilado .dk-card { width: clamp(96px, calc(50vw - 20px - max(12px, env(safe-area-inset-left))), 300px); }
body.dk-movil.dk-hud-apilado .dk-centro { top: calc(max(8px, env(safe-area-inset-top)) + 36px); }
body.dk-movil.dk-hud-apilado .dk-hint { top: calc(max(8px, env(safe-area-inset-top)) + 76px); }
body.dk-movil .dk-card-head { flex-wrap: wrap; column-gap: 6px; row-gap: 0; }   /* si no cabe, la cifra baja bajo el nombre */
body.dk-movil .dk-card--yo { left: max(12px, env(safe-area-inset-left)); }
body.dk-movil .dk-card--rival { right: max(12px, env(safe-area-inset-right)); }
body.dk-movil .dk-card-orb, body.dk-movil .dk-card-sub { display: none; }
body.dk-movil .dk-card-head { margin-bottom: 3px; }
body.dk-movil .dk-card-name { font-size: 13px; text-shadow: 0 1px 4px #000; }
body.dk-movil .dk-card-val { font-size: 12px; color: #fff; text-shadow: 0 1px 4px #000; }
body.dk-movil .dk-bar { height: 10px; background: rgba(10,5,25,.7); }
body.dk-movil .dk-centro { top: max(8px, env(safe-area-inset-top)); gap: 6px; }
body.dk-movil .dk-turno { font-size: 12px; padding: 5px 10px; gap: 6px; border-width: 1.5px; }
body.dk-movil .dk-turno-dot { width: 7px; height: 7px; }
body.dk-movil .dk-pill { font-size: 12px; padding: 5px 11px 5px 8px; border-width: 1.5px; }
body.dk-movil .dk-mute { width: 32px; height: 32px; min-width: 32px; font-size: 14px; }
body.dk-movil .dk-mute::after { inset: -6px; }
body.dk-movil .dk-hint { top: 46px; font-size: 12px; padding: 5px 12px; max-width: 60vw; }
body.dk-movil .dk-flash-text { font-size: 26px; }
@media (max-width: 900px) {
  .dk-card { padding: 8px 10px; gap: 8px; }        /* (el ancho ya lo da el hueco del grupo central: B1) */
  .dk-card-orb { width: 38px; height: 38px; }
  .dk-card-name { font-size: 15px; }
  .dk-hint { top: 104px; }
}
@media (max-height: 500px) {
  .dk-resultado { padding: 12px 16px; gap: 6px; }
  .dk-resultado .dk-veredicto { font-size: 30px; }
}

/* ---- FILA DE MODOS de la entrada (decisión 1) -----------------------------------------
   Orden fijo: «Contra la máquina · 2 jugadores · Reto del día · En vivo» (solo los que existan).
   Un modo es un <button class="dk-modo" aria-pressed> que SOLO elige (arranca «¡Jugar!»);
   «En vivo» es un enlace <a class="dk-modo dk-modo--vivo"> a <juego>_online.php, siempre destacado. */
.dk-modos { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 2px 0 0; padding: 4px; border-radius: 999px; background: rgba(8,4,20,.55); border: 1px solid var(--dk-linea); }
.dk-modo {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid transparent; background: none; cursor: pointer; text-decoration: none;
  font: 700 14px/1.1 var(--dk-ui); color: var(--dk-papel-2); white-space: nowrap;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.dk-modo:hover { color: #fff; border-color: var(--dk-linea); }
.dk-modo:focus-visible { outline: 2px solid var(--dk-yo); outline-offset: 2px; }
.dk-modo[aria-pressed="true"] { color: #052a03; background: var(--dk-yo); border-color: var(--dk-yo); }
.dk-modo--vivo, .dk-modo--vivo:visited { color: var(--g-acc, var(--dk-yo)); border-color: rgba(var(--g-acc-rgb, 57,255,20), .55); background: rgba(var(--g-acc-rgb, 57,255,20), .12); }
.dk-modo--vivo:hover { color: #fff; border-color: var(--g-acc, var(--dk-yo)); }
.dk-modo--vivo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dk-rival); box-shadow: 0 0 8px var(--dk-rival); animation: dk-pulso 1.1s ease-in-out infinite; }
.dk-modo--vivo::after { content: "→"; font-weight: 700; }
.dk-modo-txt { margin: 0; font: 500 13px/1.35 var(--dk-ui); color: var(--dk-papel-2); }
@media (max-height: 500px) { .dk-modo { min-height: 44px; padding: 0 12px; font-size: 13px; } .dk-modos { gap: 4px; padding: 2px; } }

/* ---- VENTANA propia (ayuda «?», OrbyKit.ventana) ------------------------------------- */
.dk-ventana {
  position: absolute; inset: 0; z-index: var(--z-modal, 10000);
  display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(4,2,12,.74);   /* sin backdrop-filter a pantalla completa sobre la partida (rendimiento 2026-11-13) */
  font-family: var(--dk-ui); touch-action: pan-y;
}
.dk-ventana.is-hidden { display: none; }
.dk-ventana-caja {
  position: relative; width: min(480px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 20px 16px; border-radius: 18px; text-align: left; color: #e9e4f5;
  background: var(--dk-cristal-fuerte); border: 1px solid var(--dk-linea); box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.dk-ventana-tit { margin: 0 36px 8px 0; font: 700 20px/1.2 var(--dk-ui); color: #fff; }
.dk-ventana ol { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.dk-ventana li { margin: 0 0 6px; }
.dk-ventana li b { color: #fff; }
.dk-ventana-teclas { margin: 6px 0 0; font-size: 12px; line-height: 1.4; color: var(--dk-papel-2); }
body.dk-touch .dk-ventana-teclas { display: none; }
.dk-ventana-x {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--dk-linea); background: none; color: #fff; font-size: 20px; line-height: 1;
}
.dk-ventana-x::after { content: ""; position: absolute; inset: -4px; }
.dk-ventana-x:focus-visible, .dk-ventana-ok:focus-visible { outline: 2px solid var(--dk-yo); outline-offset: 2px; }
.dk-ventana-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-top: 10px; }
.dk-ventana-pie a { color: var(--dk-yo); font-weight: 700; font-size: 13px; }
.dk-ventana-ok { min-height: 44px; }
.dk-ventana .orby-estatus { margin: 8px 0 0; font-size: 12px; color: var(--dk-papel-2); text-align: left; }
@media (max-height: 500px) {
  .dk-ventana-caja { padding: 12px 16px 12px; }
  .dk-ventana-tit { font-size: 17px; margin-bottom: 4px; }
  .dk-ventana ol { font-size: 13px; line-height: 1.35; }
  .dk-ventana li { margin-bottom: 3px; }
}
/* casilla común de ajustes (decisión 8): «Mandos para zurdos» / «Vibración» */
.dk-ajuste { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 6px 0 0; font: 600 14px/1.2 var(--dk-ui); color: #fff; cursor: pointer; }
.dk-ajuste input { width: 22px; height: 22px; margin: 0; accent-color: var(--dk-yo); cursor: pointer; }

/* ---- «¿Salir del duelo?» (en vivo, js/gaming-duelo-estado.js; decisión 13) ----------- */
.dk-salir {
  position: fixed; inset: 0; z-index: 10050; display: grid; place-items: center; padding: 16px;
  background: rgba(4,2,12,.78);   /* sin backdrop-filter a pantalla completa (rendimiento 2026-11-13) */
  font-family: var(--dk-ui, system-ui, sans-serif);
}
.dk-salir-caja {
  width: min(380px, 100%); padding: 20px 20px 16px; border-radius: 18px; text-align: center; color: #e9e4f5;
  background: var(--dk-cristal-fuerte, rgba(14,10,30,.94)); border: 1px solid var(--dk-linea, rgba(190,170,255,.22));
  box-shadow: inset 0 2px 0 var(--dk-rival, #ff5b3d), 0 20px 60px rgba(0,0,0,.6);
}
.dk-salir-tit { margin: 0 0 6px; font: 700 21px/1.2 var(--dk-ui, system-ui, sans-serif); color: #fff; }
.dk-salir-txt { margin: 0 0 14px; font-size: 15px; line-height: 1.4; color: var(--dk-papel-2, #ddd); }
.dk-salir-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
/* botones propios (no todas las páginas de juego cargan publico.css) */
.dk-salir-btn {
  min-height: 48px; min-width: 140px; padding: 0 20px; border-radius: 999px; cursor: pointer;
  font: 700 16px/1 var(--dk-ui, system-ui, sans-serif); border: 1.5px solid var(--dk-linea, rgba(190,170,255,.3));
  background: rgba(255,255,255,.04); color: #fff;
}
.dk-salir-btn--seguir { border-color: var(--dk-yo, #39ff14); background: var(--dk-yo, #39ff14); color: #052a03; }
.dk-salir-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---- Movimiento reducido ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .dk-hud, .dk-jugando .dk-hud { transition: opacity .2s ease, visibility 0s; transform: none !important; }
  .dk-centro, .dk-jugando .dk-centro { transform: translateX(-50%) !important; }
  .dk-accion, .dk-turno-dot, .dk-girar-movil, .dk-resultado, .dk-resultado .dk-veredicto, .dk-otra.dk-listo, .dk-accion.dk-pop, .dk-modo--vivo::before { animation: none !important; }
  .dk-otra.dk-bloqueado::after { animation-duration: var(--dk-bloqueo, 700ms) !important; }
}
