/* ==========================================================================
   AG BEATS • High-Fidelity Mobile Music Player Stylesheet
   Adheres strictly to Mobile App Craft: Inset Grouped Cards, Dark Glassmorphism,
   Squircle Geometry, WCAG AAA Contrast, and Thumb-Zone Optimization.
   ========================================================================== */

:root {
  --bg-primary: #090d16;
  --bg-surface: rgba(18, 24, 38, 0.85);
  --bg-card: rgba(22, 30, 48, 0.7);
  --bg-card-hover: rgba(30, 41, 66, 0.85);
  --bg-card-active: rgba(6, 182, 212, 0.12);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(6, 182, 212, 0.4);
  
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.4);
  --accent-cyan-light: #22d3ee;
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.4);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-squircle: 22%;

  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
  --safe-right: max(14px, env(safe-area-inset-right));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 768px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #151c30 0%, #090d16 60%);
}

/* --------------------------------------------------------------------------
   Header & Search Bar
   -------------------------------------------------------------------------- */
.app-header {
  padding: var(--safe-top) var(--safe-right) 10px var(--safe-left);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-squircle);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-cyan-glow);
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff, var(--accent-cyan-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Search Input */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-wrapper input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

/* Filter Pills */
.filter-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-pills-row::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn.active {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 10px var(--accent-cyan-glow);
}

.pill-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.pill-select {
  padding: 6px 28px 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  transition: all 0.2s ease;
  white-space: nowrap;
  max-width: 210px;
  text-overflow: ellipsis;
}

.pill-select:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.pill-select:focus,
.pill-select.active {
  background-color: rgba(6, 182, 212, 0.16);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan-light);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

.pill-select option {
  background: #0f172a;
  color: #f1f5f9;
  padding: 8px;
}

/* Playlists Row */
.playlists-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.playlists-row::-webkit-scrollbar {
  display: none;
}

.playlist-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.playlist-chip.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
}

.playlist-chip-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.playlist-chip-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan-light);
  background: rgba(6, 182, 212, 0.2);
  padding: 2px 6px;
  border-radius: 9999px;
}

/* --------------------------------------------------------------------------
   Main Tracks List (Inset Grouped Cards)
   -------------------------------------------------------------------------- */
.tracks-container {
  flex: 1;
  overflow-y: auto;
  padding: 14px var(--safe-right) calc(100px + var(--safe-bottom)) var(--safe-left);
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

.tracks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Inset Track Card */
.track-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.track-card:hover {
  background: var(--bg-card-hover);
}

.track-card:active {
  transform: scale(0.98);
}

.track-card.active {
  background: var(--bg-card-active);
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 18px rgba(6, 182, 212, 0.15);
}

.track-card.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-cyan);
}

/* Squircle Thumbnail */
.track-thumb-wrapper {
  position: relative;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.track-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-squircle);
  border: 1px solid var(--border-subtle);
  background: #111827;
}

.track-card.active .track-thumb {
  border-color: var(--accent-cyan);
}

/* Track Metadata */
.track-info-col {
  flex: 1;
  min-width: 0; /* Prevents overflow truncation bugs */
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.track-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-card.active .track-title {
  color: var(--accent-cyan-light);
}

.active-track-cue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--accent-cyan-light);
  letter-spacing: 0.2px;
}

.active-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulseDot 1.6s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.6; }
}

