/* Partida: formas orgánicas, brillo y variaciones (parte de Codex). */

/* Paleta y letras heredadas del mundo. Las tintas neutras solo modelan el relieve.
   No se altera --S, --nodo, --isla-d ni el círculo útil de ajustarTextoIsla. */
#pJuego {
  --j-sombra: rgb(0 0 0 / 38%);
  --j-luz: rgb(255 255 255 / 20%);
  --j-veta: repeating-linear-gradient(174deg, transparent 0 7px,
    rgb(0 0 0 / 5%) 8px, transparent 9px 15px);
  --j-costa: 48% 52% 47% 53% / 51% 46% 54% 49%;
}
/* La partida ocupa la ventana; ni el sprite anterior ni una tira larga de
   jugadores pueden desplazar el pie o ensanchar la columna en móvil. */
#pJuego.activa { position: fixed; inset: 0; width: 100%; margin: 0 auto; }
#pJuego .cabecera, #pJuego .zona-juego, #pJuego .pergamino,
#pJuego .pie-juego, #pJuego .tira-jugadores { min-width: 0; }
@media (max-aspect-ratio: 5/4), (max-width: 599px) {
  #pJuego.activa { grid-template-columns: minmax(0, 1fr); }
}

/* Mar lento bajo las siluetas propias de cada mundo; viñeta detrás del HUD. */
#pJuego .escena {
  background: radial-gradient(ellipse at 24% 32%, var(--luz), transparent 58%),
    radial-gradient(ellipse at 78% 72%, var(--silueta-tono), transparent 65%);
  background-size: 135% 130%;
  animation: juego-marea 48s ease-in-out infinite alternate;
}
#pJuego .escena::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 48% 46%, transparent 35%, rgb(0 0 0 / 30%) 100%);
}
#pJuego .escena-luz { animation: none; opacity: 0.65; will-change: auto; }
#pJuego .escena-motas { animation: none; opacity: 0.28; will-change: auto; }
@keyframes juego-marea {
  from { transform: scale(1.02); opacity: 0.8; }
  to { transform: scale(1.06); opacity: 1; }
}

/* Herrajes de la cabecera: relieve sobrio para que destaque la isla. */
#pJuego .barra {
  background: var(--j-veta), var(--hud-bg);
  border-radius: 0 0 22px 13px / 0 0 8px 12px;
  box-shadow: inset 0 -2px 0 var(--j-luz), 0 4px 0 var(--isla-lado-2),
    0 9px 18px var(--j-sombra);
}
#pJuego .chip, #pJuego .jugador, #pJuego .chip-estaca {
  border-radius: 14px 9px 16px 11px / 9px 13px 8px 12px;
  box-shadow: inset 0 1px 0 var(--j-luz), inset 0 -2px 3px rgb(0 0 0 / 16%),
    0 3px 5px rgb(0 0 0 / 20%);
  font-variant-numeric: tabular-nums;
}
#pJuego .jugador:nth-child(2n) { border-radius: 9px 16px 11px 14px; }
#pJuego .jugador.activo {
  box-shadow: inset 0 1px 0 var(--j-luz), 0 3px 0 var(--isla-lado-2),
    0 0 12px color-mix(in srgb, var(--acento) 40%, transparent);
}
#pJuego .progreso { font-variant-numeric: tabular-nums; opacity: 1; }

/* Hoja gastada: veta de papel y doble canto, sin cortar las letras. */
#pJuego .pergamino {
  position: relative;
  background: var(--j-veta), var(--hud-bg);
  border-radius: 22px 13px 25px 12px / 9px 18px 11px 20px;
  box-shadow: inset 0 2px 0 var(--j-luz), inset 0 -4px 8px rgb(0 0 0 / 12%),
    0 3px 0 var(--isla-lado), 0 6px 0 var(--isla-lado-2), 0 12px 18px var(--j-sombra);
}
#pJuego .pergamino::after {
  content: ""; position: absolute; inset: 5px; border: 1px solid currentColor;
  opacity: 0.12; border-radius: inherit; pointer-events: none;
}
#pJuego .pastilla { border-radius: 8px 5px 10px 6px; text-transform: none; letter-spacing: 0; }
#pJuego .pregunta { text-wrap: pretty; }

