:root {
  --primary-accent: #00f2fe;
  --secondary-accent: #4facfe;
  --glow-color: rgba(0, 242, 254, 0.5);
  --word-active: #ffe600;
  --word-active-glow: rgba(255, 230, 0, 0.8);
  --bg-dark: #0a0c14;
  --card-bg: rgba(18, 22, 38, 0.75);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-main: #f0f4f8;
  --text-muted: #8a99ad;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background layers */
.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.8s ease-in-out;
  z-index: -2;
}

.bg-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(10, 12, 20, 0.45) 0%, rgba(10, 12, 20, 0.85) 100%);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  z-index: -1;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 1280px;
  min-height: 90vh;
  margin: 20px auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Glassmorphism panels */
.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: rgba(18, 22, 38, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sound Wave Animation */
.sound-wave-icon {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.sound-wave-icon span {
  width: 4px;
  background: var(--primary-accent);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite alternate;
}

.sound-wave-icon span:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.sound-wave-icon span:nth-child(2) { height: 90%; animation-delay: 0.3s; }
.sound-wave-icon span:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.sound-wave-icon span:nth-child(4) { height: 100%; animation-delay: 0.4s; }

@keyframes wave {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* Track Switcher */
.track-switcher {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.track-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.track-btn .track-num {
  font-size: 0.75rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #fff;
}

.track-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.track-btn.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2) 0%, rgba(79, 172, 254, 0.2) 100%);
  color: #fff;
  border: 1px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.track-btn.active .track-num {
  background: var(--primary-accent);
  color: #0a0c14;
  font-weight: 800;
}

/* Grid Layout */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  flex: 1;
}

@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* Player Card & Visualizer */
.player-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: space-between;
}

.visualizer-container {
  position: relative;
  width: 100%;
  height: 260px;
  background: rgba(10, 12, 20, 0.7);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#visualizer-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visualizer-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary-accent);
  background: rgba(10, 12, 20, 0.75);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 242, 254, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--primary-accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary-accent);
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.track-info h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.track-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Controls Wrapper */
.controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--secondary-accent) 0%, var(--primary-accent) 100%);
  border-radius: 4px;
  box-shadow: 0 0 12px var(--primary-accent);
  transition: width 0.1s linear;
}

.buttons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-btn {
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.25s ease;
}

.secondary-btn {
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.main-play-btn {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
  color: #0a0c14;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.4);
}

.main-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.7);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.icon-btn:hover {
  color: #fff;
}

#volume-slider {
  width: 70px;
  accent-color: var(--primary-accent);
  cursor: pointer;
}

/* Karaoke Card */
.karaoke-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 520px;
}

.karaoke-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.download-mp4-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 180, 0, 0.2) 100%);
  border: 1px solid rgba(255, 215, 0, 0.6);
  color: #ffd700;
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.download-mp4-btn:hover {
  background: #ffd700;
  color: #0a0c14;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.mp4-download-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 20px;
  background: rgba(10, 12, 20, 0.5);
  border-radius: 16px;
  border: 1px dashed rgba(255, 215, 0, 0.4);
  margin-top: 15px;
}

.mp4-main-download-btn {
  background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
  color: #0a0c14;
  padding: 14px 28px;
  border-radius: 14px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
  transition: all 0.3s ease;
}

.mp4-main-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
}

.mp4-file-info {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.export-yt-btn {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.2) 0%, rgba(255, 68, 68, 0.2) 100%);
  border: 1px solid rgba(255, 68, 68, 0.5);
  color: #ff4444;
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.export-yt-btn:hover {
  background: #ff4444;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
}

.yt-textarea {
  width: 100%;
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 14px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

.yt-textarea:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.edit-lyrics-btn {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15) 0%, rgba(79, 172, 254, 0.15) 100%);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: var(--primary-accent);
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.edit-lyrics-btn:hover {
  background: var(--primary-accent);
  color: #0a0c14;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.karaoke-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-accent);
}

.sync-status {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(0, 242, 254, 0.12);
  color: var(--primary-accent);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 242, 254, 0.25);
  letter-spacing: 1px;
}

/* Lyrics Scroll Area */
.lyrics-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.lyrics-scroll-area::-webkit-scrollbar {
  width: 6px;
}

.lyrics-scroll-area::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.lyrics-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.lyrics-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--primary-accent);
}

/* Lyrics Line & Word Karaoke Styling */
.lyric-line {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.35);
  padding: 10px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lyric-line:hover {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
}

.lyric-line.active-line {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--primary-accent);
}

/* Word Karaoke Glow */
.lyric-word {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 4px;
  border-radius: 6px;
  transition: transform 0.15s ease, color 0.15s ease, text-shadow 0.15s ease;
}

.lyric-word.active-word {
  color: var(--word-active) !important;
  font-weight: 800;
  transform: scale(1.12);
  text-shadow: 0 0 12px var(--word-active-glow), 0 0 24px rgba(255, 230, 0, 0.5);
}

.lyric-word.passed-word {
  color: rgba(255, 255, 255, 0.9);
}

.lyrics-placeholder {
  text-align: center;
  color: var(--text-muted);
  margin-top: 60px;
  font-size: 1.1rem;
}

/* Lyrics Editor Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 20, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: rgba(22, 26, 44, 0.95);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
}

.close-btn:hover {
  color: #fff;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.editor-lines-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-line-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.editor-line-row input[type="text"] {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.editor-line-row input[type="number"] {
  width: 75px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--primary-accent);
  padding: 8px 6px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
}

.time-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.delete-line-btn {
  background: rgba(255, 75, 75, 0.15);
  border: 1px solid rgba(255, 75, 75, 0.3);
  color: #ff4b4b;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.delete-line-btn:hover {
  background: #ff4b4b;
  color: #fff;
}

.add-line-btn {
  background: rgba(0, 242, 254, 0.1);
  border: 1px dashed rgba(0, 242, 254, 0.4);
  color: var(--primary-accent);
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  margin-top: 10px;
}

.add-line-btn:hover {
  background: rgba(0, 242, 254, 0.2);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}

.right-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  padding: 8px 18px;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.save-action {
  background: linear-gradient(135deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
  color: #0a0c14;
}

.save-action:hover {
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.5);
}

.secondary-action {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.cancel-action {
  background: transparent;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}
