/**
 * LIPA Brain Gym — UI visual (mates + promos)
 */
:root {
  --brain-violet: #a855f7;
  --brain-violet-deep: #7c3aed;
  --brain-magenta: #e879f9;
  --brain-glow: rgba(168, 85, 247, 0.55);
  --brain-surface: linear-gradient(145deg, rgba(124, 58, 237, 0.22) 0%, rgba(15, 10, 30, 0.95) 55%);
}

/* —— Home promo —— */
.home-brain {
  max-width: var(--lipa-max-wide, 1100px);
  margin: 0 auto var(--lipa-space-2xl, 48px);
  padding: 0 var(--lipa-space-lg, 24px);
}

.home-brain__head {
  text-align: center;
  margin-bottom: var(--lipa-space-lg, 24px);
}

.home-brain__head h2 {
  font-family: var(--lipa-font-display);
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  background: linear-gradient(90deg, #e9d5ff, var(--brain-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-brain__head p {
  margin: 0;
  color: var(--lipa-text-secondary);
  font-size: 1rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.home-brain__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--lipa-space-md, 16px);
}

.brain-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--lipa-text);
  border-radius: var(--lipa-radius-lg, 20px);
  border: 1px solid rgba(168, 85, 247, 0.35);
  background: var(--brain-surface);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
}

.brain-card:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 121, 249, 0.6);
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.25);
}

.brain-card__stage {
  position: relative;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: hidden;
}

.brain-card__stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.35), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.12), transparent 40%);
  pointer-events: none;
}

.brain-card__float {
  position: absolute;
  font-size: 2.5rem;
  font-weight: 800;
  opacity: 0.08;
  color: #fff;
  pointer-events: none;
  user-select: none;
}

.brain-card__float--a { top: 12%; left: 10%; transform: rotate(-12deg); }
.brain-card__float--b { bottom: 8%; right: 12%; transform: rotate(8deg); }

.brain-card__equation {
  position: relative;
  z-index: 1;
  text-align: center;
  font-family: var(--lipa-font-display);
  line-height: 1.1;
}

.brain-card__expr {
  display: block;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f5f3ff;
  text-shadow: 0 0 24px var(--brain-glow);
}

.brain-card__hint {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brain-magenta);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brain-card--tablas .brain-card__expr {
  color: #faf5ff;
  text-shadow: 0 0 28px rgba(232, 121, 249, 0.5);
}

.brain-card__body {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.brain-card__body h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
}

.brain-card__body p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--lipa-text-secondary);
}

.brain-card__cta {
  font-size: 14px;
  font-weight: 600;
  color: #e9d5ff;
}

/* Rutinas en home — pills visibles */
.home-routines {
  max-width: var(--lipa-max, 980px);
  margin: 0 auto var(--lipa-space-xl, 32px);
  padding: 0 var(--lipa-space-lg, 24px);
}

.home-routines__block {
  margin-bottom: var(--lipa-space-md, 16px);
  padding: var(--lipa-space-md, 16px);
  border-radius: var(--lipa-radius, 14px);
  border: 1px solid var(--lipa-border);
  background: var(--lipa-surface);
}

.home-routines__block--brain {
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(124, 58, 237, 0.08);
}

.home-routines__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lipa-text-secondary);
  margin: 0 0 12px;
}

.home-routines__block--brain .home-routines__label {
  color: #d8b4fe;
}

.home-routine-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.home-routine-steps a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--lipa-text) !important;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--lipa-border-strong);
  transition: background 0.15s, border-color 0.15s;
}

.home-routine-steps a:hover {
  background: rgba(0, 212, 255, 0.12);
  border-color: rgba(0, 212, 255, 0.45);
  color: #fff !important;
}

.home-routines__block--brain .home-routine-steps a {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
}

.home-routines__block--brain .home-routine-steps a:hover {
  background: rgba(168, 85, 247, 0.28);
  border-color: var(--brain-magenta);
}

.home-routine-steps .step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.35);
  color: var(--lipa-accent);
}

.home-routines__block--brain .home-routine-steps .step-n {
  color: #e9d5ff;
  background: rgba(0, 0, 0, 0.4);
}

.home-routines__more {
  margin: 10px 0 0;
  font-size: 13px;
}

.home-routines__more a {
  color: var(--lipa-accent) !important;
  font-weight: 500;
  text-decoration: none;
}

.home-routines__block--brain .home-routines__more a {
  color: #d8b4fe !important;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.hero-chip--brain {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(124, 58, 237, 0.12);
  color: #e9d5ff;
}

.hero-chip--brain a {
  color: inherit;
  text-decoration: none;
}

/* —— Juegos mates (arena visual) —— */
.math-arena {
  position: relative;
  min-height: 280px;
  border: 2px solid transparent;
  border-radius: var(--lipa-radius-lg, 20px);
  background:
    linear-gradient(160deg, rgba(30, 16, 60, 0.95) 0%, rgba(8, 8, 14, 0.98) 100%);
  background-clip: padding-box;
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, 0.25),
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.math-arena::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brain-violet-deep), var(--brain-magenta), rgba(0, 212, 255, 0.35));
  z-index: 0;
  opacity: 0.65;
}

.math-arena::after {
  content: '7 3 9 4 12 8';
  position: absolute;
  inset: 0;
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 0;
}

.math-arena__inner {
  position: relative;
  z-index: 1;
  padding: var(--lipa-space-lg, 24px) var(--lipa-space-md, 16px);
}

.math-arena--live {
  animation: brain-pulse-border 2s ease-in-out infinite;
}

@keyframes brain-pulse-border {
  0%, 100% { box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.3), 0 12px 40px rgba(124, 58, 237, 0.15); }
  50% { box-shadow: 0 0 0 1px rgba(232, 121, 249, 0.5), 0 12px 48px rgba(124, 58, 237, 0.35); }
}

.math-question {
  font-family: var(--lipa-font-display);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  margin: 0 0 var(--lipa-space-lg, 24px);
  color: #fff;
  letter-spacing: -0.03em;
  text-shadow: 0 0 32px var(--brain-glow), 0 2px 0 rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}

.math-question--pop {
  animation: math-pop 0.2s ease-out;
}

@keyframes math-pop {
  0% { transform: scale(0.92); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.math-timer-ring {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(168, 85, 247, 0.35);
  border-top-color: var(--brain-magenta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #e9d5ff;
}

.math-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 380px;
  margin: 0 auto;
}

.math-choice {
  min-height: 64px;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
}

.math-choice:hover:not(:disabled) {
  border-color: rgba(232, 121, 249, 0.6);
  background: rgba(168, 85, 247, 0.2);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
}

.math-choice:active {
  transform: scale(0.96);
}

.math-choice--ok {
  border-color: #4ade80 !important;
  background: rgba(74, 222, 128, 0.25) !important;
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.35);
}

.math-choice--bad {
  border-color: #f87171 !important;
  background: rgba(248, 113, 113, 0.2) !important;
}

.math-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.math-streak[hidden] {
  display: none !important;
}

.game-page--brain .stats .stat strong {
  color: #e9d5ff;
}

.brain-hub-page .arcade-card__visual--calculo,
.brain-hub-page .arcade-card__visual--tablas {
  font-size: 2.75rem;
}
