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

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

#mfgames-resta112-root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1f2937;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, .16);
  --line: #64748b;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, .18);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, .18);
  --yellow: #facc15;
  --yellow-soft: rgba(250, 204, 21, .18);
  --blue: #2563eb;
  --shadow: rgba(0,0,0,.18);
  min-height: 92vh;
  padding: 22px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  text-align: center;
  position: relative;
  overflow-x: hidden;
}

#mfgames-resta112-root.theme-light {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --accent: #0e7490;
  --accent-soft: rgba(14, 116, 144, .13);
  --line: #94a3b8;
  --shadow: rgba(15, 23, 42, .12);
}

#mfgames-resta112-root.theme-pastel {
  --bg: #5b3c88;
  --panel: #6d4fb3;
  --panel-soft: #7c5ac2;
  --text: #fff7fb;
  --muted: #fce7f3;
  --accent: #f9a8d4;
  --accent-soft: rgba(249, 168, 212, .20);
  --line: #f9a8d4;
  --shadow: rgba(0,0,0,.15);
}

#mfgames-resta112-root h1,
#mfgames-resta112-root h2,
#mfgames-resta112-root h3 {
  font-family: 'Fredoka', system-ui, sans-serif;
  line-height: 1.08;
  margin: 0;
}

#mfgames-resta112-root h1 {
  color: var(--accent);
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 700;
}

#mfgames-resta112-root h3 {
  color: var(--accent);
  font-size: 22px;
  margin-bottom: 10px;
}

#mfgames-resta112-root p {
  line-height: 1.55;
  margin: 8px 0;
}

.mf-resta112-loading {
  padding: 40px;
  color: var(--muted);
  font-size: 18px;
}

