/* ═══════════════════════════════════════════════════════
   Letras — Design System "Neon Verse"
   Dark theme, music-inspired, purple + cyan accents
   ═══════════════════════════════════════════════════════ */

:root {
  --base: #0f0f14;
  --surface: #16161e;
  --surface-card: #1c1c27;
  --surface-elevated: #242432;
  --surface-highest: #2e2e40;
  --primary: #a78bfa;
  --primary-dim: rgba(167, 139, 250, 0.12);
  --primary-glow: rgba(167, 139, 250, 0.25);
  --accent: #67e8f9;
  --accent-dim: rgba(103, 232, 249, 0.12);
  --accent-glow: rgba(103, 232, 249, 0.20);
  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.12);
  --error: #f87171;
  --error-dim: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.12);
  --on-surface: #e8e5f0;
  --on-surface-variant: #9e9bb0;
  --on-surface-dim: #6b687e;
  --outline: rgba(255, 255, 255, 0.06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--base);
  color: var(--on-surface);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(167, 139, 250, 0.3); color: #fff; }

.hidden { display: none !important; }

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-highest); border-radius: 3px; }

/* ── Layout ───────────────────────────────────────────── */
.app-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem;
  padding-bottom: calc(80px + var(--safe-bottom));
  min-height: 100dvh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  background: var(--base);
  z-index: 50;
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Icon button ──────────────────────────────────────── */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--surface-card);
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.25rem;
}
.icon-btn:hover { background: var(--surface-elevated); color: var(--on-surface); }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  transition: background 0.2s;
}
.card:hover { background: var(--surface-elevated); }
.card-flat {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

/* ── Song list ────────────────────────────────────────── */
.song-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.song-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.song-card .song-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.song-card .song-artist {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
}

.song-card .song-badges {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.badge-fill { background: var(--primary-dim); color: var(--primary); }
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-lang {
  background: var(--surface-highest);
  color: var(--on-surface-dim);
}

/* ── Global stats ─────────────────────────────────────── */
.global-stats-card {
  margin-bottom: 1rem;
}

.gs-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.gs-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(
    var(--ring-color) calc(var(--ring-pct) * 1%),
    var(--surface-highest) calc(var(--ring-pct) * 1%)
  );
}
.gs-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface-card);
}
.gs-ring-value {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 800;
}

.gs-title {
  font-size: 0.9375rem;
  font-weight: 700;
}
.gs-subtitle {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  margin-top: 0.125rem;
}

.gs-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 0.5rem;
}
.gs-segment {
  border-radius: 4px;
  min-width: 4px;
  transition: flex 0.4s ease;
}

.gs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.gs-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.625rem;
  color: var(--on-surface-variant);
  font-weight: 500;
}
.gs-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Song card mastery ────────────────────────────────── */
.song-card-top {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.song-card-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(
    var(--ring-color) calc(var(--ring-pct) * 1%),
    var(--surface-highest) calc(var(--ring-pct) * 1%)
  );
}
.song-card-ring::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface-card);
}
.song-card:hover .song-card-ring::before {
  background: var(--surface-elevated);
}
.song-card-ring-value {
  position: relative;
  z-index: 1;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--on-surface);
}

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

.song-mastery-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  flex-wrap: wrap;
}

.mastery-tag {
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--tag-color) 15%, transparent);
  color: var(--tag-color);
}

.attempts-label {
  font-size: 0.625rem;
  color: var(--on-surface-dim);
}

.mode-bars {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.75rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--outline);
}

