/* ==============================================================================
   Myhem's Lyric Downloader (Mldl)
   Minimal, Sharp, Refined Theme
   ============================================================================== */

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

:root {
  /* Dark (default) - clean, high contrast */
  --bg: #0a0e14;
  --bg-elevated: #10161e;
  --bg-card: #141b26;
  --bg-input: #0d121a;

  --border: #1e2a3a;
  --border-strong: #2a3a4e;
  --border-focus: #00d4aa;

  --fg: #e8edf2;
  --fg-muted: #6a7a8a;
  --fg-subtle: #4a5a6a;

  --accent: #00d4aa;
  --accent-dim: #00b896;
  --accent-glow: rgba(0, 212, 170, 0.15);

  --danger: #ff4757;
  --warning: #ffa502;
  --success: #2ed573;

  --font: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

  --transition: 150ms ease;
}

/* Light mode - clean, not washed out */
[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-elevated: #ffffff;
  --bg-card: #edf1f5;
  --bg-input: #ffffff;

  --border: #d0d8e0;
  --border-strong: #b8c4d0;
  --border-focus: #00a888;

  --fg: #1a222e;
  --fg-muted: #6a7a8a;
  --fg-subtle: #8a9ab0;

  --accent: #00a888;
  --accent-dim: #009074;
  --accent-glow: rgba(0, 168, 136, 0.12);

  --shadow: 0 8px 32px rgba(20, 30, 40, 0.08);
  --shadow-sm: 0 2px 8px rgba(20, 30, 40, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  font-weight: 500;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
  transition: background var(--transition), color var(--transition);
}

/* Subtle grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

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

/* ==============================================================================
   Navigation
   ============================================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(16, 22, 30, 0.3);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  gap: 1rem;
  z-index: 100;
}

[data-theme="light"] .navbar {
  background: rgba(245, 247, 250, 0.4);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--bg);
}

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

.brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

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

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

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

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}

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

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

.btn-icon-only {
  padding: 0.5rem;
}

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

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

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

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

[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.5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

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

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

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

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

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

.hero-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 400;
  max-width: 560px;
  margin: 0 auto;
}

/* ==============================================================================
   Cards & Forms
   ============================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

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

/* Tabs */
.tab-header {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-input);
  padding: 0.25rem;
  border-radius: var(--radius);
  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.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

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

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

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

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

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

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

.input-control {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* Submit button row */
.form-row > .btn {
  height: fit-content;
  align-self: end;
}

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

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

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

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

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

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

.format-pill.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

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

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

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

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

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

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

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

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

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

.history-item-type {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.6rem;
}

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

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

.history-item-delete:hover {
  background: rgba(255, 71, 87, 0.1);
  color: var(--danger);
}

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

.empty-icon, .error-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  color: var(--fg-subtle);
}

.error-card {
  border-color: rgba(255, 71, 87, 0.3);
  background: rgba(255, 71, 87, 0.05);
}

.error-card h3 {
  color: var(--danger);
  margin-bottom: 0.5rem;
}

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

.album-candidate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  gap: 1rem;
}

.album-candidate-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

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

.album-candidate-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

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

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

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

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

.back-to-albums-btn {
  margin-bottom: 0.5rem;
}

.album-title-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
}

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

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

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

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

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

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

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

.tracklist-table th {
  background: var(--bg-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:hover {
  background: var(--bg-input);
}

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

.track-title-cell {
  font-weight: 500;
}

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

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

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

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

.song-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  gap: 1rem;
}

.song-result-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

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

.song-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-card-artist {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

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

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-word-sync {
  background: rgba(46, 213, 115, 0.12);
  color: var(--success);
  border-color: rgba(46, 213, 115, 0.3);
}

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

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

.donation-card {
  padding: 1.5rem;
}

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

.donation-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 165, 2, 0.12);
  border: 1px solid rgba(255, 165, 2, 0.3);
  color: var(--warning);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.donation-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

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

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

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

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

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

.crypto-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.crypto-badge.btc { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.crypto-badge.eth { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.crypto-badge.sol { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.crypto-badge.ltc { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }

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

.crypto-address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.crypto-address {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--fg-subtle);
  background: var(--bg);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.crypto-address:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.crypto-address.copied {
  background: rgba(46, 213, 115, 0.12);
  border-color: var(--success);
  color: var(--success);
}

/* ==============================================================================
   Modals
   ============================================================================== */
dialog {
  margin: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--fg);
  box-shadow: var(--shadow);
  padding: 0;
  max-width: 640px;
  width: 92%;
  max-height: 90vh;
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

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

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

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

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

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

.tag-helpers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.tag-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.tag-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

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

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

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

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

.proxy-status {
  font-size: 0.75rem;
  font-weight: 600;
}

.proxy-status.success { color: var(--success); }
.proxy-status.warning { color: var(--warning); }
.proxy-status.error { color: var(--danger); }
.proxy-status.testing { color: var(--accent); }

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

.preview-subheading {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: -0.25rem;
}

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

.preview-tab-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.preview-tab-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.karaoke-container {
  height: 280px;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.karaoke-line {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--fg-subtle);
  transition: color var(--transition), transform var(--transition);
  line-height: 1.7;
}

.karaoke-line.active {
  color: var(--fg);
  transform: scale(1.03);
}

.karaoke-word {
  display: inline-block;
  padding: 0 0.1rem;
  transition: color 80ms ease;
}

.karaoke-word.active {
  color: var(--accent);
  font-weight: 600;
}

.karaoke-word.passed {
  color: var(--fg);
}

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

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

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

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

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

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 200ms ease;
  border-radius: 999px;
}

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

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

.progress-log-item.log-success { color: var(--success); }
.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
   ============================================================================== */
.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.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 500;
  animation: toast-in 200ms ease, toast-out 200ms ease 2.8s forwards;
  pointer-events: auto;
  min-width: 200px;
  max-width: 90vw;
}

.toast.success {
  border-left: 3px solid var(--success);
}

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

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

/* ==============================================================================
   Spinner
   ============================================================================== */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

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

/* ==============================================================================
   Responsive
   ============================================================================== */
@media (max-width: 768px) {
  .navbar { padding: 0.75rem 1rem; }
  .brand-title { font-size: 1rem; }
  .brand-badge { font-size: 0.6rem; padding: 0.08rem 0.35rem; }
  .app-container { padding: 1.5rem 1rem; }
  .hero-title { font-size: 1.6rem; }
  .hero-subtitle { font-size: 0.9rem; }
  .card { padding: 1.25rem; }
  .tab-btn { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
  .input-control { padding: 0.65rem 0.85rem; font-size: 1rem; }
  .format-pill { padding: 0.35rem 0.65rem; font-size: 0.7rem; }
  .album-header-card { flex-direction: column; align-items: stretch; }
  .album-header-actions { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .album-header-actions .btn { flex: 1; min-width: 140px; }
  .song-result-card, .album-candidate-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .song-card-actions, .album-candidate-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .song-card-actions .btn { flex: 1; min-width: 110px; }
  .crypto-grid { grid-template-columns: 1fr; }
  dialog { width: 95%; max-width: none; margin: 1rem; border-radius: var(--radius); }
  .karaoke-container { height: 240px; }
  .preview-textarea { height: 240px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.4rem; }
  .format-pills { justify-content: center; }
  .format-pill span { font-size: 0.65rem; }
  .format-pill { padding: 0.35rem 0.5rem; }
  .format-pill input { width: 14px; height: 14px; }
}