/* ==============================================================================
   Myhem's Lyric Downloader (Mldl)
   Minimalist Monochrome Frosted Glass Theme
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Dark (Default Monochrome) */
  --bg: #09090b;
  --bg-subtle: #121215;
  --bg-glass: rgba(18, 18, 22, 0.65);
  --bg-glass-elevated: rgba(24, 24, 29, 0.75);
  --bg-glass-input: rgba(255, 255, 255, 0.035);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(255, 255, 255, 0.45);
  --border-glass: rgba(255, 255, 255, 0.06);

  --fg: #fafafa;
  --fg-muted: #a1a1aa;
  --fg-subtle: #71717a;
  --fg-dim: #52525b;

  --accent: #ffffff;
  --accent-fg: #09090b;
  --accent-dim: #e4e4e7;
  --accent-glow: rgba(255, 255, 255, 0.12);
  --accent-glow-strong: rgba(255, 255, 255, 0.25);

  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --success: #e4e4e7;
  --success-bg: rgba(255, 255, 255, 0.08);

  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --blur-md: 20px;
  --blur-lg: 32px;
  --blur-xl: 48px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-lg: 0 24px 54px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 24px rgba(255, 255, 255, 0.12);

  --transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Mode Monochrome */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-subtle: #f4f4f5;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-glass-elevated: rgba(255, 255, 255, 0.9);
  --bg-glass-input: rgba(0, 0, 0, 0.035);
  --bg-glass-hover: rgba(0, 0, 0, 0.05);

  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.18);
  --border-focus: rgba(0, 0, 0, 0.6);
  --border-glass: rgba(0, 0, 0, 0.06);

  --fg: #09090b;
  --fg-muted: #71717a;
  --fg-subtle: #a1a1aa;
  --fg-dim: #d4d4d8;

  --accent: #09090b;
  --accent-fg: #fafafa;
  --accent-dim: #27272a;
  --accent-glow: rgba(0, 0, 0, 0.08);
  --accent-glow-strong: rgba(0, 0, 0, 0.16);

  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --success: #18181b;
  --success-bg: rgba(0, 0, 0, 0.06);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 54px -12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.06);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark light;
  touch-action: manipulation;
}

body {
  font-family: var(--font);
  font-weight: 400;
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
}

/* Ambient Frosted Blur Spheres */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -120px;
  left: 15%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 0.8;
}

body::after {
  bottom: 5%;
  right: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 0.6;
}

[data-theme="light"] body::before {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0) 70%);
}

[data-theme="light"] body::after {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 70%);
}

/* ==============================================================================
   Opening Intro Splash Screen
   ============================================================================== */
.opening-splash {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  background: radial-gradient(circle at center, rgba(24, 24, 28, 0.97) 0%, rgba(9, 9, 11, 0.99) 100%);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

[data-theme="light"] .opening-splash {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.97) 0%, rgba(244, 244, 245, 0.99) 100%);
}

.opening-splash.splash-dismiss {
  opacity: 0;
  transform: scale(1.05);
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  max-width: 480px;
  animation: splash-zoom-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.splash-icon-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
}

.splash-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 70%);
  animation: splash-glow-pulse 2s ease-in-out infinite alternate;
}

[data-theme="light"] .splash-glow {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
}

.splash-icon {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass-elevated);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  display: grid;
  place-items: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 2;
}

.splash-equalizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 24px;
  margin-bottom: 1.2rem;
}

.eq-bar {
  width: 4px;
  background: var(--fg);
  border-radius: 4px;
  animation: eq-bounce 0.9s ease-in-out infinite alternate;
}

.eq-bar.bar-1 { height: 8px; animation-delay: 0.1s; }
.eq-bar.bar-2 { height: 20px; animation-delay: 0.25s; }
.eq-bar.bar-3 { height: 14px; animation-delay: 0.4s; }
.eq-bar.bar-4 { height: 22px; animation-delay: 0.15s; }
.eq-bar.bar-5 { height: 10px; animation-delay: 0.35s; }

