:root {
  color-scheme: dark;

  /* Paleta del menú principal */
  --morado-claro: #b04cff;
  --morado: #8a3ffc;
  --morado-oscuro: #5b21b6;
  --morado-profundo: #3b0f7a;
  --amarillo: #ffd23f;
  --lila: #f3d9ff;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: system-ui, sans-serif;
}

canvas {
  display: block;
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  color: #e6e9f0;
  text-align: center;
  cursor: pointer;
  z-index: 10;
}

#overlay.oculto {
  display: none;
}

.overlay-box h1 {
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.overlay-box p {
  margin: 0 0 20px;
  font-size: 1.1rem;
  color: #9fb4ff;
}

.overlay-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.9;
  color: #b8bfce;
}

kbd {
  background: #1d222e;
  border: 1px solid #3a4153;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

#hud {
  position: fixed;
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #cfd6e4;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  pointer-events: none;
  z-index: 5;
}

/* Plano del cohete (feature mision) */
#plano-cohete {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 5;
  padding: 10px 14px;
  background: rgba(10, 20, 45, 0.82);
  color: #fff;
  border: 1px solid #5b8def;
  border-radius: 8px;
  font:
    13px/1.6 system-ui,
    sans-serif;
  pointer-events: none;
}
#plano-cohete strong {
  display: block;
  margin-bottom: 4px;
  color: #ffd166;
}
#plano-cohete .plano-pie {
  margin-top: 6px;
  color: #bcd3f5;
}
#barra-polvo {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  z-index: 5;
  font:
    12px system-ui,
    sans-serif;
  color: #fff;
  text-align: center;
  pointer-events: none;
}
#barra-polvo div {
  height: 8px;
  margin-top: 3px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
}
#barra-polvo i {
  display: block;
  height: 100%;
  width: 0;
  background: #b9b4aa;
}

/* ---- Tarjeta de misión (feature mision) */
#objetivo {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 5;
  max-width: min(340px, 30vw);
  padding: 8px 14px;
  background: rgba(10, 20, 45, 0.82);
  border: 1px solid #ffd166;
  border-radius: 8px;
  color: #fff;
  font:
    14px/1.4 system-ui,
    sans-serif;
  text-align: left;
  pointer-events: none;
}
#objetivo strong {
  display: block;
  color: #ffd166;
  font-size: 11px;
  letter-spacing: 0.12em;
}
#objetivo em {
  display: block;
  color: #bcd3f5;
  font-size: 12px;
}

/* ---- Cinemática (feature cinematica): viñetas de cómic */
.cine {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  font-family: system-ui, sans-serif;
}
.cine[hidden] {
  display: none;
}
.cine__negro {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
}
.cine__barra {
  position: absolute;
  left: 0;
  right: 0;
  height: 9vh;
  background: #000;
}
.cine__barra--arriba {
  top: 0;
  border-bottom: 3px solid #ffd166;
}
.cine__barra--abajo {
  bottom: 0;
  border-top: 3px solid #ffd166;
}
.cine--ligera .cine__barra,
.cine--ligera .cine__vineta,
.cine--ligera .cine__saltar {
  display: none;
}
.cine__vineta {
  position: absolute;
  top: calc(9vh + 10px);
  left: 16px;
  color: #ffd166;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.cine__titulo {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}
.cine__titulo h1 {
  margin: 0;
  font-size: clamp(32px, 7vw, 84px);
  letter-spacing: 0.12em;
  text-shadow:
    4px 4px 0 #1c3b8c,
    0 0 28px rgba(120, 160, 255, 0.5);
}
.cine__titulo p {
  color: #bcd3f5;
  font-size: 1.1rem;
}
.cine__pie {
  position: absolute;
  left: 50%;
  bottom: calc(9vh + 18px);
  transform: translateX(-50%);
  width: min(780px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cine--ligera .cine__pie {
  bottom: 28px;
}
.cine__pie [hidden] {
  display: none;
}
.cine__leyenda {
  padding: 10px 16px;
  background: #fff3c4;
  color: #1b1b1b;
  border: 3px solid #1b1b1b;
  box-shadow: 5px 5px 0 #000;
  font-size: 15px;
  line-height: 1.45;
}
.cine__texto {
  margin: 0;
  padding: 12px 16px;
  background: rgba(20, 22, 30, 0.92);
  color: #e8e8e8;
  border: 2px solid #8fb4ff;
  border-radius: 6px;
  font:
    15px/1.5 "Courier New",
    monospace;
  white-space: pre-wrap;
  text-align: left;
}
.cine__pista {
  position: absolute;
  right: 18px;
  bottom: calc(9vh + 6px);
  color: #ffd166;
  font-size: 13px;
  animation: cine-parpadeo 1.2s infinite;
}
.cine--ligera .cine__pista {
  display: none;
}
@keyframes cine-parpadeo {
  50% {
    opacity: 0.35;
  }
}
.cine__saltar {
  position: absolute;
  top: calc(9vh + 6px);
  right: 16px;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid #888;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
}

/* ---- Pantalla de entrada (ver features/portada) */
/* Mientras dura una cinemática se ocultan los avisos del juego (misión, zona, plano, coordenadas) */
body.en-cine #objetivo,
body.en-cine #letrero,
body.en-cine #plano-cohete,
body.en-cine #boceto-nave,
body.en-cine #letrero-interactuar,
body.en-cine #hud,
body.en-cine #barra-polvo {
  display: none !important;
}
/* El plano del cohete baja un poco para no chocar con el letrero de zona (arriba al centro) */
#plano-cohete {
  top: 60px;
} /* deja libre el botón ⚙ de configuración (arriba a la derecha) */

/* ---- Portada: negro, Tierra arriba a la izquierda, título en arco, luna en píxeles y Mi y Ni a la derecha */
#overlay {
  background: #000 url("../assets/vectors/background.svg") center / cover
    no-repeat;
  cursor: default;
  font-family: "Fredoka", system-ui, sans-serif;
  overflow: hidden;
}