/* Costa irregular. La variación del contorno es menor que el margen de lectura (12%). */
#pJuego .isla {
  border-radius: var(--j-costa);
  box-shadow: inset 0 3px 3px var(--j-luz),
    0 calc(var(--isla-d) * 0.028) 0 var(--isla-lado),
    0 calc(var(--isla-d) * 0.055) 0 var(--isla-lado-2),
    0 calc(var(--isla-d) * 0.10) calc(var(--isla-d) * 0.08) var(--j-sombra), var(--isla-sombra);
}
#pJuego .isla::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--j-veta), radial-gradient(ellipse at 32% 15%, var(--j-luz), transparent 65%);
  box-shadow: inset 2px 0 2px var(--j-luz), inset -3px -4px 6px rgb(0 0 0 / 14%);
}
#pJuego .isla-deco { border-radius: inherit; overflow: hidden; }
#pJuego .isla.revelable::after { border-radius: inherit; }
#pJuego .isla-base {
  background: linear-gradient(115deg, var(--isla-lado), var(--isla-lado-2) 68%);
  clip-path: polygon(0 0, 100% 0, 94% 29%, 80% 40%, 76% 64%, 62% 69%, 50% 100%, 38% 78%, 25% 70%, 17% 45%, 6% 33%);
}
/* Grabado SVG: grietas dibujadas a mano, con los colores del mundo. */
#pJuego .isla-base::after {
  background: var(--isla-lado);
  opacity: 0.65;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100'%3E%3Cpath d='M22 0l21 27-5 19 33 18 26 36M96 0l-7 28 21 15-9 36M169 0l-29 25 9 16-30 27M43 27l46 1M110 43l39-2' fill='none' stroke='black' stroke-width='3'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
#pJuego .ruta {
  border-radius: var(--j-costa);
  box-shadow: 0 1px 0 var(--j-luz), 0 6px 12px rgb(0 0 0 / 12%);
}

/* Variaciones fijas por posición, sin azar al redibujar.
   Solo varía la pieza: los centros y la contrarrotación del tablero siguen intactos. */
#pJuego .nodo { --j-angle: -3deg; --j-taille: 0.98; --j-patine: 0.04;
  --estaca-clip: none; --estaca-radio: 36% 43% 32% 40% / 28% 31% 42% 38%; }
#pJuego .nodo:nth-child(3n + 2) { --j-angle: 4deg; --j-taille: 1.02; --j-patine: 0.10;
  --estaca-radio: 40% 29% 44% 32% / 35% 44% 28% 38%; }
#pJuego .nodo:nth-child(3n) { --j-angle: -1deg; --j-taille: 0.96; --j-patine: 0.07; }
#pJuego .nodo:nth-child(5n) { --j-angle: 2deg; --j-taille: 1; --j-patine: 0.01; }
#pJuego .estaca-caja { transform: rotate(var(--j-angle)) scale(var(--j-taille)); }
#pJuego .estaca {
  border: 1px solid var(--estaca-contorno, var(--acento));
  box-shadow: inset 0 2px 1px var(--j-luz), inset -2px -3px 4px rgb(0 0 0 / 28%),
    0 3px 0 var(--isla-lado-2), 0 5px 7px var(--j-sombra);
}
#pJuego .estaca::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--j-veta), linear-gradient(rgb(0 0 0 / var(--j-patine)), rgb(0 0 0 / var(--j-patine)));
}
#pJuego .nodo.sel .estaca-caja { transform: rotate(var(--j-angle)) scale(1.20); }
#pJuego .nodo.sel .estaca {
  outline: 2px solid var(--acento); outline-offset: 3px;
  box-shadow: inset 0 2px 1px var(--j-luz), 0 4px 0 var(--isla-lado-2),
    0 7px 12px var(--j-sombra), 0 0 18px color-mix(in srgb, var(--acento) 65%, transparent);
}
/* Área de pulsación independiente de la pequeña pieza tallada. */
#pJuego .nodo::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: max(48px, 100%); height: max(48px, 100%); transform: translate(-50%, -50%);
  border-radius: 40%;
}
#pJuego .nodo:active .estaca-caja { transform: rotate(var(--j-angle)) scale(0.92); }
#pJuego .nodo:focus-visible { outline: none; }
#pJuego .nodo:focus-visible .estaca { outline: 3px solid var(--acento); outline-offset: 4px; }