@keyframes eq-bounce {
  0% { transform: scaleY(0.3); opacity: 0.45; }
  100% { transform: scaleY(1); opacity: 1; }
}

.splash-brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.splash-brand-subtitle {
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

@keyframes splash-zoom-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes splash-glow-pulse {
  0% { transform: scale(0.85); opacity: 0.35; }
  100% { transform: scale(1.25); opacity: 0.85; }
}

main, header, dialog, .toast-container {
  position: relative;
  z-index: 1;
}

/* Page Entry Animations */
.navbar {
  animation: nav-reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.hero-section {
  animation: hero-reveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.08s backwards;
}

.search-card {
  animation: card-reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s backwards;
}

.donation-section {
  animation: fade-reveal 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.22s backwards;
}

.status-footer {
  animation: fade-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.28s backwards;
}

@keyframes nav-reveal {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hero-reveal {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-reveal {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-reveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Minimalist Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ==============================================================================
   Navigation
   ============================================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-lg)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
  transition: opacity var(--transition);
}

.brand:hover {
  opacity: 0.85;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--fg);
  display: grid;
  place-items: center;
  color: var(--bg);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--bg-glass-input);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==============================================================================
   Buttons & Controls
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--bg-glass-input);
  color: var(--fg);
  border-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
  color: var(--fg);
}

.btn-outline:active:not(:disabled) {
  transform: translateY(0);
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-xs);
}

.btn-icon-only {
  padding: 0.45rem;
  border-radius: var(--radius-sm);
}

/* Theme toggle */
.theme-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}

.theme-toggle:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  color: var(--fg);
  transition: transform var(--transition);
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

.theme-toggle .theme-icon-sun {
  display: none;
}

.theme-toggle .theme-icon-moon {
  display: block;
}

[data-theme="light"] .theme-toggle .theme-icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .theme-icon-moon {
  display: none;
}

/* ==============================================================================
   Visitor Banner
   ============================================================================== */
.visitor-banner {
  padding: 0.4rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.visitor-content {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.visitor-content strong {
  color: var(--fg);
  font-weight: 600;
}

/* ==============================================================================
   Main Layout
   ============================================================================== */
.app-container {
  max-width: 840px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  width: 100%;
}

.hero-section {
  text-align: center;
  margin-bottom: 2.25rem;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 0.4rem;
  color: var(--fg);
}

.hero-subtitle {
  color: var(--fg-muted);
  font-size: 0.88rem;
  font-weight: 400;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

.hero-subtitle strong {
  color: var(--fg);
  font-weight: 600;
}

/* ==============================================================================
   Cards & Glass Surfaces
   ============================================================================== */
.card,
.search-card,
.donation-card,
.album-view {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-lg)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-card {
  margin-bottom: 1.5rem;
}

.search-card:hover {
  border-color: var(--border-strong);
}

/* Tabs */
.tab-header {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-glass-input);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  justify-content: center;
}

.tab-btn:hover:not(.active) {
  color: var(--fg);
  background: var(--bg-glass-hover);
}

.tab-btn.active {
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-btn svg {
  width: 14px;
  height: 14px;
}

/* Form Layout */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.85rem;
}

@media (max-width: 680px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.input-control:hover {
  border-color: var(--border-strong);
}

.input-control:focus {
  background: var(--bg-glass-hover);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-control::placeholder {
  color: var(--fg-dim);
  font-weight: 400;
}

/* Submit button row */
.form-row > div:last-child > .btn {
  height: 38px;
}

/* Format Pills */
.formats-section {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-glass);
}

.formats-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.65rem;
}

.format-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.format-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  backdrop-filter: blur(8px);
}

.format-pill:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.format-pill input {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
}

.format-pill.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Search History */
.history-section {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-glass);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.history-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 0.75rem;
}

.history-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.history-item-query {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  display: flex;
  gap: 0.45rem;
  font-size: 0.65rem;
  color: var(--fg-subtle);
  flex-wrap: wrap;
}

