/* ==========================================================================
   interactive.css — Sandbox panels, Quiz cards, AI Agent chat, Journey widget
   ========================================================================== */

/* ==========================================================================
   Sandbox Panels — "Try It Yourself"
   ========================================================================== */
.sandbox-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2rem 2.5rem;
  margin: 2.5rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--glass-shadow), 0 0 40px rgba(168, 85, 247, 0.05);
  transition: box-shadow var(--transition-base);
}

.sandbox-panel:hover {
  box-shadow: var(--glass-shadow), 0 0 60px rgba(168, 85, 247, 0.1);
}

.sandbox-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent-highlight), var(--accent-primary));
}

.sandbox-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.sandbox-header h4 {
  font-size: 1.2rem;
  margin: 0;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sandbox-header h4::before {
  content: '🧪';
  font-size: 1.1rem;
}

.sandbox-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-highlight);
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.2);
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  margin-left: auto;
}

.sandbox-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.sandbox-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.sandbox-control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sandbox-control-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Custom Range Slider */
.sandbox-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sandbox-slider:hover {
  background: rgba(255, 255, 255, 0.15);
}

.sandbox-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-highlight);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.sandbox-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.7);
}

.sandbox-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.sandbox-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-highlight);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
  cursor: grab;
  border: none;
}

.sandbox-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-highlight);
  background: rgba(0, 245, 255, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  min-width: 50px;
  text-align: center;
  border: 1px solid rgba(0, 245, 255, 0.15);
}

/* Sandbox Select Dropdown */
.sandbox-select {
  padding: 0.4rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sandbox-select:hover {
  border-color: var(--accent-highlight);
  background: rgba(255, 255, 255, 0.12);
}

.sandbox-select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

/* Sandbox Output */
.sandbox-output {
  background: #0a0a12;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  min-height: 100px;
  position: relative;
  overflow: hidden;
}

.sandbox-output-label {
  position: absolute;
  top: 0.5rem; right: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.sandbox-output canvas {
  width: 100%;
  max-height: 250px;
}

.sandbox-output-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-highlight);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Sandbox Action Buttons */
.sandbox-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.sandbox-btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.sandbox-btn-primary {
  background: var(--gradient-glow);
  color: #fff;
  border: none;
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.3);
}

.sandbox-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.5);
}

.sandbox-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sandbox-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Quiz Cards — Knowledge Checks
   ========================================================================== */
.quiz-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2rem 2.5rem;
  margin: 3rem 0;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.quiz-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, #f59e0b, #ec4899);
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quiz-header h4 {
  font-size: 1.15rem;
  margin: 0;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-header h4::before {
  content: '🧠';
  font-size: 1.1rem;
}

.quiz-score {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
}

.quiz-question {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.quiz-question:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.quiz-question p {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  max-width: none;
}

.quiz-question p strong {
  color: #fff;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.quiz-option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.quiz-option-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.quiz-option.selected {
  border-color: var(--accent-primary);
  background: rgba(168, 85, 247, 0.1);
}

.quiz-option.selected .quiz-option-marker {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.quiz-option.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  color: var(--text-primary);
}

.quiz-option.correct .quiz-option-marker {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.quiz-option.incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  animation: quizShake 0.5s ease-out;
}

.quiz-option.incorrect .quiz-option-marker {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.quiz-option.disabled {
  pointer-events: none;
  opacity: 0.6;
}

@keyframes quizShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.quiz-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeSlideIn 0.3s ease-out;
}

.quiz-feedback.correct {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.quiz-feedback.incorrect {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fill-in-blank input */
.quiz-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quiz-input {
  width: 120px;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
  transition: all var(--transition-fast);
}

.quiz-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.quiz-input.correct {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.quiz-input.incorrect {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.quiz-check-btn {
  padding: 0.5rem 1rem;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-check-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.quiz-check-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ==========================================================================
   AI Agent Chat Panels
   ========================================================================== */

/* Floating trigger button */
.ai-agent-trigger {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.5), 0 0 40px rgba(168, 85, 247, 0.2);
  transition: all var(--transition-base);
  animation: agentPulse 3s ease-in-out infinite;
}

.ai-agent-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(168, 85, 247, 0.7), 0 0 60px rgba(168, 85, 247, 0.3);
}

.ai-agent-trigger.active {
  animation: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes agentPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(168, 85, 247, 0.5), 0 0 40px rgba(168, 85, 247, 0.2); }
  50% { box-shadow: 0 4px 30px rgba(168, 85, 247, 0.7), 0 0 60px rgba(168, 85, 247, 0.35); }
}

.ai-agent-name-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.ai-agent-trigger:hover .ai-agent-name-tooltip {
  opacity: 1;
}

/* Agent Panel */
.ai-agent-panel {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 380px;
  max-height: 520px;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 40px rgba(168, 85, 247, 0.1);
  z-index: 899;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: agentSlideUp 0.3s ease-out;
}

.ai-agent-panel.show {
  display: flex;
}

@keyframes agentSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-agent-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--gradient-primary);
  flex-shrink: 0;
}

.ai-agent-info h5 {
  font-size: 0.95rem;
  margin: 0;
  color: #fff;
}

.ai-agent-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ai-agent-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border: none;
}

.ai-agent-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ai-agent-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ai-agent-message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 90%;
  animation: fadeSlideIn 0.3s ease-out;
}

