:root {
  --mc-navy: #102343;
  --mc-blue: #246bd5;
  --mc-blue-dark: #153d84;
  --mc-sky: #cdefff;
  --mc-yellow: #ffe071;
  --mc-gold: #b76500;
  --mc-mint: #dff8ee;
  --mc-green: #16835c;
  --mc-border: #83c6e5;
  --mc-ink: #2d3d56;
}

html, body { min-height: 100%; }
body {
  color: var(--mc-navy);
  background-color: #dff6ff !important;
}

/* Cabecera funcional con el lenguaje visual aprobado en la maqueta. */
#puntuacionFlotatenDivId {
  align-items: center;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid #c6e2ef;
  box-shadow: 0 8px 24px rgba(16, 35, 67, .08);
  display: flex !important;
  gap: 1rem;
  justify-content: center;
  min-height: 92px;
  padding: 13px 24px !important;
  position: relative;
  width: 100% !important;
  z-index: 20;
}
.matecitos-hud-brand {
  align-items: center;
  display: flex;
  font: 900 13px/1.2 Nunito, system-ui, sans-serif;
  gap: .65rem;
  left: 24px;
  letter-spacing: .055em;
  max-width: 235px;
  position: absolute;
}
.matecitos-hud-brand img {
  filter: drop-shadow(0 6px 8px rgba(16, 35, 67, .15));
  height: 54px;
  object-fit: contain;
  width: 54px;
}
#puntuacionFlotante {
  margin: 0 auto;
  max-width: 690px;
}
#contentNumPantalla,
#puntuacionFlotante .contentNumPantalla {
  border-width: 2px !important;
  box-shadow: 0 7px 18px rgba(16, 35, 67, .1) !important;
  min-height: 58px;
}
#puntuacionFlotante td:nth-child(1) #contentNumPantalla {
  background: #edf8ff !important;
  border-color: #78bce4 !important;
}
#puntuacionFlotante td:nth-child(2) .contentNumPantalla {
  background: #fff7c8 !important;
  border-color: #efb22a !important;
}
#puntuacionFlotante td:nth-child(3) .contentNumPantalla {
  background: var(--mc-mint) !important;
  border-color: #55b997 !important;
}
#contentNumPantalla::before {
  background: var(--mc-blue) !important;
  box-shadow: 0 3px 0 var(--mc-blue-dark), 0 0 0 1px #5b9de0 !important;
  color: #fff !important;
  content: "1/10" !important;
}
#puntuacionFlotante td:nth-child(2) .contentNumPantalla::before {
  background: var(--mc-gold) !important;
  box-shadow: 0 3px 0 #7f4300, 0 0 0 1px #d59a24 !important;
  color: #fff !important;
}
#puntuacionFlotante td:nth-child(3) .contentNumPantalla::before {
  background: var(--mc-green) !important;
  box-shadow: 0 3px 0 #0f6043, 0 0 0 1px #55b997 !important;
  color: #fff !important;
}

/* Tarjeta central: mantiene intacto el motor clásico y cambia solo su piel. */
#content {
  min-height: calc(100vh - 180px);
  padding: clamp(1rem, 3vh, 2.6rem) 1rem 7rem !important;
}
#ejerPrincipalId,
#explicacionEjercicio {
  background: rgba(255, 255, 255, .97) !important;
  border: 2px solid var(--mc-border) !important;
  border-radius: 34px !important;
  box-shadow: 0 18px 45px rgba(16, 35, 67, .15) !important;
  max-width: 940px !important;
  min-height: 505px;
  padding: clamp(1.5rem, 3.4vw, 2.8rem) clamp(1rem, 4vw, 3rem) 2rem !important;
}
#explicacionEjercicio {
  margin: 0 auto !important;
}
#explicacionEjercicio > h1:empty { display: none; }
#descriptionTitle {
  color: var(--mc-navy) !important;
  font-size: clamp(2.25rem, 5vw, 3.55rem) !important;
  letter-spacing: -.025em !important;
  line-height: 1.07 !important;
  padding-bottom: clamp(1.5rem, 3vw, 2.2rem) !important;
  text-shadow: none !important;
}
#contentText {
  color: var(--mc-ink);
  font-size: clamp(1.15rem, 2.1vw, 1.55rem) !important;
  font-weight: 800;
  line-height: 1.4;
}
#contentText .enunFont,
#contentTextRespuesta .enunFont {
  font-size: clamp(1.15rem, 2.1vw, 1.55rem) !important;
  line-height: 1.4;
}
#contentTextRespuesta {
  color: var(--mc-ink);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem) !important;
  line-height: 1.42;
  margin: 0 auto !important;
  max-width: 860px;
}
#contentTextRespuesta h2 {
  color: var(--mc-navy);
  font-size: clamp(1.65rem, 3.5vw, 2.35rem) !important;
  height: auto !important;
  letter-spacing: -.01em !important;
  line-height: 1.15 !important;
  padding: 1rem 0 !important;
}

