/* ================= THEME TOKENS ================= */
:root{
  --bg1:#f5f7ff; --bg2:#eef3ff;
  --ink:#0b1020; --muted:#475569;

  --card:rgba(255,255,255,.75);
  --soft:rgba(255,255,255,.55);
  --ring:rgba(124,58,237,.25);
  --shadow:0 30px 60px rgba(2,6,23,.12);

  --brand:#7c3aed; --brand2:#22d3ee; --brand-deep:#5b21b6;
  --danger:#ef4444;

  --barbg:rgba(2,6,23,.08);
  --btn:#0b1020;
  --accent:#f59e0b;
}
.theme-dark{
  --bg1:#0b1020; --bg2:#0a0f1b;
  --ink:#e9f1ff; --muted:#a6b2c6;
  --card:rgba(255,255,255,.08);
  --soft:rgba(255,255,255,.06);
  --ring:rgba(124,58,237,.45);
  --shadow:0 30px 60px rgba(2,6,23,.35);
  --barbg:rgba(255,255,255,.12);
  --btn:#f8fafc;
}

/* ================ BASE & BACKGROUND (no white gaps) ================ */
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent }
html,body{
  min-height:100vh;
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Inter, Roboto, Helvetica, Arial;
  color:var(--ink);
  background-color: var(--bg2); /* solid fallback */
  background:
    radial-gradient(1200px 800px at 10% 0%, rgba(124,58,237,.10), transparent 55%),
    radial-gradient(1000px 700px at 90% 10%, rgba(34,211,238,.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}
button,input,select,textarea{ font:inherit; color:var(--ink) }
button{ cursor:pointer; user-select:none }
a{ color:inherit; text-decoration:none }

/* ================ HEADER/NAV (no underlines) ================ */
.header{
  position:sticky; top:0; z-index:5;
  backdrop-filter:saturate(1.2) blur(16px);
  background:linear-gradient(to bottom, rgba(12,15,26,.06), rgba(12,15,26,.02));
  border-bottom:1px solid var(--ring);
}
.header-inner{ max-width:1000px; margin:0 auto; padding:10px 16px; display:flex; justify-content:space-between; align-items:center; }
.logo{ width:40px; height:40px; border-radius:14px; color:#fff; font-weight:800; display:grid; place-items:center; background:linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow:var(--shadow) }
.title{ font-weight:800; letter-spacing:-.02em }
.subtitle{ font-size:12px; color:var(--muted) }
.nav .btn{ border:1px solid rgba(2,6,23,.12); background:var(--soft); color:var(--btn); text-decoration:none; border-bottom:none; }
.nav .btn.active{ background:linear-gradient(135deg, var(--brand), var(--brand2)); border-color:transparent; color:#fff }

/* remove any stray underlines/bottom borders from tab-like controls */
.seg .btn, .tabbar .btn, .tabbar a {
  text-decoration: none !important;
  border-bottom: none !important;
  box-shadow: none;
}

/* ================ COMMON UI ================ */
.container{ max-width:1000px; margin:0 auto; padding:16px }
.card{ backdrop-filter:saturate(1.4) blur(14px); background:var(--card); border:1px solid rgba(2,6,23,.12); border-radius:16px; padding:16px; box-shadow:var(--shadow) }
.btn{ position:relative; overflow:hidden; padding:10px 14px; border-radius:14px; border:1px solid rgba(2,6,23,.12); background:var(--soft); color:var(--btn); transition:transform .06s ease, background .25s ease, border-color .25s ease, color .2s; font-weight:700; letter-spacing:-.01em }
.btn:active{ transform:scale(.98) }
.btn.primary{ color:#fff; border-color:transparent; background:linear-gradient(135deg, var(--brand), var(--brand2)) }
.btn.danger{ background:rgba(239,68,68,.15); color:#991b1b; border-color:rgba(239,68,68,.35) }
.seg{ display:flex; gap:8px; flex-wrap:wrap }
.stack{ display:grid; gap:10px }
.row{ display:flex; gap:8px; align-items:center }
.choices{ display:grid; gap:8px }
.choice{ text-align:left; padding:12px 14px; border-radius:14px; border:1px solid rgba(2,6,23,.12); background:var(--soft); transition:transform .06s, background-color .2s, border-color .2s, color .2s, opacity .2s }
.choice.correct{ background:rgba(16,185,129,.28); border-color:rgba(16,185,129,.55); color:#064e3b }
.choice.wrong{ background:rgba(239,68,68,.25); border-color:rgba(239,68,68,.55); color:#7f1d1d }
.choice.dim{ opacity:.55 }
.bar{ height:8px; background:var(--barbg); border-radius:999px; overflow:hidden }
.bar .fill{ height:8px; background:linear-gradient(90deg, var(--brand), var(--brand2)); width:0% }
.meta{ font-size:12px; color:var(--muted) }
.pill{ padding:4px 8px; border-radius:9999px; border:1px solid rgba(2,6,23,.12); background:var(--soft); font-size:12px }

/* ================ MUSIC & LYRICS ================ */
.music-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:12px }
.cover{ width:64px; height:64px; border-radius:12px; object-fit:cover; border:1px solid rgba(2,6,23,.12) }

/* per-line (generic lyrics list) */
.line{ padding:8px 10px; border-radius:12px; margin-bottom:4px; background:var(--soft); border:1px solid rgba(2,6,23,.12) }
.line .src{ white-space:pre-wrap; color:var(--ink) }
.line .tr{ color:#d97706; font-style:italic; margin-top:2px; white-space:pre-wrap }
.theme-dark .line .tr{ color:#fbbf24 } /* brighter on dark */

/* Lyrics map */
.lymap-line{ padding:8px 10px; border-radius:12px; margin-bottom:10px; background:var(--soft); border:1px solid rgba(2,6,23,.12) }
.lymap-line .src{ color:var(--ink) }
.lymap-tr{ color:#d97706; margin-top:6px; font-size:13px }
.theme-dark .lymap-tr{ color:#fbbf24 } /* brighter on dark */
.lyw{ border-bottom:1px dotted rgba(2,6,23,.35); padding:0 1px; border-radius:4px }
.lyw.show{ background:rgba(250,204,21,.2) }

/* Word-level color classes */
.pill.lv0, .lyw.lv0{ background:rgba(239,68,68,.18); border-color:rgba(239,68,68,.35); color:#7f1d1d }
.pill.lv20, .lyw.lv20{ background:rgba(245,158,11,.20); border-color:rgba(245,158,11,.45); color:#78350f }
.pill.lv40, .lyw.lv40{ background:rgba(234,179,8,.22); border-color:rgba(234,179,8,.48); color:#713f12 }
.pill.lv60, .lyw.lv60{ background:rgba(132,204,22,.25); border-color:rgba(132,204,22,.55); color:#365314 }
.pill.lv80, .lyw.lv80{ background:rgba(16,185,129,.28); border-color:rgba(16,185,129,.55); color:#064e3b }

/* Per-sentence progress bar */
.sentbar{ height:6px; background:var(--barbg); border-radius:999px; overflow:hidden; margin-top:8px }
.sentbar .fill{ height:6px; background:linear-gradient(90deg, var(--brand), var(--brand2)); width:0% }

/* Now Playing floater */
#np{ position:fixed; left:50%; bottom:12px; transform:translateX(-50%); z-index:30 }
#np .wrap{
  display:flex; gap:10px; align-items:center;
  backdrop-filter:saturate(1.4) blur(12px);
  background:rgba(17,24,39,.08);
  border:1px solid rgba(2,6,23,.12);
  border-radius:16px; padding:10px 12px; box-shadow:var(--shadow);
  position:relative; overflow:hidden;
}
#np img{ width:40px; height:40px; border-radius:10px; object-fit:cover; border:1px solid rgba(2,6,23,.12) }
#np .t{ font-weight:700; max-width:220px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
#np .m{ font-size:12px; color:var(--muted); max-width:220px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
#np .dots{ width:36px; height:36px; display:flex; align-items:center; justify-content:center; border-radius:10px; border:1px solid rgba(2,6,23,.12); background:var(--soft) }
#np .link{ text-decoration:underline; cursor:pointer }
.npbar{ position:absolute; left:0; right:0; bottom:0; height:3px; background:var(--barbg); overflow:hidden }
.npbar .fill{ height:3px; width:0%; background:linear-gradient(90deg, var(--brand), var(--brand2)); transition: width .25s linear; }

/* Button progress + toast */
.btn .pfill{ position:absolute; inset:0; width:0%; background:rgba(10,15,26,.25); transition:width .18s ease; z-index:0 }
.btn .pglow{ position:absolute; top:0; bottom:0; left:-20%; width:16%; background:linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.65) 50%, rgba(255,255,255,0) 100%); transform:translateX(-100%); animation:sweep 1.2s ease infinite; z-index:1; opacity:.9 }
.btn.loading{ pointer-events:none }
.btn .plabel{ position:relative; z-index:2 }
@keyframes sweep{ to{ transform:translateX(600%) } }
#toast{ position:fixed; bottom:70px; left:50%; transform:translateX(-50%); background:rgba(10,15,26,.85); color:#fff; padding:10px 14px; border:1px solid rgba(255,255,255,.16); border-radius:12px; opacity:0; pointer-events:none; transition:opacity .22s ease; z-index:35 }
#toast.show{ opacity:1 }

/* Spotify green button (elsewhere) */
.btn.spotify{
  background:#1DB954;
  border-color:#12a244;
  color:#fff;
}
.btn.spotify .logo{ margin-right:8px }
.btn.spotify.loading{ opacity:.9 }

/* ===== Floater Add button — SIMPLE, PURPLE, NO ANIMATION ===== */
#np #npAdd{
  color:#fff !important;
  border-color: rgba(147,51,234,.42) !important;
  background: rgba(147,51,234,.85) !important; /* purple like lyrics chips */
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}
#np #npAdd .pglow{ display:none !important; } /* no sweep animation at all */
#np #npAdd .pfill{
  background: linear-gradient(90deg, rgba(147,51,234,.25), rgba(147,51,234,.65)) !important;
  opacity:.95;
  transition: width .22s ease;
}

/* ======= DARK-MODE READABILITY FOR LYRICS MAP ======= */
.theme-dark .lymap-line .src,
.theme-dark .line .src { color: #ffffff; }

.theme-dark .lyw,
.theme-dark .lyw.lv0,
.theme-dark .lyw.lv20,
.theme-dark .lyw.lv40,
.theme-dark .lyw.lv60,
.theme-dark .lyw.lv80 {
  color: #ffffff !important;
  border-bottom-color: rgba(255,255,255,.35);
}
.theme-dark .pill.lv0,
.theme-dark .pill.lv20,
.theme-dark .pill.lv40,
.theme-dark .pill.lv60,
.theme-dark .pill.lv80 {
  color: #ffffff !important;
}

/* --- Words page: big items --- */
.word-item{padding:12px 14px;border-radius:14px;background:var(--panel);box-shadow:var(--shadow);margin-bottom:10px}
.word-item .word-txt{font-size:18px;font-weight:700;line-height:1.25}
.word-item .word-txt .arrow{opacity:.7;font-weight:600}
.word-item .bar.under{margin-top:8px}

/* --- Music cards: add delete button spacing on small screens --- */
.music-card{display:grid;grid-template-columns:64px 1fr auto;gap:12px;align-items:center}
.music-card .btns{display:flex;gap:8px}
@media (max-width:720px){
  .music-card{grid-template-columns:56px 1fr}
  .music-card .btns{grid-column:1 / -1}
}

/* --- Settings: compact Spotify connect --- */
.btn-spotify{display:inline-flex;align-items:center;gap:10px;background:#1DB954;color:#fff;border:none;border-radius:12px;padding:10px 14px;font-weight:700}
.btn-spotify::before{
  content:""; width:18px; height:18px; display:inline-block; filter:invert(100%);
  background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="%23ffffff" viewBox="0 0 24 24"><path d="M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm5.485 17.25a.75.75 0 01-1.035.27 12.744 12.744 0 00-10.9-.64.75.75 0 11-.575-1.386 14.247 14.247 0 0112.186.716.75.75 0 01.324 1.04zm1.48-3.043a.937.937 0 01-1.29.336 15.94 15.94 0 00-13.588-.8.938.938 0 11-.662-1.759 17.817 17.817 0 0115.2.894.937.937 0 01.34 1.329zm.122-3.115a1.125 1.125 0 01-1.562.403 19.782 19.782 0 00-16.91-.995 1.125 1.125 0 11-.78-2.108 22.032 22.032 0 0118.85 1.112 1.125 1.125 0 01.402 1.588z"/></svg>') no-repeat center/contain;
}

/* Hide busy/diagnostic fluff on settings */
.settings-card .meta, .settings-card .note { display:none }

/* --- Buttons: danger (delete) --- */
.btn.danger{background:rgba(255,92,92,.12);color:#ff7b7b}
.btn.danger:hover{background:rgba(255,92,92,.2)}