.track-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.track-artist {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.tag-badge.flac {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-badge.lyrics {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.tag-badge.story {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.track-action-col {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.track-duration {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.play-state-indicator {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.track-card.active .play-state-indicator {
  color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   Bottom Docked Floating Mini Player (Thumb Zone)
   -------------------------------------------------------------------------- */
.mini-player {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 8px);
  left: 14px;
  right: 14px;
  max-width: 740px;
  margin: 0 auto;
  background: rgba(18, 24, 38, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(6, 182, 212, 0.2);
  z-index: 45;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.mini-player:active {
  transform: scale(0.99);
}

.mini-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
}

.mini-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  transition: width 0.2s linear;
}

.mini-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
}

.mini-cover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-squircle);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mini-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mini-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-artist-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}

.mini-artist {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-expand-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan-light);
  opacity: 0.9;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

.mini-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-btn-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.mini-btn-play svg {
  width: 20px;
  height: 20px;
}

.mini-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mini-btn svg {
  width: 20px;
  height: 20px;
}

.mini-btn-expand {
  color: var(--accent-cyan-light);
  transition: transform 0.2s ease, color 0.2s ease;
}

.mini-btn-expand:hover {
  color: #ffffff;
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Full Screen Now Playing & Karaoke Drawer
   -------------------------------------------------------------------------- */
.player-sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.player-sheet.open {
  transform: translateY(0%);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
}

.sheet-btn-down {
  transform: rotate(0deg);
}

.sheet-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sheet-subtitle {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.sheet-playlist-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-badge-group .format-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Sheet Tabs */
.sheet-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 4px;
  margin: 8px 0 12px 0;
  gap: 4px;
}

.sheet-tab {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.sheet-tab.active {
  background: var(--bg-card);
  color: var(--accent-cyan-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Tab Panes */
.tab-pane {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-pane.active {
  display: flex;
}

/* Tab 1: Artwork & Controls */
#tabArtwork {
  align-items: center;
  justify-content: space-around;
  padding: 10px 0;
}

.artwork-wrapper {
  width: min(70vw, 290px);
  height: min(70vw, 290px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-artwork {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-squircle);
  object-fit: cover;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--accent-cyan-glow);
  border: 1px solid var(--border-subtle);
}

.track-meta {
  text-align: center;
  width: 100%;
  padding: 0 20px;
}

.now-playing-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-artist {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Visualizer Bars */
.visualizer-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 24px;
}

.vbar {
  width: 4px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.playing .vbar:nth-child(1) { animation: bounce 0.6s infinite ease-in-out alternate; }
.playing .vbar:nth-child(2) { animation: bounce 0.8s 0.1s infinite ease-in-out alternate; }
.playing .vbar:nth-child(3) { animation: bounce 0.7s 0.2s infinite ease-in-out alternate; }
.playing .vbar:nth-child(4) { animation: bounce 0.9s 0.15s infinite ease-in-out alternate; }
.playing .vbar:nth-child(5) { animation: bounce 0.65s 0.25s infinite ease-in-out alternate; }
.playing .vbar:nth-child(6) { animation: bounce 0.85s 0.05s infinite ease-in-out alternate; }
.playing .vbar:nth-child(7) { animation: bounce 0.75s 0.18s infinite ease-in-out alternate; }
.playing .vbar:nth-child(8) { animation: bounce 0.95s 0.22s infinite ease-in-out alternate; }

@keyframes bounce {
  0% { height: 4px; opacity: 0.4; }
  100% { height: 22px; opacity: 1; }
}

/* Scrub Progress Bar */
.scrub-container {
  width: 100%;
  padding: 0 10px;
}

.seek-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan-light);
  box-shadow: 0 0 10px var(--accent-cyan);
  cursor: pointer;
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Player Controls */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding: 10px 10px 0 10px;
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.control-btn:active {
  transform: scale(0.9);
  color: #ffffff;
}

.control-btn.active {
  color: var(--accent-cyan);
}

.control-btn svg {
  width: 26px;
  height: 26px;
}

.play-hero-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--accent-cyan-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.play-hero-btn:active {
  transform: scale(0.92);
}

.play-hero-btn svg {
  width: 32px;
  height: 32px;
}

/* --------------------------------------------------------------------------
   Tab 2: Synchronized Dual Karaoke Lyrics
   -------------------------------------------------------------------------- */
.lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.lyrics-hint {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lyrics-pill-btn {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan-light);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.lyrics-scroll-box {
  flex: 1;
  overflow-y: auto;
  padding: 40px 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.lyric-line {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.35;
  transform: scale(0.96);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lyric-line:hover {
  opacity: 0.7;
}

.lyric-line.active {
  opacity: 1;
  transform: scale(1.04);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.2);
}

.lyric-romanized {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.4;
}

.lyric-line.active .lyric-romanized {
  color: var(--accent-cyan-light);
  text-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

.lyric-translation {
  font-size: 0.9rem;
  font-weight: 500;
  color: #cbd5e1;
  line-height: 1.35;
  font-style: italic;
}

.lyric-line.active .lyric-translation {
  color: #f1f5f9;
  font-weight: 600;
}

.lyric-hindi {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lyrics-empty, .story-empty {
  margin: auto;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 40px 20px;
}

/* --------------------------------------------------------------------------
   Tab 3: Cultural Monograph / Meaning
   -------------------------------------------------------------------------- */
.story-scroll-box {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 40px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  line-height: 1.7;
  font-size: 0.95rem;
  color: #e2e8f0;
  -webkit-overflow-scrolling: touch;
}

.story-scroll-box h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.story-scroll-box h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan-light);
  margin-top: 18px;
  margin-bottom: 8px;
}

.story-scroll-box h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-purple);
  margin-top: 14px;
  margin-bottom: 6px;
}

.story-scroll-box p {
  margin-bottom: 12px;
}

.story-scroll-box blockquote {
  border-left: 3px solid var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: #f8fafc;
}

.story-scroll-box ul, .story-scroll-box ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Remote Download Request Card (When Search Yields No Results)
   -------------------------------------------------------------------------- */
.remote-download-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  background: var(--bg-card);
  border: 1px dashed var(--border-accent);
  border-radius: var(--radius-xl);
  margin: 16px 0;
  gap: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease;
}

.web-search-results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.web-candidate-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: left;
  transition: all 0.2s ease;
}

.web-candidate-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(22, 32, 52, 0.95);
}

.web-candidate-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-squircle);
  object-fit: cover;
  flex-shrink: 0;
  background: #111827;
  border: 1px solid var(--border-subtle);
}

.web-candidate-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.web-candidate-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.web-candidate-artist {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-cyan-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.web-candidate-dur {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.web-candidate-action {
  flex-shrink: 0;
}

.candidate-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--accent-cyan-glow);
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease;
}

.candidate-download-btn:active {
  transform: scale(0.94);
}

.candidate-download-btn.downloading {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan-light);
  pointer-events: none;
}

.candidate-download-btn.ready {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

/* Offline Device Download Button on Track Cards */
.track-offline-download-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.track-offline-download-btn:hover {
  color: var(--accent-cyan-light);
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
}

.track-offline-download-btn:active {
  transform: scale(0.9);
}

.track-offline-download-btn svg {
  width: 16px;
  height: 16px;
}

/* Offline Banner / Button inside Now Playing Drawer */
.sheet-offline-group {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.sheet-offline-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.2;
}

.sheet-offline-btn.offline-app-btn {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.4);
  color: #67e8f9;
}

.sheet-offline-btn.offline-app-btn:hover {
  background: rgba(34, 211, 238, 0.22);
  border-color: var(--accent-cyan);
}

.sheet-offline-btn.offline-app-btn.is-saved {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.45);
  color: #4ade80;
}

.sheet-offline-btn.export-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
}

