@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

.mf-divide111-root {
  --bg-main: #0f172a;
  --bg-panel: #020617;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --border-accent: #38bdf8;
  --cell-bg: #020617;
  --cell-border: #334155;
  --input-text: #ffffff;
  --locked-bg: #0f172a;
  --locked-text: #e8e8e8;
  --btn-primary: #2563eb;
  --btn-hover: #1d4ed8;
  --shadow: rgba(56, 189, 248, 0.2);
  --success: #16a34a;
  --danger: #b91c1c;
  --warning: #ca8a04;
  font-family: 'Press Start 2P', cursive;
  color: var(--text-main);
}

.mf-divide111-root[data-theme="white"] {
  --bg-main: #f8fafc;
  --bg-panel: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-accent: #2563eb;
  --cell-bg: #ffffff;
  --cell-border: #cbd5e1;
  --input-text: #1e293b;
  --locked-bg: #f1f5f9;
  --locked-text: #121314;
  --btn-primary: #334155;
  --btn-hover: #1e293b;
  --shadow: rgba(0, 0, 0, 0.1);
}

.mf-divide111-root[data-theme="pink"] {
  --bg-main: #fdf2f8;
  --bg-panel: #ffffff;
  --text-main: #831843;
  --text-muted: #be185d;
  --border-accent: #f472b6;
  --cell-bg: #fff1f2;
  --cell-border: #fbcfe8;
  --input-text: #831843;
  --locked-bg: #fce7f3;
  --locked-text: #db2777;
  --btn-primary: #ec4899;
  --btn-hover: #db2777;
  --shadow: rgba(236, 72, 153, 0.2);
}

.mf-divide111-shell {
  max-width: 1160px;
  margin: 24px auto;
  padding: 24px 18px 44px;
  border-radius: 24px;
  background: var(--bg-main);
  text-align: center;
  min-height: 520px;
  box-shadow: 0 18px 50px var(--shadow);
}

.mf-divide111-shell h1 {
  margin: 12px 0 12px;
  font-size: clamp(20px, 3vw, 34px);
  color: var(--border-accent);
  line-height: 1.35;
}

.mf-divide111-subtitle {
  margin: 0 auto 18px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.8;
}

.mf-divide111-tracker-row {
  display: flex;
  justify-content: flex-end;
  min-height: 34px;
}

.mf-divide111-tracker-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(51,65,85,0.9);
  color: #ffffff;
  font-size: 10px;
  line-height: 1;
}

.mf-divide111-tracker-badge.active { background: rgba(20, 83, 45, 0.95); }
.mf-divide111-tracker-badge.free { background: rgba(51, 65, 85, 0.95); }
.mf-divide111-tracker-badge.loading { background: rgba(133, 77, 14, 0.95); }
.mf-divide111-tracker-badge.error { background: rgba(127, 29, 29, 0.95); }

