/* The jam page. Colours follow Nexus Music's default theme. */
:root {
  --base: #0b0811;
  --panel: #14101d;
  --raised: #1e182b;
  --line: #ffffff1c;
  --text: #f3effa;
  --muted: #a89fbb;
  --faint: #6f6783;
  --accent: #8b5cf6;
  --accent-bright: #a98bfb;
  --on-accent: #150c2b;
  --warm: #f5b85c;
  --danger: #f47676;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% -10%, #2a1a52 0%, var(--base) 62%) fixed var(--base);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }

:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .solid { fill: currentColor; stroke: none; }

.primary { background: var(--accent); color: #fff; font-weight: 650; }
.primary:active { background: var(--accent-bright); }

/* ---- before joining ---- */

.gate {
  max-width: 400px;
  margin: 0 auto;
  padding: max(12vh, 48px) 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  align-items: center;
}

.mark { border-radius: 14px; }

.gate h1 { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
.gate p { color: var(--muted); text-wrap: pretty; }

#join { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; text-align: left; }
#join label { font-size: 13px; font-weight: 650; color: var(--muted); }

#join input {
  height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--raised);
}

#join button { height: 52px; border-radius: 26px; margin-top: 6px; }
#join button:disabled { opacity: 0.6; }

/* For someone at a PC, who may have the app. */
.gate .tip { display: none; margin-top: 12px; font-size: 14px; color: var(--faint); }

/* ---- the jam ---- */

.jam {
  max-width: 1040px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 16px) 16px calc(env(safe-area-inset-bottom) + 32px);
}

.top { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; }
.top-words { flex: 1; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-bright); }
.top h1 { font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  background: var(--raised);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.chip svg { width: 18px; height: 18px; color: var(--muted); }

.people { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 14px; }
.people li { padding: 6px 12px; border-radius: 16px; background: var(--raised); font-size: 14px; color: var(--muted); }
.people li.host { color: var(--text); }
.people li.you { color: var(--accent-bright); }

.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f5b85c1f;
  border: 1px solid #f5b85c40;
  color: var(--warm);
  font-size: 14px;
}

.columns { display: flex; flex-direction: column; gap: 20px; }

.now {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-areas: "art words" "progress progress" "controls controls" "note note";
  column-gap: 16px;
  row-gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.art {
  grid-area: art;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--raised) center / 44% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6783' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E");
  overflow: hidden;
  box-shadow: 0 12px 32px #00000066;
}

.art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.now-words { grid-area: words; min-width: 0; }
.now-title { font-size: 20px; line-height: 1.2; font-weight: 750; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.now-artist { margin-top: 4px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { grid-area: progress; }
.bar { height: 4px; border-radius: 2px; background: #ffffff24; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 2px; background: var(--accent-bright); }
.times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.controls { grid-area: controls; display: flex; justify-content: center; align-items: center; gap: 20px; }

.round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--raised);
  border: 1px solid var(--line);
}

.round.primary { width: 60px; height: 60px; background: var(--text); color: var(--base); border: 0; }
.round.primary:active { background: #fff; }
.round svg { width: 24px; height: 24px; }
.round:disabled { opacity: 0.5; }

.now .hint { grid-area: note; text-align: center; }

.hint { color: var(--faint); font-size: 14px; text-wrap: pretty; }

.side { min-width: 0; }

.search {
  position: sticky;
  top: max(env(safe-area-inset-top), 8px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 16px;
  border-radius: 26px;
  background: var(--raised);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px #0b0811cc;
}

.search:focus-within { border-color: var(--accent-bright); }
.search svg { color: var(--muted); }

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
}

.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }

.plain { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }

.list-title { margin: 20px 4px 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.songs li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 4px;
  border-radius: 10px;
}

.songs img, .songs .blank { width: 48px; height: 48px; border-radius: 6px; flex: none; background: var(--raised); object-fit: cover; }
.songs .blank { background: var(--raised) center / 44% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6783' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E"); }

.song-words { flex: 1; min-width: 0; }
.song-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-about { display: flex; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.song-artist { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Who added it gives way last: on a narrow phone it's the artist's name that's cut short. */
.song-by { flex: none; max-width: 70%; overflow: hidden; text-overflow: ellipsis; color: var(--accent-bright); }
.song-by::before { content: "\00b7\00a0"; color: var(--muted); }
.song-length { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }

.act {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--raised);
  border: 1px solid var(--line);
}

.act.add { background: var(--accent); border-color: transparent; color: #fff; }
.act.done { background: none; color: var(--accent-bright); }
.act.busy { opacity: 0.5; }
.act.remove { background: none; border-color: transparent; color: var(--muted); }

.side > .hint { padding: 12px 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 22px;
  background: var(--text);
  color: var(--base);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px #000000a0;
  z-index: 5;
}

.toast.bad { background: var(--danger); }

/* On a narrow phone the song's length makes way for its name. */
@media (max-width: 420px) {
  .song-length { display: none; }
}

@media (min-width: 860px) {
  .gate .tip { display: block; }
  .jam { padding-top: 32px; }
  .columns { flex-direction: row; align-items: flex-start; gap: 32px; }
  .now {
    position: sticky;
    top: 32px;
    width: 360px;
    flex: none;
    grid-template-columns: 1fr;
    grid-template-areas: "art" "words" "progress" "controls" "note";
    padding: 24px;
    row-gap: 18px;
  }
  .now-words { text-align: center; }
  .now-title { font-size: 24px; }
  .side { flex: 1; }
  .search { top: 16px; }
  .list-title { margin-top: 24px; }
}

@media (prefers-reduced-motion: no-preference) {
  .bar-fill { transition: width 0.5s linear; }
  .act, .round, .chip { transition: background-color 0.12s, opacity 0.12s; }
}