#overlay .tierra-lejana {
  position: absolute;
  left: 4px;
  top: 36%;
  width: 30px;
  height: auto;
  opacity: 0.95;
  pointer-events: none;
} /* la Tierra, diminuta, a lo lejos */
#overlay .logo-spaceapps {
  position: absolute;
  top: 14px;
  right: 62px;
  width: 84px;
  height: auto;
  pointer-events: none;
}

#overlay #vitrina {
  position: absolute;
  right: 3%;
  bottom: 0;
  width: 420px;
  height: 340px;
  pointer-events: none;
}
#overlay #vitrina canvas {
  display: block;
}
#overlay .overlay-box {
  position: relative;
  z-index: 2;
  max-width: 780px;
  padding: 12px 24px 0;
  margin-top: -6vh;
}
#overlay .logo-titulo {
  margin: 0;
  line-height: 0;
}
#overlay .logo-titulo img {
  display: block;
  margin: 0 auto;
  width: min(640px, 78vw);
  height: auto;
  filter: drop-shadow(0 0 22px rgba(176, 76, 255, 0.45));
}

#overlay .sub {
  margin: 14px 0 18px;
  color: var(--lila);
  letter-spacing: 0.3em;
  font-size: 0.8rem;
  font-weight: 700;
}

#overlay .historia {
  margin: 0 auto 10px;
  max-width: 640px;
  color: #ffd23f;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.5;
}
#overlay .historia--es {
  color: rgba(255, 210, 63, 0.38);
  font-size: 0.95rem;
  font-style: italic;
}
#overlay .controles i,
#overlay .creditos i {
  opacity: 0.5;
  font-style: italic;
}
#overlay .boton-inicio .bi__en,
#overlay .boton-inicio .bi__es {
  display: block;
}
#overlay .boton-inicio .bi__es {
  font-size: 0.62em;
  opacity: 0.6;
  letter-spacing: 0.18em;
  font-style: normal;
}
#overlay .boton-saltar .bi__es {
  opacity: 0.6;
}
#overlay .boton-inicio {
  margin: 20px 8px 8px;
  padding: 9px 26px;
  font:
    700 0.95rem "Fredoka",
    system-ui,
    sans-serif;
  letter-spacing: 0.08em;
  color: #fff;
  background: #2f4fa6;
  border: 3px solid #1b2f73;
  border-radius: 999px;
  box-shadow: 0 4px 0 #0f1c47;
  cursor: pointer;
}
#overlay .boton-inicio:hover {
  background: #3b60c4;
}
#overlay .boton-inicio:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0f1c47;
}
#overlay .boton-saltar {
  display: block;
  margin: 6px auto 0;
  padding: 4px 10px;
  font:
    0.8rem "Fredoka",
    system-ui,
    sans-serif;
  color: rgba(190, 205, 245, 0.7);
  background: transparent;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}
