/**
 * algebra.css — Стили тренажёра Алгебра 8 (Феоктистов)
 * Вынесено из algebra.html (было 315 строк inline <style>).
 */

/* Переменные только для Алгебры (не конфликтуют с :root) */
.algebra-page {
  --cyan: #0ea5e9;
  --purple: #a855f7;
}

/* Моноширинный шрифт для математики */
.math-font {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  letter-spacing: -0.5px;
}

/* Визуальные дроби */
.math-fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 4px;
  font-family: 'JetBrains Mono', monospace;
}
.math-num {
  border-bottom: 2px solid currentColor;
  padding-bottom: 2px;
}
.math-den {
  padding-top: 2px;
}

/* Таймер-полоска */
.timer-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 100%;
  transition: width 0.05s linear;
}

/* Шаг решения */
.solution-step {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', monospace;
}

/* Логотип */
.logo-badge {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Активная кнопка таймера / фильтра */
.active-timer-btn {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px var(--primary-shadow) !important;
}

/* =====================================================================
   Сетка-навигация вкладок (3×2)
   ===================================================================== */
.tabs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.tabs-grid .tab-btn {
  justify-content: center;
  text-align: center;
  padding: 0.75rem 0.5rem;
  font-size: 0.88rem;
  border-radius: var(--radius);
  white-space: normal;
  line-height: 1.25;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  touch-action: manipulation;
  cursor: pointer;
}

@media (max-width: 640px) {
  .tabs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    margin: 0.85rem 0;
  }
  .tabs-grid .tab-btn {
    padding: 0.6rem 0.35rem;
    font-size: 0.82rem;
    gap: 0.25rem;
    min-height: 48px;
  }
}

/* =====================================================================
   Вкладка 1: Радар паттернов — большие кнопки
   ===================================================================== */
.pattern-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.pattern-card-compact {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 0.65rem 0.6rem;
  transition: all 0.15s ease;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 64px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.pattern-card-compact:hover,
.pattern-card-compact:active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.pattern-icon-compact {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--primary);
}

.pattern-title-compact {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.25;
  color: var(--text-primary);
}

.pattern-sub-compact {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

/* =====================================================================
   Вкладка 3: Делители — кнопки выбора
   ===================================================================== */
.factor-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem 0.5rem;
  min-height: 64px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.factor-btn:hover,
.factor-btn:active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

/* =====================================================================
   Вкладка 6: Таблица умножения — большие кнопки
   ===================================================================== */
.mult-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.mult-opt-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 1.2rem 0.5rem;
  min-height: 76px;
  font-size: 1.85rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.mult-opt-btn:hover,
.mult-opt-btn:active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(0.98);
}

.mult-filter-btn,
.mult-timer-btn {
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-weight: 600;
}

/* =====================================================================
   Таблица Пифагора (Вкладка 6)
   ===================================================================== */
.pythagoras-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

.pythagoras-table {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-collapse: collapse;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  -webkit-user-select: none;
  user-select: none;
}

.pythagoras-table th,
.pythagoras-table td {
  padding: 0.35rem 0.15rem;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  min-width: 32px;
  height: 32px;
  transition: all 0.12s ease;
}

.pythagoras-table th {
  background: var(--bg-subtle);
  color: var(--primary);
  font-weight: 700;
}

.pythagoras-table td {
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.pythagoras-table td:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.pythagoras-table td.highlight-cell {
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 800;
}

.pythagoras-table td.hidden-cell {
  color: transparent !important;
  background: var(--bg-subtle);
  position: relative;
}

.pythagoras-table td.hidden-cell::after {
  content: '?';
  color: var(--text-muted);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
}

.pythagoras-table td.revealed-cell {
  color: var(--success) !important;
  background: var(--success-bg) !important;
  font-weight: 800;
}

.pythagoras-table td.revealed-cell::after {
  content: '';
}
