:root {
  --ai-positive: var(--sm-indigo);
  --ai-negative: #ec4899;
  --ai-positive-light: rgba(79, 70, 229, 0.15);
  --ai-negative-light: rgba(236, 72, 153, 0.15);
  --ai-zero: var(--sm-highlight);
}

/* ── Layout ────────────────────────────────────────────────────
   Three-zone space-between layout:
     1. .ai-title    — near top
     2. .ai-viz      — SVG fills all remaining height; equation is
                       drawn inside the SVG viewBox so it scales
                       with the number line as one unit
     3. .ai-controls — near bottom
   ────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 20px 10px 28px;
  box-sizing: border-box;
}

/* ── Title ─────────────────────────────────────────────────── */
.ai-title {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
  font-family: 'Lexend', sans-serif;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 600;
  color: var(--sm-text);
}

/* ── Viz container — grows to fill all space between title and controls ── */
.ai-viz {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 0;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  border: none;
  box-shadow: none;
}

.ai-viz,
.ai-viz:focus,
.ai-viz:active,
.ai-viz:focus-within {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* ── SVG — height-driven so it fills the available vertical space ── */
#ai-svg {
  height: 100%;
  width: auto;
  max-width: 100%;
  overflow: visible;
  cursor: grab;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#ai-svg:focus,
#ai-svg:focus-visible {
  outline: none;
}

#ai-svg.ai-dragging {
  cursor: grabbing;
}

/* ── Controls ──────────────────────────────────────────────── */
.ai-controls {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 32px;
  padding: 0 20px;
  width: 100%;
}

/* ── Dots ──────────────────────────────────────────────────── */
.ai-dot {
  cursor: grab;
}

.ai-dot:hover {
  filter: brightness(1.15);
}

/* ── Arrows ────────────────────────────────────────────────── */
.ai-arrow {
  transition: opacity 0.2s ease;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 767px) {
  .ai-controls {
    flex-direction: column;
    align-items: center;
    gap: 4px 16px;
  }
}