#overlay .controles {
  position: absolute;
  z-index: 2;
  left: 24px;
  bottom: 34px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 0.75rem;
  color: #f3d9ff;
}
#overlay .controles li {
  margin: 5px 0;
}
#overlay .creditos {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 6px;
  margin: 0;
  font-size: 0.7rem;
  color: #2f3340;
  text-shadow: none;
}
/* Antes de empezar solo el botón arranca el juego; ya empezado, la pantalla es una pausa y todo ella reanuda */
#overlay.antes-de-empezar {
  cursor: default;
}
#overlay.ya-empezo {
  cursor: pointer;
}
#overlay.ya-empezo .historia,
#overlay.ya-empezo .boton-saltar {
  display: none;
}
@media (max-width: 1000px) {
  #overlay .controles {
    display: none;
  }
}
@media (max-width: 760px) {
  #overlay #vitrina {
    display: none;
  }
}
#overlay.ya-empezo #menu { display: none; } /* en la pausa solo queda CONTINUAR */
#overlay.antes-de-empezar #btn-comenzar, #overlay.antes-de-empezar #btn-menu-principal { display: none; } /* CONTINUAR y volver al menú solo existen en la pausa */

/* ---- Libreta (pantalla de información con páginas) */
.info-panel.info-panel--libreta {
  background: radial-gradient(
    ellipse at center,
    rgba(60, 40, 22, 0.55),
    rgba(8, 6, 4, 0.9) 75%
  );
  backdrop-filter: blur(12px);
}
.info-panel .info-panel__caja--libreta {
  width: min(1000px, 100%);
  max-height: 96vh;
  background: transparent;
  border: none;
  padding: 0 0 96px;
  overflow: visible;
}
.info-panel__caja--libreta .info-panel__titulo {
  text-align: center;
  color: #ffd166;
}
.info-panel__caja--libreta .info-panel__contenido {
  overflow: visible;
}
.libreta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Libreta abierta: dos páginas rayadas con el espiral en el centro */
.libreta__hoja {
  position: relative;
  perspective: 1800px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: min(430px, 52vh);
  border-radius: 8px;
  background:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0) 44%,
      rgba(0, 0, 0, 0.16) 49.2%,
      rgba(0, 0, 0, 0.3) 50%,
      rgba(0, 0, 0, 0.16) 50.8%,
      rgba(0, 0, 0, 0) 56%
    ),
    repeating-linear-gradient(#fbf6e4 0 27px, #cfe0ea 27px 28px);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.7),
    0 0 0 5px #3a5ea8,
    0 0 0 7px #1c3b8c;
  color: #2b2b2b;
  font-family: "Segoe Print", "Comic Sans MS", "Bradley Hand", cursive;
}
.libreta__pagina {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 34px 24px 28px;
  justify-content: center;
}
.libreta__izq {
  align-items: center;
  padding-right: 30px;
}
.libreta__der {
  align-items: stretch;
  padding-left: 34px;
  transform-origin: left center;
}
.libreta__hoja.pasa .libreta__der {
  animation: libreta-pasa 0.5s ease-out;
}
@keyframes libreta-pasa {
  from {
    transform: rotateY(-70deg);
    opacity: 0.2;
  }
  to {
    transform: rotateY(0);
    opacity: 1;
  }
}
.libreta__espiral {
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 30px;
  margin-left: -15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.libreta__espiral i {
  display: block;
  width: 34px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(#9aa1ab, #eceff2 50%, #6b7280);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
@media (max-width: 760px) {
  .libreta__hoja {
    grid-template-columns: 1fr;
  }
  .libreta__espiral {
    display: none;
  }
  .libreta__pagina,
  .libreta__izq,
  .libreta__der {
    padding: 14px 18px;
  }
}
.libreta__foto {
  margin: 0;
  padding: 8px 8px 4px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transform: rotate(-1.4deg);
}
.libreta__foto img {
  display: block;
  max-width: 100%;
  max-height: 220px;
}
.libreta__foto figcaption {
  margin-top: 3px;
  font:
    11px system-ui,
    sans-serif;
  text-align: center;
}
.libreta__foto a {
  color: #1c3b8c;
}
.libreta__sinfoto {
  padding: 70px 40px;
  background: #ddd;
  font:
    13px system-ui,
    sans-serif;
  color: #555;
}
.libreta__dibujo {
  width: 190px;
  height: 228px;
  border: 6px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transform: rotate(1.2deg);
}
.libreta__pie {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  align-self: stretch;
}
.libreta__pie--es {
  color: #5b5b66;
  font-size: 13px;
  opacity: 0.7;
  font-style: italic;
}
/* Diálogos de Mi y Ni: siempre abajo de la pantalla, con su carita al lado */
.dialogo-mini {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(780px, 90vw);
  z-index: 2;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(20, 22, 30, 0.94);
  border: 2px solid #8fb4ff;
  border-radius: 8px;
  text-shadow: none;
  text-align: left;
}
.dialogo-mini[hidden] {
  display: none;
}
.dialogo-mini__fila {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dialogo-mini__cara {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font:
    700 22px system-ui,
    sans-serif;
  color: #1b1b1b;
  background: #ffd166 center / cover no-repeat;
  border: 2px solid #fff;
  box-shadow: 0 0 10px rgba(143, 180, 255, 0.5);
}
.dialogo-mini__cara--mi {
  background-image: var(--retrato-mi, none);
  background-color: #9ad7ff;
}
.dialogo-mini__cara--ni {
  background-image: var(--retrato-ni, none);
  background-color: #ffb3d1;
}
.dialogo-mini__nombre {
  flex: none;
  min-width: 2.4em;
  font:
    700 15px "Courier New",
    monospace;
  letter-spacing: 0.05em;
}
.dialogo-mini__nombre--mi {
  color: #ffd166;
}
.dialogo-mini__nombre--ni {
  color: #ff9ec7;
}
.dialogo-mini__texto {
  color: #e8e8e8;
  font:
    15px/1.5 "Courier New",
    monospace;
}
.libreta__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  font:
    13px system-ui,
    sans-serif;
}
.libreta__btn {
  padding: 6px 14px;
  cursor: pointer;
  color: #1b1b1b;
  background: #ffd166;
  border: 2px solid #1b1b1b;
  border-radius: 4px;
  font-weight: 700;
}
.libreta__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Fuente: discreta, al pie de la tarjeta */
.info-panel__fuente {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: #aab3c6;
  text-align: center;
}
.info-panel__fuente a {
  color: #b9c9f2;
}
.libreta__foto--plano img {
  max-height: 250px;
}

/* Aviso breve de misión (límite de exploración) */
#aviso-mision {
  position: fixed;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: none;
  background: rgba(8, 14, 28, 0.78);
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  text-align: center;
  font:
    14px system-ui,
    sans-serif;
  border: 1px solid rgba(255, 209, 102, 0.5);
}
#aviso-mision em {
  display: block;
  font-size: 12px;
  color: #bcd3f5;
}
.info-panel__pie a,
.libreta__foto figcaption a {
  color: inherit;
  text-decoration: underline dotted;
}
body.en-cine #aviso-mision {
  display: none !important;
}

