/* === Glow & Neon Effects === */

/* Text glow */
.glow-text {
  text-shadow:
    0 0 7px #00d4ff66,
    0 0 20px #00d4ff33,
    0 0 40px #00d4ff22;
}

.glow-text-amber {
  text-shadow:
    0 0 7px #ffaa0066,
    0 0 20px #ffaa0033,
    0 0 40px #ffaa0022;
}

/* Neon box glow */
.neon-box {
  box-shadow:
    0 0 5px #00d4ff33,
    0 0 15px #00d4ff22,
    inset 0 0 15px #00d4ff11;
}

/* Pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px #00d4ff33, 0 0 15px #00d4ff22;
  }
  50% {
    box-shadow: 0 0 10px #00d4ff66, 0 0 30px #00d4ff44, 0 0 50px #00d4ff22;
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.pulse-glow {
  animation: pulseGlow 3s ease-in-out infinite;
}

/* Fade in up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-left {
  animation: slideInLeft 0.5s ease forwards;
}

/* Electric flicker */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  5% { opacity: 0.8; }
  10% { opacity: 1; }
  15% { opacity: 0.6; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  85% { opacity: 0.7; }
  90% { opacity: 1; }
}

.flicker {
  animation: flicker 4s ease-in-out infinite;
}

/* Spark burst on completion */
@keyframes sparkBurst {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.spark-burst {
  animation: sparkBurst 0.5s ease-out forwards;
}

/* Landing title animation */
@keyframes titleReveal {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.landing-title {
  animation: titleReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.landing-subtitle {
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.4s forwards;
}

.landing-desc {
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.6s forwards;
}

#start-btn, #continue-btn {
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.8s forwards;
}

/* Quiz completion */
.quiz-completion {
  text-align: center;
  padding: 2rem 1rem;
}

.completion-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: sparkBurst 0.6s ease-out;
}

.completion-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--accent-green);
}

.completion-score {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.completion-final {
  margin-top: 1rem;
}

.completion-final p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Interactive widget styles */
.interactive-instruction {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

/* Amber interactive */
.amber-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
  min-height: 120px;
}

.amber-wool {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #665544, #887766);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.amber-piece {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #cc8800, #ffbb33);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: grab;
  transition: box-shadow 0.3s ease;
  font-size: 1.5rem;
  user-select: none;
}

.amber-piece.charged {
  box-shadow: 0 0 15px #ffaa0066, 0 0 30px #ffaa0033;
}

.amber-label, .wool-label, .straw-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.amber-straw {
  font-size: 1.5rem;
  transition: transform 0.5s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.amber-straw.attracted {
  transform: translateX(-20px);
  animation: attract 0.5s ease-out;
}

@keyframes attract {
  0% { transform: translateX(0); }
  50% { transform: translateX(-25px); }
  100% { transform: translateX(-20px); }
}

.charge-meter {
  margin-top: 1rem;
}

.charge-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.charge-bar-bg {
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  max-width: 200px;
  margin: 0 auto;
}

.charge-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-amber), #ff6600);
  border-radius: 3px;
  transition: width 0.1s ease;
}

/* Compass interactive */
.compass-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
}

.wire-line {
  width: 200px;
  height: 4px;
  background: #666;
  border-radius: 2px;
  position: relative;
}

.wire-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.compass-dial {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid #444466;
  position: relative;
  background: var(--bg-card);
}

.compass-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 4px;
  margin-left: -35px;
  margin-top: -2px;
  background: linear-gradient(90deg, #ff4444, #4444ff);
  border-radius: 2px;
  transition: transform 0.5s ease;
  transform: rotate(0deg);
}

.compass-n, .compass-s {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
}

.compass-n {
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.compass-s {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.switch-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
}

.current-status {
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: color 0.3s ease;
}

.current-status.on {
  color: var(--accent-electric);
  text-shadow: var(--glow-electric);
}

/* === Diagram block styles === */
.block-diagram {
  background: var(--bg-card, #1a1a2e);
  border-radius: var(--radius-md, 12px);
  padding: 1.25rem;
  border: 1px solid #ffffff0a;
}

.diagram-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.diagram-caption {
  font-family: var(--font-heading, sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--chapter-accent, #00d4ff);
}

.diagram-svg-wrap {
  width: 100%;
  max-width: 500px;
}

.diagram-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

/* === Canvas interactive styles === */
.interactive-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.interactive-canvas {
  background: #0a0a14;
  border: 1px solid #ffffff12;
  border-radius: var(--radius-sm, 8px);
  touch-action: none;
  cursor: crosshair;
  max-width: 100%;
}

.interactive-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.interactive-btn {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

/* === Slider styles === */
.interactive-slider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary, #aaa);
}

.interactive-slider label {
  white-space: nowrap;
  min-width: 60px;
}

.interactive-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
}

.interactive-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--chapter-accent, #00d4ff);
  cursor: pointer;
  box-shadow: 0 0 6px var(--chapter-accent, #00d4ff44);
}

.interactive-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--chapter-accent, #00d4ff);
  cursor: pointer;
  box-shadow: 0 0 6px var(--chapter-accent, #00d4ff44);
}

.slider-value {
  min-width: 24px;
  text-align: center;
  color: var(--chapter-accent, #00d4ff);
  font-weight: 600;
  font-size: 0.85rem;
}

/* Screen transition */
.screen-enter {
  animation: fadeInUp 0.4s ease forwards;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .narrative-block {
    opacity: 1;
    transform: none;
  }
}

/* === Topic Picker === */

.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 600px;
  margin: 2rem auto 0;
  width: 100%;
}

.topic-card {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid #2a2a4a;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  position: relative;
  font-family: inherit;
  color: inherit;
  width: 100%;
}

.topic-card:hover {
  border-color: var(--topic-accent, var(--accent-electric));
  box-shadow:
    0 0 20px color-mix(in srgb, var(--topic-accent, var(--accent-electric)) 20%, transparent),
    inset 0 0 20px color-mix(in srgb, var(--topic-accent, var(--accent-electric)) 5%, transparent);
  transform: translateY(-2px);
}

.topic-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.topic-info {
  flex: 1;
  min-width: 0;
}

.topic-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.35rem;
}

.topic-seed {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--topic-accent, var(--accent-electric));
  margin: 0 0 0.35rem;
}

.topic-seed-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}

.topic-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--topic-accent, var(--accent-electric));
  color: var(--bg-deep);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.back-to-topics {
  margin-top: 1rem;
  opacity: 0.7;
}

.back-to-topics:hover {
  opacity: 1;
}
