/* Maths Games - shared polish for aptitude & arithmetic */

.math-game .game-header {
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, var(--surface) 55%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid #27ae60;
}

.math-game .stat-card {
  border-left: 3px solid #27ae60;
}

.math-game .stat-value--pulse {
  animation: math-stat-pulse 0.45s ease;
}

@keyframes math-stat-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); color: var(--success); }
  100% { transform: scale(1); }
}

.math-start {
  text-align: center;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.math-howto {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.math-howto__title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.math-howto__list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.55;
}

.math-difficulty {
  margin: 1rem 0 1.25rem;
}

.math-game .difficulty-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 1.25rem;
}

.math-game .difficulty-select .difficulty-btn {
  min-width: 7rem;
}

.math-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.math-progress {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.math-progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.math-timer-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.math-timer-bar__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2ecc71, #27ae60);
  border-radius: 999px;
  transition: width 0.35s ease, background 0.3s ease;
}

.math-timer-bar__fill--urgent {
  background: linear-gradient(90deg, #f39c12, #e74c3c);
}

.math-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  max-width: min(92vw, 400px);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}

.math-toast--success { border-color: var(--success); background: rgba(39, 174, 96, 0.12); }
.math-toast--error { border-color: var(--danger); background: rgba(231, 76, 60, 0.1); }
.math-toast--info { border-color: #27ae60; background: rgba(39, 174, 96, 0.1); }

.math-problem-display {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  color: #27ae60;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 0.75rem;
  margin: 0.75rem 0 1rem;
  font-variant-numeric: tabular-nums;
}

.math-expression-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid #27ae60;
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin: 0.75rem 0 1rem;
  text-align: center;
}

.math-expression-text {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--text);
}

.math-game .game-input,
.math-game .answer-input {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.math-streak-badge {
  display: inline-block;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.35rem;
}

.math-game #timer-card.timer-urgent .stat-value {
  color: var(--danger);
  animation: math-timer-blink 0.8s ease infinite;
}

@keyframes math-timer-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.math-fraction-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.5rem 0 0.75rem;
}

/* Even/Odd + Compare */
.math-eo-prompt,
.math-cmp-prompt {
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.math-eo-number {
  text-align: center;
  font-size: clamp(3rem, 14vw, 4.5rem);
  font-weight: 800;
  color: var(--brand);
  margin: 0.5rem 0 1.25rem;
  font-variant-numeric: tabular-nums;
}
.math-eo-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.math-eo-btn {
  min-width: 120px;
}
.math-cmp-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 420px;
  margin: 0 auto 1rem;
}
.math-cmp-num {
  padding: 1.25rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 800;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.math-cmp-num:hover {
  border-color: var(--brand);
}
.math-cmp-eq {
  display: block;
  margin: 0 auto;
  min-width: 140px;
}
