.hud {
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.32rem 0.55rem 0.36rem;
  background: linear-gradient(180deg, #fffaf0 0%, #fff1d4 100%);
  border-radius: 0.85rem;
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 rgba(43, 33, 24, 0.14);
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 0;
}

.hud-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.95rem, 2.1vw, 1.15rem);
  line-height: 1.1;
  color: #7a4e00;
  min-width: 0;
}

.hud-brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
}

.hud-meta {
  display: flex;
  align-items: center;
  flex-shrink: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.28rem;
  min-width: 0;
}

.hud-alias,
.hud-level,
.hud-score,
.hud-pistas {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 1.05rem;
  padding: 0 0.38rem;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1;
}

.hud-alias {
  max-width: min(9.5rem, 34vw);
  background: #fff;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 0.68rem;
}

.hud-alias span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-level {
  background: var(--forest);
  color: #fff;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hud-score {
  position: relative;
  flex-shrink: 0;
  background: #fff8e6;
  border: 1px solid #c48a1a;
  color: #7a4e00;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.hud-score-label {
  font-size: 0.58rem;
  font-weight: 800;
  opacity: 0.85;
  text-transform: lowercase;
}

.hud-score.is-gain {
  animation: hudScorePop 0.65s ease;
  background: #e8f7ea;
  border-color: #2f8f4e;
  color: #1f6b38;
}

.hud-score-bump {
  position: absolute;
  left: 50%;
  top: -0.55rem;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 800;
  color: #1f6b38;
  pointer-events: none;
  animation: hudScoreBump 0.85s ease forwards;
  white-space: nowrap;
}

@keyframes hudScorePop {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes hudScoreBump {
  0% { opacity: 0; transform: translate(-50%, 0.2rem) scale(0.85); }
  25% { opacity: 1; transform: translate(-50%, -0.15rem) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -0.85rem) scale(1); }
}

.hud-pistas {
  background: #fff;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.hud-pistas .bi { color: var(--amber); font-size: 0.75rem; }

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.hud-partida { position: relative; }

.hud-partida-menu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  z-index: 40;
  display: none;
  min-width: 12.5rem;
  max-width: min(16rem, calc(100vw - 1.5rem));
  padding: 0.4rem;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 0.65rem;
  box-shadow: 0 10px 24px rgba(43, 33, 24, 0.18);
}

.hud-partida-menu.is-open { display: grid; gap: 0.28rem; }

.hud-partida-menu [hidden] { display: none !important; }

.hud-partida-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 2rem;
  padding: 0.3rem 0.55rem;
  border: 1.5px solid var(--ink);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: left;
}

.hud-partida-item:hover,
.hud-partida-item:focus-visible {
  background: var(--forest);
  color: #fff;
}

.hud-partida-item.is-danger {
  border-color: #8a3c3c;
  color: #8a3c3c;
}

.hud-partida-item.is-danger:hover,
.hud-partida-item.is-danger:focus-visible {
  background: #8a3c3c;
  color: #fff;
}

.hud-partida-warn {
  margin: 0.1rem 0.15rem 0.2rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #5d5142;
}

.hud-chip {
  --bs-btn-color: var(--sun-ink);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--forest);
  --bs-btn-hover-border-color: var(--forest);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1e4a36;
  --bs-btn-active-border-color: #1e4a36;
  --bs-btn-disabled-color: #a89880;
  --bs-btn-disabled-border-color: #e5dac6;
  min-height: 1.7rem;
  padding: 0.05rem 0.5rem;
  border-width: 1.5px;
  border-radius: 0.55rem;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: 0 1px 0 rgba(43, 33, 24, 0.16);
  flex: 0 0 auto;
}

.hud-chip:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.hud-icon-btn,
.hud-audio-toggle {
  width: 1.85rem;
  min-width: 1.85rem;
  padding-inline: 0;
  display: inline-grid;
  place-items: center;
}

.hud-icon-btn .bi,
.hud-audio-toggle .bi { font-size: 0.95rem; line-height: 1; }

.hud-audio-toggle[aria-pressed="true"] {
  color: #8a3c3c;
  border-color: #8a3c3c;
  background: rgba(138, 60, 60, 0.08);
}

