/* ============================================================
   soundblue — "the listening room"
   A mastering-console aesthetic: deep ink-blue, phosphor-cyan
   oscilloscope waveforms, instrument-readout monospace.
   Dark, precise, built for people who care about the signal.
   ============================================================ */
:root {
  /* ---- ink & surfaces ---- */
  --ink:       #06080f;   /* page base — near-black blue */
  --ink-2:     #090d18;
  --panel:     #0d1322;   /* cards / bars */
  --panel-2:   #111a2e;   /* recessed fields, hovers */
  --panel-hi:  #16203a;
  --line:      rgba(150,180,255,.10);   /* hairlines */
  --line-2:    rgba(150,180,255,.18);

  /* ---- type ---- */
  --text:      #e9eefb;
  --text-2:    #97a4c4;
  --text-3:    #5d6a8c;

  /* ---- the signal (phosphor) ---- */
  --signal:        #56d8ff;   /* the trace; primary accent */
  --signal-bright: #8fe9ff;
  --signal-soft:   rgba(86,216,255,.30);
  --signal-line:   rgba(86,216,255,.45);
  --glow:          0 0 0 1px var(--signal-line), 0 0 28px rgba(86,216,255,.30);

  /* ---- quality phosphors ---- */
  --q-hires:    #ffcf6e;   /* gold */
  --q-lossless: #56d8ff;   /* cyan */
  --q-hq:       #8fb6ff;   /* steel */
  --q-low:      #ff8a6b;   /* warm */

  /* ---- waveform (mirrored in app.js drawWave) ---- */
  --wave-unplayed: #38507e;
  --wave-played:   #56d8ff;

  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 18px 40px -18px rgba(0,0,0,.8);

  --display: "Bricolage Grotesque", "Helvetica Neue", sans-serif;
  --sans:    "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text);
  background-color: var(--ink);
  /* layered atmosphere: two cool glows + a faint instrument grid */
  background-image:
    radial-gradient(1100px 680px at 8% -10%, rgba(46,98,196,.22), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(86,216,255,.10), transparent 55%),
    radial-gradient(1200px 900px at 50% 120%, rgba(28,52,110,.30), transparent 60%),
    linear-gradient(transparent 0, transparent calc(100% - 1px), var(--line) 100%),
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), var(--line) 100%);
  background-size: auto, auto, auto, 100% 56px, 56px 100%;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: 92px;
  min-height: 100vh;
}
/* fine film grain over everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .04; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 2; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--signal-soft); color: #fff; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, rgba(11,16,28,.86), rgba(8,11,20,.72));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 14px 30px -20px #000;
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 30px; height: 30px;
  filter: drop-shadow(0 0 10px rgba(86,216,255,.55));
}
.brand-text {
  font-family: var(--display);
  color: #fff; font-size: 21px; font-weight: 500; letter-spacing: -.3px;
}
.brand-text b { font-weight: 800; color: var(--signal); }

.search {
  position: relative; flex: 1; max-width: 560px;
  display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 13px; width: 17px; height: 17px;
  color: var(--text-3); pointer-events: none; transition: color .18s;
}
.search input {
  width: 100%; height: 38px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 0 14px 0 38px;
  font-family: var(--sans); font-size: 14px; color: var(--text);
  background: var(--panel-2);
  outline: none; transition: border-color .18s, box-shadow .18s, background .18s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus {
  border-color: var(--signal-line);
  box-shadow: 0 0 0 3px var(--signal-soft);
  background: var(--panel-hi);
}
.search:focus-within .search-icon { color: var(--signal); }

.topnav { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); color: var(--text-2);
  border: 1px solid var(--line); border-radius: 9px;
  height: 38px; padding: 0 14px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .6px; text-transform: uppercase;
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
}
.ghost-btn:hover {
  background: var(--panel-hi); color: var(--signal);
  border-color: var(--signal-line); box-shadow: 0 0 18px -4px var(--signal-soft);
}
.ghost-btn svg { width: 15px; height: 15px; }
.ghost-btn.spin svg { animation: spin .8s linear infinite; }
.lib-count {
  font-family: var(--mono); color: var(--text-3);
  font-size: 11px; letter-spacing: .5px; white-space: nowrap;
}

/* ---------- Feed ---------- */
.feed { max-width: 1240px; margin: 0 auto; padding: 38px 20px 48px; }
.feed-head {
  margin-bottom: 26px; padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
}
.feed-head h1 {
  font-family: var(--display); font-size: 34px; font-weight: 800;
  letter-spacing: -1px; margin: 0; color: var(--text); line-height: 1;
}
.feed-sub {
  margin: 0; color: var(--text-2);
  font-family: var(--mono); font-size: 12px; letter-spacing: .4px;
}

