.mfgames-resta12-root {
  --mf12-bg: #f8fbff;
  --mf12-card: #ffffff;
  --mf12-ink: #18233f;
  --mf12-soft: #5b6685;
  --mf12-primary: #3267ff;
  --mf12-primary-dark: #214bd1;
  --mf12-secondary: #ffb84d;
  --mf12-good: #22a06b;
  --mf12-warn: #f59e0b;
  --mf12-help: #8b5cf6;
  --mf12-danger: #ef4444;
  --mf12-line: rgba(24, 35, 63, 0.13);
  --mf12-shadow: 0 18px 45px rgba(31, 47, 91, 0.14);
  --mf12-radius: 24px;
  box-sizing: border-box;
  width: 100%;
  min-height: 680px;
  font-family: Nunito, Atkinson Hyperlegible, Fredoka, Baloo 2, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--mf12-ink);
  background: radial-gradient(circle at top left, rgba(255, 221, 143, 0.45), transparent 30%), linear-gradient(135deg, #eef7ff 0%, #fff7ed 100%);
  border-radius: 28px;
  padding: 16px;
}

.mfgames-resta12-root * {
  box-sizing: border-box;
}

.mfgames-resta12-root button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.mfgames-resta12-root button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mf12-loading {
  min-height: 420px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.4rem;
}

.mf12-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.mf12-topbar,
.mf12-play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.mf12-eyebrow {
  margin: 0 0 4px;
  color: var(--mf12-primary);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.mf12-topbar h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1;
}

.mf12-subtitle {
  margin: 6px 0 0;
  color: var(--mf12-soft);
  font-weight: 800;
}

.mf12-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.mf12-theme,
.mf12-ghost,
.mf12-secondary,
.mf12-primary {
  border-radius: 999px;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(31, 47, 91, 0.08);
}

.mf12-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--mf12-primary), var(--mf12-primary-dark));
}

.mf12-secondary {
  color: #50320a;
  background: linear-gradient(180deg, #ffd98c, var(--mf12-secondary));
}

.mf12-ghost,
.mf12-theme {
  color: var(--mf12-ink);
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid var(--mf12-line);
}

.mf12-theme.active {
  color: #fff;
  background: var(--mf12-ink);
}

.mf12-session {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.74);
  border: 2px solid var(--mf12-line);
}

.mf12-session.formal span {
  color: var(--mf12-primary-dark);
}

.mf12-session.free span {
  color: var(--mf12-good);
}

.mf12-session small {
  color: var(--mf12-soft);
}

.mf12-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--mf12-shadow);
  border-radius: var(--mf12-radius);
  padding: 18px;
  margin-bottom: 18px;
}

.mf12-mascot,
.mf12-result-mascot {
  width: 90px;
  height: 90px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-size: 3.5rem;
  background: linear-gradient(135deg, #e0f2fe, #fef3c7);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.05);
}

.mf12-hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
}

.mf12-hero p {
  margin: 6px 0 0;
  color: var(--mf12-soft);
  font-weight: 800;
  font-size: 1.08rem;
}

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

.mf12-card {
  min-height: 245px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--mf12-radius);
  background: var(--mf12-card);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--mf12-shadow);
}

.mf12-card.locked {
  filter: grayscale(0.3);
  opacity: 0.76;
}

.mf12-card-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-size: 2rem;
  background: #eef6ff;
}

.mf12-card h3 {
  margin: 4px 0 0;
  font-size: 1.28rem;
}

.mf12-card p {
  margin: 0;
  color: var(--mf12-soft);
  font-weight: 800;
}

.mf12-example {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 14px;
  background: #f4f7ff;
  color: var(--mf12-primary-dark);
  font-size: 1.2rem;
  font-weight: 1000;
}

.mf12-card-actions,
.mf12-result-actions,
.mf12-panel-actions,
.mf12-learn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mf12-lock-note {
  color: var(--mf12-danger);
  font-weight: 900;
}

.mf12-footer {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.mf12-play-header {
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(31, 47, 91, 0.09);
  border-radius: 24px;
  padding: 12px;
}

.mf12-progress {
  text-align: center;
}

.mf12-progress strong {
  display: block;
  font-size: 1.1rem;
}

.mf12-progress span {
  display: block;
  color: var(--mf12-soft);
  font-weight: 900;
  font-size: 0.92rem;
}

.mf12-hearts {
  min-width: 118px;
  text-align: right;
  font-size: 1.9rem;
  letter-spacing: 2px;
}

.mf12-heart.on {
  color: #ff4d6d;
  filter: drop-shadow(0 3px 0 rgba(255, 77, 109, 0.18));
}

.mf12-heart.off {
  color: #c9d1e4;
}

.mf12-play-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.mf12-challenge-card,
.mf12-answer-panel,
.mf12-learn-card,
.mf12-result-card {
  background: rgba(255, 255, 255, 0.90);
  border-radius: 28px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--mf12-shadow);
}

.mf12-challenge-card {
  min-height: 560px;
  padding: 22px;
  text-align: center;
}

.mf12-answer-panel {
  padding: 18px;
  position: sticky;
  top: 12px;
}