.mf-resta112-status {
  position: sticky;
  top: 8px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  margin: 0 auto 12px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  background: #334155;
  box-shadow: 0 8px 20px var(--shadow);
}
.mf-resta112-status.ok { background: #14532d; }
.mf-resta112-status.danger { background: #991b1b; }
.mf-resta112-status.learn { background: #7c3aed; }
.mf-resta112-status.neutral { background: #334155; }

.mf-resta112-hero,
.mf-resta112-game-head {
  max-width: 1200px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  text-align: left;
  box-shadow: 0 14px 28px var(--shadow);
}

.mf-resta112-kicker {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .02em;
}

.mf-resta112-hero-text {
  font-size: 18px;
  color: var(--muted);
}

.mf-resta112-session-box {
  min-width: 250px;
  padding: 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.mf-resta112-themebar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 12px auto 18px;
}

#mfgames-resta112-root button,
#mfgames-resta112-root .mf-btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  background: var(--blue);
  color: #fff;
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

#mfgames-resta112-root button:hover,
#mfgames-resta112-root .mf-btn:hover {
  transform: translateY(-1px);
}

#mfgames-resta112-root button:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.mf-btn.secondary { background: #475569 !important; }
.mf-btn.ghost { background: var(--panel-soft) !important; color: var(--text) !important; }
.mf-btn.learn { background: #7c3aed !important; }
.mf-btn.danger { background: #b91c1c !important; }
.mf-btn.success { background: #15803d !important; }
.mf-btn.wide { width: 100%; }

.mf-resta112-card-grid {
  max-width: 1200px;
  margin: 18px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.mf-resta112-card {
  min-height: 190px;
  padding: 22px !important;
  background: var(--panel) !important;
  border: 3px solid var(--green) !important;
  color: var(--text) !important;
  border-radius: 24px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  box-shadow: 0 14px 28px var(--shadow);
}

.mf-resta112-card.is-locked {
  border-color: var(--line) !important;
  filter: grayscale(.6);
}

.mf-card-icon {
  font-size: 42px;
  line-height: 1;
}

.mf-card-title {
  font-family: 'Fredoka', system-ui, sans-serif;
  font-size: 28px;
  color: var(--accent);
}

.mf-card-sample {
  color: var(--muted);
  font-weight: 700;
  font-size: 18px;
}

.mf-card-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.mf-resta112-menu-actions,
.mf-summary-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mf-resta112-layout {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(290px, 360px);
  gap: 18px;
  align-items: start;
}

.mf-resta112-board-panel,
.mf-resta112-guide,
.mf-resta112-keypad,
.mf-resta112-summary {
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 14px 28px var(--shadow);
}

.mf-resta112-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 64px;
}

.mf-resta112-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 14px auto;
}

.mf-resta112-hud span {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,.14);
  font-weight: 700;
}

.mf-resta112-board {
  display: grid;
  gap: 4px;
  justify-content: center;
  margin: 24px auto;
  overflow-x: auto;
}

.mf-cell {
  min-height: 62px;
  border: 2px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
}

.mf-cell.header {
  color: var(--accent);
  background: transparent;
  border-style: dashed;
  font-size: 18px;
}

.mf-cell.blank {
  background: transparent;
  border-color: transparent;
}

.mf-cell.operator {
  color: var(--yellow);
  background: transparent;
  border-color: transparent;
  font-size: 34px;
}

.mf-cell.line {
  min-height: 10px;
  border: 0;
  border-top: 5px solid var(--accent);
  border-radius: 0;
  background: transparent;
}

.mf-cell.borrow {
  min-height: 50px;
  border-style: dashed;
}

.mf-cell.active {
  outline: 5px solid var(--green);
  outline-offset: 2px;
  background: rgba(34,197,94,.10);
}

.mf-cell.soft {
  background: var(--yellow-soft);
  border-color: var(--yellow);
}

.mf-cell.correct,
.mf-cell.answered {
  background: #14532d !important;
  border-color: #22c55e !important;
  color: #fff !important;
}

.mf-cell.wrong {
  background: #7f1d1d !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}

.mf-cell input {
  width: 100%;
  height: 100%;
  min-height: 56px;
  text-align: center;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 28px;
  font-weight: 900;
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  opacity: 1 !important;
  -webkit-text-fill-color: currentColor !important;
}

.mf-cell input.two-digit {
  font-size: 22px;
}

.mf-cell.correct input,
.mf-cell.answered input,
.mf-cell input.answered-input {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.mf-resta112-message {
  max-width: 760px;
  margin: 16px auto 0;
  padding: 15px 18px;
  border-radius: 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
}

.mf-resta112-message.learn {
  background: var(--green-soft);
  border-color: var(--green);
}

.mf-resta112-guide {
  text-align: left;
}

.mf-resta112-guide p {
  color: var(--text);
  font-size: 18px;
}

.mf-resta112-keypad {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mf-keypad-top,
.mf-keypad-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.key {
  min-height: 62px;
  font-size: 28px !important;
  border-radius: 18px !important;
  background: #2563eb !important;
}

.key-muted { background: #dc2626 !important; }
.key-ok { background: #16a34a !important; }

.mf-learn-counters {
  max-width: 760px;
  margin: 16px auto 0;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  text-align: left;
}

.circles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.circle {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-flex;
}

.circles.muted .circle {
  background: var(--red);
}

.circle.empty {
  background: transparent;
  border: 2px dashed var(--line);
}

.mf-resta112-summary {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
}

.mf-stars {
  font-size: 40px;
  margin: 16px auto;
}

@media (max-width: 900px) {
  #mfgames-resta112-root {
    padding: 12px;
    border-radius: 12px;
  }

  .mf-resta112-hero,
  .mf-resta112-game-head {
    flex-direction: column;
    text-align: center;
  }

  .mf-resta112-layout {
    grid-template-columns: 1fr;
  }

  .mf-resta112-side {
    position: static;
  }

  .mf-resta112-keypad {
    position: static;
  }

  .mf-resta112-board-panel {
    overflow-x: auto;
  }

  .mf-cell {
    min-height: 54px;
    font-size: 24px;
  }
}

@media (max-width: 520px) {
  .mf-resta112-card-grid {
    grid-template-columns: 1fr;
  }

  .mf-resta112-board {
    gap: 3px;
    transform: scale(.92);
    transform-origin: top center;
  }

  .mf-keypad-top,
  .mf-keypad-nav {
    grid-template-columns: 1fr;
  }
}