/* Timones y asideros: la misma materia, con siluetas diferentes. */
#pJuego .btn-barajar, #pJuego .btn-redondo {
  min-width: 48px; min-height: 48px;
  border-radius: 36% 29% 38% 27% / 28% 38% 30% 40%;
  background: var(--j-veta), var(--hud-bg); color: var(--hud-texto);
  border: 1px solid var(--acento);
  box-shadow: inset 0 2px 0 var(--j-luz), 0 3px 0 var(--isla-lado-2), 0 6px 9px var(--j-sombra);
}
#pJuego .btn-barajar { border-radius: 12px 8px 14px 9px; }
#pJuego .flecha.der { border-radius: 29% 38% 27% 36% / 38% 28% 40% 30%; }
#pJuego .btn-clavar, #pJuego .juicio {
  border-radius: 23px 14px 27px 16px / 14px 22px 16px 23px;
  box-shadow: inset 0 2px 0 var(--j-luz), inset 0 -4px 6px rgb(0 0 0 / 18%),
    0 6px 0 var(--btn-borde), 0 12px 18px var(--j-sombra),
    0 0 20px color-mix(in srgb, var(--acento) 28%, transparent);
}
#pJuego .btn-clavar { text-transform: none; letter-spacing: 0; background: var(--j-veta), var(--btn-bg); }
#pJuego .btn-clavar::before { border-radius: inherit; }
#pJuego .juicio::after { border-radius: inherit; }
#pJuego .juicio.acerte { background: linear-gradient(var(--j-luz), transparent 55%, rgb(0 0 0 / 25%)), var(--ok); }
#pJuego .juicio.falle { background: linear-gradient(var(--j-luz), transparent 55%, rgb(0 0 0 / 25%)), var(--mal);
  border-radius: 14px 23px 16px 27px / 22px 14px 23px 16px; }
#pJuego :is(.btn-clavar, .juicio, .btn-barajar, .btn-redondo) {
  touch-action: manipulation; transition: transform 0.22s cubic-bezier(0.3, 1.4, 0.5, 1);
}
#pJuego :is(.btn-clavar, .juicio, .btn-barajar, .btn-redondo):active:not(:disabled) {
  transform: translateY(3px) scale(0.97); transition-duration: 60ms;
  box-shadow: inset 0 2px 5px var(--j-sombra), 0 1px 0 var(--btn-borde);
}
#pJuego :is(button, summary):focus-visible { outline: 3px solid var(--acento); outline-offset: 4px; }
#pJuego .icono-juicio, #pJuego .isla-deco i { animation: none; }
#pJuego .pie-juego { padding-bottom: max(18px, calc(10px + env(safe-area-inset-bottom))); }

@media (min-aspect-ratio: 5/4) and (min-width: 600px) {
  #pJuego .tablero-hueco { margin-bottom: 12px; }
}

@media (max-width: 600px) {
  #pJuego .barra { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 6px; }
  #pJuego .chip { padding: 4px 7px; }
  #pJuego .marcador { gap: 4px; }
  #pJuego .pergamino-cabecera { gap: 8px; }
  #pJuego .btn-barajar { padding: 6px 8px; }
  #pJuego .aviso { font-size: 1rem; }
}

/* Segunda ronda: diez materiales, con el centro despejado para la lectura.
   Se conservan diámetro, cajas y tipografías que mide ajustarTextoIsla. */