/* Opciones numéricas grandes, claras y táctiles. */
#contentText .buttonSelected,
#contentTextRespuesta .buttonSelected {
  background: #effaff !important;
  border: 3px solid #73b7db !important;
  border-radius: 22px !important;
  box-shadow: 0 6px 0 #b5ddeb !important;
  box-sizing: border-box;
  color: var(--mc-navy) !important;
  cursor: pointer;
  margin: .42rem !important;
  min-height: 76px;
  min-width: 76px;
  padding: .45rem .8rem !important;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
#contentText .buttonSelected:hover,
#contentTextRespuesta .buttonSelected:hover {
  box-shadow: 0 8px 0 #a1d2e7 !important;
  transform: translateY(-2px);
}
#contentText .buttonSelected[aria-pressed="true"],
#contentTextRespuesta .buttonSelected[aria-pressed="true"] {
  background: var(--mc-blue) !important;
  border-color: var(--mc-blue-dark) !important;
  box-shadow: 0 6px 0 var(--mc-blue-dark) !important;
  color: #fff !important;
  filter: none !important;
}
#contentText .buttonSelected img,
#contentTextRespuesta .buttonSelected img { display: none !important; }
#contentText .buttonSelected .containerContImage,
#contentTextRespuesta .buttonSelected .containerContImage { color: inherit; }
#contentText .buttonSelected .centeredImageButtonSelected,
#contentTextRespuesta .buttonSelected .centeredImageButtonSelected {
  color: inherit;
  font: 900 clamp(1.7rem, 4vw, 2.25rem)/1 Nunito, system-ui, sans-serif !important;
  left: auto !important;
  position: static !important;
  top: auto !important;
  transform: none !important;
}

#buttonComprobar,
#buttonComenzar,
#contentTextRespuesta [data-legacy-id="buttonComprobar"] {
  background: var(--mc-blue) !important;
  border: 2px solid var(--mc-blue-dark) !important;
  border-radius: 18px !important;
  box-shadow: 0 6px 0 var(--mc-blue-dark) !important;
  color: #fff !important;
  cursor: pointer;
  min-height: 56px;
  min-width: 210px;
  padding: .75rem 1.5rem !important;
}
#buttonComprobar img,
#buttonComenzar img,
#contentTextRespuesta [data-legacy-id="buttonComprobar"] img { display: none !important; }
#buttonComprobar .centeredImageTextButtons,
#buttonComenzar .centeredImageTextButtons,
#contentTextRespuesta [data-legacy-id="buttonComprobar"] .centeredImageTextButtons {
  color: #fff;
  font: 900 1.2rem/1.1 Nunito, system-ui, sans-serif !important;
  left: auto !important;
  position: static !important;
  top: auto !important;
  transform: none !important;
}