@media (min-width: 900px) {
  .hud {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hud-top { flex: 1 1 auto; }
  .hud-actions { flex: 0 1 auto; justify-content: flex-end; }
  .hud-partida-menu { left: auto; right: 0; }
}

.font-scale-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 1.7rem;
  padding: 0.05rem 0.22rem;
  border-radius: 0.55rem;
  background: #fff;
  border: 1.5px solid var(--ink);
  box-shadow: 0 1px 0 rgba(43, 33, 24, 0.16);
  flex: 0 0 auto;
}

.font-scale-controls .font-scale-btn {
  min-width: 1.55rem;
  min-height: 1.4rem;
  padding: 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
  border-radius: 0.4rem;
  box-shadow: none;
}

.font-scale-label {
  min-width: 2.2rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #5d5142;
}

.progress-mini {
  width: 88px;
  height: 12px;
  border-radius: 999px;
  background: #ece3d2;
  border: 2px solid rgba(43, 33, 24, 0.12);
  overflow: hidden;
}

.progress-mini > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--sun) 0%, var(--leaf) 100%);
}

.dialog-panel {
  position: relative;
  background: linear-gradient(180deg, #fffaf0 0%, #fff3dc 100%);
  border-radius: 0.9rem;
  padding: 0.45rem 0.55rem 0.5rem;
  border: 2px solid var(--ink);
  min-height: 0;
  box-shadow: 0 3px 0 rgba(43, 33, 24, 0.14);
  z-index: 20;
}

.dialog-panel::before { display: none; }

.dialog-panel.is-speaking {
  box-shadow:
    0 3px 0 rgba(43, 33, 24, 0.14),
    inset 3px 0 0 var(--sun-deep);
}

.dialog-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.28rem;
  align-items: start;
}

.dialog-avatar {
  width: 2.05rem;
  height: 2.05rem;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center bottom;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.06rem;
  border: 1.5px solid rgba(43, 33, 24, 0.18);
}

.dialog-name {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--sun-ink);
  font-size: 0.95rem;
  line-height: 1.1;
}

.dialog-heading {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0;
}

.dialog-voice-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-left: auto;
}

.dialog-repeat {
  min-height: 1.55rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #fff;
  color: var(--sun-ink);
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 2px 0 var(--ink);
  white-space: nowrap;
}

.dialog-repeat:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.dialog-voice-state {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 1.55rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: rgba(43, 33, 24, 0.06);
  color: #5d5142;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.dialog-text {
  margin: 0;
  padding: 0.35rem 0.55rem;
  border-radius: 0.65rem;
  background: #fff;
  border: 1px solid rgba(43, 33, 24, 0.1);
  font-size: clamp(0.84rem, 1.9vw, 0.98rem);
  line-height: 1.35;
  font-weight: 700;
  min-height: 2.4em;
  color: var(--ink);
}

.dialog-text .typed-cursor {
  display: inline-block;
  width: 0.55ch;
  margin-left: 1px;
  background: var(--forest);
  animation: blinkCursor 0.8s steps(1) infinite;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.dialog-actions:empty { display: none; }

.dialog-actions .btn {
  min-height: 1.7rem;
  padding: 0.12rem 0.7rem;
  border-width: 0;
  border-radius: 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 2px 0 var(--sun-ink);
}

.dialog-actions .btn:disabled,
.dialog-actions .btn-accent:disabled,
.dialog-actions .btn-outline-primary:disabled {
  opacity: 0.55;
  filter: none;
}

.dialog-hint-skip {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(43, 33, 24, 0.5);
  margin: 0;
}

@keyframes dialogPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes blinkCursor {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dialog-panel { animation: none; }
  .dialog-text .typed-cursor { animation: none; }
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
}

.game-toast {
  font-family: var(--font-display);
  background: #fff;
  color: var(--ink);
  border: 3px solid var(--leaf);
  border-left-width: 8px;
  border-radius: 14px;
  padding: 0.7rem 1rem;
  box-shadow: 0 6px 0 rgba(43, 33, 24, 0.12);
  font-weight: 700;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.game-toast-badge {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.game-toast.is-warn { border-color: var(--sun-deep); }
.game-toast.is-error { border-color: var(--coral); }

.character-layer {
  position: absolute;
  left: 1.5%;
  bottom: 2%;
  top: 38%;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  max-width: 34%;
}

.character-layer img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.2));
  transform-origin: bottom center;
  will-change: transform;
}

