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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0a0a1a;
  color: #e0e0e0;
  min-height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 280px;
  background: #12122a;
  border-right: 1px solid #2a2a4a;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 16px;
  flex-shrink: 0;
}

.sidebar h1 {
  font-size: 1.4rem;
  color: #8b8bff;
  text-align: center;
  margin-bottom: 8px;
}

.sidebar h1 span {
  color: #ff6b8a;
}

.mode-selector {
  display: flex;
  gap: 6px;
}

.mode-btn {
  flex: 1;
  padding: 10px 6px;
  border: 1px solid #3a3a5a;
  background: #1a1a3a;
  color: #aaa;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.mode-btn.active {
  background: #2a2a6a;
  color: #8b8bff;
  border-color: #8b8bff;
}

.note-target {
  background: #1a1a3a;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.note-target-label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.note-target-name {
  font-size: 2.5rem;
  font-weight: bold;
  color: #ff6b8a;
}

.note-target-freq {
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

.exercise-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.exercise-note {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  border: 2px solid #3a3a5a;
  background: #1a1a3a;
  color: #888;
  transition: all 0.3s;
}

.exercise-note.current {
  border-color: #ff6b8a;
  color: #ff6b8a;
  background: #2a1a2a;
  transform: scale(1.15);
}

.exercise-note.done {
  border-color: #4ade80;
  color: #4ade80;
  background: #1a2a1a;
}

.detected-note {
  background: #1a1a3a;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.detected-note-label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.detected-note-name {
  font-size: 2rem;
  font-weight: bold;
  transition: color 0.2s;
}

.detected-freq {
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

.cents-bar {
  margin-top: 12px;
  height: 8px;
  background: #2a2a4a;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.cents-marker {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 12px;
  background: #fff;
  border-radius: 2px;
  transition: left 0.1s;
}

.cents-center {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 8px;
  background: #4ade80;
  transform: translateX(-50%);
}

.cents-label {
  font-size: 0.75rem;
  margin-top: 4px;
}

.btn-start {
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-start.inactive {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}

.btn-start.inactive:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-start.active {
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: white;
  animation: pulse-btn 2s infinite;
}

@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.main-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pitch-display {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.note-lane {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(100% / 13);
  display: flex;
  align-items: center;
  border-bottom: 1px solid #1a1a2e;
  transition: background 0.2s;
}

.note-lane.highlight {
  background: rgba(139, 139, 255, 0.05);
}

.note-lane-label {
  width: 50px;
  text-align: center;
  font-size: 0.8rem;
  color: #555;
  font-weight: bold;
  user-select: none;
}

.note-lane.active .note-lane-label {
  color: #8b8bff;
}

.note-lane.target .note-lane-label {
  color: #ff6b8a;
}

.note-lane-line {
  flex: 1;
  height: 1px;
  background: #1e1e3a;
}

.note-lane.active .note-lane-line {
  background: rgba(139, 139, 255, 0.3);
}

.note-lane.target .note-lane-line {
  background: rgba(255, 107, 138, 0.3);
}

.ball-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  transition: bottom 0.08s ease-out;
  z-index: 10;
  pointer-events: none;
}

.ball {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #a78bfa, #6366f1, #4338ca);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.6), 0 0 60px rgba(99, 102, 241, 0.3);
  transition: all 0.15s ease-out;
}

.ball.in-tune {
  background: radial-gradient(circle at 35% 35%, #86efac, #4ade80, #22c55e);
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.6), 0 0 60px rgba(74, 222, 128, 0.3);
}

.ball.no-sound {
  opacity: 0.3;
  box-shadow: none;
}

.target-line {
  position: absolute;
  left: 50px;
  right: 0;
  height: 3px;
  background: rgba(255, 107, 138, 0.4);
  z-index: 5;
  pointer-events: none;
  transition: bottom 0.3s ease;
}

.target-line::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 19px;
  background: rgba(255, 107, 138, 0.06);
}

.volume-meter {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 200px;
  background: #1a1a3a;
  border-radius: 4px;
  overflow: hidden;
}

.volume-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: linear-gradient(to top, #4ade80, #facc15, #ef4444);
  border-radius: 4px;
  transition: height 0.05s;
}

.score-display {
  background: #1a1a3a;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
}

.score-value {
  font-size: 2rem;
  font-weight: bold;
  color: #4ade80;
}

.score-label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.exercise-controls {
  display: flex;
  gap: 8px;
}

.exercise-controls button {
  flex: 1;
  padding: 8px;
  border: 1px solid #3a3a5a;
  background: #1a1a3a;
  color: #aaa;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.exercise-controls button:hover {
  background: #2a2a4a;
  color: #fff;
}

.no-mic {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #555;
}

.no-mic svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  fill: #333;
}

/* ===== FLAPPY MODE ===== */

/* ===== Flappy 3D ===== */
.flappy-area {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 85% 15%, #0c1445 0%, #070b2a 40%, #020515 100%);
}

.stars-3d {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 1;
}

.star-3d {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  animation: starTwinkle 3s ease-in-out infinite alternate;
}

.star-3d:nth-child(3n) { animation-delay: -1s; width: 3px; height: 3px; }
.star-3d:nth-child(5n) { animation-delay: -2s; }
.star-3d:nth-child(7n) { width: 1px; height: 1px; }

@keyframes starTwinkle {
  0% { opacity: 0.1; }
  100% { opacity: 0.8; }
}

.tunnel-grid {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 85% 15%, transparent 20%, rgba(50, 50, 180, 0.03) 50%, rgba(30, 30, 120, 0.08) 100%);
}

