/* ============================================================================
   MDisco — "The Console" design language
   ----------------------------------------------------------------------------
   MDisco reads like the screen of a well-made music instrument (Teenage-
   Engineering register): a matte warm-charcoal chassis, hairline structure
   (no cards-with-glow), silkscreen-style mono labels, all machine data
   (positions, counts, durations, dates) set in tabular monospace like a device
   readout, tactile flat controls, and ONE restrained signal accent per
   playlist. No glow, no gradients, no glass-blur, no decorative sparkle. Flat,
   matte, engineered.

   Type split is the spine of the system:
     · monospace  → identity, labels, and all numeric/machine data (the readout)
     · system sans → prose: reasons, bios, subtitles, empty states
   Color is Restrained: one neutral chassis shared everywhere; each playlist
   contributes a single signal accent (Sonar cool / Augur amber / Patron
   copper) shown on its name, its channel LED, and its active controls.
   ========================================================================== */

:root {
  /* ---- Chassis: refined warm-charcoal dark, layered by hairline + surface
     step rather than by shadow. ---- */
  --bg:          #1a1917;   /* deepest chassis */
  --surface:     #211f1c;   /* raised panel / row */
  --surface-2:   #29262260; /* input / hover fill (over surface) */
  --surface-2s:  #2b2825;   /* solid variant of the above */
  --line:        rgba(236, 232, 222, 0.10);  /* hairline */
  --line-strong: rgba(236, 232, 222, 0.17);  /* structural hairline */

  --fg:    #ece8e0;   /* warm bone silkscreen text */
  --muted: #a29d90;   /* warm grey — secondary text (~6:1 on --bg) */
  --faint: #78736a;   /* decorative only; never load-bearing text */

  /* Neutral house accent (history, auth, homepage chrome): a low-chroma warm
     "unlit indicator". Each playlist overrides --accent/--accent-strong. */
  --accent:        #b9a58a;
  --accent-strong: #d6c5a6;

  /* Engineered radii — squared for tags/inputs, gently rounded for panels;
     transport controls are round like physical buttons. */
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 8px;

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo,
          Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
          Arial, sans-serif;

  /* Source-tier colors (readouts), tuned for legibility on the dark chassis. */
  --c-bandcamp: #7cb8cc;
  --c-youtube:  #e08a72;
  --c-lastfm:   #d9a441;
}

/* Sonar reads cool (new releases), Augur amber (divination/discovery), Patron
   copper (the spending end). These set the scoped accent for both the homepage
   summary and the full playlist page. */