/* Doble buffer: fundido entre poses (alerta P1, etc.) */
.character-layer.has-crossfade {
  display: grid;
  align-items: end;
  justify-items: center;
}

.character-layer.has-crossfade .sprite-buf {
  grid-area: 1 / 1;
  position: relative;
  height: 100%;
  width: auto;
  max-width: 100%;
  transition: opacity 0.58s ease-in-out;
  will-change: opacity, transform;
}

.character-layer.has-crossfade .sprite-buf.is-front {
  opacity: 1;
  z-index: 2;
}

.character-layer.has-crossfade .sprite-buf.is-back {
  opacity: 0;
  z-index: 1;
}

/* Habla estable (Maestro): mismo cuerpo, solo opacidad, sin fundido ni salto de src */
.character-layer.has-stable-swap .sprite-buf {
  transition: none !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: contain !important;
  object-position: bottom center !important;
  transform: none !important;
  animation: none !important;
}

.character-layer.is-breathe img,
.character-layer.is-breathe .sprite-buf {
  animation: spriteBreathe 3.2s ease-in-out infinite;
}

.character-layer.is-soft-breathe .sprite-buf,
.character-layer.is-soft-breathe img {
  animation: spriteSoftBreathe 4.6s ease-in-out infinite;
}

.character-layer.is-talk img {
  animation: spriteTalk 1.6s ease-in-out infinite;
}

.character-layer.is-pop img {
  animation: spritePop 0.7s ease-out 1;
}

.character-layer.is-shake img {
  animation: spriteShake 0.55s ease-in-out 2;
}

@keyframes spriteBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.02); }
}

@keyframes spriteSoftBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.01); }
}

@keyframes spriteTalk {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  25% { transform: translateY(-2px) scale(1.01, 0.98); }
  50% { transform: translateY(-4px) scale(1.02, 1.02); }
  75% { transform: translateY(-2px) scale(1.01, 0.97); }
}


@keyframes spritePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.06) translateY(-6px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes spriteShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .character-layer.is-breathe img,
  .character-layer.is-soft-breathe img,
  .character-layer.is-soft-breathe .sprite-buf,
  .character-layer.is-talk img,
  .character-layer.is-pop img,
  .character-layer.is-shake img,
  #dialog-panel.is-speaking .dialog-avatar {
    animation: none !important;
  }
  .character-layer.has-crossfade .sprite-buf {
    transition: none;
  }
}

.character-layer.is-right {
  left: auto;
  right: 1.5%;
  justify-content: flex-end;
}

/* Portada: Lumi completo dentro del stage, sin recorte */
.character-layer.is-hero {
  top: 10%;
  bottom: 3%;
  right: 2%;
  left: auto;
  max-width: min(42%, 380px);
}

.hotspot {
  position: absolute;
  z-index: 4;
  min-width: 64px;
  min-height: 64px;
  border: 2px dashed transparent;
  border-radius: 0.75rem;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.hotspot.is-active {
  border-color: rgba(212, 160, 23, 0.85);
  background: rgba(255, 248, 220, 0.18);
  animation: pulseSoft 1.6s ease-in-out infinite;
}

.hotspot img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
}

.hotspot.is-saved { outline: 3px solid var(--leaf); }
.hotspot.is-discarded { opacity: 0.45; filter: grayscale(0.4); }

/* N1-S2: las pistas van a color, del mismo dibujo que el bosque.
   El marco sigue al fondo 16:9 (object-fit: cover) para que cada pista
   quede en la banca, la mesa, las cajas o el sendero. */