#pJuego {
  --j-cara: var(--isla-bg);
  --j-grano: var(--j-veta);
  --j-relieve: radial-gradient(ellipse at 32% 0%, rgb(255 255 255 / 22%), transparent 58%),
    linear-gradient(170deg, transparent 35%, rgb(0 0 0 / 22%));
}
[data-tema="historia"] #pJuego {
  --j-cara: radial-gradient(ellipse at 35% 24%, color-mix(in srgb, var(--mal) 85%, white), var(--mal) 56%, color-mix(in srgb, var(--mal) 55%, black));
  --j-grano: repeating-radial-gradient(ellipse at 44% 38%, transparent 0 8px, rgb(0 0 0 / 5%) 9px, transparent 11px 17px);
}
[data-tema="gastronomia"] #pJuego {
  --j-cara: radial-gradient(ellipse at 34% 25%, white, var(--hud-texto) 58%, color-mix(in srgb, var(--hud-texto) 70%, var(--acento)) 84%, var(--acento));
  --j-grano: repeating-radial-gradient(circle, transparent 0 5px, rgb(130 85 35 / 3%) 6px, transparent 7px 12px);
}
[data-tema="geografia"] #pJuego {
  --j-cara: radial-gradient(ellipse at 37% 28%, var(--resp-texto), color-mix(in srgb, var(--resp-texto) 90%, var(--acento)) 56%, var(--acento));
  --j-grano: repeating-linear-gradient(16deg, transparent 0 16px, rgb(94 71 16 / 5%) 17px, transparent 18px 32px);
}
[data-tema="ciencia"] #pJuego {
  --j-cara: radial-gradient(ellipse at 36% 26%, color-mix(in srgb, var(--isla-lado) 75%, var(--acento)), var(--isla-lado-2) 68%, var(--resp-texto));
  --j-grano: repeating-linear-gradient(90deg, transparent 0 15px, rgb(0 242 254 / 5%) 16px, transparent 17px 32px);
}
[data-tema="cultura"] #pJuego {
  --j-cara: radial-gradient(ellipse at 36% 27%, var(--hud-texto), color-mix(in srgb, var(--hud-texto) 75%, var(--acento)) 53%, var(--acento));
  --j-grano: repeating-conic-gradient(from 12deg, transparent 0deg 14deg, rgb(90 58 13 / 4%) 16deg, transparent 18deg 30deg);
}
[data-tema="deportes"] #pJuego {
  --j-cara: radial-gradient(ellipse at 32% 24%, var(--isla-lado), color-mix(in srgb, var(--isla-lado) 80%, var(--isla-lado-2)) 55%, var(--isla-lado-2));
  --j-grano: repeating-linear-gradient(102deg, transparent 0 2px, rgb(255 255 255 / 4%) 3px, transparent 4px 7px);
}
[data-tema="naturaleza"] #pJuego {
  --j-cara: radial-gradient(ellipse at 34% 26%, var(--resp-texto), var(--texto) 60%, color-mix(in srgb, var(--texto) 78%, var(--isla-lado)));
  --j-grano: repeating-radial-gradient(ellipse at 15% 80%, transparent 0 12px, rgb(74 58 30 / 5%) 13px, transparent 15px 21px);
}
[data-tema="musica"] #pJuego {
  --j-cara: radial-gradient(ellipse at 30% 20%, var(--isla-lado), var(--resp-bg) 72%);
  --j-grano: repeating-radial-gradient(circle, transparent 0 2px, rgb(255 255 255 / 6%) 3px, transparent 4px 6px);
}
[data-tema="mitologia"] #pJuego {
  --j-cara: radial-gradient(ellipse at 34% 24%, var(--hud-texto), var(--resp-texto) 58%, color-mix(in srgb, var(--resp-texto) 72%, var(--isla-lado)));
  --j-grano: repeating-linear-gradient(137deg, transparent 0 23px, rgb(74 58 122 / 6%) 25px, transparent 28px 43px);
}
[data-tema="cotidiano"] #pJuego {
  --j-cara: radial-gradient(ellipse at 30% 22%, white, color-mix(in srgb, var(--panel) 92%, var(--acento)) 55%, color-mix(in srgb, var(--panel) 65%, var(--acento)) 85%, var(--acento));
  --j-grano: radial-gradient(circle, rgb(255 61 127 / 7%) 0.7px, transparent 1.4px) 0 0 / 8px 9px;
}
#pJuego .isla {
  background: var(--j-grano), var(--j-cara);
  box-shadow: inset 2px 4px 5px rgb(255 255 255 / 35%), inset -3px -7px 12px rgb(0 0 0 / 22%),
    0 calc(var(--isla-d) * 0.028) 2px var(--isla-lado),
    0 calc(var(--isla-d) * 0.055) 3px var(--isla-lado-2),
    0 18px 25px var(--j-sombra), 0 0 32px color-mix(in srgb, var(--acento) 32%, transparent);
}
#pJuego .isla::before {
  background: radial-gradient(ellipse at 32% 8%, rgb(255 255 255 / 16%), transparent 40%);
}
[data-tema="musica"] #pJuego .isla-contenido {
  background: radial-gradient(ellipse at 35% 23%, var(--isla-lado), var(--isla-lado-2) 68%, var(--resp-bg));
  box-shadow: inset 0 3px 6px var(--j-luz), inset 0 -5px 12px var(--j-sombra);
}
#pJuego .isla-deco { opacity: 0.45; }
#pJuego .isla-resp {
  background: var(--j-relieve), var(--resp-bg);
  box-shadow: inset 0 1px 2px var(--j-luz), inset 0 -2px 3px var(--j-sombra), 0 2px 5px var(--j-sombra);
}
#pJuego :is(.chip, .pastilla, .chip-estaca, .btn-redondo, .btn-barajar) {
  background: var(--j-relieve), var(--j-veta), var(--hud-bg);
  color: var(--hud-texto);
  box-shadow: inset 0 2px 2px var(--j-luz), inset 0 -3px 5px rgb(0 0 0 / 24%),
    0 3px 2px var(--isla-lado-2), 0 6px 10px var(--j-sombra), 0 0 12px color-mix(in srgb, var(--acento) 18%, transparent);
}
#pJuego .chip-estaca:nth-child(2) { border-radius: 9px 15px 11px 16px; }
#pJuego .txt-n1 { --j-nivel: #a5f3c2; }
#pJuego .txt-n2 { --j-nivel: #ffe29a; }
#pJuego .txt-n3 { --j-nivel: #ffc2cd; }
#pJuego .chip-estaca:is(.txt-n1, .txt-n2, .txt-n3) {
  color: var(--j-nivel);
  background: radial-gradient(ellipse at 25% 0%, rgb(255 255 255 / 15%), transparent 65%),
    var(--j-veta), linear-gradient(165deg, #26323e, #101820);
  border-color: color-mix(in srgb, var(--j-nivel) 45%, #101820);
  text-shadow: 0 1px 2px #000;
}
#pJuego .pip {
  background: radial-gradient(ellipse at 35% 0%, #46535e, #17212b 55%, #090e15);
  border-radius: 48% 42% 45% 37% / 40% 46% 36% 43%;
  box-shadow: inset 0 1px 1px var(--j-luz), inset 0 -1px 2px #000, 0 2px 3px var(--j-sombra), 0 0 5px color-mix(in srgb, currentColor 25%, transparent);
  text-shadow: 0 1px 1px #000, 0 -1px 1px rgb(255 255 255 / 30%);
}
#pJuego .estaca { background: var(--j-relieve), var(--estaca-bg); }
#pJuego .nodo.ok .estaca { background: var(--j-relieve), var(--ok); }
#pJuego .nodo.mal .estaca { background: var(--j-relieve), var(--mal); }
/* El índice persiste aunque se reconstruya el anillo. */
#pJuego .nodo[data-i="0"] { --j-angle: -3deg; --j-taille: .98; }
#pJuego .nodo[data-i="1"] { --j-angle: 4deg; --j-taille: 1.02; }
#pJuego .nodo[data-i="2"] { --j-angle: -1deg; --j-taille: .96; }
#pJuego .nodo[data-i="3"] { --j-angle: 2deg; --j-taille: .99; }
#pJuego .nodo[data-i="4"] { --j-angle: -4deg; --j-taille: 1.01; }
#pJuego .nodo[data-i="5"] { --j-angle: 3deg; --j-taille: .97; }
#pJuego .nodo[data-i="6"] { --j-angle: -2deg; --j-taille: 1.03; }
#pJuego .nodo[data-i="7"] { --j-angle: 1deg; --j-taille: .95; }
#pJuego .nodo[data-i="8"] { --j-angle: -3.5deg; --j-taille: 1; }
#pJuego .nodo[data-i="9"] { --j-angle: 2.5deg; --j-taille: 1.015; }
#pJuego .btn-clavar { background: var(--j-relieve), var(--j-veta), var(--btn-bg); }
#pJuego .btn-clavar::before {
  inset: 0; background: radial-gradient(ellipse at 35% 0%, rgb(255 255 255 / 28%), transparent 62%);
  box-shadow: inset 0 2px 3px rgb(255 255 255 / 45%), inset 0 -5px 8px rgb(0 0 0 / 26%);
}
#pJuego .btn-clavar::after {
  inset: 0; width: auto; border-radius: inherit; transform: none;
  background: radial-gradient(ellipse at 50% 100%, color-mix(in srgb, var(--acento) 32%, transparent), transparent 70%);
  box-shadow: inset 0 0 15px color-mix(in srgb, var(--btn-filo) 45%, transparent);
  animation: juego-resplandor 3.6s ease-in-out infinite; will-change: auto;
}
@keyframes juego-resplandor { 0%, 100% { opacity: .25; } 50% { opacity: .85; } }
#pJuego .btn-clavar:disabled::after { animation: none; opacity: .15; }
#pJuego .tira-jugadores {
  justify-content: safe center; padding: 8px 12px 7px; scroll-padding-inline: 12px;
}
#pJuego .jugador {
  background: var(--j-relieve), var(--j-veta), var(--hud-bg); color: var(--hud-texto);
  transition: transform .2s ease-out, opacity .2s ease-out;
}
#pJuego .jugador > div { min-width: 0; }
#pJuego .jugador:nth-child(3n) { border-radius: 12px 18px 9px 15px; }
#pJuego .reloj-arco { transition: none; }
@media (max-width: 600px) {
  /* Hasta tres tripulantes caben enteros; más mantienen scroll centrado seguro. */
  #pJuego .tira-jugadores { gap: 8px; }
  #pJuego .tira-jugadores:not(:has(.jugador:nth-child(4))) .jugador {
    flex: 1 1 0; min-width: 0; max-width: 150px; gap: 4px; padding: 4px;
  }
  #pJuego .tira-jugadores:not(:has(.jugador:nth-child(4))) .jugador > div { flex: 1; }
  #pJuego .jugador .pts { overflow-wrap: anywhere; }
  #pJuego .flecha { font-size: 2rem; }
}