.history-item-type {
  background: var(--bg-glass-hover);
  color: var(--fg-muted);
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-xs);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.58rem;
  border: 1px solid var(--border);
}

.history-item-delete {
  background: none;
  border: none;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: var(--radius-xs);
  opacity: 0;
  transition: all var(--transition-fast);
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: var(--fg);
  background: var(--bg-glass-hover);
}

/* ==============================================================================
   Empty & Error States
   ============================================================================== */
.empty-card, .error-card {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--fg-muted);
  border-radius: var(--radius-lg);
}

.empty-icon, .error-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 0.85rem;
  color: var(--fg-subtle);
  stroke-width: 1.5;
}

.empty-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.35rem;
}

.empty-card p {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.error-card {
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: var(--danger-bg);
  backdrop-filter: blur(var(--blur-md));
}

.error-card h3 {
  color: var(--danger);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.error-card p {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ==============================================================================
   Album Candidates
   ============================================================================== */
.album-candidates-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.album-candidate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  gap: 1rem;
}

.album-candidate-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* Artwork Thumbnails */
.artwork-thumb-wrap {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.artwork-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition);
}

.album-candidate-card:hover .artwork-thumb,
.song-result-card:hover .artwork-thumb {
  transform: scale(1.06);
}

.artwork-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-subtle);
  background: var(--bg-glass-input);
}

.album-candidate-info {
  flex: 1;
  min-width: 0;
}

.album-candidate-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}

.album-candidate-artist {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.album-candidate-meta {
  font-size: 0.7rem;
  color: var(--fg-subtle);
  display: flex;
  gap: 0.65rem;
}

.album-candidate-actions {
  flex-shrink: 0;
}

/* ==============================================================================
   Album View
   ============================================================================== */
.album-view {
  overflow: hidden;
  padding: 0;
}

.album-header-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--bg-glass-elevated);
  border-bottom: 1px solid var(--border);
  gap: 1.5rem;
  flex-wrap: wrap;
}

.album-header-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  min-width: 0;
}

.album-cover-container {
  width: 84px;
  height: 84px;
  min-width: 84px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-subtle);
  background: var(--bg-glass-input);
}

.album-header-info {
  flex: 1;
  min-width: 0;
}

.album-title-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
  color: var(--fg);
}

.album-artist-text {
  font-size: 0.92rem;
  color: var(--fg-muted);
  font-weight: 500;
  margin: 0 0 0.25rem;
}

.album-meta-text {
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

.album-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.selected-badge {
  font-size: 0.72rem;
  color: var(--fg-subtle);
}

/* Tracklist */
.tracklist-container {
  overflow-x: auto;
}

.tracklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 540px;
}

.tracklist-table th,
.tracklist-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.tracklist-table th {
  background: var(--bg-glass-input);
  color: var(--fg-subtle);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
}

.tracklist-table tbody tr {
  transition: background var(--transition-fast);
}

.tracklist-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

.track-num-cell {
  color: var(--fg-subtle);
  width: 44px;
  font-variant-numeric: tabular-nums;
}

.track-title-cell {
  font-weight: 500;
  color: var(--fg);
}

.track-duration-cell {
  color: var(--fg-subtle);
  width: 76px;
  font-variant-numeric: tabular-nums;
}

.track-actions-cell {
  text-align: right;
  width: 110px;
}

.track-select-cb {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ==============================================================================
   Single Song Results
   ============================================================================== */
.song-results-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.song-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  gap: 1rem;
}

.song-result-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.song-card-info {
  flex: 1;
  min-width: 0;
}

.song-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}