.intro-n1-s2 .n1s2-spots {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: max(100cqw, calc(100cqh * 16 / 9));
  height: max(100cqh, calc(100cqw * 9 / 16));
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.intro-n1-s2 .hotspot {
  border-color: transparent;
  background: transparent;
  animation: none;
  width: max(26px, var(--spot-size, 6cqi));
  height: max(26px, var(--spot-size, 6cqi));
  min-width: 0;
  min-height: 0;
  transform: translate(-50%, -50%);
  padding: 0;
  pointer-events: auto;
}

.intro-n1-s2 .hotspot.is-active {
  border-color: transparent;
  background: transparent;
  animation: none;
}

.intro-n1-s2 .hotspot img {
  width: 100%;
  height: 100%;
  opacity: 1;
  filter: drop-shadow(0 2px 2px rgba(40, 30, 10, 0.28));
  transition: transform 0.2s ease;
}

.intro-n1-s2 .hotspot[data-id="E-BOS-01"] {
  width: 3.2cqi;
  height: 3.2cqi;
  min-width: 22px;
  min-height: 22px;
}

.intro-n1-s2 .hotspot[data-id="E-BOS-04"] {
  transform: translate(-50%, -50%) rotate(72deg);
}

.intro-n1-s2 .hotspot.is-active:hover img,
.intro-n1-s2 .hotspot.is-active:focus-visible img,
.intro-n1-s2 .hotspot.is-revealed img {
  opacity: 1;
  transform: scale(1.06);
  filter: drop-shadow(0 3px 3px rgba(40, 30, 10, 0.35));
}

.intro-n1-s2 .hotspot.is-active:hover,
.intro-n1-s2 .hotspot.is-active:focus-visible,
.intro-n1-s2 .hotspot.is-revealed {
  border-color: transparent;
  background: transparent;
}

.intro-n1-s2 .hotspot.is-found img {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.55));
}

.intro-n1-s2 .hotspot.is-found {
  border-color: transparent;
  background: transparent;
  outline: 2px solid rgba(212, 160, 23, 0.8);
  animation: none;
}

.intro-n1-s2 .hotspot.is-saved img {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(77, 139, 111, 0.55));
}

.intro-n1-s2 .hotspot.is-saved {
  border-color: transparent;
  background: transparent;
  outline: 2px solid rgba(77, 139, 111, 0.9);
}

.intro-n1-s2 .hotspot.is-discarded img {
  opacity: 0.55;
}

/* N2-S2: las pistas van a color, como en el bosque.
   El marco sigue al fondo 16:9 (object-fit: cover). */
.intro-n2-s2 .n2s2-spots {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: max(100cqw, calc(100cqh * 16 / 9));
  height: max(100cqh, calc(100cqw * 9 / 16));
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.intro-n2-s2 .hotspot {
  border-color: transparent;
  background: transparent;
  animation: none;
  width: max(26px, var(--spot-size, 6cqi));
  height: max(26px, var(--spot-size, 6cqi));
  min-width: 0;
  min-height: 0;
  transform: translate(-50%, -50%);
  padding: 0;
  pointer-events: auto;
}

.intro-n2-s2 .hotspot.is-active {
  border-color: transparent;
  background: transparent;
  animation: none;
}

.intro-n2-s2 .hotspot img {
  width: 100%;
  height: 100%;
  opacity: 1;
  filter: drop-shadow(0 2px 2px rgba(40, 30, 10, 0.28));
  transition: transform 0.2s ease;
}

/* Bolsa del río: sombra suave de contacto para no verse pegada */
.intro-n2-s2 .hotspot[data-id="E-RIO-01"] img {
  filter: drop-shadow(0 3px 2px rgba(30, 50, 70, 0.35)) saturate(0.92) contrast(0.96);
}

.intro-n2-s2 .hotspot.is-active:hover img,
.intro-n2-s2 .hotspot.is-active:focus-visible img,
.intro-n2-s2 .hotspot.is-revealed img {
  opacity: 1;
  transform: scale(1.06);
  filter: drop-shadow(0 3px 3px rgba(40, 30, 10, 0.35));
}

.intro-n2-s2 .hotspot.is-active:hover,
.intro-n2-s2 .hotspot.is-active:focus-visible,
.intro-n2-s2 .hotspot.is-revealed {
  border-color: transparent;
  background: transparent;
}

.intro-n2-s2 .hotspot.is-found img {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.55));
}