.offline-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.sheet-offline-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent-cyan-light);
}

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

.remote-download-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-squircle);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(139, 92, 246, 0.25));
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 18px var(--accent-cyan-glow);
}

.remote-download-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.remote-download-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 380px;
}

.remote-download-desc strong {
  color: var(--accent-cyan-light);
}

.download-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--accent-cyan-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.download-action-btn:active {
  transform: scale(0.95);
}

.download-action-btn svg {
  width: 18px;
  height: 18px;
}

.download-progress-box {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.download-status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-cyan-light);
}

.download-success-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.download-success-msg {
  font-size: 0.95rem;
  font-weight: 700;
  color: #34d399;
}

.btn-play-now {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4);
}

/* --------------------------------------------------------------------------
   Loading Spinner
   -------------------------------------------------------------------------- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Tablet & Larger Screen Responsive Tweaks
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .app-container {
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.7);
  }
}

/* --------------------------------------------------------------------------
   Custom Playlists & Favorites Controls & Badges
   -------------------------------------------------------------------------- */
.playlist-chip-new {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px dashed var(--accent-cyan) !important;
  color: var(--accent-cyan-light);
  font-weight: 700;
}

.playlist-chip-new:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35), rgba(16, 185, 129, 0.35));
}

.playlist-chip.custom-playlist {
  border-left: 3px solid var(--accent-cyan);
}

.custom-pl-badge {
  font-size: 0.65rem;
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan-light);
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-delete-pl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete-pl:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
}

/* Track Card Buttons */
.btn-track-fav,
.btn-track-more,
.btn-track-remove-pl {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.15s ease, color 0.15s ease;
}

.btn-track-fav:hover,
.btn-track-more:hover {
  color: var(--text-primary);
  transform: scale(1.15);
}

.btn-track-fav.active {
  color: #ef4444;
  animation: heartPulse 0.25s ease-out;
}

.btn-track-remove-pl {
  color: #f87171;
}

.btn-track-remove-pl:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

@keyframes heartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Player Sheet Track Meta with Actions */
.track-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.track-meta-main {
  flex: 1;
  min-width: 0;
}

.track-meta-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-sheet-action {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-squircle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sheet-action svg {
  width: 22px;
  height: 22px;
}

.btn-sheet-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.btn-sheet-action.btn-fav.active {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

/* --------------------------------------------------------------------------
   Modern Glass Floating Modals
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
}

.modal-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.modal-btn.secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.modal-btn.secondary:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-btn.primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.modal-btn.primary:hover {
  transform: translateY(-1px);
}

/* Modal Playlist List for "Add to Playlist" */
.modal-playlist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.modal-playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-playlist-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

.modal-playlist-item.in-playlist {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.1);
}

.modal-playlist-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-playlist-item-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-playlist-item-check {
  font-size: 1rem;
  color: #34d399;
  font-weight: 700;
}

.modal-inline-create {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.modal-input-compact {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

.modal-input-compact:focus {
  border-color: var(--accent-cyan);
}

.modal-btn-compact {
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