.song-card-artist {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.song-card-tags {
  display: flex;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-xs);
  background: var(--bg-glass-input);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-word-sync {
  background: var(--bg-glass-hover);
  color: var(--fg);
  border-color: var(--border-strong);
}

.song-card-actions {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* ==============================================================================
   Donation Section (Monochrome Glass)
   ============================================================================== */
.donation-section {
  margin-top: 2rem;
}

.donation-card {
  padding: 1.35rem;
}

.donation-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.donation-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  color: var(--fg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.donation-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  color: var(--fg);
}

.donation-subtitle {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin: 0;
  font-weight: 400;
}

.crypto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
}

.crypto-item {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.crypto-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
}

.crypto-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.crypto-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.1rem 0.38rem;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-glass-hover);
  color: var(--fg);
  border: 1px solid var(--border);
}

.crypto-label {
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-weight: 500;
}

.crypto-address-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.crypto-address {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--fg-subtle);
  background: var(--bg-glass-input);
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.crypto-address:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
  color: var(--fg);
}

.crypto-address.copied {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  font-weight: 600;
}

/* ==============================================================================
   API Availability Status Bar & Footer
   ============================================================================== */
.status-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.status-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.76rem;
  flex-wrap: wrap;
}

.status-indicators {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--fg);
  font-weight: 500;
  cursor: default;
}

.status-divider {
  color: var(--fg-dim);
}

.status-summary {
  color: var(--fg-muted);
  font-size: 0.72rem;
}

/* Status Dots */
.status-dot {
  width: 9px;
  height: 9px;
  min-width: 9px;
  border-radius: 50%;
  display: inline-block;
  transition: all var(--transition);
}

.status-dot.status-online {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.75);
}

.status-dot.status-offline {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.75);
}

.status-dot.status-loading {
  background: #71717a;
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ==============================================================================
   Modals & Dialogs (Frosted Glass Floating Cards)
   ============================================================================== */
dialog {
  margin: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-glass-elevated);
  backdrop-filter: blur(var(--blur-xl)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-xl)) saturate(180%);
  color: var(--fg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  padding: 0;
  max-width: 560px;
  width: min(92%, 560px);
  max-height: min(86vh, 86dvh);
  overflow: hidden;
  animation: modal-pop 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: backdrop-fade 200ms ease;
}

@keyframes backdrop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.25rem;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--fg);
}

.modal-body {
  padding: 1.25rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.9rem 1.25rem;
  background: var(--bg-glass);
  border-top: 1px solid var(--border);
}

/* Settings */
.settings-section {
  margin-bottom: 1.15rem;
}

.settings-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
  display: block;
}

.settings-help {
  font-size: 0.72rem;
  color: var(--fg-subtle);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.settings-help code {
  background: var(--bg-glass-input);
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--fg);
}

.tag-helpers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.tag-btn {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-strong);
}

.naming-preview-box {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.45rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
}

.preview-tag-title {
  color: var(--fg-subtle);
  font-weight: 500;
}

.preview-tag-code {
  color: var(--fg);
  font-weight: 600;
}

/* Animation Settings in Settings Modal */
.anim-settings-card {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.anim-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.anim-setting-info {
  flex: 1;
  min-width: 0;
}

.anim-setting-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.15rem;
}

.anim-setting-desc {
  font-size: 0.7rem;
  color: var(--fg-muted);
  line-height: 1.35;
}

/* Switch Toggle Component */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 23px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-glass-input);
  border: 1px solid var(--border-strong);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 15px;
  width: 15px;
  left: 3px;
  bottom: 3px;
  background-color: var(--fg-muted);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: var(--fg);
  border-color: var(--fg);
}

.switch input:checked + .slider:before {
  transform: translateX(19px);
  background-color: var(--bg);
}

.switch:focus-within .slider {
  box-shadow: 0 0 0 2px var(--border-focus);
}

/* API Guide in Settings Modal */
.api-guide-card {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-guide-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.api-guide-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.api-guide-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg);
}

.api-guide-desc {
  font-size: 0.72rem;
  color: var(--fg-muted);
  line-height: 1.4;
  margin: 0;
  padding-left: 1.15rem;
}

.api-guide-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-glass);
  font-size: 0.7rem;
  color: var(--fg-subtle);
  line-height: 1.4;
}

.api-guide-note svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.proxy-test-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.proxy-status {
  font-size: 0.72rem;
  font-weight: 500;
}