.card-sonar,  .theme-sonar  { --accent: #52b6ae; --accent-strong: #86d3cb; }
.card-augur,  .theme-augur  { --accent: #d9a441; --accent-strong: #edc471; }
.card-patron, .theme-patron { --accent: #dd8351; --accent-strong: #edaa7f; }
/* The Reliquary is the fourth channel — a cool violet, the one hue the other
   three leave free. The Vault deliberately takes no class at all: it keeps the
   neutral "unlit indicator" accent, because nothing is being fed into it. */
.card-reliquary, .theme-reliquary { --accent: #9b8ec4; --accent-strong: #bfb4e0; }

* { box-sizing: border-box; }

/* Author `display` on .player-bar / .info-modal would otherwise beat the UA
   [hidden] rule, leaking those elements in their idle state. Enforce it. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Themed browser surfaces (the parts we don't draw still wear the system) */
::selection { background: var(--accent-strong); color: #14130f; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; border-radius: var(--r-sm); }
:focus:not(:focus-visible) { outline: none; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
input { caret-color: var(--accent-strong); accent-color: var(--accent); }

/* ---- Drawn icon system (Feather-weight strokes / solid transport glyphs).
   `currentColor` throughout so an icon takes its button's color. ---- */
.ic {
  width: 1.05em;
  height: 1.05em;
  display: inline-block;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
/* Transport glyphs read clearest as solid fills. */
.ic-play, .ic-pause, .ic-prev, .ic-next { fill: currentColor; stroke: none; }

/* ============================ Header ==================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
}

/* The wordmark is a silkscreen device label: mono, uppercase, tracked. */
.site-header h1 {
  margin: 0;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.site-header h1 a { color: var(--fg); text-decoration: none; }
.site-header a { color: var(--fg); text-decoration: none; }
.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-header nav > a { color: var(--muted); transition: color 0.12s ease; }
.site-header nav > a:hover { color: var(--fg); }

/* ---- Header dropdown menus ---- */
.nav-menu { position: relative; flex: 0 0 auto; }
.site-header .nav-menu-trigger {
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.12s ease;
}
.site-header .nav-menu-trigger:hover { color: var(--fg); }
.nav-caret { opacity: 0.7; }
.nav-caret .ic { width: 0.85em; height: 0.85em; }

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem;
  margin-top: 0.45rem;
  background: var(--surface-2s);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.13s ease, transform 0.13s ease, visibility 0.13s;
  z-index: 70;
}
.nav-dropdown--right { left: auto; right: 0; }
/* Transparent bridge over the margin gap so hover doesn't drop. */
.nav-dropdown::before { content: ""; position: absolute; left: 0; right: 0; top: -0.45rem; height: 0.45rem; }
.nav-menu:hover .nav-dropdown,
.nav-menu:focus-within .nav-dropdown { opacity: 1; visibility: visible; transform: none; }

.site-header .nav-dropitem,
.site-header .nav-logout button {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}
.site-header .nav-dropitem:hover,
.site-header .nav-logout button:hover { color: var(--fg); background: var(--surface-2s); }
.nav-logout { margin: 0; }

/* Home-dropdown rows carry each playlist's channel LED. */
.site-header .nav-dropitem.drop-sonar,
.site-header .nav-dropitem.drop-augur,
.site-header .nav-dropitem.drop-patron,
.site-header .nav-dropitem.drop-reliquary { position: relative; padding-left: 1.35rem; }
.site-header .nav-dropitem.drop-sonar::before,
.site-header .nav-dropitem.drop-augur::before,
.site-header .nav-dropitem.drop-patron::before,
.site-header .nav-dropitem.drop-reliquary::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: -0.25rem;
  border-radius: 1px;
}
.site-header .drop-sonar::before  { background: #52b6ae; }
.site-header .drop-augur::before  { background: #d9a441; }
.site-header .drop-patron::before { background: #dd8351; }
.site-header .drop-reliquary::before { background: #9b8ec4; }

/* Playlist title docked into the bar on scroll — wears the playlist accent. */
.nav-docktitle {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.4em);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.nav-docktitle.is-docked { opacity: 1; transform: none; pointer-events: auto; }
.nav-docktitle strong {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-docktitle-date { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; flex: 0 0 auto; }

/* ============================ Layout =================================== */

main {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* Prose links pick up the scoped accent. .link-btn opts out below. */
main a { color: var(--accent-strong); text-decoration: none; }
main a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 0.18em; }

.subtitle { color: var(--muted); margin: -0.25rem 0 1.5rem; }

.empty {
  color: var(--muted);
  font-style: normal;
  padding: 0.9rem 1.05rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.08rem 0.36rem;
  border-radius: var(--r-sm);
  color: var(--accent-strong);
}

/* Section heading (History, auth) — channel-label register. */
main > h2, .auth-card h2 {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

/* ===================== Homepage playlist summaries ===================== */

.playlist-summary {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
  background: var(--surface);
  transition: border-color 0.15s ease;
}
.playlist-summary:hover { border-color: var(--line-strong); }

.playlist-summary h2,
.playlist-head h2 {
  display: flex;
  align-items: center;
  margin: 0;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
/* The channel LED — a small signal square in the playlist's accent. */
.playlist-summary h2::before,
.playlist-head h2::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.7rem;
  border-radius: 1px;
  background: var(--accent);
  flex: 0 0 auto;
}
.playlist-summary h2 small,
.playlist-head h2 small {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  margin-left: 0.7rem;
}
.card-subtitle { color: var(--muted); margin: 0.55rem 0 0.85rem; font-size: 0.93rem; }
.playlist-summary p:last-child { margin-bottom: 0; }
.playlist-summary p a { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em; }

/* ================= Homepage "Week Readout" hero ======================= */
/* A precomputed week-in-review instrument panel above the summary cards: it
   looks BACK (7-day totals, what you did with last week's lists), the cards
   below look FORWARD (this week's drop). Machine-data mono throughout; the only
   colour is the three channel LEDs (each row carries a card-* accent class),
   every meter/bar stays neutral bone — "one accent per surface" holds. */
.week-readout {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 1.5rem 1.5rem 1.65rem;
  margin-bottom: 1.5rem;
}
.wr-masthead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}
.wr-eyebrow {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--mono); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.55rem;
}
.wr-pwr { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.wr-week {
  margin: 0;
  font-family: var(--mono); font-weight: 600; font-size: 1.5rem;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg);
}
.wr-figures { display: flex; gap: 1.75rem; }
.wr-fig { text-align: right; }
.wr-fig .wr-n {
  font-family: var(--mono); font-weight: 600; font-size: 2.1rem; line-height: 1;
  color: var(--fg); font-variant-numeric: tabular-nums;
}
.wr-fig .wr-u {
  display: block; margin-top: 0.4rem;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted);
}
.wr-legend {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted); margin: 1.35rem 0 0.95rem;
}
.wr-quiet {
  font-family: var(--sans); font-size: 0.9rem; color: var(--muted);
  margin: 1.1rem 0 0;
}
.wr-masthead--quiet { padding-bottom: 0; border-bottom: 0; }

/* Channel rows: what you did with last week's lists. The counts carry the
   signal; each row links through to the very list it reports on, so the row
   stays neutral bone until you engage it and only the LED holds colour. */
.wr-channels { display: grid; gap: 0; }
.wr-channel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 1.1rem;
  padding: 0.62rem 0.6rem;
  margin: 0 -0.6rem;
  border-top: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.wr-channel:first-child { border-top: 0; }
.wr-channel--link { color: inherit; text-decoration: none; cursor: pointer; }
.wr-channel--link:hover,
.wr-channel--link:focus-visible { background: var(--surface-2s); outline: none; }
.wr-id { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.wr-led { width: 0.6rem; height: 0.6rem; border-radius: 1px; background: var(--accent); flex: 0 0 auto; }
.wr-name {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg);
}
.wr-outcome {
  font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
  text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.wr-outcome b { color: var(--fg); font-weight: 600; }
.wr-outcome .wr-sep { color: var(--faint); margin: 0 0.15rem; }
.wr-outcome--none { color: var(--muted); }
/* Drill-through affordance: a right-pointing chevron that lifts to bone on
   hover/focus. No motion — the tone shift is the whole feedback. */
.wr-go { display: inline-flex; flex: 0 0 auto; }
.wr-go .ic { width: 1rem; height: 1rem; color: var(--faint); transform: rotate(-90deg); transition: color 0.12s ease; }
.wr-channel--link:hover .wr-go .ic,
.wr-channel--link:focus-visible .wr-go .ic { color: var(--fg); }

/* Top rotation: the week's most-played tracks (Last.fm 7-day chart). */
.wr-rotation { display: grid; gap: 0.55rem; }
.wr-rot {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) 6.5rem 2rem;
  align-items: center; gap: 0.9rem;
}
.wr-pos {
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  font-variant-numeric: tabular-nums; text-align: right;
}
/* Clip on the block-level grid item; the inner artist/title are inline, where
   text-overflow is inert, so the whole line truncates as one unit. */
.wr-track { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-artist { font-family: var(--mono); font-size: 0.82rem; color: var(--fg); }
.wr-title { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }
.wr-bar { height: 0.5rem; background: rgba(236, 232, 222, 0.06); border-radius: 999px; overflow: hidden; }
.wr-bar > i { display: block; height: 100%; background: rgba(236, 232, 222, 0.30); border-radius: 999px; }
.wr-rot--lead .wr-bar > i { background: rgba(236, 232, 222, 0.46); }
.wr-plays {
  font-family: var(--mono); font-size: 0.82rem; color: var(--fg);
  text-align: right; font-variant-numeric: tabular-nums;
}
.wr-rot--lead .wr-pos { color: var(--fg); }
.wr-cards-legend {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.9rem;
}

@media (max-width: 560px) {
  .wr-channel { gap: 0.7rem; }
  .wr-outcome { font-size: 0.76rem; }
  .wr-rot { grid-template-columns: 1.4rem minmax(0, 1fr) 2rem; }
  .wr-bar { display: none; }
  .wr-figures { gap: 1.4rem; }
}

/* ===================== Playlist detail header ========================= */

.playlist-head {
  padding: 0 0 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line-strong);
}
.playlist-head h2 { font-size: 1.5rem; }
.playlist-head h2::before { width: 0.7rem; height: 0.7rem; }
.playlist-head .card-subtitle { margin-bottom: 0; }
.bandcamp-friday { color: var(--muted); font-size: 0.85rem; margin: 0.6rem 0 0; }
/* Long-word safety so a subtitle never overruns a narrow viewport. */
.card-subtitle, .bandcamp-friday, .subtitle, .reason { overflow-wrap: anywhere; }

/* ===================== Add-a-track panel ============================== */

.add-panel { margin-bottom: 1.25rem; }
.add-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: var(--r-md);
  padding: 0.4rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.add-toggle:hover { border-color: var(--accent); color: var(--fg); }
.add-form { margin-top: 0.8rem; }
.add-inputs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.add-inputs input {
  flex: 1 1 10rem;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--fg);
  font: inherit;
  transition: border-color 0.12s ease;
}
.add-inputs input::placeholder { color: var(--faint); }
.add-inputs input:focus { outline: none; border-color: var(--accent); }
.add-search-btn {
  flex: 0 0 auto;
  padding: 0.5rem 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #14130f;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.add-search-btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.add-results { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.add-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 0.92rem;
}
.add-result-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-pick {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  background: none;
  color: var(--accent-strong);
  border-radius: var(--r-sm);
  padding: 0.2rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.add-pick:hover { background: var(--accent); color: #14130f; }
.add-status { color: var(--muted); font-size: 0.85rem; margin: 0.55rem 0 0; min-height: 1.1em; }

/* ============================ Track rows =============================== */

.playlist { list-style: none; padding: 0; margin: 0; }

/* Rows are a readout list separated by hairlines — not floating cards.
   State (active / added / blocked) is carried by a background tint + the
   position color + the row's own badges, never a heavy colored border. */
.track-card {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.track-card:first-child { border-top: 1px solid var(--line); }
.track-card:hover { background: var(--surface); }

.track-main { font-size: 1.02rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; row-gap: 0.4rem; }
/* Fixed-width mono readout gutter for the track number. */
.position {
  flex: 0 0 auto;
  min-width: 1.6rem;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.artist { font-weight: 600; white-space: nowrap; }
.track { color: var(--muted); font-weight: 400; min-width: 0; }

/* Play control — a round tactile button; the active row fills with accent. */
.play-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.play-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.play-btn.playing { background: var(--accent); border-color: var(--accent); color: #14130f; }
.play-btn--empty { border: none; background: none; cursor: default; }
/* play/pause glyph swap driven by .is-playing (set by the player JS). */
.play-btn .ic-pause,
.player-playpause .ic-pause { display: none; }
.play-btn.is-playing .ic-play,
.player-playpause.is-playing .ic-play { display: none; }
.play-btn.is-playing .ic-pause,
.player-playpause.is-playing .ic-pause { display: inline-block; }

/* Silkscreen data/label tags — mono, squared, hairline-bordered. */
.source-badge, .added-badge, .price-badge {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.14rem 0.4rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.source-badge.source-bandcamp { color: var(--c-bandcamp); border-color: color-mix(in srgb, var(--c-bandcamp) 45%, transparent); }
.source-badge.source-youtube  { color: var(--c-youtube);  border-color: color-mix(in srgb, var(--c-youtube) 45%, transparent); }

.info-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  margin-left: auto;
  border: none;
  background: none;
  color: var(--faint);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.12s ease;
}
.info-btn:hover { color: var(--accent-strong); }

.reason { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0 0.65rem 2.6rem; max-width: 68ch; }

.links { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-left: 2.6rem; }
/* Quiet, uniform hairline chips — the service's colour surfaces only on hover,
   so it never competes with the playlist's single channel accent. */
.link-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--fg);
  background: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.link-btn.bandcamp     { --lc: var(--c-bandcamp); }
.link-btn.lastfm       { --lc: var(--c-lastfm); }
.link-btn.youtube      { --lc: var(--c-youtube); }
.link-btn.listenbrainz { --lc: #86d3cb; }
.link-btn.musicbrainz  { --lc: #edc471; }
.link-btn.soundcloud   { --lc: #dd8351; }
.link-btn:hover { background: var(--lc, var(--accent)); color: #14130f; border-color: var(--lc, var(--accent)); }

/* Action-button family (block / remove / purchase) — quiet mono chips. */
.block-actions, .purchase-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.55rem 0 0 2.6rem;
}
.block-btn, .unblock-btn, .remove-added-btn, .like-btn, .keep-btn,
.buy-btn, .dismiss-btn, .undo-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 0.24rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.block-btn:hover        { border-color: var(--c-youtube); color: var(--c-youtube); }
.remove-added-btn:hover { border-color: var(--c-youtube); color: var(--c-youtube); }
.unblock-btn:hover      { border-color: var(--accent); color: var(--accent-strong); }
.block-note { color: var(--c-youtube); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; }

/* ---- Liked state: the row's one affirmative action ----
   Wears the playlist accent (the same role .added-badge plays), so it stays
   inside "one signal accent per surface" — the outline heart fills in when set.
   A like shapes the next generation, so the row itself is otherwise unchanged. */
.like-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.is-liked .like-btn {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent-strong) 50%, transparent);
}
.is-liked .like-btn .ic-heart { fill: currentColor; stroke: none; }
/* A blocked artist can't also be a liked one — hide the control rather than
   offer two contradictory states at once (the block wins; undo restores it). */
.blocked-artist .like-btn { display: none; }

/* ---- Kept state: the row's other affirmative action ----
   Same treatment as the like, one step along: the gem outline fills in when the
   song is in the Reliquary. Track-level, so only this row changes. On the
   Reliquary and Vault pages every row is kept, and pressing it removes. */
.keep-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.is-kept .keep-btn {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent-strong) 50%, transparent);
}
.is-kept .keep-btn .ic-keep { fill: color-mix(in srgb, currentColor 55%, transparent); }
.keep-btn[disabled] { opacity: 0.4; cursor: default; }
/* A blocked row can't also be kept — same reasoning as the like control. */
.blocked-artist .keep-btn, .blocked-track .keep-btn { display: none; }

/* Earlier Vault years, under the Reliquary's heading. */
.kept-trail {
  margin: 0.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.kept-trail-count { color: var(--faint); }

/* ---- Added-by-you state ---- */
.added-badge { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent-strong) 50%, transparent); }
.added-track { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.added-track .position { color: var(--accent-strong); }

/* ---- Blocked state: fade + mark, no heavy border ---- */
.blocked-artist, .blocked-track { background: color-mix(in srgb, var(--c-youtube) 6%, transparent); }
.block-note, .unblock-btn { display: none; }
.blocked-artist .block-btn, .blocked-track .block-btn { display: none; }
.blocked-artist .block-note, .blocked-track .block-note,
.blocked-artist .unblock-btn, .blocked-track .unblock-btn { display: inline-flex; }
.blocked-artist .track-main, .blocked-artist .reason, .blocked-artist .links,
.blocked-track .track-main, .blocked-track .reason, .blocked-track .links { opacity: 0.42; }

/* ============================ Player bar ============================== */

.playlist { padding-bottom: 7.5rem; }
.playlist--no-player { padding-bottom: 1.5rem; }

.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  z-index: 50;
}
.player-bar:not([hidden]) { animation: bar-rise 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes bar-rise { from { transform: translateY(100%); } to { transform: none; } }

.player-video { flex: 0 0 auto; width: 148px; height: 83px; }
.player-video iframe { width: 100%; height: 100%; border: 0; border-radius: var(--r-sm); }
.player-controls { flex: 0 0 auto; display: flex; gap: 0.4rem; }
.player-ctrl {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: var(--surface-2s);
  color: var(--fg);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.player-ctrl:hover { border-color: var(--accent); color: var(--accent-strong); }
.player-shuffle.active { background: var(--accent); color: #14130f; border-color: var(--accent); }
/* Central play/pause is the primary transport control. */
.player-playpause { color: var(--accent-strong); border-color: var(--accent); }
.player-playpause:hover { color: #14130f; background: var(--accent); }

.player-count {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.player-now { flex: 1 1 auto; font-size: 0.92rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: var(--surface-2s);
  color: var(--muted);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.player-close:hover { border-color: var(--c-youtube); color: var(--c-youtube); }

@media (max-width: 560px) {
  .site-header { padding: 0.6rem 0.8rem; gap: 0.6rem; }
  .site-header h1 { font-size: 0.82rem; letter-spacing: 0.12em; }
  .site-header nav { gap: 0.6rem; font-size: 0.7rem; }
  .nav-user { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* The dock-title (a scroll affordance) is empty here and only complicates
     the header flex on narrow screens. */
  .nav-docktitle { display: none; }
  main { padding: 1.5rem 1.1rem 3rem; }
  /* The per-row source badge is redundant on narrow screens (the link chips
     below already signal availability, and the player bar shows the live
     source) — hide it so rows never overflow the viewport. */
  .track-main .source-badge { display: none; }
  .player-video { width: 104px; height: 58px; }
  .player-now { font-size: 0.86rem; }
  .reason, .links, .block-actions, .purchase-actions { margin-left: 0; }
  .reason { max-width: none; }
}

/* ============================ Info modal ============================== */

body.modal-open { overflow: hidden; }

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.info-modal[hidden] { display: none; }
.info-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 9, 8, 0.74); }
.info-modal-card {
  position: relative;
  display: flex;
  gap: 1.2rem;
  width: 100%;
  max-width: 32rem;
  max-height: 85vh;
  overflow: auto;
  padding: 1.35rem;
  background: var(--surface-2s);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: modal-in 0.16s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.info-modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.info-modal-close:hover { border-color: var(--accent); color: var(--accent-strong); }
.info-modal-media { flex: 0 0 auto; }
.info-modal-media img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--r-md); display: block; border: 1px solid var(--line); }
.info-modal-media img[hidden] { display: none; }
.info-modal-text { min-width: 0; }
.info-modal-text h3 {
  margin: 0 1.8rem 0.4rem 0;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
}
.info-modal-origin { margin: 0 0 0.55rem; color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.info-modal-track { margin: 0 0 0.65rem; font-size: 0.92rem; font-weight: 600; }
.info-modal-bio { margin: 0 0 0.65rem; font-size: 0.9rem; line-height: 1.55; max-width: 62ch; }
.info-modal-attr { margin: 0; color: var(--faint); font-size: 0.72rem; }
.info-modal-origin[hidden], .info-modal-track[hidden],
.info-modal-bio[hidden], .info-modal-attr[hidden] { display: none; }

@media (max-width: 420px) {
  .info-modal-card { flex-direction: column; }
  .info-modal-media img { width: 100%; height: 160px; }
}

/* ===================== Patron (buy list) states ======================= */

.price-badge { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent-strong) 45%, transparent); margin-left: 0.1rem; }

.buy-btn:hover     { border-color: #86d3cb; color: #86d3cb; }
.dismiss-btn:hover { border-color: var(--c-youtube); color: var(--c-youtube); }
.undo-btn:hover    { border-color: var(--accent); color: var(--accent-strong); }
.purchase-note { color: var(--accent-strong); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; }

.bought    { background: color-mix(in srgb, #86d3cb 7%, transparent); }
.bought .position { color: #86d3cb; }
.dismissed { background: color-mix(in srgb, var(--c-youtube) 6%, transparent); }
.purchase-note, .undo-btn { display: none; }
.bought .buy-btn, .bought .dismiss-btn, .dismissed .buy-btn, .dismissed .dismiss-btn { display: none; }
.bought .purchase-note, .bought .undo-btn,
.dismissed .purchase-note, .dismissed .undo-btn { display: inline-flex; }
.dismissed .track-main, .dismissed .reason, .dismissed .links { opacity: 0.42; }
.bought .track-main, .bought .reason, .bought .links { opacity: 0.78; }

/* ============================ History ================================= */

.history-table { width: 100%; border-collapse: collapse; }
.history-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.history-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.history-table tbody tr { transition: background 0.12s ease; }
.history-table tbody tr:hover { background: var(--surface); }
.history-table td:first-child { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
/* Playlist identity + track counts are machine data — set them in the mono
   readout register, like the rest of the console. */
.history-table td:nth-child(2) { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.history-table td:nth-child(3) { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.history-table td:last-child a { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* ============================ Auth pages ============================== */

.auth-card {
  max-width: 30rem;
  margin: 3rem auto 0;
  padding: 2rem 1.9rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
}
.auth-card h2 { margin-bottom: 1rem; }
.auth-lead { color: var(--muted); font-size: 0.98rem; line-height: 1.6; margin: 0 0 1.5rem; max-width: 60ch; }
.auth-errors { list-style: none; margin: 0 0 1.25rem; padding: 0.75rem 0.9rem; border: 1px solid color-mix(in srgb, var(--c-youtube) 45%, transparent); border-radius: var(--r-md); color: var(--c-youtube); font-size: 0.9rem; background: color-mix(in srgb, var(--c-youtube) 8%, transparent); }
.auth-errors li + li { margin-top: 0.35rem; }
.btn-lastfm, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn-lastfm { background: var(--accent); border: 1px solid var(--accent); color: #14130f; }
.btn-lastfm:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-secondary { background: none; border: 1px solid var(--line-strong); color: var(--fg); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-strong); }
.auth-alt { color: var(--muted); font-size: 0.9rem; margin: 1.5rem 0 0; }

/* ============================ Motion ================================== */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