.intro-n2-s2 .hotspot.is-found {
  border-color: transparent;
  background: transparent;
  outline: 2px solid rgba(212, 160, 23, 0.8);
  animation: none;
}

.intro-n2-s2 .hotspot.is-saved img {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(77, 139, 111, 0.55));
}

.intro-n2-s2 .hotspot.is-saved {
  border-color: transparent;
  background: transparent;
  outline: 2px solid rgba(77, 139, 111, 0.9);
}

.intro-n2-s2 .hotspot.is-discarded img {
  opacity: 0.55;
}

/* N3-S2 — evidencias más opacas en la plaza (tonos apagados, sin brillo) */
.intro-n3-s2 .hotspot {
  border-color: transparent;
  background: transparent;
  animation: none;
  min-width: 54px;
  min-height: 54px;
}

.intro-n3-s2 .hotspot.is-active {
  border-color: rgba(138, 90, 60, 0.45);
  background: rgba(255, 242, 210, 0.38);
  animation: none;
}

.intro-n3-s2 .hotspot img {
  width: 54px;
  height: 54px;
  opacity: 0.42;
  filter: saturate(0.48) brightness(0.88) contrast(0.92) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.18));
  transition: opacity 0.28s ease, filter 0.28s ease, transform 0.2s ease;
}

.intro-n3-s2 .hotspot.is-active:hover img,
.intro-n3-s2 .hotspot.is-active:focus-visible img,
.intro-n3-s2 .hotspot.is-revealed img {
  opacity: 0.88;
  transform: scale(1.04);
  filter: saturate(0.78) brightness(0.96) drop-shadow(0 0 10px rgba(138, 90, 60, 0.38));
}

.intro-n3-s2 .hotspot.is-active:hover,
.intro-n3-s2 .hotspot.is-active:focus-visible,
.intro-n3-s2 .hotspot.is-revealed {
  border-color: rgba(138, 90, 60, 0.62);
  background: rgba(255, 242, 210, 0.52);
}

.intro-n3-s2 .hotspot.is-saved img {
  opacity: 1;
  filter: saturate(0.95) brightness(0.98) drop-shadow(0 0 8px rgba(77, 139, 111, 0.5));
}

.intro-n3-s2 .hotspot.is-saved {
  outline: 3px solid rgba(77, 139, 111, 0.82);
  border-color: rgba(77, 139, 111, 0.72);
  background: rgba(220, 245, 230, 0.55);
}

.intro-n3-s2 .hotspot.is-discarded img {
  opacity: 0.48;
  filter: grayscale(0.5) brightness(0.92) saturate(0.4);
}

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.card-choice {
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  height: 100%;
}

.card-choice:hover,
.card-choice:focus-visible {
  border-color: var(--leaf);
}

.card-choice.is-selected {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(47, 93, 74, 0.2);
}

.evidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid rgba(0,0,0,0.08);
}

.evidence-chip img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.bitacora-section {
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(42, 36, 28, 0.08);
}

.bitacora-section h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--forest);
  margin-bottom: 0.35rem;
}

.bitacora-section.locked {
  opacity: 0.55;
}

.indicator-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(47, 93, 74, 0.12);
  overflow: hidden;
}

.indicator-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--leaf), var(--amber));
}

