@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700;800&family=Fredoka:wght@500;600;700&display=swap');

#mfgames-fracciones112-root,
#mfgames-fracciones112-root * { box-sizing: border-box; }

#mfgames-fracciones112-root {
  --bg: #f6f9ff;
  --surface: #ffffff;
  --surface-2: #eef5ff;
  --ink: #102033;
  --muted: #516178;
  --line: #bfd6ff;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --yellow: #f59e0b;
  --yellow-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --violet: #7c3aed;
  --shadow: rgba(15, 23, 42, .11);
  min-height: 88vh;
  padding: 24px;
  border-radius: 24px;
  background: radial-gradient(circle at 20% 0%, #e0f2fe 0, transparent 32%), var(--bg);
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  text-align: left;
  overflow-x: hidden;
}

#mfgames-fracciones112-root h1,
#mfgames-fracciones112-root h2,
#mfgames-fracciones112-root h3,
#mfgames-fracciones112-root strong,
#mfgames-fracciones112-root button {
  font-family: 'Fredoka', 'Atkinson Hyperlegible', system-ui, sans-serif;
}

#mfgames-fracciones112-root h1,
#mfgames-fracciones112-root h2,
#mfgames-fracciones112-root h3 { margin: 0; line-height: 1.08; }

#mfgames-fracciones112-root h1 { font-size: clamp(30px, 4vw, 54px); font-weight: 700; color: var(--ink); }
#mfgames-fracciones112-root h2 { font-size: clamp(24px, 3vw, 38px); color: var(--ink); }
#mfgames-fracciones112-root h3 { font-size: 20px; color: #1d4ed8; }
#mfgames-fracciones112-root p { margin: 6px 0; color: var(--muted); line-height: 1.45; font-size: 17px; }

.mf-frac112-loading { padding: 36px; background: var(--surface); border-radius: 20px; color: var(--ink); font-weight: 800; }
.mf-frac112-app { max-width: 1220px; margin: 0 auto; }

.mf-topbar,
.mf-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 42px var(--shadow);
}

.mf-status-pill,
.mf-hud span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 2px solid #86efac;
  background: var(--green-soft);
  color: #14532d;
  font-weight: 900;
  white-space: nowrap;
}

.mf-hud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.mf-hud span { background: #f8fafc; color: var(--ink); border-color: #cbd5e1; }

.mf-panel {
  position: relative;
  padding: 22px;
  background: rgba(255,255,255,.94);
  border: 2px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 42px var(--shadow);
}

.mf-intro { max-width: 650px; }
.mf-rule {
  position: absolute;
  right: 22px;
  top: 22px;
  max-width: 360px;
  padding: 18px 20px;
  border-radius: 22px;
  background: #0f172a;
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 14px 32px var(--shadow);
}

.mf-level-grid,
.mf-activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.mf-level-card,
.mf-activity-card,
.mf-option-card,
.mf-order-card,
.mf-order-slot,
#mfgames-fracciones112-root button.mf-btn,
#mfgames-fracciones112-root .mf-symbol-buttons button {
  border: 0;
  cursor: pointer;
  font-weight: 900;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.mf-level-card,
.mf-activity-card {
  min-height: 205px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 22px;
  border-radius: 22px;
  background: var(--surface);
  border: 2px solid #dbeafe;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 30px rgba(37, 99, 235, .08);
}

.mf-level-card:hover,
.mf-activity-card:hover,
.mf-option-card:hover,
.mf-order-card:hover,
.mf-btn:hover,
.mf-symbol-buttons button:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(37,99,235,.16); }

.level-badge {
  display: inline-flex;
  padding: 7px 14px;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--blue-soft);
  font-weight: 900;
}