/* Respuesta visual sin oscilación, rotación ni desplazamiento automático. */
@media (prefers-reduced-motion: reduce) {
  #pJuego *, #pJuego *::before, #pJuego *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
  #pJuego .isla.revelable::after { opacity: 0.65; }
  #pJuego .btn-clavar::after { opacity: 0; }
}
/* Camarote v18: todas las reglas quedan aisladas de las pantallas anteriores. */
#pCamarote {
  --cam-mar: #0b3a52; --cam-madera: #392518; --cam-laton: #b58c47;
  --cam-papel: #f4e0ad; --cam-tinta: #34200e; --cam-oro: #ffda70;
  --cam-borde: clamp(4px, .7vh, 15px);
  --cam-izq: max(var(--cam-borde), env(safe-area-inset-left));
  --cam-der: max(var(--cam-borde), env(safe-area-inset-right));
  --cam-arriba: max(var(--cam-borde), env(safe-area-inset-top));
  --cam-abajo: max(var(--cam-borde), env(safe-area-inset-bottom));
  --cam-alto: calc(12dvh - var(--cam-arriba) - 4px);
  --cam-fichas-alto: calc(11dvh - var(--cam-abajo) - 4px);
  --cam-fichas-ancho: 58vw;
  font-family: "Lilita One", system-ui, sans-serif; color: #fff2d2; background: var(--cam-mar);
}
#pCamarote.activa {
  position: fixed; inset: 0; z-index: 30; display: block;
  width: 100vw; height: 100vh; height: 100dvh; min-height: 0; max-width: none;
  margin: 0; padding: 0; overflow: hidden; overscroll-behavior: none; animation: none;
  background: #0b3a52; isolation: isolate;
}
#pCamarote *, #pCamarote *::before, #pCamarote *::after { box-sizing: border-box; }
/* El motor encaja la cámara y rellena el mar; CSS no impone proporciones. */
#pCamarote .camarote-escena, #pCamarote .escenario-camarote {
  position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; min-height: 0;
  margin: 0; padding: 0; aspect-ratio: auto; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#pCamarote .camarote-escena { z-index: 0; }