.mode-mini {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.mode-mini-track {
  flex: 1;
  height: 4px;
  background: var(--surface-highest);
  border-radius: 2px;
  overflow: hidden;
}
.mode-mini-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.mode-mini-label {
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--on-surface-dim);
  min-width: 1.25rem;
}

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--on-surface-dim);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; color: var(--on-surface-variant); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c5ce0);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface-elevated);
  color: var(--on-surface);
}
.btn-secondary:hover { background: var(--surface-highest); }
.btn-ghost {
  background: transparent;
  color: var(--on-surface-variant);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover { color: var(--on-surface); background: var(--surface-card); }
.btn-danger {
  background: var(--error-dim);
  color: var(--error);
}
.btn-block { width: 100%; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  margin-bottom: 0.5rem;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 0.9375rem;
  transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
}
.form-select {
  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='none' stroke='%239e9bb0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 1.5rem;
  animation: slideUp 0.3s ease-out;
}
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius-xl); max-height: 80dvh; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Practice view ────────────────────────────────────── */
.practice-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
}
.practice-header .back-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--surface-card);
  color: var(--on-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.practice-header .song-info { flex: 1; }
.practice-header .song-info h2 { font-size: 1.125rem; font-weight: 700; }
.practice-header .song-info p { font-size: 0.75rem; color: var(--on-surface-variant); }

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.mode-btn {
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--on-surface-variant);
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.mode-btn:hover { background: var(--surface-card); }
.mode-btn.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Fill-in-the-blanks ───────────────────────────────── */
.lyrics-display {
  padding: 1rem 0;
  line-height: 2;
}
.lyrics-display .line {
  margin-bottom: 0.375rem;
}
.lyrics-display .word {
  display: inline;
  font-size: 1rem;
}
.lyrics-display .blank-input {
  display: inline-block;
  background: var(--surface-card);
  border: 1px solid var(--outline);
  border-bottom: 2px solid var(--primary);
  border-radius: 4px;
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.125rem 0.25rem;
  text-align: center;
  outline: none;
  transition: all 0.2s;
  min-width: 3rem;
}
.blank-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}
.blank-input.correct {
  background: var(--success-dim);
  border-color: var(--success);
  color: var(--success);
}
.blank-input.incorrect {
  background: var(--error-dim);
  border-color: var(--error);
  color: var(--error);
}

.difficulty-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
  border-radius: var(--radius-md);
}
.difficulty-control label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.difficulty-control input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
}
.difficulty-control .diff-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 2.5rem;
  text-align: right;
}

/* ── Karaoke mode ─────────────────────────────────────── */
.karaoke-area {
  padding: 1rem 0;
}
.karaoke-context {
  padding: 1rem;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  min-height: 120px;
}
.karaoke-context .past-line {
  color: var(--on-surface-dim);
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
  opacity: 0.6;
}
.karaoke-context .current-line {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}
.karaoke-input-row {
  display: flex;
  gap: 0.5rem;
}
.karaoke-input {
  flex: 1;
  padding: 0.875rem 1rem;
  background: var(--surface-card);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.karaoke-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.karaoke-submit {
  padding: 0 1.25rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--base);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.karaoke-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
}
.karaoke-feedback.correct {
  background: var(--success-dim);
  color: var(--success);
}
.karaoke-feedback.incorrect {
  background: var(--error-dim);
  color: var(--error);
}

/* ── Puzzle mode ──────────────────────────────────────── */
.puzzle-area { padding: 1rem 0; }

.puzzle-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-dim);
  margin-bottom: 0.5rem;
}

.puzzle-dropzone {
  min-height: 60px;
  background: var(--surface);
  border: 2px dashed var(--outline);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  transition: border-color 0.2s;
}
.puzzle-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
}

.puzzle-bank {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
}

.puzzle-line {
  padding: 0.625rem 1rem;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  cursor: grab;
  user-select: none;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.puzzle-line:hover { background: var(--surface-elevated); }
.puzzle-line:active { cursor: grabbing; transform: scale(0.98); }
.puzzle-line.placed { opacity: 0.4; }
.puzzle-line.correct-pos { border-color: var(--success); background: var(--success-dim); }
.puzzle-line.incorrect-pos { border-color: var(--error); background: var(--error-dim); }

/* ── Score / Progress bar ─────────────────────────────── */
.score-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}
.score-bar .score-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-variant);
}
.score-bar .score-track {
  flex: 1;
  height: 6px;
  background: var(--surface-highest);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar .score-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.score-bar .score-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 3rem;
  text-align: right;
}

/* ── Results ──────────────────────────────────────────── */
.results-card {
  text-align: center;
  padding: 2rem 1.5rem;
}
.results-card .results-score {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}
.results-card .results-label {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  margin-bottom: 1.5rem;
}
.results-card .results-msg {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.results-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ── Verse navigator (puzzle) ─────────────────────────── */
.verse-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.verse-nav .verse-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-variant);
}
.verse-dots {
  display: flex;
  gap: 0.375rem;
}
.verse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-highest);
  transition: background 0.2s;
}
.verse-dot.active { background: var(--primary); }
.verse-dot.done { background: var(--success); }

/* ── Section title ────────────────────────────────────── */
.section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-dim);
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