.mf-level-card strong,
.mf-activity-card strong { font-size: 24px; color: #172554; }
.mf-level-card span:not(.level-badge),
.mf-activity-card span { color: var(--muted); font-size: 17px; }
.mf-level-card em,
.mf-activity-card em {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-style: normal;
  text-align: center;
  font-weight: 900;
}

.is-locked { opacity: .55; filter: grayscale(.1); }
.is-locked em { background: #94a3b8; }

#mfgames-fracciones112-root .mf-btn {
  padding: 12px 18px;
  border-radius: 16px;
  color: #ffffff;
  background: var(--blue);
  font-size: 16px;
  border: 2px solid transparent;
}
#mfgames-fracciones112-root .mf-btn.light { background: #f8fafc; color: #1d4ed8; border-color: #bfdbfe; }
#mfgames-fracciones112-root .mf-btn.success { background: var(--green); color: #ffffff; }
#mfgames-fracciones112-root .mf-btn.warning { background: var(--yellow); color: #381f00; }
#mfgames-fracciones112-root .mf-btn.danger { background: var(--red); color: #ffffff; }

.mf-guide {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 20px;
  color: #083344;
  background: #e0f2fe;
  border: 2px solid #7dd3fc;
  font-size: 21px;
}
.mf-guide span { font-size: 32px; }

.mf-compare-grid,
.mf-match-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(220px, .8fr) minmax(260px, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.mf-fraction-card,
.mf-action-card,
.mf-order-wrap,
.mf-detect-wrap {
  padding: 20px;
  border-radius: 22px;
  background: #f8fbff;
  border: 2px solid #dbeafe;
  text-align: center;
}

.mf-action-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  background: #f1f5ff;
}

.mf-fraction-symbol {
  margin: 12px 0;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 900;
  color: #0f172a;
  letter-spacing: .02em;
}
.mf-fraction-words { margin-top: 10px; color: #475569; font-weight: 900; font-size: 18px; }

.mf-symbol-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mf-symbol-buttons button {
  min-width: 74px;
  min-height: 64px;
  padding: 12px;
  border-radius: 18px;
  color: #ffffff;
  background: #0ea5e9;
  font-size: 28px;
}

.mf-stack,
.mf-help-row,
.mf-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.mf-stack { flex-direction: column; }

.mf-visual { margin: 10px auto; }
.mf-bar {
  width: min(100%, 340px);
  height: 68px;
  display: grid;
  overflow: hidden;
  background: #ffffff;
  border: 4px solid #1e293b;
  border-radius: 16px;
}
.mf-bar.small { width: 178px; height: 46px; border-width: 3px; border-radius: 12px; }
.mf-bar span,
.mf-chocolate span {
  min-width: 0;
  border-right: 2px solid #1e293b;
  background: #ffffff;
}
.mf-bar span:last-child,
.mf-chocolate span:last-child { border-right: 0; }
.mf-bar span.filled { background: linear-gradient(180deg, #38bdf8, #818cf8); }

.mf-chocolate {
  width: min(100%, 340px);
  min-height: 88px;
  display: grid;
  gap: 5px;
  padding: 8px;
  background: #7c2d12;
  border: 4px solid #431407;
  border-radius: 18px;
}
.mf-chocolate.small { width: 190px; min-height: 66px; border-width: 3px; gap: 4px; padding: 6px; }
.mf-chocolate span {
  min-height: 35px;
  border: 2px solid #431407;
  border-radius: 9px;
  background: #9a3412;
}
.mf-chocolate span.filled { background: #f59e0b; }

.mf-circle { display: block; margin: 8px auto; max-width: 100%; }
.mf-circle .circle-bg { fill: #ffffff; stroke: none; }
.mf-circle path.empty { fill: #ffffff; }
.mf-circle path.filled { fill: #38bdf8; }
.mf-circle .slice-lines line { stroke: #1e293b; stroke-width: 2.3; }
.mf-circle .circle-outline { fill: none; stroke: #1e293b; stroke-width: 5; }

.mf-common {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #ecfeff;
  border: 2px dashed #06b6d4;
  color: #155e75;
  font-weight: 900;
}

.mf-options-grid,
.mf-order-pool,
.mf-order-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.mf-option-card,
.mf-order-card,
.mf-order-slot {
  min-height: 150px;
  padding: 14px;
  border-radius: 18px;
  border: 2px solid #bfdbfe;
  background: #ffffff;
  color: var(--ink);
}
.mf-option-card.selected,
.mf-order-card.selected { border-color: var(--green); background: var(--green-soft); }
.mf-order-wrap { display: block; }
.mf-order-wrap h3 { text-align: center; margin: 18px 0 10px; }
.mf-order-slots { margin: 10px 0 16px; }
.mf-order-slot.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  background: #f8fafc;
  border-style: dashed;
}

.mf-proposal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 18px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: #fff7ed;
  border: 2px solid #fdba74;
  color: #7c2d12;
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 900;
}
.mf-proposal b { color: #1d4ed8; font-size: 1.25em; }

.mf-feedback {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #e0f2fe;
  border: 2px solid #38bdf8;
  color: #083344;
  font-weight: 900;
  font-size: 19px;
  text-align: center;
}
.mf-feedback.good { background: var(--green-soft); border-color: #22c55e; color: #14532d; }
.mf-feedback.bad { background: var(--red-soft); border-color: #ef4444; color: #7f1d1d; }
.mf-feedback.info { background: var(--yellow-soft); border-color: #f59e0b; color: #78350f; }

.mf-summary {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px;
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 18px 42px var(--shadow);
}
.mf-summary-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0;
}
.mf-summary-stats span {
  padding: 14px 18px;
  border-radius: 16px;
  background: #f8fafc;
  border: 2px solid #dbeafe;
  font-weight: 900;
  font-size: 21px;
}

@media (max-width: 980px) {
  #mfgames-fracciones112-root { padding: 12px; }
  .mf-topbar, .mf-game-head { flex-direction: column; align-items: stretch; }
  .mf-rule { position: static; margin: 16px 0; max-width: none; }
  .mf-compare-grid, .mf-match-grid { grid-template-columns: 1fr; }
  .mf-fraction-card, .mf-action-card, .mf-order-wrap, .mf-detect-wrap { padding: 14px; }
  .mf-bar { height: 58px; }
}