#pCamarote .escenario-camarote canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
#pCamarote #canvas-luz { pointer-events: none; }
#pCamarote .cam-cartel { top: 50%; }
#pCamarote .camarote-hud, #pCamarote .camarote-barra {
  position: absolute; inset: 0; margin: 0; padding: 0; min-height: 0;
  border: 0; background: none; box-shadow: none; pointer-events: none;
}
#pCamarote .camarote-hud { z-index: 2; }
#pCamarote .camarote-barra { display: block; }
#pCamarote .cam-meta, #pCamarote .cam-fase, #pCamarote .cam-jugador {
  border: 1px solid var(--cam-laton); border-radius: 8px 15px 7px 12px;
  background: repeating-linear-gradient(4deg, transparent 0 7px, #150b0533 8px 9px, transparent 10px 17px), linear-gradient(155deg, #775232, var(--cam-madera) 75%);
  box-shadow: inset 0 2px 1px #fbd28a80, inset 0 -3px 3px #140a07, 0 2px 0 #201209, 0 4px 7px #0008;
  text-shadow: 0 2px 1px #160c07;
}
#pCamarote .btn-redondo {
  position: absolute; top: var(--cam-arriba); left: var(--cam-izq);
  width: clamp(32px, 6.6vh, 142px); height: clamp(32px, 6.6vh, 142px); padding: 0;
  border: 2px solid #efd18a; border-radius: 50%; color: var(--cam-tinta);
  background: radial-gradient(circle at 35% 25%, #ffecab, #c99b4f 60%, #79501f);
  box-shadow: inset 0 2px 2px #fff3be, inset 0 -4px 4px #543414, 0 3px 0 #30200f, 0 5px 8px #0009;
  font-size: clamp(16px, 2.5vh, 54px);
}
#pCamarote .cam-meta {
  position: absolute; top: var(--cam-arriba); left: calc(var(--cam-izq) + clamp(32px, 6.6vh, 142px) + 8px);
  display: flex; align-items: center; justify-content: center; gap: .3em;
  width: max-content; max-width: 17vw; height: min(6.6vh, var(--cam-alto)); padding: 0 .6em;
  font-size: clamp(14px, 1.35vw, 52px); line-height: 1; white-space: nowrap;
}
#pCamarote .cam-meta svg { width: 1em; height: 1.2em; flex: none; }
#pCamarote .cam-fase {
  position: absolute; top: var(--cam-arriba); right: var(--cam-der);
  width: 24vw; height: calc(var(--cam-alto) * .53); padding: 0 .4em;
  display: flex; align-items: center; justify-content: space-between; gap: .3em;
  font-size: clamp(12px, 1.2vw, 46px); line-height: 1;
}
#pCamarote .cam-fase-nombre { min-width: 0; overflow-wrap: anywhere; }
#pCamarote .cam-reloj {
  flex: none; min-width: 2.5ch; padding: .02em .18em; text-align: center; font-variant-numeric: tabular-nums;
  font-size: clamp(18px, 3.5vh, 76px); color: var(--cam-oro); background: #160e0a;
  border: 1px solid #96703c; border-radius: 5px 9px 4px 7px; box-shadow: inset 0 2px 4px #000;
}
#pCamarote .cam-barajar {
  position: absolute; top: calc(var(--cam-arriba) + var(--cam-alto) * .53 + 4px); right: var(--cam-der);
  display: flex; justify-content: center; gap: .3em; width: 24vw;
  height: calc(var(--cam-alto) * .47 - 4px); min-height: 0; margin: 0; padding: 0 .4em;
  font-size: clamp(12px, 1.15vw, 44px); line-height: 1;
}
#pCamarote .cam-pergamino {
  position: absolute; top: calc(var(--cam-arriba) + 3px); left: 50%; translate: -50% 0;
  width: 46vw; height: calc(var(--cam-alto) - 6px); margin: 0; padding: .3vh 1vw;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25vh;
  color: var(--cam-tinta); border: 1px solid var(--cam-laton); border-radius: 5px 12px 7px 15px;
  background: repeating-linear-gradient(6deg, #96562108 0 1px, transparent 2px 5px), linear-gradient(100deg, #d3af70, var(--cam-papel) 18%, #eed69d 82%, #caa367);
  box-shadow: inset 0 2px 0 #fff0cb, inset 0 -3px 5px #8e572b55, 0 4px 7px #0008;
}
#pCamarote .cam-pergamino::before, #pCamarote .cam-pergamino::after {
  content: ""; position: absolute; left: -.4vw; right: -.4vw; height: clamp(3px, .55vh, 12px);
  border-radius: 50px; background: linear-gradient(#fff0c0, #c19b58 55%, #765126);
  box-shadow: 0 1px 2px #4a2b16aa; pointer-events: none;
}
#pCamarote .cam-pergamino::before { top: -3px; }
#pCamarote .cam-pergamino::after { bottom: -3px; }
#pCamarote .cam-pergamino .pastilla {
  flex: none; max-width: 100%; margin: 0; padding: .1em .7em;
  font: clamp(11px, 1vw, 38px)/1 "Lilita One", system-ui, sans-serif;
  color: #fff0cb; background: #59351d; border: 1px solid #a87836; border-radius: 9px 5px 8px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#pCamarote .cam-pregunta {
  min-width: 0; margin: 0; font: clamp(16px, 1.45vw, 56px)/1.08 "Lilita One", system-ui, sans-serif;
  text-align: center; text-wrap: balance; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
