*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #1A0E07;
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.game-viewport {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: hidden;
}
.screen.active {
  display: block;
}

/* ==================== FONDOS LIMPIOS POR PROMPTS ==================== */
.layer-bg {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}
.bg-coliseo { background-image: url('../img/bg_coliseo.webp'); }
.bg-pista   { background-image: url('../img/bg_pista_baile.webp'); }
.bg-establo { background-image: url('../img/bg_establo.webp'); }

/* ==================== CAPA LOGO ==================== */
.layer-logo-wrap {
  position: absolute;
  top: 1.8%;
  left: 1.5%;
  width: 19.5%;
  z-index: 6;
  pointer-events: none;
  animation: logoFloat 3.6s ease-in-out infinite;
}
.logo-img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(28, 12, 4, 0.42));
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ==================== CAPAS DE PERSONAJES ==================== */
.layer-character-wrap {
  position: absolute;
  left: 18.5%;
  bottom: 14%;
  width: 44.5%;
  height: 67%;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.layer-character-wrap.char-full-bottom {
  left: 14%;
  bottom: -1%;
  width: 45%;
  height: 76%;
}
.layer-character-wrap.char-map-left {
  left: 9.5%;
  bottom: -1%;
  width: 42%;
  height: 75%;
}
.layer-character-wrap.char-mounted-pos {
  left: 8%;
  bottom: -1%;
  width: 44%;
  height: 79%;
}
.layer-character-wrap.char-win-pos {
  left: 11%;
  bottom: -1%;
  width: 45%;
  height: 75%;
}

.character-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  transform-origin: bottom center;
  filter: drop-shadow(0 8px 14px rgba(34, 15, 5, 0.32));
  animation: characterBreathe 2.8s ease-in-out infinite;
}
@keyframes characterBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.008, 0.995); }
}

/* ==================== GLOBOS DE DIÁLOGO EN CÓDIGO SVG ==================== */
.welcome-speech-bubble {
  position: absolute;
  top: 1.4%;
  left: 39.5%;
  width: 49.5%;
  height: 45%;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-speech-bubble.bubble-map-pos {
  top: 2%;
  left: 26%;
  width: 32.5%;
  height: 41%;
}
.welcome-speech-bubble.bubble-win-pos {
  top: 1.8%;
  left: 29%;
  width: 34%;
  height: 40%;
}

.bubble-svg-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(25, 11, 4, 0.28));
}

.bubble-content {
  position: relative;
  z-index: 2;
  width: 78%;
  margin-top: -5.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.bubble-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.bubble-rays-svg {
  width: clamp(24px, 3vw, 44px);
  height: clamp(28px, 3.4vw, 50px);
  flex-shrink: 0;
}
.bubble-rays-svg.rays-right { transform: scaleX(-1); }

.bubble-content h1 {
  margin: 0 0 6px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.15rem, 2.45vw, 2.4rem);
  line-height: 1.04;
  color: #1A0B04;
}
.bubble-map-pos .bubble-content h1,
.bubble-win-pos .bubble-content h1 {
  font-size: clamp(1rem, 2vw, 1.95rem);
}
.bubble-content p {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: clamp(0.76rem, 1.32vw, 1.25rem);
  line-height: 1.24;
  color: #200E05;
}
.bubble-content p.p-lg {
  font-size: clamp(0.88rem, 1.55vw, 1.45rem);
}
.s7-sub-heading {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.9rem, 1.55vw, 1.45rem);
  color: #1A0B04;
  margin-bottom: 4px;
}