/* ---- Boceto de la nave: desplegable con los restos que faltan (feature boceto) */
#boceto-nave {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  width: min(520px, 46vw);
  background: rgba(10, 20, 45, 0.88);
  color: #fff;
  border: 1px solid #5b8def;
  border-radius: 8px;
  font:
    13px/1.5 system-ui,
    sans-serif;
}
#boceto-nave[hidden] {
  display: none;
}
#boceto-nave summary {
  padding: 8px 12px;
  cursor: pointer;
  color: #ffd166;
  font-weight: 600;
  user-select: none;
}
.boceto-lienzo {
  position: relative;
  line-height: 0;
}
.boceto-lienzo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0 0 8px 8px;
}
.boceto-parte {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: 2px solid;
  border-radius: 10px;
  pointer-events: none;
}
.boceto-parte span {
  margin-bottom: 4px;
  padding: 1px 8px;
  border-radius: 10px;
  font:
    700 11px/1.6 system-ui,
    sans-serif;
  color: #fff;
}
.boceto-parte--falta {
  border-color: #e5484d;
  background: rgba(229, 72, 77, 0.28);
}
.boceto-parte--falta span {
  background: #c4282d;
}
.boceto-parte--ok {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.18);
}
.boceto-parte--ok span {
  background: #238636;
}

