/* TranceLab Academy — Trance/EDM Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Heebo:wght@300;400;600;700&display=swap');

:root {
  --bg: #0a0a14;
  --bg2: #111122;
  --bg3: #1a1a2e;
  --purple: #7c3aed;
  --purple-light: #a855f7;
  --cyan: #06b6d4;
  --cyan-light: #22d3ee;
  --pink: #ec4899;
  --yellow: #fbbf24;
  --green: #10b981;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --border: rgba(124,58,237,0.3);
  --glow-purple: 0 0 20px rgba(124,58,237,0.6);
  --glow-cyan: 0 0 20px rgba(6,182,212,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Heebo', sans-serif;
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 50%, rgba(6,182,212,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(10,10,20,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  background: linear-gradient(135deg, #ff6b6b, #fbbf24, #10b981, #06b6d4, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow-shift 4s linear infinite;
  background-size: 300%;
}
@keyframes rainbow-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.header-stats {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.8rem;
}
.xp-badge {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
}
.streak-badge {
  color: var(--yellow);
  font-size: 0.9rem;
}

/* Progress bar */
.progress-bar-container {
  padding: 8px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.progress-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 3px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(6,182,212,0.4);
}

/* Main content */
.main { flex: 1; padding: 20px; max-width: 600px; margin: 0 auto; width: 100%; }

/* Mascot */
.mascot-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.mascot-svg {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.speech-bubble {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
  flex: 1;
}
.speech-bubble::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-left-color: var(--border);
}
.speech-bubble .en-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* Level card */
.level-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.level-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.05) 0%, transparent 60%);
  pointer-events: none;
}
.level-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--purple-light);
  margin-bottom: 4px;
}
.level-title-he {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.level-title-en {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.level-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 8px;
}
.level-desc-en {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Tap button */
.tap-button {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 20px auto;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: var(--glow-purple);
  color: white;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tap-button:active, .tap-button.pressed {
  transform: scale(0.92);
  box-shadow: 0 0 40px rgba(124,58,237,0.9);
}
.tap-button .btn-label {
  font-size: 0.7rem;
  font-family: 'Orbitron', sans-serif;
  margin-top: 4px;
  opacity: 0.8;
}

/* Metronome */
.metronome {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}
.metro-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  transition: all 0.1s;
}
.metro-dot.active {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
  transform: scale(1.3);
}
.metro-dot.hit {
  background: var(--purple-light);
  border-color: var(--purple-light);
  box-shadow: var(--glow-purple);
}

/* Rhythm feedback */
.rhythm-feedback {
  text-align: center;
  font-size: 1rem;
  min-height: 28px;
  margin: 8px 0;
  font-weight: 600;
}
.rhythm-feedback.good { color: var(--green); }
.rhythm-feedback.bad { color: var(--pink); }

/* Listen-choose */
.listen-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
  flex-wrap: wrap;
}
.listen-btn {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  color: var(--text);
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 1rem;
  transition: all 0.2s;
  min-width: 120px;
  text-align: center;
}
.listen-btn:hover { border-color: var(--purple-light); background: rgba(124,58,237,0.1); }
.listen-btn.selected { border-color: var(--cyan); background: rgba(6,182,212,0.15); }
.listen-btn.correct { border-color: var(--green); background: rgba(16,185,129,0.15); color: var(--green); }
.listen-btn.wrong { border-color: var(--pink); background: rgba(236,72,153,0.15); color: var(--pink); }

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin: 12px 0;
}
.question-text-en {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 12px;
}

/* Sequencer */
.sequencer {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
}
.sequencer-grid {
  display: grid;
  gap: 4px;
  min-width: 280px;
}
.seq-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.seq-label {
  width: 60px;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: 'Orbitron', sans-serif;
  flex-shrink: 0;
  padding-left: 4px;
}
.seq-steps {
  display: flex;
  gap: 4px;
  flex: 1;
}
.seq-step {
  flex: 1;
  aspect-ratio: 1;
  min-width: 24px;
  max-width: 40px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--bg3);
  border: 1.5px solid rgba(255,255,255,0.08);
  transition: all 0.1s;
  position: relative;
}
.seq-step.on { background: var(--purple); border-color: var(--purple-light); box-shadow: 0 0 8px rgba(124,58,237,0.5); }
.seq-step.playing { background: var(--cyan); border-color: var(--cyan-light); box-shadow: var(--glow-cyan); transform: scale(1.1); }
.seq-step.on.playing { background: var(--cyan); }