@media (max-width: 575.98px) {
  .toast-host {
    left: 0.5rem;
    right: 0.5rem;
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
  .dialog-panel {
    min-height: 0;
    padding: 0.4rem 0.5rem;
    animation: none;
    flex-shrink: 0;
  }
  .dialog-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }
  .dialog-avatar {
    width: 1.85rem;
    height: 1.85rem;
  }
  .dialog-name { font-size: 0.88rem; }
  .dialog-text {
    font-size: 0.86rem;
    min-height: 1.6em;
    line-height: 1.3;
  }
  .dialog-actions { margin-top: 0.15rem; }
  .dialog-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 1.65rem;
    font-size: 0.75rem;
  }
  .hud {
    padding: 0.28rem 0.4rem 0.32rem;
    gap: 0.22rem;
    flex-shrink: 0;
  }
  .hud-actions { width: 100%; }
  .hud-actions .btn,
  .hud-chip,
  .font-scale-controls .font-scale-btn {
    flex: 0 0 auto;
    min-height: 1.65rem;
    font-size: 0.72rem;
  }
  .character-layer {
    top: 45%;
    max-width: 30%;
  }
  .character-layer.is-hero {
    top: 14%;
    max-width: 44%;
  }
  .title-hero {
    right: 40%;
    top: 5%;
  }
  .hotspot {
    min-width: 32px;
    min-height: 32px;
  }
  .hotspot img {
    width: 32px;
    height: 32px;
  }
  .intro-n2-s2 .hotspot,
  .intro-n3-s2 .hotspot {
    min-width: 32px;
    min-height: 32px;
  }
  .intro-n2-s2 .hotspot img,
  .intro-n3-s2 .hotspot img {
    width: 32px;
    height: 32px;
  }
  #bitacoraDrawer {
    width: 100% !important;
    max-width: 100% !important;
  }
  #bitacoraDrawer .offcanvas-body {
    padding: 0.65rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .dialog-panel {
    animation: none;
    min-height: 0;
    padding: 0.32rem 0.4rem;
  }
  .dialog-inner { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .dialog-avatar { width: 1.7rem; height: 1.7rem; }
  .dialog-text { font-size: 0.76rem; min-height: 0; padding: 0.28rem 0.4rem; }
  .dialog-hint-skip { display: none; }
  .dialog-actions .btn { min-height: 1.5rem; }
  .hud { padding: 0.18rem 0.35rem 0.22rem; }
  .hud-actions .btn,
  .hud-chip { min-height: 1.5rem; font-size: 0.7rem; flex: 0 0 auto; }
}

/* ---- Extra-small phones ---- */
@media (max-width: 389px) {
  .hud {
    padding: 0.2rem 0.35rem;
    gap: 0.2rem 0.25rem;
    border-radius: 0.7rem;
  }
  .hud-brand {
    font-size: 0.78rem;
  }
  .hud-meta {
    font-size: 0.68rem;
    gap: 0.25rem;
  }
  .hud-score {
    font-size: 0.66rem;
    padding: 0 0.3rem;
  }
  .hud-score-label {
    display: none;
  }
  .progress-mini {
    width: 36px;
    height: 6px;
  }
  .hud-actions .btn,
  .hud-chip {
    flex: 0 0 auto;
    font-size: 0.7rem;
    min-height: 1.5rem;
    padding-inline: 0.35rem;
  }
  .dialog-panel {
    min-height: 0;
    padding: 0.35rem 0.4rem;
  }
  .dialog-inner { grid-template-columns: minmax(0, 1fr); }
  .dialog-avatar { width: 1.7rem; height: 1.7rem; }
  .dialog-name { font-size: 0.8rem; }
  .dialog-text { font-size: 0.78rem; min-height: 1.3em; }
  .dialog-hint-skip { display: none; }
  .dialog-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 1.5rem;
    font-size: 0.72rem;
  }
  .character-layer {
    top: 50%;
    max-width: 24%;
    opacity: 1;
  }
  .character-layer.is-hero {
    top: 16%;
    max-width: 40%;
    opacity: 1;
  }
  .hotspot {
    min-width: 30px;
    min-height: 30px;
  }
  .hotspot img {
    width: 30px;
    height: 30px;
  }
  .intro-n2-s2 .hotspot,
  .intro-n3-s2 .hotspot {
    min-width: 32px;
    min-height: 32px;
  }
  .intro-n2-s2 .hotspot img,
  .intro-n3-s2 .hotspot img {
    width: 32px;
    height: 32px;
  }
  .toast-host {
    top: 0.5rem;
    bottom: auto;
    left: 0.5rem;
    right: 0.5rem;
    max-width: none;
  }
  .game-toast {
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
    border-radius: 0.6rem;
  }
}