/* ---- Letrero «Pulsa E para interactuar» (feature collectibles) */
#letrero-interactuar {
  position: fixed;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
  background: rgba(8, 14, 28, 0.82);
  color: #fff;
  padding: 8px 18px;
  border-radius: 10px;
  text-align: center;
  font:
    600 15px system-ui,
    sans-serif;
  border: 1px solid rgba(255, 209, 102, 0.6);
}
#letrero-interactuar[hidden] {
  display: none;
}
#letrero-interactuar em {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #bcd3f5;
}

/* ---- Configuración (feature configuracion): botón ⚙ arriba a la derecha y panel del volumen */
#config-boton {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  background: rgba(10, 20, 45, 0.88);
  color: #ffd166;
  border: 1px solid #5b8def;
  border-radius: 50%;
  font:
    22px/1 system-ui,
    sans-serif;
}
#config-boton:hover,
#config-boton[aria-expanded="true"] {
  background: rgba(30, 50, 100, 0.95);
}
#config-panel {
  position: fixed;
  top: 58px;
  right: 12px;
  z-index: 20;
  width: 260px;
  padding: 10px 14px;
  background: rgba(10, 20, 45, 0.94);
  color: #fff;
  border: 1px solid #5b8def;
  border-radius: 8px;
  font:
    13px/1.5 system-ui,
    sans-serif;
}
#config-panel[hidden] {
  display: none;
}
#config-panel strong {
  display: block;
  margin-bottom: 8px;
  color: #ffd166;
}
#config-panel label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
#config-panel input[type="range"] {
  width: 100%;
  margin: 6px 0;
  accent-color: #ffd166;
  cursor: pointer;
}
#config-panel em {
  display: block;
  font-size: 11px;
  color: #bcd3f5;
}

/* Teletransporte rápido dentro del panel de configuración */
#config-panel .config-destinos {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 8px;
}
#config-panel .config-destinos span {
  color: #ffd166;
  font-weight: 600;
}
#config-panel .config-destinos button {
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  color: #fff;
  font:
    13px system-ui,
    sans-serif;
  background: rgba(91, 141, 239, 0.25);
  border: 1px solid #5b8def;
  border-radius: 6px;
}
#config-panel .config-destinos button:hover {
  background: rgba(91, 141, 239, 0.55);
}

/* ---- Texto bilingüe: inglés principal, español tenue ---- */
.bi {
  display: block;
}
.bi__en {
  display: block;
}
.bi__es {
  display: block;
  opacity: 0.55;
  font-size: 0.84em;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.bi--linea .bi__en,
.bi--linea .bi__es {
  display: inline;
}
.bi--linea .bi__es {
  margin-left: 0.5em;
}
.bi__es--linea {
  display: inline;
  margin-left: 0.4em;
}
.cine__linea {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.cine__linea + .cine__linea {
  margin-top: 10px;
}
.cine__quien {
  flex: none;
  min-width: 2.6em;
}
.cine__quien--mi {
  color: #ffd166;
}
.cine__quien--ni {
  color: #ff9ec7;
}
.cine__dicho {
  flex: 1;
}

/* Botones y títulos bilingües dentro de las tarjetas */
.info-panel__cerrar .bi__es,
.libreta__btn .bi__es {
  font-size: 0.7em;
}
.info-panel__titulo .bi__es {
  font-size: 0.6em;
  font-weight: 400;
}
.libreta__nav .bi__es {
  font-size: 0.8em;
}
.dialogo-mini__texto .bi__es {
  font-size: 0.82em;
}
#hud i {
  margin-left: 0.4em;
  opacity: 0.55;
  font-size: 0.85em;
}
#objetivo span,
#aviso-mision span {
  display: block;
}
#objetivo em,
#aviso-mision em,
#letrero-interactuar em {
  opacity: 0.6;
  font-style: italic;
}
#objetivo small {
  display: block;
  margin-top: 4px;
  color: #ffe9a8;
  font-size: 11px;
}

/* Título de las tarjetas: más grande y más arriba */
.info-panel .info-panel__titulo {
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  line-height: 1.1;
  transform: translateY(-14px);
  margin-bottom: 0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}