#pCamarote .cam-jugadores {
  position: absolute; left: var(--cam-izq); bottom: var(--cam-abajo); width: var(--cam-fichas-ancho);
  height: min(4.6vh, var(--cam-fichas-alto)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr); gap: clamp(2px, .4vh, 8px); padding: 0; margin: 0; background: none;
}
#pCamarote .cam-jugadores:has(.cam-jugador:nth-child(5)) { height: var(--cam-fichas-alto); }
#pCamarote .cam-jugador {
  min-width: 0; min-height: 0; max-width: none; display: flex; align-items: center; gap: .3em; padding: .2vh .35vw;
  font-size: clamp(12px, 1.1vw, 42px); line-height: 1;
}
#pCamarote .cam-jugador .avatar {
  flex: none; width: min(3.4vh, 2.8vw); height: min(3.4vh, 2.8vw); min-width: 0;
  display: grid; place-items: center; border: 1px solid var(--cam-oro); border-radius: 50%;
  box-shadow: inset 0 1px 2px #fff2bb, 0 2px 2px #140a07; font-size: inherit;
}
#pCamarote .cam-jugador .avatar svg { width: 100%; height: 100%; }
#pCamarote .cam-nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pCamarote .cam-aseguradas, #pCamarote .cam-saco { display: inline-flex; align-items: center; gap: .12em; font-variant-numeric: tabular-nums; white-space: nowrap; }
#pCamarote .cam-saco { color: var(--cam-oro); }
#pCamarote .cam-saco:empty { display: none; }
#pCamarote .cam-jugador .icono, #pCamarote .cam-jugador .icono-bandera, #pCamarote .cam-jugador .barajo { flex: none; width: .9em; height: 1em; }
#pCamarote .btn-redondo, #pCamarote .cam-barajar, #pCamarote .cam-boton-empujon {
  pointer-events: auto; cursor: pointer; touch-action: manipulation;
  transition: transform .24s cubic-bezier(.34,1.56,.64,1);
}
#pCamarote button:focus-visible { outline: 3px solid #fff0bc; outline-offset: 3px; }
#pCamarote button:active:not(:disabled), #pCamarote button.pulsado:not(:disabled) { transform: scale(.92); transition-duration: .06s; }
#pCamarote .cam-controles { display: none; position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#pCamarote .joystick, #pCamarote .cam-boton-empujon {
  position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); pointer-events: auto;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#pCamarote .joystick { left: calc(var(--cam-izq) + var(--cam-fichas-ancho) + 12px); width: clamp(80px, 18vh, 144px); aspect-ratio: 1; }