.proxy-status.success { color: var(--fg); font-weight: 600; }
.proxy-status.warning { color: var(--warning); }
.proxy-status.error { color: var(--danger); }
.proxy-status.testing { color: var(--fg-muted); }

/* ==============================================================================
   Preview Modal & Karaoke
   ============================================================================== */
.preview-modal {
  max-width: 700px;
}

.preview-subheading {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

.preview-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.preview-tab-btn {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.preview-tab-btn:hover:not(.active) {
  color: var(--fg);
  border-color: var(--border-strong);
}

.preview-tab-btn.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  font-weight: 600;
}

/* ==============================================================================
   AMLL (Apple Music-Like Lyrics) Dynamic Renderer
   ============================================================================== */
.karaoke-container {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Display", "SF Pro", "Helvetica Neue", "Inter", sans-serif;
  height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4.5rem 1.6rem;
  background: radial-gradient(circle at 50% 20%, rgba(28, 28, 36, 0.88) 0%, rgba(10, 10, 14, 0.96) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  text-align: left;
  position: relative;
  scroll-behavior: smooth;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.65), 0 20px 45px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .karaoke-container {
  background: radial-gradient(circle at 50% 20%, rgba(246, 246, 250, 0.92) 0%, rgba(234, 234, 240, 0.98) 100%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.05), 0 16px 36px rgba(0, 0, 0, 0.06);
}

/* Ambient dynamic mesh backdrop */
.karaoke-container::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 20%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
  animation: amll-mesh-pulse 8s ease-in-out infinite alternate;
}

[data-theme="light"] .karaoke-container::before {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
}

@keyframes amll-mesh-pulse {
  0% { transform: translate(0, 0) scale(1); opacity: 0.45; }
  50% { transform: translate(35px, -25px) scale(1.22); opacity: 0.9; }
  100% { transform: translate(-30px, 30px) scale(0.9); opacity: 0.5; }
}

/* AMLL Lyric Lines (Apple Music Depth of Field Layout) */
.karaoke-line {
  position: relative;
  z-index: 1;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.022em;
  color: rgba(255, 255, 255, 0.22);
  filter: blur(2px);
  opacity: 0.28;
  transform: scale(0.95);
  transform-origin: left center;
  transition: font-size 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  user-select: none;
}

[data-theme="light"] .karaoke-line {
  color: rgba(0, 0, 0, 0.2);
}

.karaoke-line:hover {
  opacity: 0.8;
  filter: blur(0px);
  background: var(--bg-glass-hover);
  transform: scale(0.98) translateX(4px);
}

/* Active Line Prominence (Apple Music Stage Focus) */
.karaoke-line.active {
  font-size: 2.1rem;
  font-weight: 800;
  color: #ffffff;
  opacity: 1;
  filter: blur(0px);
  transform: scale(1.03) translateX(8px);
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.35);
  letter-spacing: -0.03em;
}

[data-theme="light"] .karaoke-line.active {
  color: #000000;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.15);
}

.karaoke-line.passed {
  opacity: 0.32;
  filter: blur(1.2px);
  transform: scale(0.96);
}

/* Sub-voice / Background Vocals (Apple Music Secondary Role Styling) */
.karaoke-line.amll-sub-voice {
  font-size: 1.05rem !important;
  font-weight: 600;
  font-style: italic;
  opacity: 0.22;
  filter: blur(1.5px);
  transform: scale(0.93);
  margin-top: -0.85rem;
  padding-left: 1.35rem;
}

.karaoke-line.amll-sub-voice.active {
  font-size: 1.45rem !important;
  font-weight: 700;
  font-style: italic;
  opacity: 0.92;
  filter: blur(0px);
  transform: scale(1.01) translateX(6px);
  margin-top: -0.45rem;
  padding-left: 1.35rem;
}

.amll-sub-word {
  font-style: italic;
  font-size: 0.82em;
  opacity: 0.85;
}