.mf-divide111-theme-selector {
  margin: 18px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mf-divide111-theme-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid var(--text-muted);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.mf-divide111-theme-btn:hover,
.mf-divide111-theme-btn.is-active {
  transform: scale(1.08);
  box-shadow: 0 0 0 4px var(--shadow);
}

.mf-divide111-theme-btn.black { background: #020617; }
.mf-divide111-theme-btn.white { background: #ffffff; border-color: #cbd5e1; }
.mf-divide111-theme-btn.pink { background: #fbcfe8; border-color: #f472b6; }

.mf-divide111-refresh,
.mf-divide111-shell button {
  padding: 12px 18px;
  margin: 5px;
  font-family: 'Press Start 2P', cursive;
  background: var(--btn-primary);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
  font-size: 10px;
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}

.mf-divide111-shell button:hover {
  background: var(--btn-hover);
  transform: scale(1.04);
}

.mf-divide111-shell button.secondary { background: #64748b; }

.mf-divide111-hint {
  max-width: 900px;
  margin: 14px auto 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-main);
  font-size: 11px;
  line-height: 1.7;
}

.mf-divide111-hint.ok { border-color: rgba(34, 197, 94, 0.65); background: rgba(22, 163, 74, 0.15); }
.mf-divide111-hint.warn { border-color: rgba(202, 138, 4, 0.65); background: rgba(202, 138, 4, 0.14); }
.mf-divide111-hint.error { border-color: rgba(239, 68, 68, 0.65); background: rgba(185, 28, 28, 0.18); }
.mf-divide111-hint.info { border-color: rgba(56, 189, 248, 0.65); background: rgba(56, 189, 248, 0.11); }

.mf-divide111-start {
  max-width: 900px;
  margin: 20px auto;
}

.mf-divide111-level-group {
  background: var(--bg-panel);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--cell-border);
}

.mf-divide111-level-title {
  margin-bottom: 16px;
  color: var(--border-accent);
  font-size: 13px;
}

.mf-divide111-table-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.mf-divide111-table-btn {
  width: 164px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: var(--locked-bg);
  border: 2px solid var(--cell-border);
  color: var(--text-main);
  line-height: 1.35;
}

.mf-divide111-table-btn.is-disabled {
  opacity: 0.38;
  filter: grayscale(1);
  cursor: not-allowed;
}

.mf-divide111-stars {
  color: #fbbf24;
  font-size: 10px;
}

.mf-divide111-activity-state {
  color: var(--text-muted);
  font-size: 8px;
}

.mf-divide111-hud {
  justify-content: center;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 18px auto;
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.5;
}

.mf-divide111-workspace {
  justify-content: center;
  align-items: flex-start;
  gap: 26px;
  margin-top: 20px;
  flex-wrap: wrap;
  padding: 10px;
}

.mf-divide111-panel,
.mf-divide111-guide {
  background: var(--bg-panel);
  border: 2px solid var(--border-accent);
  padding: 15px;
  border-radius: 14px;
  box-shadow: 0 0 20px var(--shadow);
}

.mf-divide111-panel h3,
.mf-divide111-guide h3 {
  margin: 0 0 12px;
  color: var(--border-accent);
  font-size: 13px;
}

.mf-divide111-grid {
  display: grid;
  grid-template-columns: repeat(9, 54px);
  grid-auto-rows: 54px;
  overflow-x: auto;
}

.mf-divide111-cell {
  border: 1px solid var(--cell-border);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  background: var(--cell-bg);
  transition: all 0.2s;
  min-width: 0;
}

.mf-divide111-cell input {
  width: 100%;
  height: 100%;
  font-size: 18px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--input-text);
  font-family: 'Press Start 2P', cursive;
}

.mf-divide111-cell input:focus {
  outline: none;
  background: rgba(125, 125, 125, 0.1);
}

.mf-divide111-cell.divider { border-left: 4px solid #ef4444; }
.mf-divide111-cell.quotient { outline: 3px solid #60a5fa; z-index: 10; }
.mf-divide111-cell.correct { background: #14532d !important; border-color: #22c55e !important; color: #ffffff !important; }
.mf-divide111-cell.correct input { color: #ffffff !important; }
.mf-divide111-cell.wrong { background: #7f1d1d !important; border-color: #ef4444 !important; color: #ffffff !important; }
.mf-divide111-cell.wrong input { color: #ffffff !important; }
.mf-divide111-cell.locked { background: var(--locked-bg); color: var(--locked-text); }
.mf-divide111-cell.no-border { border: none; background: transparent; }
.mf-divide111-cell.line-bottom { border-bottom: 4px solid var(--text-main) !important; }
.mf-divide111-cell.carry-cell { font-size: 13px; color: #fbbf24; }
.mf-divide111-cell.carry-cell input { font-size: 13px; color: #fbbf24; }

.mf-divide111-check-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.mf-divide111-check-container h4 {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.mf-divide111-grid-dynamic {
  display: grid;
  grid-auto-rows: 54px;
  gap: 2px;
  justify-content: center;
}

.mf-divide111-guide {
  width: 290px;
  text-align: left;
  font-size: 12px;
  line-height: 1.7;
}

.mf-divide111-victory-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 100000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 24px;
}

.mf-divide111-victory-content {
  background: var(--bg-panel);
  border: 4px solid #fbbf24;
  padding: 36px 24px;
  border-radius: 22px;
  max-width: 560px;
  width: min(92vw, 560px);
  text-align: center;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.mf-divide111-victory-content h2 {
  color: #fbbf24;
  margin: 0 0 14px;
  font-size: 20px;
}

.mf-divide111-big-stars {
  font-size: 36px;
  color: #fbbf24;
  margin: 18px 0;
}

.mf-divide111-save-status {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .mf-divide111-shell {
    margin: 12px auto;
    border-radius: 0;
    padding: 18px 8px 36px;
  }

  .mf-divide111-grid {
    grid-template-columns: repeat(9, 42px);
    grid-auto-rows: 42px;
  }

  .mf-divide111-grid-dynamic {
    grid-auto-rows: 42px;
  }

  .mf-divide111-cell,
  .mf-divide111-cell input {
    font-size: 13px;
  }

  .mf-divide111-panel,
  .mf-divide111-guide {
    max-width: calc(100vw - 34px);
    overflow-x: auto;
  }

  .mf-divide111-table-btn {
    width: 138px;
    min-height: 84px;
  }
}