#pCamarote .joystick-base {
  position: absolute; inset: 0; border: 4px ridge #b68a43; border-radius: 50%;
  background: repeating-linear-gradient(12deg, #25170a44 0 3px, transparent 4px 12px), radial-gradient(circle, #24150d, #725031);
  box-shadow: inset 0 6px 15px #000b, inset 0 -2px 2px #f7d48b88, 0 5px 12px #0009;
}
#pCamarote .joystick-palanca {
  position: absolute; left: calc(50% - 24px); top: calc(50% - 24px); width: 48px; height: 48px;
  border: 3px solid #ddbb70; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 25%, #e6bd70, #986331 55%, #452b16);
  box-shadow: inset 0 2px 2px #fff3be99, inset 0 -4px 4px #211006, 0 5px 8px #000a;
}
#pCamarote .cam-boton-empujon {
  right: max(12px, env(safe-area-inset-right)); width: clamp(72px, 16vh, 128px); aspect-ratio: 1;
  min-height: 48px; padding: 8px; border: 4px ridge #d6ab57; border-radius: 50%; color: #fff0bc;
  font: clamp(16px, 2vw, 23px) "Lilita One", system-ui, sans-serif; text-shadow: 0 2px 2px #300a04;
  background: radial-gradient(circle at 35% 25%, #cf5940, #85281c 60%, #45140d);
  box-shadow: inset 0 3px 3px #ffb47b88, inset 0 -6px 8px #380b07, 0 4px 0 #462e15, 0 7px 12px #0009;
}
#pCamarote .cam-girar { display: none; }
@media (pointer: coarse), (hover: none) {
  #pCamarote { --cam-fichas-ancho: 38vw; }
  #pCamarote .cam-controles { display: block; }
  #pCamarote .cam-nombre { display: none; }
  #pCamarote .cam-jugador { justify-content: space-between; gap: 1px; }
}
/* En horizontal corto se conservan dos líneas de pregunta y las dos filas de botín. */
@media (max-height: 520px) and (orientation: landscape) {
  #pCamarote { --cam-borde: 2px; --cam-fichas-ancho: 42vw; }
  #pCamarote .cam-nombre, #pCamarote .cam-pergamino .pastilla { display: none; }
  #pCamarote .cam-meta { font-size: 14px; padding-inline: .3em; }
  #pCamarote .cam-fase { font-size: 12px; }
  #pCamarote .cam-reloj { font-size: 18px; }
  #pCamarote .cam-barajar { font-size: 12px; }
  #pCamarote .cam-barajar span { display: inline; }
  #pCamarote .cam-pergamino { padding: 0 .7vw; }
  #pCamarote .cam-pregunta { font-size: 16px; line-height: .95; }
  #pCamarote .cam-jugador { padding: 0 2px; font-size: 14px; gap: 1px; }
  #pCamarote .cam-jugador .avatar { width: 12px; height: 12px; }
  #pCamarote .cam-jugador .barajo { width: 6px; }
}
@media (orientation: portrait) and (max-width: 700px) {
  #pCamarote { --cam-fichas-ancho: calc(100vw - var(--cam-izq) - var(--cam-der)); }
  #pCamarote .cam-meta { max-width: none; top: calc(var(--cam-arriba) + 48px); left: var(--cam-izq); height: 22px; font-size: 12px; }
  #pCamarote .btn-redondo { width: 44px; height: 44px; }
  #pCamarote .cam-pergamino { left: 48%; width: 46vw; }
  #pCamarote .cam-pergamino .pastilla, #pCamarote .cam-nombre { display: none; }
  #pCamarote .cam-pregunta { font-size: 16px; }
  #pCamarote .cam-fase { width: 26vw; font-size: 11px; }
  #pCamarote .cam-reloj { font-size: 20px; }
  #pCamarote .cam-barajar { width: 26vw; font-size: 12px; }
  #pCamarote .cam-jugador { justify-content: space-between; font-size: 12px; gap: 1px; padding-inline: 2px; }
  #pCamarote .cam-jugador .barajo { width: 6px; }
  #pCamarote .cam-jugador .avatar { width: 20px; height: 20px; }
  #pCamarote .joystick, #pCamarote .cam-boton-empujon { bottom: calc(11dvh + 12px); }
  #pCamarote .joystick { left: max(12px, env(safe-area-inset-left)); }
  #pCamarote .cam-girar { display: block; width: min(80vw, 320px); bottom: 34%; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #pCamarote *, #pCamarote *::before, #pCamarote *::after { animation: none !important; transition: none !important; }
}
