@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/montserrat-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/montserrat-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("assets/fonts/montserrat-latin-800-normal.woff2") format("woff2");
}

:root {
  --bg: #EAF6F3;
  --surface: #FFFFFF;
  --primary: #FF6B6B;
  --primary-dark: #E85A5A;
  --secondary: #4EC9B0;
  --secondary-dark: #38B39C;
  --accent-yellow: #FFD166;
  --text: #1B3A4B;
  --text-soft: #4A6572;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 10px 24px rgba(27, 58, 75, 0.12);
  --font-main: "Montserrat", ui-rounded, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  background-image: radial-gradient(circle at 100% 0%, #FFEFC7 0%, transparent 45%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  touch-action: manipulation;
  cursor: pointer;
  border: none;
}

#app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ===== Home (kids-app) — port fiel del diseño de referencia ===== */

.kids-app {
  background: linear-gradient(#fffaf0 0%, #fffdf9 47%, #f7fbff 100%);
  min-height: 100vh;
  padding: 24px clamp(20px, 5vw, 78px) 32px;
  position: relative;
  overflow: hidden;
}

.sun-glow {
  filter: blur(4px);
  opacity: 0.65;
  background: #fff1c4;
  border-radius: 50%;
  width: 560px;
  height: 560px;
  position: absolute;
  top: -310px;
  right: -100px;
}

.topbar, .hero-section, .adventure-section, .footer-note {
  z-index: 1;
  max-width: 1180px;
  margin-inline: auto;
  position: relative;
}

.topbar {
  justify-content: space-between;
  align-items: center;
  display: flex;
}

.brand-lockup {
  align-items: center;
  gap: 12px;
  display: flex;
  text-decoration: none;
  color: inherit;
}

.brand-lockup img {
  object-fit: contain;
  max-width: 200px;
}

.game-brandbar { margin-bottom: 18px; }

.sound-button {
  color: #8490a4;
  cursor: pointer;
  background: #fff;
  border: 0;
  border-radius: 999px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 14px;
  display: flex;
  box-shadow: 0 5px 15px #dbe3ef77;
  touch-action: manipulation;
}

.sound-button.is-on { color: #4d91d5; }

.hero-section {
  justify-content: space-between;
  align-items: center;
  min-height: 292px;
  padding: 42px 5.5% 24px;
  display: flex;
}

.hero-copy { max-width: 570px; }

.eyebrow {
  color: #ed8872;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  font-size: 14px;
  font-weight: 500;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
  display: flex;
}

.hero-copy h1 {
  color: #293957;
  letter-spacing: -3px;
  margin: 0;
  font-size: clamp(48px, 6vw, 78px);
  font-weight: 950;
  line-height: 0.98;
}

.hero-copy h1 span { color: #ed7867; }

.hero-copy > p {
  color: #65738c;
  max-width: 480px;
  margin: 18px 0;
  font-size: 20px;
  line-height: 1.55;
}

.hero-tip {
  background: #fff;
  border: 1px solid #f3eadc;
  border-radius: 15px;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  padding: 10px 14px;
  display: flex;
  box-shadow: 0 7px 20px #e8dfd333;
}

.tip-icon {
  color: #d49326;
  background: #fff0c7;
  border-radius: 11px;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  display: grid;
}

.hero-tip p { color: #7b8494; margin: 0; font-size: 14px; }
.hero-tip strong { color: #526077; }

.hero-mascot {
  place-items: center;
  width: 260px;
  height: 236px;
  display: grid;
  position: relative;
}

.hero-mascot::before {
  content: "";
  background: #ffeab2;
  border-radius: 50% 50% 45% 45%;
  width: 214px;
  height: 172px;
  position: absolute;
  transform: rotate(-5deg);
}

.hero-mascot img {
  object-fit: contain;
  filter: drop-shadow(0 15px 12px #d4a74e44);
  width: 190px;
  height: 190px;
  position: relative;
  animation: bob 2.4s ease-in-out infinite;
}

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

.sparkle {
  z-index: 2;
  color: #f1bd45;
  font-size: 31px;
  position: absolute;
}

.sparkle-one { top: 17px; left: 24px; }
.sparkle-two { color: #ed8872; font-size: 23px; bottom: 19px; right: 18px; }

.adventure-section { padding: 18px 0 8px; }

.section-heading {
  justify-content: space-between;
  align-items: end;
  margin-bottom: 18px;
  display: flex;
}

.section-kicker {
  color: #ed8872;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  font-size: 13px;
  margin: 0 0 6px;
}

.section-heading h2 {
  color: #293957;
  letter-spacing: -1px;
  margin: 0;
  font-size: 34px;
}

.progress-pill {
  color: #d69d2f;
  background: #fff3cc;
  border-radius: 999px;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 14px;
  display: flex;
}

.game-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  display: grid;
}

.game-card {
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 0;
  border-radius: 23px;
  padding: 13px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 9px 24px #ced9e833;
  text-decoration: none;
  display: block;
  touch-action: manipulation;
}

.game-card:hover, .game-card:focus-visible {
  outline: none;
  transform: translateY(-5px);
  box-shadow: 0 15px 28px #becbda55;
}

.game-card:active { transform: translateY(-1px); }

.card-top {
  color: var(--game-color);
  justify-content: space-between;
  align-items: center;
  display: flex;
}

.game-number { opacity: 0.8; font-size: 13px; font-weight: 950; }

.card-arrow {
  background: var(--game-soft);
  border-radius: 50%;
  place-items: center;
  width: 30px;
  height: 30px;
  display: grid;
}

.game-art {
  background: var(--game-soft);
  border-radius: 17px;
  place-items: center;
  height: 116px;
  margin: 8px 0 12px;
  display: grid;
  overflow: hidden;
}

.game-art img { object-fit: contain; width: 125px; height: 105px; }

.game-art-emoji { font-size: 56px; }

@media (max-width: 700px) {
  .game-art-emoji { font-size: 42px; }
}

.game-info { align-items: center; gap: 9px; display: flex; }

.game-emoji {
  background: var(--game-soft);
  border-radius: 11px;
  place-items: center;
  width: 35px;
  height: 35px;
  font-size: 23px;
  display: grid;
}

.game-info h3 { color: #34415b; margin: 0; font-size: 17px;}
.game-info p { color: #9aa4b3; margin: 0; font-size: 13px;}

.footer-note {
  text-align: center;
  color: #aab4c0;
  padding: 34px 0 0;
  font-size: 13px;
}

.footer-dot {
  background: #f3bf54;
  border-radius: 50%;
  width: 5px;
  height: 5px;
  margin: 0 8px 2px;
  display: inline-block;
}

@media (max-width: 700px) {
  .kids-app { padding: 18px 16px 26px; }
  .hero-section { min-height: auto; padding: 38px 4px 26px; }
  .hero-copy { max-width: 100%; }
  .hero-copy h1 { font-size: 56px; }
  .hero-copy > p { font-size: 18px; }
  .hero-mascot { display: none; }
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .game-card { border-radius: 18px; padding: 10px; }
  .game-art { height: 96px; }
  .game-art img { width: 105px; height: 88px; }
  .game-info h3 { font-size: 14px; }
  .game-info p { font-size: 12px; }
  .game-emoji { width: 29px; height: 29px; font-size: 19px; }
  .section-heading h2 { font-size: 28px; }
  .progress-pill { padding: 8px 10px; }
  .progress-pill span { display: none; }
}

@media (min-width: 701px) and (max-width: 950px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
  .game-info h3 { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card { transition: none; }
}

/* ===== Página de juego individual — port fiel de la referencia ===== */

.game-page {
  background: radial-gradient(circle at 82% 0%, var(--game-soft) 0, transparent 30%),
    linear-gradient(180deg, #fffaf0 0%, #f8fbff 100%);
  color: #293957;
  min-height: 100vh;
  padding: 24px clamp(20px, 5vw, 78px) 32px;
}

.game-header, .game-shell {
  z-index: 1;
  max-width: 1030px;
  margin: 0 auto;
  position: relative;
}

.game-header {
  justify-content: space-between;
  align-items: center;
  display: flex;
}

.back-link {
  color: #718099;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  touch-action: manipulation;
}

.back-link:hover { color: var(--game-color); }

.game-shell { padding: 55px 0 30px; }

.game-intro {
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 0 6%;
  display: flex;
  flex-wrap: wrap;
}

.game-intro-copy { max-width: 600px; }

.game-title-badge {
  background: var(--game-soft);
  border-radius: 21px;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 17px;
  font-size: 38px;
  display: grid;
}

.game-intro h1 {
  letter-spacing: -2.5px;
  color: #293957;
  margin: 0;
  font-size: clamp(43px, 5vw, 74px);
  line-height: 1;
}

.game-intro-copy > p:not(.section-kicker) {
  color: #68758b;
  max-width: 470px;
  margin: 16px 0 20px;
  font-size: 19px;
  line-height: 1.5;
}

.game-score { gap: 9px; display: flex; flex-wrap: wrap; }

.game-score span {
  color: var(--game-color);
  background: #fff;
  border-radius: 999px;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 14px;
  display: inline-flex;
  box-shadow: 0 5px 15px #dbe3ef77;
}

.game-hero-art {
  background: var(--game-soft);
  border-radius: 45% 55% 50% 40%;
  place-items: center;
  width: 260px;
  height: 210px;
  display: grid;
  flex-shrink: 0;
}

.game-hero-art img { object-fit: contain; width: 210px; height: 175px; }

.play-card {
  background: #fff;
  border-radius: 30px;
  width: min(900px, 100%);
  margin: 38px auto 0;
  padding: clamp(18px, 4vw, 35px);
  box-shadow: 0 18px 45px #becbda44;
}

@media (max-width: 700px) {
  .game-shell { padding: 30px 0 20px; }
  .game-intro { padding: 0; justify-content: center; text-align: center; }
  .game-intro-copy { text-align: center; }
  .game-title-badge { margin-inline: auto; }
  .game-score { justify-content: center; }
  .game-hero-art { display: none; }
}

#game-container { min-height: 200px; }

.game-heading {
  margin: 0 0 6px;
  font-size: 26px;
  color: var(--primary-dark);
  text-align: center;
}

.game-sub {
  margin: 0 0 18px;
  color: var(--text-soft);
  text-align: center;
  font-size: 17px;
}

.game-start {
  text-align: center;
  padding: 30px 10px;
}

.game-start .big-icon {
  font-size: 60px;
  margin-bottom: 6px;
}

.game-start .btn-primary {
  font-size: 20px;
  padding: 14px 28px;
}

/* Buttons (shared) */

.btn-primary, .btn-secondary {
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 18px;
  min-height: 44px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
}

.btn-secondary:active { background: #dcede8; }

/* Coming soon placeholder */

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 30px 10px;
}

.coming-soon .big-icon { font-size: 65px; }
.coming-soon .big-icon img { width: 120px; height: 120px; object-fit: contain; }

/* Memorice game */

.memo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

@media (max-width: 380px) {
  .memo-grid { grid-template-columns: repeat(3, 1fr); }
}

.memo-status {
  text-align: center;
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 14px;
}

.memo-card {
  aspect-ratio: 1 / 1;
  perspective: 800px;
  background: none;
  padding: 0;
}

.memo-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
  border-radius: var(--radius-sm);
}

.memo-card.is-flipped .memo-card-inner,
.memo-card.is-matched .memo-card-inner {
  transform: rotateY(180deg);
}

.memo-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  backface-visibility: hidden;
  font-size: 36px;
}

.memo-face-back {
  background: var(--secondary);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
}

.memo-face-front {
  background: var(--surface);
  border: 2px solid var(--bg);
  transform: rotateY(180deg);
}

.memo-face-front img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.memo-card.is-matched .memo-face-front {
  background: #FFF3D6;
  border-color: var(--accent-yellow);
}

.memo-complete {
  text-align: center;
  padding: 20px 0 6px;
}

.memo-complete .big-icon { font-size: 60px; }

.complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

.complete-actions .btn-primary,
.complete-actions .btn-secondary {
  margin: 0;
}

.memo-complete .big-icon-img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Ordena el cepillado */

.sequence-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.sequence-slot {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg);
  border: 2px dashed #cfe3df;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--text-soft);
  font-size: 22px;
}

.sequence-slot.is-filled {
  background: #FFF3D6;
  border: 2px solid var(--accent-yellow);
  font-size: 26px;
}

.sequence-slot.is-filled img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.step-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 460px;
  margin: 0 auto;
}

.step-card {
  background: var(--surface);
  border: 2px solid var(--bg);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 92px;
}

.step-card:active { transform: scale(0.97); }

.step-icon { font-size: 36px; }

.step-icon img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.step-label {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.25;
}

.step-card.is-done {
  background: #E9F7F1;
  border-color: var(--secondary);
  opacity: 0.55;
}

.step-card.is-shaking {
  animation: shake 0.4s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .step-card.is-shaking { animation: none; }
}

/* Elige el alimento sano — formato verdadero/falso */

.tf-progress {
  text-align: center;
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 14px;
}

.tf-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 32px 16px;
  max-width: 320px;
  margin: 0 auto 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tf-card-small {
  padding: 18px 16px;
  margin-bottom: 16px;
}

.tf-icon { font-size: 101px; line-height: 1; }

.tf-icon img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.tf-card-small .tf-icon { font-size: 67px; }

.tf-card-small .tf-icon img {
  width: 150px;
  height: 150px;
}

.tf-label {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.tf-question {
  text-align: center;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 18px;
}

.tf-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.tf-btn {
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 18px;
  font-weight: 800;
  min-width: 120px;
  min-height: 56px;
  text-transform: uppercase;
}

.tf-btn-yes {
  background: #E1F5EC;
  color: #1F8A5A;
}

.tf-btn-yes:active { background: #C9EEDB; }

.tf-btn-no {
  background: #FCE7E7;
  color: #C43E3E;
}

.tf-btn-no:active { background: #F8D2D2; }

.tf-feedback {
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  text-align: center;
  max-width: 420px;
  margin: 0 auto 18px;
}

.tf-feedback.is-correct {
  background: #E9F7F1;
  border: 2px solid var(--secondary);
}

.tf-feedback.is-incorrect {
  background: #FCEFE9;
  border: 2px solid #F2A65A;
}

.tf-feedback-mark { font-size: 41px; }

.tf-feedback-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin: 6px 0 4px;
}

.tf-feedback-truth {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-soft);
  margin: 0 0 10px;
}

.tf-feedback-text {
  font-size: 16px;
  color: var(--text);
  line-height: 1.45;
  margin: 0;
}

.tf-next {
  display: block;
  margin: 0 auto;
}

/* ¿Qué le pasa al diente? — quiz de opción múltiple */

.question-icon {
  background: var(--bg);
  width: 74px;
  height: 74px;
  border-radius: 50%;
  font-size: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.quiz-scenario {
  text-align: center;
  font-size: 19px;
  color: var(--text);
  line-height: 1.45;
  max-width: 420px;
  margin: 0 auto 6px;
}

.quiz-prompt {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-soft);
  margin: 0 0 18px;
}

.quiz-options {
  display: grid;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto 16px;
}

.quiz-options button {
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--bg);
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 17px;
  font-weight: 700;
}

.quiz-options button:disabled { opacity: 0.85; }

.quiz-options button.correct {
  color: #168366;
  background: #eafaf5;
  border-color: #49c7a0;
}

.quiz-options button.wrong {
  color: #c55e56;
  background: #fff0ef;
  border-color: #f09b91;
}

.answer-feedback {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px;
  line-height: 1.4;
  max-width: 420px;
  margin: 0 auto 16px;
}

.answer-feedback p { margin: 0; }

.answer-feedback.good { color: #168366; background: #eafaf5; }
.answer-feedback.try-again { color: #aa7b24; background: #fff5dc; }

/* Cuenta los dientes */

.count-teeth-row {
  text-align: center;
  font-size: 34px;
  line-height: 1.5;
  max-width: 380px;
  margin: 0 auto 6px;
}

.count-teeth-row img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  vertical-align: middle;
  margin: 0 2px;
}

.count-options {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 0 auto 16px;
}

.count-option {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--bg);
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.count-option:disabled { opacity: 0.85; }

.count-option.correct {
  color: #168366;
  background: #eafaf5;
  border-color: #49c7a0;
}

.count-option.wrong {
  color: #c55e56;
  background: #fff0ef;
  border-color: #f09b91;
}

/* Simón dice del cepillado */

.simon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 380px;
  margin: 0 auto;
}

@media (max-width: 380px) {
  .simon-grid { grid-template-columns: repeat(2, 1fr); }
}

.simon-btn {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 4px solid var(--simon-color, var(--bg));
  padding: 10px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.simon-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.simon-btn:active { transform: scale(0.95); }

.simon-btn.is-active {
  background: var(--simon-color);
  transform: scale(1.08);
}

.simon-btn.is-correct {
  background: #E9F7F1;
}

.simon-btn.is-wrong {
  animation: shake 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
  .simon-btn.is-wrong { animation: none; }
}

/* Laberinto del cepillo */

.maze-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.maze-grid {
  display: grid;
  grid-template-columns: repeat(var(--maze-cols, 6), 1fr);
  grid-template-rows: repeat(var(--maze-rows, 6), 1fr);
  gap: 4px;
  width: min(320px, 90vw);
  aspect-ratio: 1 / 1;
  background: var(--bg);
  padding: 6px;
  border-radius: var(--radius-md);
}

.maze-cell {
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.maze-cell.is-path { background: var(--surface); }
.maze-cell.is-wall { background: #cfe3df; }

.maze-brush, .maze-goal {
  line-height: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.maze-brush img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.maze-controls {
  display: grid;
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px;
  gap: 8px;
  justify-content: center;
}

.maze-btn {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  font-size: 26px;
}

.maze-btn:active { transform: scale(0.94); }

.maze-btn-up { grid-column: 2; grid-row: 1; }
.maze-btn-left { grid-column: 1; grid-row: 2; }
.maze-btn-right { grid-column: 3; grid-row: 2; }
.maze-btn-down { grid-column: 2; grid-row: 2; }

/* Rompecabezas de la boca */

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  width: min(320px, 90vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: var(--bg);
  padding: 6px;
  border-radius: var(--radius-md);
}

.puzzle-piece {
  min-width: 0;
  min-height: 0;
  border-radius: 6px;
  background-size: 300% 300%;
  background-repeat: no-repeat;
  border: 3px solid transparent;
  padding: 0;
}

.puzzle-piece:active { transform: scale(0.96); }

.puzzle-piece.is-selected {
  border-color: var(--primary);
}

/* Popup */

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 58, 75, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.popup-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(27, 58, 75, 0.25);
}

.popup-icon {
  font-size: 58px;
  margin-bottom: 8px;
}

.popup-icon img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.popup-card h2 {
  margin: 0 0 10px;
  font-size: 25px;
  color: var(--primary-dark);
}

.popup-card p {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.45;
}

.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .mascot { animation: none; }
  .memo-card-inner { transition: none; }
}