/* ==================== TAPETE DE BAILE 3D Y BOTÓN JUGAR ==================== */
.welcome-dancemat-layer {
  position: absolute;
  bottom: 1.8%;
  left: 44%;
  transform: translateX(-50%);
  width: 63%;
  height: 22.5%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dancemat-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.mat-svg-tile {
  cursor: pointer;
  transition: filter 0.12s ease;
}
.mat-svg-tile:hover { filter: brightness(1.15); }
.mat-svg-tile.is-pressed { filter: brightness(1.35) drop-shadow(0 0 12px #FEF08A); }

.btn-jugar-main {
  position: absolute;
  bottom: 0%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 28%;
  padding: 8px 34px;
  border-radius: 999px;
  border: 4.5px solid #FFFDF7;
  background: linear-gradient(180deg, #FFE249 0%, #F59E0B 52%, #D97706 100%);
  box-shadow:
    inset 0 0 0 4px #331506,
    inset 0 10px 6px rgba(255, 255, 255, 0.45),
    inset 0 -7px 6px rgba(0, 0, 0, 0.25),
    0 8px 16px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.1s ease, filter 0.12s ease;
}
.btn-jugar-main:hover { filter: brightness(1.06); transform: translateX(-50%) translateY(-2px); }
.btn-jugar-main:active { transform: translateX(-50%) translateY(2px); }

.btn-map-bottom {
  bottom: 2.2%;
  left: 50.5%;
}
.btn-continuar-inline {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: 100%;
}
.btn-continuar-inline:hover { transform: translateY(-2px); }
.btn-green-playagain {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  background: linear-gradient(180deg, #86EF43 0%, #22C55E 52%, #15803D 100%);
}
.btn-green-playagain:hover { transform: translateY(-2px); }
.btn-comprar-green {
  bottom: 2.2%;
  left: auto;
  right: 11%;
  transform: none;
  min-width: 25%;
  background: linear-gradient(180deg, #86EF43 0%, #22C55E 52%, #15803D 100%);
}
.btn-comprar-green:hover { transform: translateY(-2px); }

.play-triangle-svg, .cart-svg {
  width: clamp(24px, 2.7vw, 40px);
  height: clamp(24px, 2.7vw, 40px);
  flex-shrink: 0;
}
.jugar-text {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.15rem, 2.25vw, 2.15rem);
  color: #FFFFFF;
  -webkit-text-stroke: 4.5px #220E04;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #220E04;
  white-space: nowrap;
}

/* ==================== BOTONES LATERALES NÍTIDOS (SIN STROKE APLASTADO) ==================== */
.welcome-side-buttons {
  position: absolute;
  right: 2.2%;
  bottom: 14.5%;
  width: 15.6%;
  min-width: 162px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 7;
}
.btn-side-navy {
  width: 100%;
  padding: 6px 16px 6px 10px;
  border-radius: 999px;
  border: 3.5px solid #FFFFFF;
  background: linear-gradient(180deg, #3B6094 0%, #203A64 52%, #132544 100%);
  box-shadow:
    inset 0 0 0 3px #0E1B31,
    inset 0 6px 4px rgba(255, 255, 255, 0.32),
    inset 0 -5px 5px rgba(0, 0, 0, 0.35),
    0 6px 12px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.12s ease;
}
.btn-side-navy:hover { filter: brightness(1.08); transform: translateY(-2px); }
.side-icon-box {
  width: clamp(26px, 2.6vw, 38px);
  height: clamp(26px, 2.6vw, 38px);
  flex-shrink: 0;
}
.side-svg { width: 100%; height: 100%; }
.side-btn-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.88rem, 1.32vw, 1.26rem);
  color: #FFFFFF;
  letter-spacing: 0.02em;
  text-shadow:
    -1.5px -1.5px 0 #0D192B,
     1.5px -1.5px 0 #0D192B,
    -1.5px  1.5px 0 #0D192B,
     1.5px  1.5px 0 #0D192B,
     0px    2.5px 0 #0D192B;
}

.btn-menu-blue {
  position: absolute;
  bottom: 2.5%;
  left: 1.8%;
  padding: 7px 22px 7px 14px;
  border-radius: 999px;
  border: 3.5px solid #FFFFFF;
  background: linear-gradient(180deg, #4CC2FF 0%, #1D75E8 52%, #12439E 100%);
  box-shadow:
    inset 0 0 0 3px #0C2556,
    inset 0 6px 4px rgba(255, 255, 255, 0.38),
    0 6px 12px rgba(0, 0, 0, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.9rem, 1.5vw, 1.4rem);
  color: #FFFFFF;
  letter-spacing: 0.02em;
  text-shadow:
    -1.5px -1.5px 0 #0A1E46,
     1.5px -1.5px 0 #0A1E46,
    -1.5px  1.5px 0 #0A1E46,
     1.5px  1.5px 0 #0A1E46,
     0px    2.5px 0 #0A1E46;
  cursor: pointer;
  z-index: 12;
}
.btn-sm-inline {
  position: static;
  padding: 4px 14px;
  font-size: 0.95rem;
}
.menu-home-svg { width: 28px; height: 28px; }

/* ==================== BOTONES HERO (INTERFACES 2 Y 4) ==================== */
.s2-buttons-col {
  position: absolute;
  right: 7%;
  bottom: 12%;
  width: 39%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 8;
}
.s4-cta-wrap {
  position: absolute;
  right: 6.5%;
  bottom: 8%;
  width: 40%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 8;
}
.s4-difficulty-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.diff-pill {
  background: #FFF9EB;
  border: 3.5px solid #241006;
  border-radius: 16px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.8rem, 1.25vw, 1.12rem);
  color: #241006;
  cursor: pointer;
}
.diff-pill.is-selected {
  background: #FEF08A;
  box-shadow: inset 0 0 0 3px #D97706;
}
.diff-pill.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.s4-horse-check {
  background: rgba(255, 249, 235, 0.95);
  border: 3px solid #241006;
  border-radius: 14px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: clamp(0.7rem, 1.05vw, 0.94rem);
  color: #241006;
  text-align: center;
}
.btn-s4-stable {
  justify-content: center;
}

.btn-hero {
  width: 100%;
  padding: 12px 26px;
  border-radius: 999px;
  border: 5px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.12s ease;
}
.btn-hero:hover { filter: brightness(1.06); transform: translateY(-2px); }
.btn-hero-orange {
  background: linear-gradient(180deg, #FFE249 0%, #F59E0B 52%, #D97706 100%);
  box-shadow: inset 0 0 0 4.5px #3A1807, inset 0 12px 6px rgba(255,255,255,0.45), 0 10px 18px rgba(0,0,0,0.45);
}
.btn-hero-red {
  background: linear-gradient(180deg, #FF6B6B 0%, #E11D48 52%, #881337 100%);
  box-shadow: inset 0 0 0 4.5px #3B0714, inset 0 12px 6px rgba(255,255,255,0.42), 0 10px 18px rgba(0,0,0,0.45);
}
.hero-icon-svg, .hero-icon-img {
  width: clamp(38px, 4.1vw, 58px);
  height: clamp(38px, 4.1vw, 58px);
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.35));
}
.hero-btn-text {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.25rem, 2.35vw, 2.2rem);
  color: #FFFFFF;
  -webkit-text-stroke: 5px #220E04;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #220E04;
}

/* ==================== MAPA EN PERGAMINO SVG (INTERFACES 3 Y 7) ==================== */
.map-scroll-container {
  position: absolute;
  right: 2.2%;
  top: 2.5%;
  width: 44.5%;
  height: 85%;
  z-index: 6;
}
.piura-scroll-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.map-region-node.is-unlocked { cursor: pointer; }
.map-region-node.is-unlocked:hover .prov-path { filter: brightness(1.08); }
.map-region-node.is-locked { cursor: pointer; }
.prov-svg-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 18px;
  fill: #FFFFFF;
  stroke: #1D0D05;
  stroke-width: 4.5px;
  paint-order: stroke fill;
  pointer-events: none;
}
.plaque-sub-txt {
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  font-weight: 700;
  fill: #3B1B08;
}
.plaque-main-txt {
  font-family: 'Fredoka', sans-serif;
  font-size: 28px;
  font-weight: 700;
  fill: #241006;
}
.horseshoe-pulse {
  animation: pulseScale 1.3s ease-in-out infinite;
}
@keyframes pulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ==================== INTERFAZ 5: BAILANDO ==================== */
.stage-top-bars {
  position: absolute;
  top: 1.4%;
  left: 26%;
  width: 46%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 16;
}
.song-progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(18, 9, 4, 0.78);
  border: 3px solid #FFFFFF;
  outline: 2.5px solid #241006;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
}
.song-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #22C55E 0%, #FACC15 60%, #F59E0B 100%);
  transition: width 0.15s linear;
}
.stage-vitals-dashboard {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(64, 29, 10, 0.94) 0%, rgba(32, 14, 5, 0.96) 100%);
  border: 3.5px solid #FACC15;
  outline: 2.5px solid #1E0E05;
  border-radius: 18px;
  padding: 6px 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.55);
}
.hud-combo-badge {
  background: linear-gradient(180deg, #FEF08A 0%, #F59E0B 100%);
  border: 2.5px solid #241006;
  border-radius: 12px;
  padding: 5px 10px;
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.88rem, 1.3vw, 1.18rem);
  color: #241006;
  white-space: nowrap;
}
.hud-meter-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hud-meter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.84rem, 1.2vw, 1.12rem);
  color: #FFFDF5;
  text-shadow: 0 2px 0 #1A0B04;
}
.hud-meter-top strong {
  color: #FEF08A;
  font-size: clamp(0.92rem, 1.32vw, 1.22rem);
}
.hud-meter-track {
  width: 100%;
  height: 11px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  overflow: hidden;
}
.hud-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.hud-fill-energy { background: linear-gradient(90deg, #F59E0B 0%, #84CC16 50%, #22C55E 100%); }
.hud-fill-water  { background: linear-gradient(90deg, #0284C7 0%, #38BDF8 60%, #7DD3FC 100%); }

.stage-hat-frame-svg {
  position: absolute;
  left: 17%;
  top: 36%;
  width: 12.5%;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
}
.stage-banner-overlay {
  position: absolute;
  right: 11.2%;
  top: 27%;
  width: 6.5%;
  height: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4;
  pointer-events: none;
}
.banner-overlay-svg { width: 70%; height: auto; }
.banner-prov-name {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.6rem, 1.05vw, 0.98rem);
  color: #FFFFFF;
  -webkit-text-stroke: 2.5px #1E1006;
  paint-order: stroke fill;
}
.stage-score-hud {
  position: absolute;
  top: 3.5%;
  right: 17%;
  z-index: 15;
  font-family: 'Fredoka', sans-serif;
  line-height: 1;
}
.score-label {
  font-size: clamp(0.95rem, 1.6vw, 1.45rem);
  font-weight: 700;
  color: #FFFFFF;
  -webkit-text-stroke: 4px #180C05;
  paint-order: stroke fill;
}
.score-number {
  font-size: clamp(1.6rem, 2.9vw, 2.7rem);
  font-weight: 700;
  color: #FFFFFF;
  -webkit-text-stroke: 5.5px #180C05;
  paint-order: stroke fill;
}
.btn-stage-close {
  position: absolute;
  top: 2.5%;
  right: 2%;
  width: clamp(34px, 3.4vw, 46px);
  height: clamp(34px, 3.4vw, 46px);
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 16;
}

.layer-dancer-stage {
  position: absolute;
  left: 33%;
  bottom: 4%;
  width: 40%;
  height: 78%;
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: pasoBounce 0.85s ease-in-out infinite;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}
@keyframes pasoBounce {
  0%, 100% { margin-bottom: 0px; }
  50% { margin-bottom: 8px; }
}
.dancer-sprite-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.4));
}
.layer-dancer-stage.step-left  { transform: translateX(-18px) rotate(-2.5deg); }
.layer-dancer-stage.step-right { transform: translateX(18px) rotate(2.5deg); }
.layer-dancer-stage.step-up    { transform: translateY(-18px) scale(1.035); }
.layer-dancer-stage.step-down  { transform: translateY(10px) scale(1.02, 0.96); }
.layer-dancer-stage.step-stumble {
  transform: translateX(-8px) rotate(-2deg);
  filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.75));
}
.dancer-ground-shadow {
  position: absolute;
  bottom: 1.5%;
  left: 16%;
  width: 68%;
  height: 7%;
  background: radial-gradient(ellipse at center, rgba(35,18,8,0.48) 0%, rgba(35,18,8,0) 75%);
  border-radius: 50%;
}
.dancer-dust-container {
  position: absolute;
  bottom: 1%;
  left: 10%;
  right: 10%;
  height: 15%;
}
.dust-cloud {
  position: absolute;
  bottom: 0;
  width: 64px;
  height: 36px;
  background: radial-gradient(circle at 50% 60%, rgba(243,198,130,0.88) 0%, rgba(230,175,100,0) 72%);
  border-radius: 50%;
  opacity: 0;
}
.dust-l { left: 8%; }
.dust-r { right: 8%; }
.dancer-dust-container.puff .dust-cloud { animation: dustBurst 0.42s ease-out; }
@keyframes dustBurst {
  0% { opacity: 0.95; transform: scale(0.55) translateY(0); }
  100% { opacity: 0; transform: scale(1.55) translateY(-14px); }
}