/* AMLL Word & Syllable Real-Time Continuous Sweep */
.karaoke-word {
  display: inline-block;
  white-space: pre-wrap;
  letter-spacing: -0.015em;
  line-height: 1.4;
  background-size: 100% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), filter 0.22s ease;
  position: relative;
}

/* Normal active syllable: Crisp, clean text highlight (NO glow) */
.karaoke-word.active-syllable {
  transform: none;
  filter: none;
}

/* Sustained / Held Vocal note (prolonged duration >= 450ms): Word gains weight, scale, and luminous glow */
.karaoke-word.sustained-syllable {
  transform: scale(1.07);
  font-weight: 800;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 32px rgba(255, 255, 255, 0.45));
}

[data-theme="light"] .karaoke-word.sustained-syllable {
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.3));
}

.preview-textarea {
  width: 100%;
  height: 330px;
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 400;
  padding: 0.75rem;
  resize: none;
  outline: none;
}

.preview-playback-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  background: var(--bg-glass);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.preview-scrubber {
  flex: 1;
  accent-color: var(--fg);
  cursor: pointer;
}

.preview-time {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--fg-subtle);
  width: 85px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==============================================================================
   Progress Modal
   ============================================================================== */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-glass-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 1rem 0 0.5rem;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--fg);
  box-shadow: 0 0 12px var(--accent-glow-strong);
  transition: width 180ms ease;
  border-radius: var(--radius-full);
}

.progress-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.progress-log-list {
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 150px;
  overflow-y: auto;
  padding: 0.65rem;
  font-size: 0.72rem;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: inherit;
}

.progress-log-item.log-success { color: var(--fg); font-weight: 500; }
.progress-log-item.log-warning { color: var(--warning); }
.progress-log-item.log-error { color: var(--danger); }
.progress-log-item.log-info { color: var(--fg-muted); }

/* ==============================================================================
   Toast Notifications
   ============================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--bg-glass-elevated);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  color: var(--fg);
  font-size: 0.78rem;
  font-weight: 500;
  animation: toast-in 200ms ease, toast-out 200ms ease 2.8s forwards;
  pointer-events: auto;
  min-width: 180px;
  max-width: 90vw;
  text-align: center;
  justify-content: center;
}

.toast.success {
  border-color: var(--border-strong);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.96); }
}

/* ==============================================================================
   Spinner
   ============================================================================== */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

[data-theme="light"] .spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
}

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

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: 0.7; }

/* ==============================================================================
   Android & Mobile Browser Responsive Optimization
   ============================================================================== */