.mf12-micro-mascot {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  border-radius: 22px;
  font-size: 2.2rem;
  background: #fff4d6;
}

.mf12-task-title {
  margin: 0;
  color: var(--mf12-soft);
  font-size: 1.15rem;
  font-weight: 1000;
}

.mf12-equation {
  margin: 8px auto;
  padding: 10px 18px;
  width: fit-content;
  border-radius: 22px;
  background: #172554;
  color: #fff;
  font-weight: 1000;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1;
  box-shadow: inset 0 -9px 0 rgba(0, 0, 0, 0.16);
}

.mf12-prompt {
  margin: 10px 0 16px;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 1000;
}

.mf12-fingers {
  display: inline-grid;
  gap: 8px;
  justify-items: center;
  margin: 8px auto 12px;
  padding: 12px 16px;
  border-radius: 24px;
  background: #f8fbff;
  border: 2px solid var(--mf12-line);
}

.mf12-finger-row {
  display: flex;
  gap: 8px;
}

.mf12-finger {
  width: 22px;
  height: 52px;
  border-radius: 15px 15px 10px 10px;
  border: 3px solid #d28c52;
  background: #f8c78a;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  transform-origin: bottom center;
}

.mf12-finger.down {
  opacity: 0.38;
  transform: scaleY(0.54);
  background: #f1dbc0;
}

.mf12-fingers strong {
  font-size: 1.4rem;
  color: var(--mf12-primary-dark);
}

.mf12-numberline {
  margin: 18px auto 0;
  max-width: 800px;
  padding: 14px;
  border-radius: 24px;
  background: #fbfdff;
  border: 2px solid var(--mf12-line);
  overflow-x: auto;
}

.mf12-jumps {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.mf12-jumps span {
  min-width: 48px;
  border-radius: 999px;
  padding: 6px 12px;
  color: #fff;
  background: var(--mf12-primary);
  font-weight: 1000;
}

.mf12-line-track {
  display: flex;
  align-items: end;
  min-width: max-content;
  padding: 18px 6px 8px;
  border-top: 5px solid #334155;
}

.mf12-line-number {
  width: 42px;
  position: relative;
  display: grid;
  justify-items: center;
  color: var(--mf12-soft);
  font-weight: 900;
}

.mf12-line-number::before {
  content: "";
  position: absolute;
  top: -24px;
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: #334155;
}

.mf12-line-number.path span {
  color: var(--mf12-primary-dark);
}

.mf12-line-number.from span,
.mf12-line-number.to span {
  display: grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--mf12-primary);
}

.mf12-line-number.to span {
  background: var(--mf12-good);
}

.mf12-trade-title {
  margin-top: 12px;
  font-weight: 1000;
  color: var(--mf12-primary-dark);
}

.mf12-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 640px;
  margin: 12px auto;
  padding: 14px;
  border: 2px solid var(--mf12-line);
  border-radius: 22px;
  background: #fbfdff;
}

.mf12-blocks small {
  display: block;
  margin-bottom: 8px;
  font-weight: 1000;
  color: var(--mf12-soft);
}

.mf12-tenbars,
.mf12-unitdots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mf12-tenbar {
  width: 36px;
  height: 110px;
  display: grid;
  gap: 2px;
  padding: 4px;
  border-radius: 13px;
  background: #dbeafe;
  border: 3px solid #60a5fa;
}

.mf12-tenbar i {
  border-radius: 4px;
  background: #93c5fd;
}

.mf12-unitdot {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #fed7aa;
  border: 3px solid #fb923c;
}

.mf12-feedback {
  min-height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 20px;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 1000;
  background: #f4f7ff;
  color: var(--mf12-primary-dark);
}

.mf12-feedback.success {
  color: #064e3b;
  background: #dcfce7;
}

.mf12-feedback.warning {
  color: #7c2d12;
  background: #ffedd5;
}

.mf12-feedback.help {
  color: #3b0764;
  background: #ede9fe;
}

.mf12-answer-wrap {
  text-align: center;
  margin-bottom: 14px;
}

.mf12-answer-wrap > span {
  display: block;
  margin-bottom: 8px;
  color: var(--mf12-soft);
  font-weight: 1000;
}

.mf12-answer-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.mf12-answer-box {
  width: 66px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 4px solid var(--mf12-primary);
  background: #fff;
  color: var(--mf12-ink);
  font-size: 2.4rem;
  font-weight: 1000;
  box-shadow: inset 0 -7px 0 rgba(50, 103, 255, 0.08);
}

.mf12-answer-box.done {
  color: #fff;
  background: var(--mf12-good);
  border-color: var(--mf12-good);
}

.mf12-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.mf12-key {
  min-height: 62px;
  border-radius: 18px;
  background: #fff;
  color: var(--mf12-ink);
  border: 2px solid var(--mf12-line) !important;
  font-size: 1.6rem;
  font-weight: 1000;
  box-shadow: 0 9px 0 #dbe4f5, 0 12px 22px rgba(31, 47, 91, 0.08);
}