.info-panel .info-panel__titulo .bi__es {
  font-size: 0.45em;
}
/* ---- Salas (menú de inicio): crear una sala o entrar con un código; hasta 5 jugadores por sala */
#overlay .pantalla[hidden] { display: none; }
#overlay #btn-volver { margin-top: 12px; }
#overlay .salas-acciones { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
#overlay .entrar-sala { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 0; }
#overlay .boton-sala { padding: 7px 18px; font: 700 0.8rem 'Fredoka', system-ui, sans-serif; letter-spacing: 0.06em; color: #fff;
  background: #7a2fa6; border: 3px solid #4b1b73; border-radius: 999px; box-shadow: 0 3px 0 #2a0f47; cursor: pointer; }
#overlay .boton-sala:hover { background: #9040c4; }
#overlay .boton-sala:active { transform: translateY(2px); box-shadow: 0 1px 0 #2a0f47; }
#overlay #codigo-sala { width: 9.5em; padding: 7px 10px; font: 700 1rem 'Fredoka', system-ui, sans-serif; letter-spacing: 0.3em; text-align: center; text-transform: uppercase;
  color: #fff; background: rgba(255, 255, 255, 0.08); border: 2px solid #b04cff; border-radius: 999px; outline: none; }
#overlay #codigo-sala::placeholder { letter-spacing: 0.04em; font-size: 0.72rem; color: rgba(255, 255, 255, 0.45); }
#overlay #codigo-sala:focus { background: rgba(255, 255, 255, 0.16); }
#overlay .estado-sala { min-height: 1.4em; margin: 8px 0 0; font: 700 0.85rem 'Fredoka', system-ui, sans-serif; color: #bcd3f5; }
#overlay .estado-sala--ok { color: #7ee787; }
#overlay .estado-sala--error { color: #ff8a8a; }
/* Ventanas bajas: se esconde el texto en español (tenue) de la historia para que los botones de salas siempre quepan */
@media (max-height: 760px) { #overlay .historia--es { display: none; } }

/* ---- Elegir mini (Mi o Ni) en el menú de inicio */
#overlay .selector-mini { margin: 4px 0 6px; }
#overlay .selector-titulo { margin: 0 0 6px; font: 700 0.72rem 'Fredoka', system-ui, sans-serif; letter-spacing: 0.2em; color: #bcd3f5; }
#overlay .selector-opciones { display: flex; justify-content: center; gap: 12px; }
#overlay .opcion-mini { display: flex; align-items: center; gap: 8px; padding: 4px 16px 4px 5px; font: 700 0.9rem 'Fredoka', system-ui, sans-serif; letter-spacing: 0.1em; color: #fff;
  background: rgba(255, 255, 255, 0.08); border: 3px solid rgba(255, 255, 255, 0.25); border-radius: 999px; cursor: pointer; }
#overlay .opcion-mini:hover { background: rgba(255, 255, 255, 0.16); }
#overlay .opcion-mini .cara { width: 38px; height: 38px; border-radius: 50%; background: #ffd23f center / cover no-repeat; }
#overlay .opcion-mini .cara--mi { background-color: #ffd23f; background-image: var(--retrato-mi, none); }
#overlay .opcion-mini .cara--ni { background-color: #ff9ec7; background-image: var(--retrato-ni, none); }
#overlay .opcion-mini[aria-checked="true"] { border-color: #ffd23f; background: rgba(255, 210, 63, 0.2); box-shadow: 0 0 14px rgba(255, 210, 63, 0.55); }

/* Volver al menú principal: solo existe en la pausa */
#overlay.antes-de-empezar #btn-menu-principal { display: none; }
#overlay #btn-menu-principal { display: block; margin: 10px auto 0; }

/* ---- Modo táctil (móvil): ajustes de la interfaz alrededor de los controles en pantalla */
body.tactil { overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }
body.tactil #hud { bottom: auto; top: 64px; left: 12px; } /* el joystick ocupa la esquina de abajo a la izquierda */
body.tactil #red { right: 104px !important; }
#btn-pausa { display: none; }
body.tactil #btn-pausa { display: block; position: fixed; top: 12px; right: 56px; z-index: 20; width: 38px; height: 38px; padding: 0; cursor: pointer;
  background: rgba(10, 20, 45, 0.88); color: #ffd166; border: 1px solid #5b8def; border-radius: 50%; font: 18px/1 system-ui, sans-serif; }
body.en-cine .movil, body.en-cine #btn-pausa { display: none !important; }
/* en táctil no se usa el teclado: se esconde la lista de teclas del menú y la nota de Esc */
body.tactil #overlay .controles { display: none; }

