:root {
  /* Wavelength brand — dusk-highway palette */
  --bg: #0B0A0F;
  --bg-2: #100E16;
  --surface: #16131F;
  --surface-2: #1D1929;
  --line: #2A2438;
  --text: #F3F0F8;
  --muted: #A7A0B8;
  --text-low: #6C6580;
  --accent: #FB6F3D;
  --ember: #FFB489;
  --accent-2: #7C5CFF;
  --haze: #B7A6FF;
  --magenta: #E8559A;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(env(safe-area-inset-top), 14px) 18px 12px;
}
/* Brand wordmark: Space Grotesk, lowercase, tonal split (wave=hi, length=mid) */
.wordmark {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.03em;
  text-transform: lowercase;
}
.wordmark .mark { width: 1.05em; height: 1.05em; display: block; }
.wordmark .w-a { color: var(--text); }
.wordmark .w-b { color: var(--muted); }
.wordmark-lg { font-size: 38px; justify-content: center; gap: 12px; margin-bottom: 4px; }
.status { font-family: "Space Mono", monospace; font-size: 12px; color: var(--muted); min-height: 14px; letter-spacing: 0.02em; }

main { flex: 1; overflow-y: auto; padding: 0 14px 16px; }

.inputs { position: sticky; top: 0; background: var(--bg); padding: 6px 0 12px; z-index: 2; }
.searchRow, .vibeRow { display: flex; gap: 8px; margin-bottom: 8px; }
input[type="search"], input[type="text"] {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
}
input:focus { border-color: var(--accent-2); }

.icon {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 18px;
  min-width: 48px;
  padding: 10px;
  cursor: pointer;
}
.icon:active { background: var(--surface-2); }
.icon.big { font-size: 26px; min-width: 60px; }
#micBtn.listening { background: var(--accent); border-color: var(--accent); }

.suggest { display: flex; flex-direction: column; margin: -4px 0 8px; }
.suggest .sg {
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 4px; font-size: 14px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest .sg:active { background: var(--surface-2); }

.exploreRow { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); padding: 2px 2px 4px; }
.exploreRow input[type="range"] { flex: 1; accent-color: var(--accent-2); }

.queue { display: flex; flex-direction: column; gap: 4px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
}
.row:active { background: var(--surface); }
.row.playing { background: var(--surface-2); }
.row img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.row .t { flex: 1; min-width: 0; }
.row .t .a { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t .b { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t .why { font-size: 11px; color: var(--accent-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .d { font-size: 12px; color: var(--muted); }

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 14px max(env(safe-area-inset-bottom), 12px);
}
.player.hidden { display: none; }
.art { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.meta { flex: 1; min-width: 0; }
.npTitle { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npArtist { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seek { width: 100%; margin-top: 6px; accent-color: var(--accent); }
.controls { display: flex; align-items: center; gap: 4px; }
#likeBtn.liked { color: var(--accent); }

.row .add { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 4px 6px; }
.row .add:active { color: var(--accent); }

.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: flex-end; z-index: 10;
}
.overlay.hidden { display: none; }
.sheet {
  width: 100%; max-height: 80vh; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 16px 16px max(env(safe-area-inset-bottom), 16px);
  display: flex; flex-direction: column; gap: 12px;
}
.sheetHead { display: flex; align-items: center; justify-content: space-between; }
.sheetHead span { font-size: 18px; font-weight: 600; }
.sheetActions { display: flex; gap: 8px; }
.pill {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.pill:active { background: var(--line); }
.sheetBody { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.importText {
  width: 100%; min-height: 140px; resize: vertical; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-size: 14px;
  padding: 12px; margin-bottom: 10px; font-family: inherit;
}
.importHint { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
#importFile { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.plRow { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-radius: 10px; cursor: pointer; }
.plRow:active { background: var(--surface-2); }
.plRow .name { flex: 1; font-size: 16px; }
.plRow .cnt { color: var(--muted); font-size: 13px; }
.plRow .del { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; }

.userLine { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.userName { font-weight: 600; color: var(--text); }
.linkbtn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; }

.authOverlay { align-items: center; justify-content: center; z-index: 20; }
.authBox {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 22px; width: min(360px, 86vw); display: flex; flex-direction: column; gap: 12px;
}
.authBox h2 { margin: 0 auto; }
.authSub { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 14px; }
.authSubmit { text-align: center; justify-content: center; font-size: 16px; padding: 12px; }
.authErr { color: #ff6b6b; font-size: 13px; min-height: 16px; text-align: center; }
.authToggle { text-align: center; }
.authToggle span { color: var(--accent); font-size: 14px; cursor: pointer; }