/* ── Mastery summary (practice view) ──────────────────── */
.mastery-summary {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.mastery-overview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mastery-ring-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(
    var(--ring-color) calc(var(--ring-pct) * 1%),
    var(--surface-highest) calc(var(--ring-pct) * 1%)
  );
}
.mastery-ring-lg::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface-card);
}
.mastery-ring-lg-value {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 800;
  color: var(--on-surface);
}

.mastery-hint {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  margin-top: 0.25rem;
}

.mastery-modes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mastery-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.mastery-mode-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface);
}
.mastery-mode-value {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--on-surface);
}
.mastery-mode-track {
  height: 5px;
  background: var(--surface-highest);
  border-radius: 3px;
  overflow: hidden;
}
.mastery-mode-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.mastery-mode-detail {
  font-size: 0.625rem;
  color: var(--on-surface-dim);
  margin-top: 0.25rem;
}

/* ── Sing / Karaoke mode ──────────────────────────────── */
.sing-setup { padding: 0.5rem 0; }

.yt-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  max-height: 45dvh;
  overflow-y: auto;
}
.yt-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.yt-result:hover { background: var(--surface-elevated); }
.yt-result img {
  width: 80px;
  height: 45px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-highest);
}
.yt-result .yt-info { flex: 1; min-width: 0; }
.yt-result .yt-title {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-result .yt-author {
  font-size: 0.6875rem;
  color: var(--on-surface-variant);
}
.yt-result .yt-dur {
  font-size: 0.6875rem;
  color: var(--on-surface-dim);
  flex-shrink: 0;
}

.sing-video-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: #000;
}
.sing-video-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.sing-lyrics-scroll {
  max-height: 40dvh;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 0.5rem 0;
  mask-image: linear-gradient(to bottom, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 8%, black 92%, transparent);
}

.sing-line {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--on-surface-dim);
  transition: all 0.3s ease;
  margin-bottom: 0.125rem;
}
.sing-line.active {
  color: var(--on-surface);
  font-weight: 700;
  font-size: 1.0625rem;
  background: var(--primary-dim);
  border-left: 3px solid var(--primary);
}
.sing-line.past {
  color: var(--on-surface-variant);
  opacity: 0.6;
}
.sing-line.blanked {
  color: transparent;
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  min-height: 1.5rem;
  position: relative;
}
.sing-line.blanked::after {
  content: '???';
  position: absolute;
  left: 0.75rem;
  color: var(--on-surface-dim);
  font-style: italic;
  font-size: 0.875rem;
}
.sing-line.blanked.active {
  background: var(--warning-dim);
  border-left: 3px solid var(--warning);
}
.sing-line.blanked.active::after {
  content: 'Canta de memoria!';
  color: var(--warning);
}
.sing-line.blanked.reveal {
  color: var(--on-surface);
  background: var(--success-dim);
  border-left: 3px solid var(--success);
}
.sing-line.blanked.reveal::after {
  display: none;
}

.sing-line.separator {
  height: 0.75rem;
  padding: 0;
}

.sing-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}
.sing-progress-mini {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  font-variant-numeric: tabular-nums;
}

/* ── Sparkline ────────────────────────────────────────── */
.sparkline-container {
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--outline);
}
.sparkline-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-dim);
  margin-bottom: 0.25rem;
}
.sparkline-svg {
  width: 100%;
  height: 40px;
}

/* ── Weak spots ───────────────────────────────────────── */
.weak-spots {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--outline);
}
.weak-spots-title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warning);
  margin-bottom: 0.625rem;
}
.weak-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
  border-left: 3px solid var(--warning);
}
.weak-line-text {
  font-size: 0.8125rem;
  color: var(--on-surface);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.weak-line-count {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--warning);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

/* ── Correction blanks ────────────────────────────────── */
.correction-blank {
  border-bottom-color: var(--warning) !important;
}
.correction-blank:focus {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 2px var(--warning-dim) !important;
}

/* ── Search flow ──────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.search-row .form-input { flex: 1; }

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 50dvh;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.search-result:hover {
  background: var(--surface-elevated);
  border-color: var(--primary-dim);
}
.search-result img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.search-result .sr-info { flex: 1; min-width: 0; }
.search-result .sr-title {
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result .sr-artist {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result .sr-arrow {
  color: var(--on-surface-dim);
  flex-shrink: 0;
}

.search-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--on-surface-dim);
  font-size: 0.875rem;
}

.lyrics-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.lyrics-source-tag {
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--accent-dim);
  color: var(--accent);
  margin-left: 0.5rem;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

/* ── Animations ───────────────────────────────────────── */
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }
