/* ===== MATEK STATS BAR ===== */
.matek-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
  animation: fadeInUp 0.5s ease-out 0.1s both;
}

.mstat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mstat:hover {
  border-color: rgba(34, 197, 94, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.08);
}

.mstat-icon {
  font-size: 1.5rem;
}

.mstat-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mstat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b6b80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== CATEGORY FILTER ===== */
.matek-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

.mcat-btn {
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #a0a0b8;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mcat-btn:hover {
  border-color: rgba(34, 197, 94, 0.3);
  color: #f0f0f5;
  background: rgba(34, 197, 94, 0.08);
}

.mcat-btn.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(6, 182, 212, 0.12));
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.15);
}

/* ===== MATEK GROUPS ===== */
.matek-group {
  margin-bottom: 40px;
  animation: fadeInUp 0.5s ease-out;
}

.matek-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.matek-group-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #f0f0f5;
}

.matek-group-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: #22c55e;
  padding: 6px 14px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 100px;
}

/* ===== TASK CARDS ===== */
.matek-task {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.matek-task::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #06b6d4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.matek-task:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.matek-task:hover::before {
  opacity: 1;
}

.matek-task.task-correct {
  border-left: 3px solid #22c55e;
}

.matek-task.task-wrong {
  border-left: 3px solid #ef4444;
}

.matek-task-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.task-status-icon {
  font-size: 1.1rem;
}

.task-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #22c55e;
  padding: 4px 12px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 100px;
}

.task-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f0f0f5;
  line-height: 1.6;
  margin-bottom: 16px;
  padding-left: 2px;
}

/* ===== TASK OPTIONS ===== */
.task-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.task-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', sans-serif;
  font-size: 0.925rem;
  color: #a0a0b8;
  text-align: left;
}

.task-opt:hover:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.06);
  color: #f0f0f5;
  transform: translateY(-1px);
}

.task-opt:disabled {
  cursor: default;
  opacity: 0.5;
}

.task-opt.opt-correct {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.12) !important;
  color: #f0f0f5 !important;
  opacity: 1 !important;
}

.task-opt.opt-wrong {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #f0f0f5 !important;
  opacity: 1 !important;
}

.opt-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  font-size: 0.8rem;
  color: #6b6b80;
  flex-shrink: 0;
  transition: 0.25s ease;
}

.task-opt.opt-correct .opt-letter {
  background: #22c55e;
  color: #fff;
}

.task-opt.opt-wrong .opt-letter {
  background: #ef4444;
  color: #fff;
}

.opt-text {
  flex: 1;
  line-height: 1.4;
}

/* ===== EXPLAIN BOX ===== */
.task-explain {
  background: rgba(34, 197, 94, 0.06);
  border-left: 3px solid #22c55e;
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #a0a0b8;
  line-height: 1.7;
  display: none;
  animation: slideDown 0.3s ease-out;
}

.task-explain.visible {
  display: block;
}

.task-explain strong {
  color: #f0f0f5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .matek-stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .mstat {
    padding: 16px 12px;
  }

  .mstat-val {
    font-size: 1.4rem;
  }

  .task-options {
    grid-template-columns: 1fr;
  }

  .matek-task {
    padding: 18px;
  }

  .matek-categories {
    gap: 6px;
  }

  .mcat-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .mstat-val {
    font-size: 1.2rem;
  }

  .matek-group-header h2 {
    font-size: 1.1rem;
  }
}

/* ===== DIFFICULTY BADGE ===== */
.task-diff {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.5px;
}

.task-diff.diff-hard {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.task-diff.diff-expert {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== NEW FORMULA PAGE (fg = formula group, fc = formula card) ===== */

/* Warning banner */
.fw-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-left: 4px solid #ef4444;
  border-radius: 14px;
  padding: 20px 26px;
  margin-bottom: 36px;
  animation: fadeInUp 0.5s ease-out 0.1s both;
}

.fw-banner-title {
  font-weight: 700;
  color: #ef4444;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.fw-banner-text {
  color: #a0a0b8;
  font-size: 0.88rem;
  line-height: 1.6;
}

.fw-banner-text strong {
  color: #f0f0f5;
}

/* Section */
.fg {
  margin-bottom: 52px;
  animation: fadeInUp 0.5s ease-out;
}

.fg-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), rgba(6, 182, 212, 0.03));
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}

.fg-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #06b6d4, #a855f7);
}

.fg-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: 14px;
  flex-shrink: 0;
}

.fg-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #f0f0f5;
  margin-bottom: 2px;
}

.fg-sub {
  font-size: 0.82rem;
  color: #6b6b80;
  font-weight: 500;
}

/* Card grid */
.fg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Card */
.fc {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.fc:hover {
  border-color: rgba(34, 197, 94, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(34, 197, 94, 0.07);
  background: rgba(255, 255, 255, 0.05);
}

.fc-wide {
  grid-column: 1 / -1;
}

/* Highlighted card */
.fc-highlight {
  border-color: rgba(245, 158, 11, 0.25);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), rgba(239, 68, 68, 0.02));
  border-left: 4px solid #f59e0b;
}

.fc-highlight:hover {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 12px 40px rgba(245, 158, 11, 0.08);
}

.fc-star {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.2rem;
}

.fc-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a0a0b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.fc-formula {
  font-family: 'Courier New', Consolas, monospace;
  font-size: 1rem;
  font-weight: 600;
  color: #4ade80;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(6, 182, 212, 0.04));
  border: 1px solid rgba(34, 197, 94, 0.1);
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.fc-highlight .fc-formula {
  color: #fbbf24;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(239, 68, 68, 0.03));
  border-color: rgba(245, 158, 11, 0.12);
}

.fc-formula-big {
  font-size: 1.3rem;
  padding: 14px 20px;
  text-align: center;
}

.fc-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
}

.fc-info {
  font-size: 0.8rem;
  color: #6b6b80;
  line-height: 1.6;
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.06);
}

/* Table */
.fc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.fc-table th,
.fc-table td {
  padding: 10px 16px;
  text-align: center;
  font-size: 0.88rem;
}

.fc-table thead th {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.06));
  color: #fbbf24;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}

.fc-table td {
  color: #f0f0f5;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fc-table tr:last-child td {
  border-bottom: none;
}

.fc-table tbody tr:hover td {
  background: rgba(245, 158, 11, 0.05);
}

.fc-table td:first-child {
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.06);
}

/* Responsive */
@media (max-width: 768px) {
  .fg-grid {
    grid-template-columns: 1fr;
  }

  .fc {
    padding: 20px;
  }

  .fg-header {
    padding: 16px 18px;
    gap: 14px;
  }

  .fg-title {
    font-size: 1.2rem;
  }

  .fg-icon {
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
  }

  .fc-formula {
    font-size: 0.9rem;
    padding: 8px 12px;
  }

  .fc-row {
    grid-template-columns: 1fr;
  }

  .fc-table th,
  .fc-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

/* ===== LINK TO FORMULAS ===== */
.formula-link-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  animation: fadeInUp 0.5s ease-out 0.15s both;
}

.formula-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 100px;
  color: #22c55e;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.formula-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.5);
}

.reset-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 100px;
  color: #ef4444;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.reset-link-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}