.rhythm-lane-wrap {
  position: absolute;
  top: 12%;
  left: 3.5%;
  width: 33%;
  height: 77%;
  z-index: 10;
}
#rhythmCanvas { width: 100%; height: 100%; display: block; }
.touch-pad-bar {
  position: absolute;
  bottom: 1.5%;
  left: 3.5%;
  width: 33%;
  display: flex;
  gap: 8px;
  z-index: 18;
}
.touch-key-btn {
  flex: 1;
  height: clamp(44px, 7vh, 56px);
  border-radius: 14px;
  border: 3.5px solid #FFFFFF;
  box-shadow:
    inset 0 0 0 3px #1E1006,
    inset 0 6px 4px rgba(255,255,255,0.35),
    0 5px 10px rgba(0,0,0,0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.1s ease;
}
.touch-key-btn:active {
  transform: translateY(2px) scale(0.97);
  filter: brightness(1.2);
}
.touch-arrow-svg {
  width: clamp(32px, 3.2vw, 44px);
  height: clamp(24px, 2.5vw, 34px);
  display: block;
  filter: drop-shadow(0 2px 0 #1E1006);
}
.touch-space-lbl {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.3vw, 1.25rem);
  color: #FFFFFF;
  text-shadow:
    -1.5px -1.5px 0 #1E1006,
     1.5px -1.5px 0 #1E1006,
    -1.5px  1.5px 0 #1E1006,
     1.5px  1.5px 0 #1E1006;
}
.tk-ArrowLeft  { background: linear-gradient(180deg, #FB923C 0%, #EA580C 100%); }
.tk-ArrowUp    { background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%); }
.tk-ArrowDown  { background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%); }
.tk-ArrowRight { background: linear-gradient(180deg, #60A5FA 0%, #1D4ED8 100%); }
.tk-Space      { background: linear-gradient(180deg, #FACC15 0%, #D97706 100%); flex: 1.3; }

/* ==================== INTERFAZ 6: MONEDAS Y DESGLOSE ==================== */
.s6-sub-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 1.9vw, 1.75rem);
  color: #1A0B04;
  margin-bottom: 6px;
}
.s6-coins-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.s6-coin-capsule {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #FCE3A6;
  border: 4px solid #241006;
  border-radius: 999px;
  padding: 4px 24px 4px 8px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.6);
}
.coin-horse-svg, .coin-horse-img {
  width: clamp(32px, 3.2vw, 46px);
  height: clamp(32px, 3.2vw, 46px);
  object-fit: contain;
  flex-shrink: 0;
}
.s6-coins-num {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.35rem, 2.5vw, 2.3rem);
  color: #1A0B04;
}
.s6-monedas-word {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 1.95vw, 1.8rem);
  color: #1A0B04;
}
.s6-actions-right {
  position: absolute;
  right: 4.5%;
  bottom: 4.5%;
  width: 39%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.s6-summary-card {
  background: linear-gradient(180deg, #FFF9EB 0%, #FCE5B8 100%);
  border: 4px solid #2A1205;
  border-radius: 20px;
  padding: 10px 16px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.s6-sum-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 1.6vw, 1.45rem);
  color: #241006;
  text-align: center;
}
.s6-sum-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.s6-sum-pill {
  background: #2A1205;
  color: #FEF08A;
  border: 2px solid #D97706;
  border-radius: 999px;
  padding: 4px 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: clamp(0.78rem, 1.1vw, 1rem);
}
.s6-sum-pill strong {
  color: #FFFFFF;
}
.btn-chest-surprise {
  width: 100%;
  padding: 9px 18px;
  border-radius: 999px;
  border: 3.5px solid #FFFFFF;
  background: linear-gradient(180deg, #3B6094 0%, #203A64 52%, #132544 100%);
  box-shadow:
    inset 0 0 0 3px #0E1B31,
    inset 0 6px 4px rgba(255,255,255,0.32),
    0 6px 14px rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.92rem, 1.35vw, 1.25rem);
  color: #FFFFFF;
  text-shadow:
    -1.5px -1.5px 0 #0D192B,
     1.5px -1.5px 0 #0D192B,
    -1.5px  1.5px 0 #0D192B,
     1.5px  1.5px 0 #0D192B;
  transition: transform 0.1s ease, filter 0.12s ease;
}
.btn-chest-surprise:hover { filter: brightness(1.1); transform: translateY(-2px); }
.btn-chest-surprise.is-opened {
  background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
}
.chest-icon-svg {
  width: clamp(28px, 2.8vw, 38px);
  height: clamp(28px, 2.8vw, 38px);
  flex-shrink: 0;
}

/* ==================== INTERFAZ 8: TROFEO SVG ==================== */
.s8-right-column {
  position: absolute;
  right: 3.5%;
  top: 4%;
  width: 44%;
  height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  z-index: 8;
}
.s8-trophy-illustration { width: 100%; height: 78%; }
.trophy-master-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4));
}
.trophy-svg-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 52px;
  fill: #FFFFFF;
  stroke: #241006;
  stroke-width: 11px;
  paint-order: stroke fill;
}