/* ---- Tablet landscape (medium height) ---- */
@media (min-height: 501px) and (max-height: 700px) and (orientation: landscape) {
  .dialog-panel { min-height: 0; padding: 0.4rem 0.5rem; }
  .dialog-inner { grid-template-columns: minmax(0, 1fr); }
  .dialog-avatar { width: 1.85rem; height: 1.85rem; }
  .dialog-text { font-size: 0.86rem; }
  .hud { padding: 0.25rem 0.4rem; }
  .character-layer {
    top: 42%;
    max-width: 28%;
  }
  .character-layer.is-hero {
    top: 12%;
    max-width: 36%;
  }
}

/* —— Cuestionario de aprendizaje (modal) —— */
.learning-quiz-dialog {
  max-width: min(560px, calc(100vw - 1.5rem));
}

.learning-quiz-progress {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted, #5c6b62);
}

.learning-quiz-prompt {
  line-height: 1.35;
  margin-bottom: 0.85rem;
}

.learning-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.learning-quiz-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 2px solid rgba(47, 93, 74, 0.22);
  border-radius: 0.75rem;
  background: #fff;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.learning-quiz-opt:hover:not(:disabled) {
  border-color: var(--leaf, #2f5d4a);
  background: rgba(47, 93, 74, 0.04);
}

.learning-quiz-opt.is-locked {
  cursor: default;
}