.ai-agent-message.agent {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.2);
  color: var(--text-primary);
  align-self: flex-start;
}

.ai-agent-message.user {
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.2);
  color: var(--text-primary);
  align-self: flex-end;
}

/* Quick Action Buttons in Agent */
.ai-agent-actions {
  padding: 0.75rem 1.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-agent-action-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  white-space: nowrap;
}

.ai-agent-action-btn:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.3);
  color: #fff;
}

.ai-agent-action-btn.eli5 {
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.ai-agent-action-btn.eli5:hover {
  background: rgba(245, 158, 11, 0.15);
}

.ai-agent-action-btn.challenge {
  border-color: rgba(236, 72, 153, 0.3);
  color: #f472b6;
}

.ai-agent-action-btn.challenge:hover {
  background: rgba(236, 72, 153, 0.15);
}

.ai-agent-action-btn.deeper {
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.ai-agent-action-btn.deeper:hover {
  background: rgba(56, 189, 248, 0.15);
}

.ai-agent-action-btn.recap {
  border-color: rgba(52, 211, 153, 0.3);
  color: #34d399;
}

.ai-agent-action-btn.recap:hover {
  background: rgba(52, 211, 153, 0.15);
}

.ai-agent-action-btn.followup {
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

.ai-agent-action-btn.followup:hover {
  background: rgba(251, 191, 36, 0.15);
}

.ai-agent-action-btn:disabled,
#agent-send-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Chat Input Bar */
.ai-agent-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

#agent-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  padding: 0.55rem 1rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-primary), sans-serif;
  transition: all var(--transition-fast);
  outline: none;
}

#agent-chat-input::placeholder {
  color: var(--text-muted);
}

#agent-chat-input:focus {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

#agent-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

#agent-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.5);
}

/* Typing Cursor Animation */
.typing-cursor {
  animation: cursorBlink 0.6s step-end infinite;
  color: var(--accent-primary);
  font-weight: 300;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Difficulty Badge */
.difficulty-badge {
  display: inline-block;
  font-size: 0.65rem !important;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.15rem;
}

.difficulty-badge.beginner {
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.difficulty-badge.intermediate {
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

.difficulty-badge.advanced {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Reset Button */
.ai-agent-reset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border: none;
  margin-left: auto;
}

.ai-agent-reset:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ==========================================================================
   Journey Progress Widget
   ========================================================================== */
.journey-widget {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 200px;
  background: rgba(10, 10, 18, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  z-index: 800;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-base);
}

.journey-widget:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.journey-widget-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.journey-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.journey-stat-label {
  color: var(--text-secondary);
}

.journey-stat-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-highlight);
}

.journey-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.journey-progress-fill {
  height: 100%;
  background: var(--gradient-glow);
  border-radius: 3px;
  transition: width var(--transition-slow);
  position: relative;
}

.journey-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
  animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* ==========================================================================
   Milestone Popups
   ========================================================================== */
.milestone-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-xl);
  padding: 3rem 4rem;
  text-align: center;
  z-index: 1100;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 80px rgba(168, 85, 247, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.milestone-popup.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.milestone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.milestone-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.milestone-emoji {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: milestoneFloat 2s ease-in-out infinite;
}

@keyframes milestoneFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.milestone-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.milestone-text {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 300px;
  margin: 0 auto 1.5rem;
}

.milestone-dismiss {
  padding: 0.6rem 1.5rem;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.milestone-dismiss:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.5);
}

/* ==========================================================================
   Scroll Reveal Animations
   ========================================================================== */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.reveal-on-scroll .build-it,
.reveal-on-scroll .under-the-hood,
.reveal-on-scroll .key-takeaway,
.reveal-on-scroll .sandbox-panel,
.reveal-on-scroll .quiz-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.reveal-on-scroll.revealed .build-it { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.reveal-on-scroll.revealed .under-the-hood { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
.reveal-on-scroll.revealed .key-takeaway { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.reveal-on-scroll.revealed .sandbox-panel { transition-delay: 0.05s; opacity: 1; transform: translateY(0); }
.reveal-on-scroll.revealed .quiz-card { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .ai-agent-panel {
    width: 340px;
    right: 1rem;
    bottom: 5rem;
    max-height: 450px;
  }

  .journey-widget {
    display: none;
  }

  .sandbox-control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .sandbox-slider {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .ai-agent-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
    left: 1rem;
    bottom: 4.5rem;
    max-height: 400px;
  }

  .ai-agent-trigger {
    width: 48px;
    height: 48px;
    bottom: 1rem;
    right: 1rem;
  }

  .sandbox-panel {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .quiz-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .milestone-popup {
    padding: 2rem;
    width: calc(100vw - 3rem);
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .reveal-on-scroll.revealed .build-it,
  .reveal-on-scroll.revealed .under-the-hood,
  .reveal-on-scroll.revealed .key-takeaway,
  .reveal-on-scroll.revealed .sandbox-panel,
  .reveal-on-scroll.revealed .quiz-card {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .ai-agent-trigger {
    animation: none;
  }

  .milestone-emoji {
    animation: none;
  }

  .journey-progress-fill::after {
    animation: none;
  }
}