@media (max-width: 768px) {
  /* Navigation Bar */
  .navbar {
    padding: 0.75rem 0.9rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .brand {
    gap: 0.5rem;
  }

  .brand-icon {
    width: 26px;
    height: 26px;
  }

  .brand-icon svg {
    width: 16px;
    height: 16px;
  }

  .brand-title {
    font-size: 0.86rem;
  }

  .brand-badge {
    font-size: 0.52rem;
    padding: 0.05rem 0.3rem;
  }

  .nav-actions {
    gap: 0.4rem;
  }

  .theme-toggle,
  .nav-actions .btn {
    min-height: 38px;
    font-size: 0.75rem;
    padding: 0.4rem 0.65rem;
  }

  /* Main Container */
  .app-container {
    padding: 1.15rem 0.85rem;
    padding-bottom: max(2.5rem, calc(1.5rem + env(safe-area-inset-bottom)));
  }

  /* Hero Section */
  .hero-section {
    margin-bottom: 1.35rem;
  }

  .hero-title {
    font-size: clamp(1.35rem, 5.5vw, 1.65rem);
    line-height: 1.25;
    margin-bottom: 0.35rem;
  }

  .hero-subtitle {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  /* Cards & Glass Containers */
  .card,
  .search-card,
  .donation-card,
  .album-view {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.15rem;
  }

  /* Search Tabs */
  .tab-header {
    margin-bottom: 1rem;
    padding: 0.2rem;
  }

  .tab-btn {
    min-height: 42px;
    padding: 0.45rem 0.6rem;
    font-size: 0.76rem;
  }

  /* Forms & Inputs (16px font-size prevents Android/iOS auto-zoom) */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .form-label {
    font-size: 0.68rem;
  }

  .input-control {
    font-size: 16px;
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
  }

  .form-row > div:last-child {
    width: 100%;
    margin-top: 0.2rem;
  }

  .form-row > div:last-child > .btn {
    width: 100%;
    min-height: 46px;
    font-size: 0.85rem;
  }

  /* Format Pills */
  .formats-section {
    margin-top: 1rem;
    padding-top: 0.95rem;
  }

  .format-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .format-pill {
    min-height: 40px;
    padding: 0.45rem 0.65rem;
    font-size: 0.73rem;
    justify-content: flex-start;
    border-radius: var(--radius-sm);
  }

  .format-pill input {
    width: 15px;
    height: 15px;
    margin-right: 0.15rem;
    flex-shrink: 0;
  }

  .format-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* History Items */
  .history-item {
    padding: 0.6rem 0.75rem;
    min-height: 46px;
  }

  .history-item-delete {
    opacity: 1;
    padding: 0.35rem;
    min-width: 32px;
    min-height: 32px;
    display: grid;
    place-items: center;
  }

  /* Album View & Header */
  .album-header-card {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.85rem;
  }

  .album-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
  }

  .album-cover-container {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: var(--radius-sm);
  }

  .artwork-thumb-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .album-title-text {
    font-size: 1.15rem;
  }

  .album-artist-text {
    font-size: 0.85rem;
  }

  .album-header-actions {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
  }

  .album-header-actions .btn {
    flex: 1;
    min-width: 130px;
    min-height: 44px;
    font-size: 0.78rem;
  }

  .selected-badge {
    width: 100%;
    text-align: center;
  }

  /* Tracklist Table Responsive Adaptations */
  .tracklist-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tracklist-table {
    min-width: 100%;
    font-size: 0.78rem;
  }

  .tracklist-table td {
    padding: 0.65rem 0.5rem;
  }

  .track-num-cell {
    width: 32px;
    padding-left: 0.5rem;
  }

  .track-duration-cell {
    width: 52px;
    font-size: 0.7rem;
  }

  .track-actions-cell {
    width: 90px;
    padding-right: 0.5rem;
  }

  .track-actions-cell .btn {
    min-height: 34px;
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
  }

  /* Single Song Results & Album Candidates */
  .song-result-card,
  .album-candidate-card {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
  }

  .song-card-info,
  .album-candidate-info {
    flex: 1 1 calc(100% - 68px);
    min-width: 0;
  }

  .song-card-actions,
  .album-candidate-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    margin-top: 0.2rem;
  }

  .song-card-actions .btn,
  .album-candidate-actions .btn {
    flex: 1;
    min-height: 42px;
    font-size: 0.78rem;
  }

  /* Centered Floating Modals with Margin and Full Rounded Corners on Mobile */
  dialog {
    width: calc(100% - 1.75rem);
    max-width: 500px;
    margin: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-strong);
    max-height: calc(100dvh - 3.5rem);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  }

  .modal-header {
    padding: 0.85rem 1.15rem;
  }

  .modal-body {
    padding: 1.1rem 1.15rem;
    max-height: calc(82dvh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 0.75rem 1.15rem;
    display: flex;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    min-height: 42px;
    flex: 1;
    width: auto;
  }

  .karaoke-container {
    height: 220px;
    padding: 1rem 0.5rem;
  }

  .karaoke-line {
    font-size: 0.95rem;
  }

  .preview-textarea {
    height: 220px;
    font-size: 14px;
  }

  .preview-playback-bar {
    padding: 0.55rem 0.75rem;
  }

  /* Crypto & Donation Cards */
  .crypto-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .crypto-item {
    padding: 0.75rem 0.85rem;
  }

  .crypto-address-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .crypto-address {
    font-size: 0.72rem;
    padding: 0.55rem 0.65rem;
    min-height: 38px;
    white-space: normal;
    word-break: break-all;
    display: block;
    line-height: 1.35;
  }

  .crypto-address-row .btn {
    width: 100%;
    min-height: 38px;
  }

  /* Status Bar on Mobile */
  .status-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
  }

  .status-bar-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 0.95rem;
  }

  /* Toast Notification on Mobile */
  .toast-container {
    bottom: max(1rem, env(safe-area-inset-bottom));
    width: 92%;
  }

  .toast {
    max-width: 100%;
    width: 100%;
    font-size: 0.76rem;
    padding: 0.65rem 0.85rem;
  }
}