/* BPM control */
.bpm-control {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin: 12px 0;
}
.bpm-label { font-size: 0.8rem; color: var(--text-dim); font-family: 'Orbitron', sans-serif; }
.bpm-value { font-size: 1.1rem; font-weight: 700; color: var(--cyan); font-family: 'Orbitron', sans-serif; width: 50px; text-align: center; }
.bpm-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.bpm-btn:hover { border-color: var(--cyan); color: var(--cyan); }

/* Play/Stop button */
.play-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: white;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(124,58,237,0.3);
  margin: 8px 0;
  letter-spacing: 1px;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(124,58,237,0.5); }
.play-btn.playing { background: linear-gradient(135deg, var(--pink), var(--purple)); }

/* Submit/Continue buttons */
.action-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid var(--purple);
  background: transparent;
  color: var(--purple-light);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin: 8px 0;
  letter-spacing: 1px;
}
.action-btn:hover { background: rgba(124,58,237,0.15); }
.action-btn.primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  border-color: transparent;
  box-shadow: var(--glow-purple);
}
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Stars display */
.stars-display { text-align: center; font-size: 1.5rem; margin: 8px 0; }

/* Hint system */
.hint-section { margin: 8px 0; }
.hint-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'Heebo', sans-serif;
  transition: all 0.2s;
}
.hint-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.hint-text {
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--yellow);
  margin-top: 8px;
  animation: fadeIn 0.3s ease;
}

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

/* Attempt counter */
.attempts { text-align: center; font-size: 0.8rem; color: var(--text-dim); margin: 4px 0; }
.attempt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px; background: var(--bg3); border: 1px solid var(--border); }
.attempt-dot.used { background: var(--pink); border-color: var(--pink); }

/* Success overlay */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s ease;
}
.success-icon { font-size: 4rem; margin-bottom: 16px; animation: bounce 0.5s ease; }
.success-title { font-size: 1.8rem; font-weight: 700; text-align: center; margin-bottom: 8px; }
.success-subtitle { color: var(--text-dim); text-align: center; margin-bottom: 24px; font-size: 0.95rem; }
.success-xp {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--yellow);
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  padding: 8px 24px;
  border-radius: 20px;
  margin-bottom: 24px;
}

@keyframes bounce { 0%,100%{transform:scale(1)} 50%{transform:scale(1.3)} }

/* Canvas for confetti */
#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* Navigation map */
.level-map { margin-bottom: 24px; }
.map-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-dim); }
.map-grid { display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; }
.map-level {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.map-level.completed {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
}
.map-level.completed:hover { transform: scale(1.1); box-shadow: var(--glow-purple); }
.map-level.current {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-light));
  color: var(--bg);
  box-shadow: var(--glow-cyan);
  animation: pulse 2s infinite;
}
.map-level.locked {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.5;
}
.map-level .stars-mini { position: absolute; bottom: -2px; font-size: 0.5rem; }

@keyframes pulse { 0%,100%{box-shadow: var(--glow-cyan)} 50%{box-shadow: 0 0 30px rgba(6,182,212,0.9)} }

/* Galaxy / home screen */
.home-screen { text-align: center; padding: 20px 0; }
.home-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b6b, #fbbf24, #10b981, #06b6d4, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300%;
  animation: rainbow-shift 4s linear infinite;
  margin-bottom: 8px;
}
.home-subtitle { color: var(--text-dim); margin-bottom: 24px; font-size: 0.95rem; }

/* Gallery */
.gallery-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.gallery-icon { font-size: 1.8rem; }
.gallery-info { flex: 1; }
.gallery-name { font-weight: 600; }
.gallery-date { font-size: 0.75rem; color: var(--text-dim); }
.gallery-play {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.gallery-play:hover { transform: scale(1.1); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg2);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 0.85rem;
  transition: all 0.2s;
  font-weight: 600;
}
.tab.active {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
}

/* Visualizer */
.visualizer {
  height: 48px;
  background: var(--bg3);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.viz-bar {
  flex: 1;
  background: linear-gradient(to top, var(--purple), var(--cyan));
  border-radius: 2px 2px 0 0;
  transition: height 0.05s;
  min-height: 2px;
}

/* Utility */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 3px; }

/* Mobile */
@media (max-width: 480px) {
  .main { padding: 12px; }
  .level-card { padding: 16px; }
  .home-title { font-size: 1.5rem; }
  .seq-step { min-width: 20px; }
}