.tunnel-grid::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 98px,
      rgba(100, 100, 255, 0.04) 98px,
      rgba(100, 100, 255, 0.04) 100px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 98px,
      rgba(100, 100, 255, 0.04) 98px,
      rgba(100, 100, 255, 0.04) 100px
    );
  mask-image: radial-gradient(ellipse at 85% 15%, transparent 10%, black 60%);
  -webkit-mask-image: radial-gradient(ellipse at 85% 15%, transparent 10%, black 60%);
}

.tunnel-grid::after {
  content: '';
  position: absolute;
  top: 15%;
  left: 85%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%);
  background: rgba(150, 150, 255, 0.3);
  border-radius: 50%;
  box-shadow: 0 0 40px 20px rgba(100, 100, 255, 0.1);
}

.flappy-3d-scene {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  perspective: 900px;
  perspective-origin: 85% 15%;
  transform-style: preserve-3d;
  z-index: 5;
  pointer-events: none;
}

.flappy-lane-3d {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px solid rgba(100, 130, 255, 0.06);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.flappy-lane-label-3d {
  width: 44px;
  text-align: center;
  font-size: 0.65rem;
  color: rgba(100, 130, 255, 0.25);
  font-weight: bold;
  text-shadow: 0 0 8px rgba(100, 130, 255, 0.3);
}

.pipe-3d {
  position: absolute;
  left: 0;
  right: 0;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.05s linear;
  backface-visibility: hidden;
}

.pipe-wall-top, .pipe-wall-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  background: linear-gradient(
    90deg,
    rgba(20, 40, 100, 0.95) 0%,
    rgba(30, 60, 140, 0.9) 10%,
    rgba(25, 50, 120, 0.85) 50%,
    rgba(30, 60, 140, 0.9) 90%,
    rgba(20, 40, 100, 0.95) 100%
  );
  border: 1px solid rgba(80, 120, 255, 0.3);
  box-shadow:
    inset 0 0 30px rgba(60, 90, 200, 0.2),
    0 0 15px rgba(60, 90, 200, 0.15);
}

.pipe-wall-top {
  top: 0;
  border-top: none;
  border-bottom: 2px solid rgba(100, 160, 255, 0.5);
}

.pipe-wall-bottom {
  bottom: 0;
  border-bottom: none;
  border-top: 2px solid rgba(100, 160, 255, 0.5);
}

.pipe-wall-edge {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    rgba(80, 140, 255, 0.6),
    rgba(120, 180, 255, 0.8),
    rgba(80, 140, 255, 0.6)
  );
  box-shadow: 0 0 12px rgba(100, 160, 255, 0.4);
}

.pipe-wall-edge.top-edge {
  bottom: 0;
}

.pipe-wall-edge.bottom-edge {
  top: 0;
}

.pipe-note-label-3d {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 80, 120, 0.85);
  color: white;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 12px;
  white-space: nowrap;
  z-index: 15;
  box-shadow: 0 0 16px rgba(255, 80, 120, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== Ball 3D ===== */
.flappy-ball-3d {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c4b5fd, #a78bfa, #7c3aed, #4c1d95);
  box-shadow:
    0 0 25px rgba(124, 58, 237, 0.6),
    0 0 50px rgba(124, 58, 237, 0.3),
    0 0 80px rgba(124, 58, 237, 0.15),
    inset 0 -4px 8px rgba(0, 0, 0, 0.3);
  z-index: 20;
  transition: bottom 0.1s ease-out, background 0.2s, box-shadow 0.2s;
  pointer-events: none;
}

.flappy-ball-3d .ball-ring {
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, 0.3);
  animation: ballPulse 1.5s ease-in-out infinite;
}

@keyframes ballPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.1; }
}

.flappy-ball-3d.singing {
  background: radial-gradient(circle at 35% 35%, #bbf7d0, #4ade80, #16a34a, #065f46);
  box-shadow:
    0 0 25px rgba(74, 222, 128, 0.7),
    0 0 50px rgba(74, 222, 128, 0.4),
    0 0 80px rgba(74, 222, 128, 0.2),
    inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.flappy-ball-3d.singing .ball-ring {
  border-color: rgba(74, 222, 128, 0.4);
}

/* ===== Score & UI overlays ===== */
.flappy-score-overlay {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 3rem;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.12);
  z-index: 25;
  pointer-events: none;
  text-shadow: 0 0 20px rgba(100, 100, 255, 0.2);
}

.flappy-gameover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 30;
  background: rgba(5, 5, 20, 0.95);
  padding: 40px 50px;
  border-radius: 20px;
  border: 1px solid rgba(100, 100, 255, 0.2);
  box-shadow: 0 0 40px rgba(50, 50, 150, 0.2);
  backdrop-filter: blur(10px);
}

.flappy-gameover h2 {
  font-size: 2rem;
  color: #ef4444;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.flappy-gameover .final-score {
  font-size: 3rem;
  font-weight: bold;
  color: #8b8bff;
  margin-bottom: 16px;
  text-shadow: 0 0 15px rgba(139, 139, 255, 0.4);
}

.flappy-gameover button {
  padding: 12px 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.flappy-gameover button:hover {
  transform: scale(1.05);
}

.flappy-start-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(150, 150, 200, 0.7);
  z-index: 25;
}

.flappy-start-hint p {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.flappy-start-hint .hint-small {
  font-size: 0.85rem;
  color: rgba(120, 120, 170, 0.5);
}