@media (max-width: 440px) {
  .brand-badge {
    display: none;
  }

  .format-pills {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 1.3rem;
  }

  .album-header-actions .btn {
    flex: 1 1 100%;
  }
}

/* ==============================================================================
   Overall UI Animations & Micro-Interactions
   ============================================================================== */
.song-result-card,
.album-candidate-card {
  animation: card-reveal-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--item-idx, 0) * 40ms);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease;
}

.song-result-card:hover,
.album-candidate-card:hover {
  transform: translateY(-3px) scale(1.005);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
}

@keyframes card-reveal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tracklist-table tbody tr {
  animation: row-reveal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--item-idx, 0) * 25ms);
  transition: background 0.18s ease, transform 0.18s ease;
}

.tracklist-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

@keyframes row-reveal-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Button & Pill Micro-Interactions */
.btn, .format-pill, .tag-btn, .tab-btn {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover, .format-pill:hover, .tag-btn:hover {
  transform: translateY(-1px);
}

.btn:active, .format-pill:active, .tag-btn:active {
  transform: scale(0.96);
}

/* Karaoke Live Playback Highlights */
.karaoke-line {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.karaoke-line.active {
  transform: scale(1.025);
  opacity: 1;
}

.karaoke-word {
  display: inline-block;
  transition: color 0.16s cubic-bezier(0.16, 1, 0.3, 1), text-shadow 0.16s cubic-bezier(0.16, 1, 0.3, 1), transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.karaoke-word.active {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.9), 0 0 28px rgba(16, 185, 129, 0.5);
  transform: scale(1.08);
}

/* ==============================================================================
   Animation Preferences & Motion Suppression (Settings Toggles)
   ============================================================================== */
/* 1. Disable Opening Splash Only */
[data-no-opening-anim="true"] #opening-splash {
  display: none !important;
}

/* 2. Disable Overall UI Animations (Instant / Reduced Motion) */
[data-no-anim="true"] *,
[data-no-anim="true"] *::before,
[data-no-anim="true"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

[data-no-anim="true"] #opening-splash {
  display: none !important;
}

/* ==============================================================================
   Android App Showcase Promo Card (Monochrome Frosted Glass Theme)
   ============================================================================== */
.btn-android-badge {
  background: var(--bg-glass-input);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.8rem;
  font-family: var(--font);
  transition: var(--transition);
}

.btn-android-badge:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-focus);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.android-promo-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-glass-elevated);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.android-promo-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
}

.android-promo-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.android-promo-icon-wrapper {
  flex-shrink: 0;
}

.android-promo-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: block;
}

.android-promo-info {
  flex: 1;
}

.android-promo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.android-promo-pill {
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font);
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-input);
  color: var(--fg);
  border: 1px solid var(--border-strong);
}

.android-promo-title {
  font-size: 1.18rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--fg);
  margin: 0;
  letter-spacing: -0.3px;
}

.android-promo-desc {
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--fg-muted);
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.android-promo-features {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.promo-feature-chip {
  font-size: 0.74rem;
  font-family: var(--font);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-input);
  border: 1px solid var(--border);
  color: var(--fg-subtle);
  font-weight: 500;
}

.android-promo-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.android-promo-actions .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .android-promo-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .android-promo-actions {
    width: 100%;
  }
  .android-promo-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