/* ==================== INTERFAZ 9: ESTABLO ==================== */
.stable-wood-sign {
  position: absolute;
  top: 1.5%;
  left: 25.5%;
  width: 30%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 8;
}
.wood-board-top {
  width: 100%;
  background: linear-gradient(180deg, #E29B4B 0%, #B86B23 100%);
  border: 4.5px solid #2A1205;
  border-radius: 18px;
  padding: 4px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.3rem, 2.6vw, 2.4rem);
  color: #2A1205;
  text-shadow: 0 2px 0 #FDE68A;
  box-shadow: 0 8px 14px rgba(0,0,0,0.45);
}
.sign-horseshoe-svg { width: 32px; height: 32px; }
.wood-board-sub {
  margin-top: -4px;
  background: #FCE3B4;
  border: 3.5px solid #2A1205;
  border-radius: 10px;
  padding: 2px 18px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.75rem, 1.25vw, 1.12rem);
  color: #2A1205;
}

.stable-coins-pill {
  position: absolute;
  top: 2.5%;
  right: 2.2%;
  background: #FCE5B8;
  border: 4px solid #2A1205;
  border-radius: 999px;
  padding: 4px 10px 4px 6px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.1rem, 1.9vw, 1.7rem);
  color: #241006;
  box-shadow: 0 6px 14px rgba(0,0,0,0.45);
  z-index: 10;
}
.coin-plus-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4ADE80, #16A34A);
  border: 3px solid #FFFFFF;
  outline: 2.5px solid #14532D;
  color: #FFFFFF;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.stable-vitals-hud {
  position: absolute;
  top: 1.5%;
  left: 57%;
  width: 25.5%;
  background: linear-gradient(180deg, rgba(54, 24, 8, 0.95) 0%, rgba(30, 13, 4, 0.96) 100%);
  border: 3.5px solid #FACC15;
  outline: 2.5px solid #1E0E05;
  border-radius: 18px;
  padding: 7px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.45);
  z-index: 10;
}
.vital-bar-box {
  color: #FFFDF5;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.82rem, 1.15vw, 1.05rem);
  font-weight: 700;
}
.vital-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vital-bar-head strong {
  color: #FEF08A;
  font-size: clamp(0.9rem, 1.25vw, 1.15rem);
}
.vital-bar-track {
  height: 10px;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}