/* Flecha para volver al menú principal (pantalla «con amigos») */
#overlay .flecha-volver { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); z-index: 3; width: 46px; height: 46px; padding: 0; cursor: pointer;
  font: 700 1.6rem/1 system-ui, sans-serif; color: #fff; background: #7a2fa6; border: 3px solid #4b1b73; border-radius: 50%; box-shadow: 0 3px 0 #2a0f47; }
#overlay .flecha-volver:hover { background: #9040c4; }
#overlay .flecha-volver:active { transform: translateY(2px); box-shadow: 0 1px 0 #2a0f47; }
#overlay .flecha-volver[hidden], #overlay.ya-empezo .flecha-volver { display: none; }

/* ---- Boceto a pantalla completa (M, o ⛶ / ✕ en móvil) */
#boceto-nave .boceto-btn { position: absolute; top: 4px; width: 34px; height: 34px; padding: 0; cursor: pointer; z-index: 2;
  font: 700 18px/1 system-ui, sans-serif; color: #ffd166; background: rgba(10, 20, 45, 0.9); border: 1px solid #5b8def; border-radius: 8px; }
#boceto-nave .boceto-ampliar { right: 6px; }
#boceto-nave .boceto-cerrar { display: none; right: 10px; top: 10px; width: 48px; height: 48px; font-size: 24px; border-radius: 50%; }
#boceto-nave summary { padding-right: 48px; }
#boceto-nave.boceto--grande { inset: 0; right: 0; bottom: 0; width: auto; height: auto; max-width: none; border: none; border-radius: 0; background: rgba(4, 8, 22, 0.97);
  z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#boceto-nave.boceto--grande .boceto-ampliar { display: none; }
#boceto-nave.boceto--grande .boceto-cerrar { display: block; }
#boceto-nave.boceto--grande summary { position: absolute; top: 0; left: 0; right: 70px; padding: 18px 20px; font-size: 1rem; }
#boceto-nave.boceto--grande .boceto-lienzo { width: min(100vw, calc((100vh - 70px) * 1.5)); margin-top: 52px; }
#boceto-nave.boceto--grande .boceto-lienzo img { border-radius: 0; }
#boceto-nave.boceto--grande .boceto-parte span { font-size: clamp(11px, 1.7vw, 18px); }
/* móvil: el panel pequeño va arriba a la derecha (abajo están los botones de juego) */
body.tactil #boceto-nave:not(.boceto--grande) { top: 64px; right: 12px; bottom: auto; width: min(260px, 46vw); }
body.boceto-abierto .movil, body.boceto-abierto #btn-pausa { visibility: hidden; }

/* ---- Menú en móviles: textos amarillos más pequeños para que los botones no se corten */
@media (max-width: 760px), (max-height: 600px) {
  #overlay { overflow-y: auto; align-items: safe center; } /* si aun así no cabe, se puede desplazar */
  #overlay .overlay-box { margin-top: 0; padding: 8px 14px 12px; }
  #overlay .titulo-arco svg { width: min(460px, 80vw); }
  #overlay .sub { margin: -4px 0 8px; font-size: 0.6rem; letter-spacing: 0.16em; }
  #overlay .historia { margin: 0 auto 6px; max-width: 92vw; font-size: 0.78rem; line-height: 1.35; }
  #overlay .historia--es { display: none; }
  #overlay .boton-inicio { margin: 8px 6px 4px; padding: 6px 18px; font-size: 0.82rem; }
  #overlay .selector-titulo { font-size: 0.6rem; }
  #overlay .opcion-mini { padding: 3px 12px 3px 4px; font-size: 0.78rem; }
  #overlay .opcion-mini .cara { width: 30px; height: 30px; }
  #overlay .estado-sala { font-size: 0.72rem; }
}
/* pantallas muy bajas (móvil en horizontal): sin la historia, para que siempre quepan los botones */
@media (max-height: 420px) {
  #overlay .historia { display: none; }
}

/* Menú de salas con los colores del diseño nuevo (azul de los botones principales) */
#overlay #codigo-sala { border-color: #3b60c4; }
#overlay .flecha-volver { background: #2f4fa6; border-color: #1b2f73; box-shadow: 0 3px 0 #0f1c47; }
#overlay .flecha-volver:hover { background: #3b60c4; }
