/* Custom Styling, On-Screen Rhythm Tap Pad & Mobile Animations for AuraCraft */

:root {
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}

body {
  touch-action: manipulation;
}

.safe-area-bottom {
  padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(16, 185, 129, 0.14));
  color: #ffffff !important;
  border: 1px solid rgba(99, 102, 241, 0.45);
  box-shadow: 0 4px 15px -3px rgba(99, 102, 241, 0.25);
}

.cat-pill.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #818cf8;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

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

.animate-fadeIn {
  animation: fadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pulseCorrect {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes shakeIncorrect {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.quiz-option-correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #ecfdf5 !important;
  animation: pulseCorrect 0.6s ease-out;
}

.quiz-option-wrong {
  background: rgba(244, 63, 94, 0.2) !important;
  border-color: #f43f5e !important;
  color: #ffe4e6 !important;
  animation: shakeIncorrect 0.38s ease-in-out;
}

/* ==========================================
   ON-SCREEN RHYTHM TAP PAD & TIMELINE GRID
   ========================================== */
.rhythm-tap-pad {
  position: relative;
  min-height: 156px;
  border-radius: 18px;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.16) 0%, rgba(15, 23, 42, 0.95) 75%);
  border: 2px dashed rgba(245, 158, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.06s ease, border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.rhythm-tap-pad:hover {
  border-color: rgba(245, 158, 11, 0.75);
}

.rhythm-tap-pad.tap-active {
  transform: scale(0.985);
  border-style: solid;
  border-color: #f59e0b;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.38) 0%, rgba(30, 41, 59, 0.98) 75%);
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.4);
}

.rhythm-timeline-box {
  position: relative;
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 14px 12px;
  overflow: hidden;
}

.rhythm-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2.5px;
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
  pointer-events: none;
  z-index: 10;
  transition: none;
}

/* ==========================================
   RESPONSIVE TOUCH PIANO KEYBOARD
   ========================================== */
.piano-wrapper {
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x;
}

.piano-keyboard {
  position: relative;
  display: flex;
  height: 142px;
  width: 100%;
  background: #090d16;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #1e293b;
}

.piano-keyboard.piano-full-range {
  min-width: 580px;
}

.piano-keyboard.piano-compact-range {
  min-width: 100%;
}

@media (max-width: 640px) {
  .piano-keyboard {
    height: 128px;
    padding: 4px;
  }
}

.piano-key-white {
  position: relative;
  flex: 1;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #94a3b8;
  border-radius: 0 0 8px 8px;
  margin: 0 1px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 7px;
  color: #334155;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  transition: transform 0.06s ease, background 0.12s ease, box-shadow 0.12s ease;
  z-index: 1;
  touch-action: manipulation;
}

.piano-key-white:active,
.piano-key-white.key-playing {
  transform: translateY(2px);
}

.piano-key-black {
  position: absolute;
  top: 5px;
  height: 78px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: 0 0 6px 6px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 5px;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.55);
  transition: transform 0.06s ease, background 0.12s ease;
  touch-action: manipulation;
}

@media (max-width: 640px) {
  .piano-key-black {
    height: 72px;
  }
}

.piano-key-white.key-root {
  background: linear-gradient(180deg, #6ee7b7 0%, #10b981 100%) !important;
  color: #064e3b !important;
  border-color: #059669 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
}

.piano-key-black.key-root {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%) !important;
  color: #ecfdf5 !important;
  border-color: #34d399 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.55);
}

.piano-key-white.key-active {
  background: linear-gradient(180deg, #a5b4fc 0%, #6366f1 100%) !important;
  color: #1e1b4b !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.45);
}

.piano-key-black.key-active {
  background: linear-gradient(180deg, #6366f1 0%, #3730a3 100%) !important;
  color: #e0e7ff !important;
  border-color: #818cf8 !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.55);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #090d16;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}