.vital-bar-fill { height: 100%; transition: width 0.25s ease; }
.fill-energy { background: linear-gradient(90deg, #F59E0B, #84CC16, #22C55E); }
.fill-water  { background: linear-gradient(90deg, #0284C7, #38BDF8, #7DD3FC); }
.ration-use-btn {
  margin-top: 2px;
  background: linear-gradient(180deg, #FEF08A 0%, #FACC15 100%);
  border: 2.5px solid #241006;
  border-radius: 10px;
  padding: 4px 8px;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.72rem, 0.98vw, 0.9rem);
  font-weight: 700;
  color: #241006;
  cursor: pointer;
}
.ration-use-btn:hover { filter: brightness(1.06); }

.layer-horse-stable-wrap {
  position: absolute;
  left: 9.5%;
  bottom: 9.5%;
  width: 36%;
  height: 70%;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.horse-stable-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.45));
  animation: characterBreathe 2.6s ease-in-out infinite;
}

.stable-dots-bar {
  position: absolute;
  left: 19%;
  bottom: 2.6%;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}
.btn-arrow-yellow {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FFE135, #D97706);
  border: 3px solid #FFFFFF;
  outline: 3px solid #241006;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
}
.dot-arrow-svg { width: 22px; height: 22px; display: block; }
.coat-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #94A3B8;
  border: 2.5px solid #241006;
}
.coat-dot.active { background: #F59E0B; transform: scale(1.2); }

.stable-shop-panel {
  position: absolute;
  right: 2.2%;
  top: 20%;
  width: 46%;
  height: 61.5%;
  background: #FCEAD2;
  border: 5px solid #4A220B;
  border-radius: 26px;
  box-shadow: inset 0 0 0 4px #E2BA82, 0 12px 24px rgba(0,0,0,0.5);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  z-index: 9;
}
.shop-tabs-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.shop-tab {
  background: #F4D8AE;
  border: 3.5px solid #4A220B;
  border-radius: 16px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.75rem, 1.1vw, 1rem);
  color: #2A1205;
  cursor: pointer;
}
.shop-tab.active {
  background: linear-gradient(180deg, #FFE249, #F59E0B);
}
.tab-svg { width: 24px; height: 24px; }

.shop-cards-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  min-height: 0;
}
.shop-card {
  position: relative;
  background: #E8C798;
  border: 3px solid #C6985E;
  border-radius: 16px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.12s ease;
}
.shop-card:hover { filter: brightness(1.04); }
.shop-card.is-selected {
  background: #FDE047;
  border: 4px solid #D97706;
  box-shadow: inset 0 0 0 2.5px #FFFFFF;
}
.item-svg-preview, .item-img-preview {
  width: 84%;
  height: 60%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.22));
}
.item-card-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: clamp(0.66rem, 0.92vw, 0.85rem);
  color: #241006;
  text-align: center;
  line-height: 1.05;
}
.shop-price-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFF9EB;
  border: 2.5px solid #3B1B08;
  border-radius: 999px;
  padding: 2px 12px 2px 6px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.72rem, 1.02vw, 0.94rem);
  color: #241006;
}
.coin-mini-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}
.check-badge-green {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 28px;
  height: 28px;
}