/* Portada del ejercicio con la misma identidad que la pantalla de juego. */
#InfoPrincipal { padding: 1rem 1rem 7rem !important; }
.backgroundInformationContent {
  background: rgba(255, 255, 255, .97) !important;
  border: 2px solid var(--mc-border) !important;
  border-radius: 34px !important;
  box-shadow: 0 18px 45px rgba(16, 35, 67, .15) !important;
  max-width: 940px !important;
}
#InfoPrincipal h1 {
  color: var(--mc-navy);
  font-size: clamp(2.2rem, 5vw, 3.55rem) !important;
  letter-spacing: -.025em !important;
}
#InfoPrincipal table { color: var(--mc-ink); }

/* Personajes y firma siempre visibles sin cubrir la actividad. */
.footerPage {
  bottom: 0 !important;
  height: 92px !important;
  margin: 0 !important;
  padding: 2.65rem 1rem .65rem !important;
  position: fixed !important;
  pointer-events: none;
}
.footerPage a {
  align-items: center;
  background: rgba(255, 255, 255, .86);
  border-radius: 999px;
  color: var(--mc-blue-dark) !important;
  display: inline-flex;
  font-size: 16px !important;
  font-weight: 900;
  min-height: 44px;
  padding: 0 1.1rem;
  pointer-events: auto;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.wrapper-beta,
.wrapper-pi {
  bottom: 0 !important;
  filter: drop-shadow(0 10px 12px rgba(16, 35, 67, .18));
  height: auto;
  max-height: 155px;
  object-fit: contain;
  pointer-events: none;
  width: 120px !important;
}
.wrapper-beta { right: 14px !important; }
.wrapper-pi { left: 14px !important; }

@media (max-width: 980px) {
  .matecitos-hud-brand span { display: none; }
  .matecitos-hud-brand { left: 10px; }
  .matecitos-hud-brand img { height: 44px; width: 44px; }
  #puntuacionFlotante { max-width: min(690px, calc(100% - 56px)); }
}

@media (max-width: 600px) {
  #puntuacionFlotatenDivId {
    min-height: 72px;
    padding: 8px 6px !important;
  }
  .matecitos-hud-brand { display: none; }
  #puntuacionFlotante { max-width: 100%; }
  #content { min-height: calc(100vh - 120px); padding: .75rem .45rem 1rem !important; }
  #ejerPrincipalId,
  #explicacionEjercicio {
    border-radius: 24px !important;
    min-height: 0;
    padding: 1.2rem .7rem 1.5rem !important;
  }
  #descriptionTitle { font-size: clamp(1.9rem, 10vw, 2.65rem) !important; }
  #contentText,
  #contentTextRespuesta { font-size: 1.05rem !important; }
  #contentText .enunFont,
  #contentTextRespuesta .enunFont { font-size: 1.15rem !important; line-height: 1.38; }
  #contentText .buttonSelected,
  #contentTextRespuesta .buttonSelected {
    border-radius: 17px !important;
    margin: .28rem !important;
    min-height: 60px;
    min-width: 60px;
    padding: .35rem .55rem !important;
  }
  #contentText .buttonSelected .centeredImageButtonSelected,
  #contentTextRespuesta .buttonSelected .centeredImageButtonSelected { font-size: 1.65rem !important; }
  #buttonComprobar, #buttonComenzar,
  #contentTextRespuesta [data-legacy-id="buttonComprobar"] { min-width: 180px; }
  #InfoPrincipal {
    align-items: stretch !important;
    flex-direction: column;
    padding: .5rem .5rem 0 !important;
  }
  #InfoPrincipal .matecitos-adaptive-badge {
    align-self: center;
    flex: 0 0 auto;
    margin: .2rem auto .5rem;
    order: -1;
  }
  .backgroundInformationContent { border-radius: 24px !important; }
  .wrapper-beta, .wrapper-pi { max-height: 110px; width: 84px !important; }
  .footerPage {
    height: 112px !important;
    padding-top: 3.4rem !important;
    position: relative !important;
  }
  .footerPage a { font-size: 14px !important; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  #contentText .buttonSelected { transition: none; }
  #contentText .buttonSelected:hover { transform: none; }
}