.mf12-key:active {
  transform: translateY(5px);
  box-shadow: 0 4px 0 #dbe4f5;
}

.mf12-key-wide {
  grid-column: span 2;
  font-size: 1.1rem;
}

.mf12-help-complete {
  max-width: 560px;
  margin: 16px auto 0;
  padding: 14px;
  border-radius: 22px;
  background: #f5f3ff;
  border: 2px solid #c4b5fd;
  text-align: left;
}

.mf12-help-complete h4 {
  margin: 0 0 8px;
  color: var(--mf12-help);
}

.mf12-help-complete p {
  margin: 6px 0;
  font-weight: 900;
}

.mf12-result-card,
.mf12-learn-card {
  max-width: 780px;
  margin: 22px auto;
  padding: 26px;
  text-align: center;
}

.mf12-result-card h2,
.mf12-learn-card h2 {
  margin: 10px 0;
  font-size: 2rem;
}

.mf12-result-mascot,
.mf12-learn-card .mf12-mascot {
  margin: 0 auto;
}

.mf12-stars {
  font-size: 2.4rem;
  letter-spacing: 4px;
  margin: 10px 0 18px;
}

.mf12-star.on {
  color: #f59e0b;
}

.mf12-star.off {
  color: #cbd5e1;
}

.mf12-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.mf12-result-grid div {
  padding: 14px;
  border-radius: 20px;
  background: #f8fbff;
  border: 2px solid var(--mf12-line);
}

.mf12-result-grid strong {
  display: block;
  font-size: 1.8rem;
}

.mf12-result-grid span {
  display: block;
  color: var(--mf12-soft);
  font-weight: 900;
}

.mf12-save-status {
  min-height: 24px;
  color: var(--mf12-soft);
  font-weight: 900;
}

.mf12-step-count {
  margin: 12px 0 0;
  color: var(--mf12-primary-dark);
  font-weight: 1000;
}

.mf12-learn-text {
  margin: 8px 0 0;
  font-size: 1.45rem;
  font-weight: 1000;
}

.mf12-learn-detail {
  margin: 8px 0 16px;
  color: var(--mf12-soft);
  font-weight: 900;
}

.mf12-big-answer {
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  margin: 18px auto;
  border-radius: 36px;
  background: var(--mf12-good);
  color: #fff;
  font-size: 4rem;
  font-weight: 1000;
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.14);
}

.theme-cuaderno {
  --mf12-bg: #fffdf4;
  --mf12-card: #fffef7;
  --mf12-primary: #0f766e;
  --mf12-primary-dark: #115e59;
  background: repeating-linear-gradient(#fffdf4, #fffdf4 31px, #dbeafe 32px), linear-gradient(90deg, rgba(248,113,113,.24), rgba(248,113,113,.24) 3px, transparent 3px, transparent 64px);
}

.theme-arcade {
  --mf12-bg: #100f2e;
  --mf12-card: #211f55;
  --mf12-ink: #f8fbff;
  --mf12-soft: #c7d2fe;
  --mf12-primary: #8b5cf6;
  --mf12-primary-dark: #6d28d9;
  --mf12-line: rgba(255,255,255,.18);
  background: radial-gradient(circle at top, #312e81, #0f102c 70%);
}

.theme-arcade .mf12-card,
.theme-arcade .mf12-hero,
.theme-arcade .mf12-play-header,
.theme-arcade .mf12-challenge-card,
.theme-arcade .mf12-answer-panel,
.theme-arcade .mf12-learn-card,
.theme-arcade .mf12-result-card,
.theme-arcade .mf12-session {
  background: rgba(33, 31, 85, 0.88);
  border-color: rgba(255,255,255,0.14);
}

.theme-arcade .mf12-example,
.theme-arcade .mf12-feedback,
.theme-arcade .mf12-numberline,
.theme-arcade .mf12-blocks,
.theme-arcade .mf12-answer-box,
.theme-arcade .mf12-key,
.theme-arcade .mf12-result-grid div,
.theme-arcade .mf12-ghost,
.theme-arcade .mf12-theme {
  background: rgba(255,255,255,0.10);
  color: var(--mf12-ink);
}

@media (max-width: 980px) {
  .mf12-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mf12-play-main {
    grid-template-columns: 1fr;
  }

  .mf12-answer-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .mfgames-resta12-root {
    padding: 10px;
    border-radius: 18px;
  }

  .mf12-topbar,
  .mf12-play-header,
  .mf12-hero {
    grid-template-columns: 1fr;
    display: grid;
    text-align: center;
    justify-items: center;
  }

  .mf12-grid,
  .mf12-result-grid,
  .mf12-blocks {
    grid-template-columns: 1fr;
  }

  .mf12-card-actions,
  .mf12-result-actions,
  .mf12-panel-actions,
  .mf12-learn-actions {
    justify-content: center;
  }

  .mf12-challenge-card {
    min-height: unset;
    padding: 16px;
  }

  .mf12-equation {
    font-size: 3.1rem;
  }

  .mf12-answer-box {
    width: 58px;
    height: 66px;
  }

  .mf12-line-number {
    width: 36px;
  }
}