.track-list { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Track card (a "sound") ---------- */
.track {
  position: relative;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px;
  display: grid; grid-template-columns: 168px 1fr; gap: 20px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  /* staggered entrance; --i set per-card in app.js */
  animation: rise .5s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.track:hover {
  border-color: var(--line-2); transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 26px 50px -22px rgba(0,0,0,.9);
}
.track.playing {
  border-color: var(--signal-line);
  box-shadow: var(--glow), 0 26px 50px -22px rgba(0,0,0,.9);
}
/* signal bar that lights up down the left edge when playing */
.track.playing::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  border-radius: 3px; background: var(--signal);
  box-shadow: 0 0 14px var(--signal);
}

.track-art {
  position: relative; width: 168px; height: 168px; border-radius: 10px;
  overflow: hidden; flex: none; user-select: none;
  background: linear-gradient(135deg, #1b2c52, #0a1224);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.track-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.track-art .art-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(143,233,255,.35);
}
.track-art .art-fallback svg { width: 48px; height: 48px; }
.big-play {
  position: absolute; left: 12px; bottom: 12px;
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: var(--signal); color: #04121a;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px -4px rgba(86,216,255,.7), 0 0 0 1px rgba(255,255,255,.2) inset;
  transition: transform .14s ease, box-shadow .14s, background .14s;
}
.big-play:hover {
  transform: scale(1.08); background: var(--signal-bright);
  box-shadow: 0 8px 26px -4px rgba(86,216,255,.9);
}
.big-play svg { width: 22px; height: 22px; }

/* Play/pause icon toggling (driven by .is-playing; SVGs ignore [hidden]). */
.ic-pause { display: none; }
.is-playing .ic-play { display: none; }
.is-playing .ic-pause { display: inline-block; }

.track-body { min-width: 0; display: flex; flex-direction: column; }
.track-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.track-artist {
  font-family: var(--mono); color: var(--signal);
  font-size: 11px; font-weight: 500; letter-spacing: .8px; text-transform: uppercase;
}
.track-head .dot { color: var(--text-3); }
.track-title {
  font-family: var(--display); color: var(--text);
  font-size: 19px; font-weight: 700; letter-spacing: -.3px;
}
.track-sub {
  color: var(--text-2); font-size: 12.5px; margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

/* Waveform */
.wave-wrap {
  position: relative; height: 96px; cursor: crosshair;
  border-radius: 8px; padding: 6px 0;
}
.track.playing .wave-wrap {
  filter: drop-shadow(0 0 6px rgba(86,216,255,.35));
}
.wave-wrap canvas { width: 100%; height: 100%; display: block; }
.wave-time {
  position: absolute; top: 6px; right: 2px;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
}

/* Footer row: badges + actions */
.track-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .6px; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; line-height: 1;
  border: 1px solid transparent;
}
.badge.q-hires    { color: var(--q-hires);    background: rgba(255,207,110,.10); border-color: rgba(255,207,110,.30); }
.badge.q-lossless { color: var(--q-lossless); background: rgba(86,216,255,.10);  border-color: rgba(86,216,255,.30); }
.badge.q-hq       { color: var(--q-hq);       background: rgba(143,182,255,.10); border-color: rgba(143,182,255,.28); }
.badge.q-low      { color: var(--q-low);      background: rgba(255,138,107,.10); border-color: rgba(255,138,107,.30); }
.badge.fmt        { color: var(--text-2);     background: var(--panel-2);        border-color: var(--line); }
.badge.spec       { color: var(--text-3);     background: transparent;           border-color: var(--line); }
.badge .mono { font-variant-numeric: tabular-nums; }

.track-actions { margin-left: auto; display: flex; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
  border-radius: 8px; height: 31px; padding: 0 12px;
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .4px;
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.chip:hover {
  border-color: var(--signal-line); color: var(--signal);
  background: var(--panel-hi); box-shadow: 0 0 16px -6px var(--signal-soft);
}
.chip svg { width: 14px; height: 14px; }
.chip.active {
  color: var(--signal); border-color: var(--signal-line); background: rgba(86,216,255,.08);
}

/* Nerd panel — a spec sheet / readout */
.nerd {
  margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px;
  display: none;
}
.nerd.open { display: block; animation: rise .35s cubic-bezier(.2,.7,.2,1) both; }
.nerd-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 20px;
}
.nerd-item {
  display: flex; flex-direction: column; gap: 3px;
  border-left: 1px solid var(--line); padding-left: 10px;
}
.nerd-k {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-3); font-weight: 500;
}
.nerd-v {
  font-family: var(--mono); font-size: 13px; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.nerd-v.accent { color: var(--signal); font-weight: 600; }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 90px 20px; color: var(--text-2); }
.empty-icon { width: 56px; height: 56px; color: var(--signal); opacity: .6;
  filter: drop-shadow(0 0 16px var(--signal-soft)); }
.empty h2 { font-family: var(--display); margin: 18px 0 8px; color: var(--text); font-size: 22px; }
.empty p { margin: 0; line-height: 1.7; font-size: 14px; }
.empty code {
  font-family: var(--mono); background: var(--panel-2); color: var(--signal);
  padding: 2px 7px; border-radius: 6px; font-size: 12.5px; border: 1px solid var(--line);
}
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--signal);
  box-shadow: 0 0 18px -4px var(--signal-soft);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Player (the console) ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: linear-gradient(180deg, rgba(13,19,34,.92), rgba(6,8,15,.96));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-top: 1px solid var(--line);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 -10px 40px -10px rgba(0,0,0,.7);
}
/* phosphor hairline along the very top of the console */
.player::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  opacity: .5;
}
.player.show { transform: translateY(0); }
.player-inner {
  max-width: 1400px; margin: 0 auto; height: 78px; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; color: var(--text);
}
.p-controls { display: flex; align-items: center; gap: 4px; }
.p-btn {
  background: transparent; border: none; color: var(--text-2);
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: color .14s, background .14s;
}
.p-btn:hover { color: #fff; background: rgba(143,182,255,.10); }
.p-btn svg { width: 22px; height: 22px; }
.p-btn.play {
  background: var(--signal); color: #04121a; width: 42px; height: 42px;
  box-shadow: 0 0 22px -4px var(--signal-soft);
}
.p-btn.play:hover { background: var(--signal-bright); }
.p-btn.small { width: 31px; height: 31px; }
.p-btn.small svg { width: 18px; height: 18px; }

.p-time {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; width: 42px; text-align: center; letter-spacing: .5px;
}
.p-wave { flex: 1; height: 50px; position: relative; cursor: crosshair; min-width: 80px; }
.player.show .p-wave { filter: drop-shadow(0 0 5px rgba(86,216,255,.30)); }
.p-wave canvas { width: 100%; height: 100%; display: block; }

.p-meta { display: flex; align-items: center; gap: 11px; width: 230px; min-width: 0; }
.p-art {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
  background: #16264d; flex: none; box-shadow: 0 0 0 1px var(--line) inset;
}
.p-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.p-title { font-family: var(--display); font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-artist { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.p-quality {
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .6px;
  color: var(--signal);
  border: 1px solid var(--signal-line); border-radius: 7px; padding: 5px 9px;
  background: rgba(86,216,255,.07); white-space: nowrap;
}
.p-volume { display: flex; align-items: center; gap: 7px; width: 124px; }
.p-volume input[type=range] { width: 86px; }

/* Range slider styling */
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px;
  background: var(--panel-hi); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--signal); cursor: pointer; box-shadow: 0 0 10px -1px var(--signal);
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border: none; border-radius: 50%;
  background: var(--signal); cursor: pointer; box-shadow: 0 0 10px -1px var(--signal);
}

/* ---------- Upload ---------- */
/* Primary variant of the ghost button — the signal color, for the main action. */
.ghost-btn.primary {
  background: rgba(86,216,255,.10); color: var(--signal);
  border-color: var(--signal-line);
}
.ghost-btn.primary:hover {
  background: rgba(86,216,255,.18); color: var(--signal-bright);
  box-shadow: 0 0 20px -4px var(--signal-soft);
}
#fileInput { display: none; }

/* Full-screen drop overlay */
.dropzone[hidden], .toast[hidden] { display: none; } /* `display:flex` below would otherwise beat [hidden] */
.dropzone {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,8,15,.82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade .14s ease both;
}
.dropzone-inner {
  pointer-events: none; text-align: center; color: var(--signal);
  border: 2px dashed var(--signal-line); border-radius: 20px;
  padding: 56px 80px; background: rgba(86,216,255,.04);
  box-shadow: 0 0 60px -10px var(--signal-soft), 0 0 0 1px rgba(86,216,255,.08) inset;
}
.dropzone-inner svg { width: 64px; height: 64px; filter: drop-shadow(0 0 16px var(--signal-soft)); animation: bob 1.4s ease-in-out infinite; }
.dropzone-inner h2 { font-family: var(--display); font-size: 26px; font-weight: 800; margin: 14px 0 6px; color: #fff; }
.dropzone-inner p { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .4px; color: var(--text-2); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-7px); } }