/* ==================== PREGUNTA CULTURAL (PERSONAJE A LA IZQUIERDA SIN CARD, OPCIONES A LA DERECHA) ==================== */
.question-overlay, .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 8, 4, 0.82);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.question-overlay.active, .modal-backdrop.active { display: flex; }

.q-stage-layout {
  width: min(96%, 1240px);
  height: 88%;
  display: grid;
  grid-template-columns: 38% 60%;
  align-items: center;
  justify-content: space-between;
  gap: 2%;
}
.q-char-left-col {
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.q-char-nocard-img {
  width: 100%;
  max-height: 92%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.75));
  animation: characterBreathe 2.6s ease-in-out infinite;
}
.q-right-options-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.q-speech-banner {
  position: relative;
  background: #FFFDF7;
  border: 6px solid #241006;
  border-radius: 28px;
  padding: 16px 22px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.55);
}
.q-speech-banner::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 42%;
  border-width: 14px 24px 14px 0;
  border-style: solid;
  border-color: transparent #241006 transparent transparent;
}
.q-speech-banner::after {
  content: '';
  position: absolute;
  left: -15px;
  top: calc(42% + 4px);
  border-width: 10px 18px 10px 0;
  border-style: solid;
  border-color: transparent #FFFDF7 transparent transparent;
}
.q-header-row, .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.q-guide-pill {
  background: #2A1205;
  color: #FEF08A;
  border: 2.5px solid #D97706;
  border-radius: 999px;
  padding: 5px 16px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(0.92rem, 1.35vw, 1.2rem);
}
.q-timer-pill {
  background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%);
  color: #FFFFFF;
  border: 3px solid #241006;
  border-radius: 999px;
  padding: 5px 18px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 1.55vw, 1.4rem);
}
.q-timer-bar {
  width: 100%;
  height: 12px;
  background: #E2E8F0;
  border: 2.5px solid #2A1205;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0;
}
.q-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22C55E, #F59E0B, #EF4444);
}
.q-prompt-title {
  margin: 6px 0 2px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.18rem, 2vw, 1.85rem);
  color: #1A0B04;
  line-height: 1.2;
}
.q-options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.q-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 12px 18px;
  background: linear-gradient(180deg, #FFFDF7 0%, #FCE7B8 100%);
  border: 4.5px solid #2A1205;
  border-radius: 20px;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,0.85),
    0 8px 18px rgba(0,0,0,0.45);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.12s ease;
}
.q-option-btn:hover {
  transform: translateX(6px);
  filter: brightness(1.04);
}
.q-key-cap {
  width: clamp(46px, 4.4vw, 60px);
  height: clamp(38px, 3.8vw, 48px);
  border-radius: 12px;
  border: 3px solid #FFFFFF;
  box-shadow: inset 0 0 0 2.5px #1E1006, 0 3px 6px rgba(0,0,0,0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  flex-shrink: 0;
}
.q-key-cap svg { width: 100%; height: 100%; display: block; }
.qk-left  { background: linear-gradient(180deg, #FB923C, #EA580C); }
.qk-up    { background: linear-gradient(180deg, #38BDF8, #0284C7); }
.qk-right { background: linear-gradient(180deg, #60A5FA, #1D4ED8); }
.q-opt-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(1.08rem, 1.75vw, 1.55rem);
  color: #1E0E05;
}
.q-option-btn.is-correct {
  background: linear-gradient(180deg, #BBF7D0 0%, #4ADE80 100%);
  border-color: #14532D;
}
.q-option-btn.is-wrong {
  background: linear-gradient(180deg, #FECACA 0%, #F87171 100%);
  border-color: #7F1D1D;
}
.q-feedback-msg {
  min-height: 36px;
  border-radius: 16px;
  padding: 8px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: clamp(0.92rem, 1.35vw, 1.2rem);
  text-align: center;
}
.q-feedback-msg.is-ok {
  background: rgba(20, 83, 45, 0.92);
  border: 3px solid #4ADE80;
  color: #FEF08A;
}
.q-feedback-msg.is-err {
  background: rgba(127, 29, 29, 0.92);
  border: 3px solid #F87171;
  color: #FFFDF7;
}

.modal-card {
  width: min(92%, 720px);
  max-height: 90%;
  overflow-y: auto;
  background: #FFF9EB;
  border: 5px solid #2A1205;
  border-radius: 24px;
  padding: 18px 22px;
  box-shadow: 0 20px 45px rgba(0,0,0,0.65);
}
.modal-sm { max-width: 480px; }
.modal-header { border-bottom: 3px dashed #D6B588; padding-bottom: 8px; margin-bottom: 12px; }
.modal-header h2 { margin: 0; font-family: 'Fredoka', sans-serif; }
.tutorial-list { font-weight: 700; line-height: 1.45; font-size: 0.92rem; }
.badges-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.badge-box {
  background: #F4D8AE;
  border: 2.5px solid #4A220B;
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
}
.badge-box.earned { background: #FEF08A; border-color: #D97706; }
.settings-list { display: grid; gap: 12px; font-weight: 800; }
.settings-list label { display: flex; justify-content: space-between; align-items: center; }

.toast-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #241006;
  color: #FEF08A;
  border: 3px solid #FACC15;
  border-radius: 999px;
  padding: 6px 18px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  z-index: 90;
  display: none;
}
.toast-banner.show { display: block; }