.learning-quiz-opt.is-correct {
  border-color: var(--leaf, #2f5d4a);
  background: rgba(47, 93, 74, 0.1);
}

.learning-quiz-opt.is-wrong {
  border-color: var(--coral, #c45c4a);
  background: rgba(196, 92, 74, 0.08);
}

.learning-quiz-opt-key {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
  background: rgba(47, 93, 74, 0.12);
}

.learning-quiz-opt-text {
  flex: 1;
  line-height: 1.35;
  font-size: 0.92rem;
}

.learning-quiz-feedback {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.learning-quiz-feedback.is-ok {
  background: rgba(47, 93, 74, 0.12);
  border-left: 4px solid var(--leaf, #2f5d4a);
}

.learning-quiz-feedback.is-warn {
  background: rgba(196, 92, 74, 0.1);
  border-left: 4px solid var(--coral, #c45c4a);
}

.learning-quiz-score {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--leaf, #2f5d4a);
}

.learning-quiz-score-label {
  font-size: 0.85rem;
  color: var(--ink-muted, #5c6b62);
}

.learning-quiz-summary-msg {
  font-size: 0.95rem;
  line-height: 1.45;
}

/* —— Buscador de municipios (P1) —— */
.municipio-search {
  position: relative;
}

.municipio-search-field {
  position: relative;
}

.municipio-search-input {
  padding-right: 2.25rem;
}

.municipio-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #5c6b62;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.municipio-search-clear:hover {
  background: rgba(47, 93, 74, 0.1);
  color: var(--forest, #2f5d4a);
}

.municipio-search-results {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: min(220px, 40dvh);
  overflow: auto;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  list-style: none;
  background: #fff;
  border: 1px solid rgba(47, 93, 74, 0.22);
  border-radius: 0.65rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.municipio-search-option {
  padding: 0.45rem 0.55rem;
  border-radius: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.35;
  cursor: pointer;
}

.municipio-search-option.is-active,
.municipio-search-option:hover {
  background: rgba(47, 93, 74, 0.1);
  color: var(--forest, #2f5d4a);
}

.municipio-search-empty {
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
  color: #5c6b62;
}

.municipio-search-hint {
  margin-top: 0.25rem;
}

/* —— Top 10 puntajes —— */
.scores-leaderboard-dialog {
  max-width: min(520px, calc(100vw - 1.5rem));
}

.scores-leaderboard-content {
  border: none;
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.scores-leaderboard-header {
  background: linear-gradient(180deg, #fff4d6 0%, #ffe9b8 100%);
  color: #6b4a00;
  border-bottom: none;
  padding: 1rem 1.15rem;
}

.scores-leaderboard-header .btn-close {
  filter: none;
  opacity: 0.7;
}

.scores-leaderboard-title-icon {
  color: #8a5a00;
  margin-right: 0.35rem;
}

.scores-leaderboard-sub {
  font-size: 0.78rem;
  opacity: 0.88;
  margin-top: 0.2rem;
}

.scores-leaderboard-body-wrap {
  background: var(--cream);
  padding: 0.85rem 1rem 1rem;
  min-height: 200px;
}

.scores-leaderboard-footer {
  background: var(--cream);
  border-top: 1px solid rgba(43, 33, 24, 0.1);
}

.scores-leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.scores-leaderboard-row {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid rgba(47, 93, 74, 0.14);
  box-shadow: 0 2px 8px rgba(47, 93, 74, 0.06);
}

.scores-leaderboard-row.is-top-1 {
  border-color: rgba(232, 197, 71, 0.55);
  background: linear-gradient(90deg, #fffef8 0%, #fff 100%);
}

.scores-leaderboard-row.is-top-2 {
  border-color: rgba(160, 168, 175, 0.45);
}

.scores-leaderboard-row.is-top-3 {
  border-color: rgba(196, 137, 90, 0.4);
}

.scores-leaderboard-row.is-you {
  border-color: var(--leaf, #2f5d4a);
  box-shadow: 0 0 0 2px rgba(47, 93, 74, 0.15);
}

.scores-leaderboard-rank {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  line-height: 1;
  color: var(--forest, #2f5d4a);
}

.scores-leaderboard-row:not(.is-top-1):not(.is-top-2):not(.is-top-3) .scores-leaderboard-rank {
  font-size: 0.95rem;
}

.scores-leaderboard-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.scores-leaderboard-name {
  font-weight: 800;
  font-size: 0.92rem;
  color: #1e2e26;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.scores-leaderboard-school {
  font-size: 0.78rem;
  font-weight: 700;
  color: #5c6b62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scores-leaderboard-you-badge {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(47, 93, 74, 0.15);
  color: var(--forest, #2f5d4a);
}

.scores-leaderboard-loc {
  font-size: 0.78rem;
  color: #5c6b62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scores-leaderboard-date {
  font-size: 0.68rem;
  color: #8a9690;
}

.scores-leaderboard-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--forest, #2f5d4a);
  white-space: nowrap;
}

.scores-leaderboard-empty-icon {
  font-size: 2rem;
  color: rgba(47, 93, 74, 0.35);
  display: block;
  margin-bottom: 0.5rem;
}

.intro-n1-s2 .scene-hint,
.intro-n2-s2 .scene-hint {
  left: 0.45rem;
  right: auto;
  transform: none;
  max-width: calc(100% - 8.2rem);
}

.clue-board-btn {
  position: absolute;
  z-index: 6;
  top: 0.4rem;
  right: 0.4rem;
  min-height: 2.4rem;
  padding: 0.25rem 0.7rem;
  font-weight: 800;
}

.screen.is-clue-open .scene-hint,
.screen.is-clue-open .clue-board-btn {
  visibility: hidden;
}

.clue-board {
  position: absolute;
  inset: 0.35rem;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: #f7f3eb;
  border: 1px solid rgba(47, 93, 74, 0.25);
  border-radius: 1rem;
  padding: 0.55rem;
  overflow: hidden;
}

.clue-board-title {
  margin: 0;
  text-align: center;
  font-weight: 800;
  color: var(--forest, #2f5d4a);
}

.clue-board-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.4rem, 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  min-height: 0;
}

.clue-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.25rem;
  border-radius: 0.7rem;
  background: #fff;
  border: 2px solid rgba(47, 93, 74, 0.18);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.15;
}

.clue-card img {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

.clue-card.is-found {
  border-color: #2f7d4a;
  background: #e7f6ea;
}

.clue-mark {
  color: #1f6b38;
  font-size: 0.68rem;
}

.clue-board-close {
  align-self: center;
  min-height: 2.4rem;
}

@media (max-height: 500px) and (orientation: landscape) {
  .clue-board-btn {
    top: 0.25rem;
    right: 0.25rem;
    min-height: 2rem;
    font-size: 0.8rem;
  }

  .clue-card img {
    width: 2.2rem;
    height: 2.2rem;
  }

  .clue-board-list {
    grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
    gap: 0.25rem;
  }
}