/* Upload progress toast (sits just above the player) */
.toast {
  position: fixed; right: 20px; bottom: 100px; z-index: 70;
  width: 320px; max-width: calc(100vw - 40px);
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line-2); border-radius: 12px; padding: 13px 15px;
  box-shadow: var(--glow), 0 18px 40px -14px rgba(0,0,0,.8);
  animation: rise .25s cubic-bezier(.2,.7,.2,1) both;
}
.toast-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.toast-msg { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-pct { font-family: var(--mono); font-size: 12px; color: var(--signal); font-variant-numeric: tabular-nums; }
.toast-bar { height: 4px; border-radius: 3px; background: var(--panel-hi); overflow: hidden; }
.toast-bar span {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--signal), var(--signal-bright));
  box-shadow: 0 0 10px var(--signal-soft); transition: width .2s ease;
}

/* ---------- Accounts, modals & shared form controls ---------- */
.auth-screen[hidden], .modal[hidden] { display: none; } /* beat the display:flex below */

/* Shared button */
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--signal); color: #04121a; box-shadow: 0 6px 20px -6px var(--signal-soft); }
.btn.primary:hover { background: var(--signal-bright); box-shadow: 0 8px 26px -6px rgba(86,216,255,.7); }
.btn.primary:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--panel-2); color: var(--text-2); border-color: var(--line); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-hi); }

/* Shared dark text field (auth + modal) */
.auth-form input, .modal-form input, .modal-form textarea {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.modal-form textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.auth-form input::placeholder, .modal-form textarea::placeholder { color: var(--text-3); }
.auth-form input:focus, .modal-form input:focus, .modal-form textarea:focus {
  border-color: var(--signal-line); box-shadow: 0 0 0 3px var(--signal-soft); background: var(--panel-hi);
}

/* Auth screen */
.auth-screen {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(46,98,196,.28), transparent 60%),
    rgba(6,8,15,.96);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.auth-card {
  width: 380px; max-width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line-2); border-radius: 18px; padding: 30px 28px 24px;
  box-shadow: var(--glow), 0 40px 80px -30px #000; animation: rise .4s cubic-bezier(.2,.7,.2,1) both;
}
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--display); font-size: 24px; font-weight: 500; color: #fff; margin-bottom: 22px;
}
.auth-brand .brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 0 10px rgba(86,216,255,.55)); }
.auth-brand b { font-weight: 800; color: var(--signal); }
.auth-tabs { display: flex; gap: 4px; background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; background: transparent; border: none; border-radius: 7px; padding: 9px 0;
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--text-2); transition: background .15s, color .15s;
}
.auth-tab.active { background: var(--panel-hi); color: var(--signal); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-form .btn { margin-top: 4px; }
.register-only { display: none; }
.register-mode .register-only { display: block; }
.auth-error { margin: 2px 0 0; color: #ff8a6b; font-size: 12.5px; }
.auth-hint { margin: 16px 0 0; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .3px; color: var(--text-3); }

/* User menu in the header */
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-chip {
  font-family: var(--mono); font-size: 12px; color: var(--signal);
  background: rgba(86,216,255,.08); border: 1px solid var(--signal-line);
  border-radius: 8px; padding: 6px 10px; white-space: nowrap;
}

/* Edit / manage modal */
.modal {
  position: fixed; inset: 0; z-index: 85;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(6,8,15,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-card {
  width: 520px; max-width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--glow), 0 40px 80px -30px #000; animation: rise .3s cubic-bezier(.2,.7,.2,1) both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-family: var(--display); font-size: 19px; font-weight: 700; margin: 0; }
.modal-x { background: transparent; border: none; color: var(--text-3); font-size: 26px; line-height: 1; width: 34px; height: 34px; border-radius: 8px; transition: color .15s, background .15s; }
.modal-x:hover { color: #fff; background: var(--panel-hi); }
.modal-form { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); }
.field-row { display: grid; grid-template-columns: 1fr 88px 1fr; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* Cover art editor (inside the modal) */
.cover-edit { display: flex; gap: 16px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.cover-preview {
  width: 92px; height: 92px; flex: none; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #1b2c52, #0a1224); box-shadow: 0 0 0 1px var(--line) inset;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: rgba(143,233,255,.35); }
.cover-ph svg { width: 34px; height: 34px; }
.cover-actions { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); }
.cover-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-btns .btn { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.ghost.danger:hover { color: var(--q-low); border-color: rgba(255,138,107,.4); background: rgba(255,138,107,.08); }
.cover-hint { margin: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .3px; color: var(--text-3); }

/* Track description + uploader credit */
.track-desc {
  margin: 6px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.5; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.track-uploader { color: var(--signal); }
.track-source {
  color: var(--signal); border-bottom: 1px dotted var(--signal-line);
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block; vertical-align: bottom;
}
.track-source:hover { color: var(--signal-bright); }
.import-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }

/* indeterminate toast bar (used while a YouTube import runs) */
.toast.busy .toast-bar span { width: 38%; animation: indet 1.15s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -38%; } 100% { margin-left: 100%; } }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .feed-head h1 { font-size: 26px; }
  .track { grid-template-columns: 88px 1fr; gap: 14px; padding: 14px; }
  .track-art { width: 88px; height: 88px; }
  .big-play { width: 36px; height: 36px; left: 6px; bottom: 6px; }
  .big-play svg { width: 16px; height: 16px; }
  .wave-wrap { height: 66px; }
  .p-meta, .p-volume, .p-quality { display: none; }
  .brand-text { display: none; }
  .ghost-btn span, .lib-count, .user-chip { display: none; } /* icon-only buttons to save room */
  .ghost-btn { padding: 0 10px; }
  .toast { bottom: 86px; right: 12px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .track, .nerd.open { animation: none; }
  * { transition-duration: .01ms !important; }
}
