/* ============================================================
   KikoMix · Components — Material You (M3)
   Buttons (filled / tonal / outlined / text), icon buttons,
   chips (assist + filter), cards (elevated / filled / outlined),
   M3 search bar, Spotify-style list rows, badges, navigation bar,
   snackbar, switches, sliders, dividers, section headers, modal,
   notice, form controls. 48px minimum touch targets.
   ============================================================ */

/* ---------- Buttons ----------
   .btn base: 48px pill, label-large type. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  min-width: 48px;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--shape-full);
  border: 1px solid transparent;
  font-size: var(--ts-label-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: .01em;
  line-height: 1;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Filled button — the primary CTA. */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--elevation-1);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--on-primary) var(--state-hover), var(--primary));
  box-shadow: var(--elevation-2);
}
.btn-primary:active {
  background: color-mix(in srgb, var(--on-primary) var(--state-pressed), var(--primary));
  box-shadow: var(--elevation-1);
}
.btn-primary[disabled] {
  background: color-mix(in srgb, var(--on-surface) 12%, transparent);
  color: color-mix(in srgb, var(--on-surface) 38%, transparent);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Tonal button — soft fill for secondary actions (was .btn-ghost). */
.btn-ghost,
.btn-tonal {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
.btn-ghost:hover, .btn-tonal:hover {
  background: color-mix(in srgb, var(--on-secondary-container) var(--state-hover), var(--secondary-container));
  box-shadow: var(--elevation-1);
}
.btn-ghost:active, .btn-tonal:active {
  background: color-mix(in srgb, var(--on-secondary-container) var(--state-pressed), var(--secondary-container));
}

/* Outlined button. */
.btn-outlined {
  background: transparent;
  border-color: var(--outline);
  color: var(--primary);
}
.btn-outlined:hover { background: color-mix(in srgb, var(--primary) var(--state-hover), transparent); }
.btn-outlined:active { background: color-mix(in srgb, var(--primary) var(--state-pressed), transparent); }

/* Text button. */
.btn-text {
  background: transparent;
  color: var(--primary);
  padding-inline: var(--space-3);
}
.btn-text:hover { background: color-mix(in srgb, var(--primary) var(--state-hover), transparent); }
.btn-text:active { background: color-mix(in srgb, var(--primary) var(--state-pressed), transparent); }

/* Danger button — M3 error container. */
.btn-danger {
  background: var(--error-container);
  color: var(--on-error-container);
}
.btn-danger:hover { background: color-mix(in srgb, var(--on-error-container) var(--state-hover), var(--error-container)); }
.btn-danger:active { background: color-mix(in srgb, var(--on-error-container) var(--state-pressed), var(--error-container)); }

.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 40px; padding: var(--space-2) var(--space-4); font-size: var(--ts-label-md); }

/* ---------- Icon buttons (48px) ---------- */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--on-surface-variant);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover {
  background: color-mix(in srgb, var(--on-surface) var(--state-hover), transparent);
  color: var(--on-surface);
}
.icon-btn:active { background: color-mix(in srgb, var(--on-surface) var(--state-pressed), transparent); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn--filled { background: var(--primary); color: var(--on-primary); }
.icon-btn--filled:hover { background: color-mix(in srgb, var(--on-primary) var(--state-hover), var(--primary)); color: var(--on-primary); }
.icon-btn--tonal { background: var(--secondary-container); color: var(--on-secondary-container); }

/* ---------- Chips ----------
   Assist chips (static info) + filter chips (toggleable).
   48px touch target, M3 8px radius. */
.chips, .chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-block: var(--space-1);
  margin-inline: calc(-1 * var(--space-4));
  padding-inline: var(--space-4);
  scrollbar-width: none;
}
.chips::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-shrink: 0;
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--shape-sm);
  border: 1px solid var(--outline-variant);
  background: transparent;
  font-size: var(--ts-label-lg);
  font-weight: var(--weight-medium);
  color: var(--on-surface-variant);
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
button.chip { cursor: pointer; }
button.chip:hover {
  background: color-mix(in srgb, var(--on-surface) var(--state-hover), transparent);
  color: var(--on-surface);
  border-color: var(--outline);
}
/* Selected filter chip. */
.chip.active,
.chip[aria-pressed="true"],
.chip.selected {
  background: var(--secondary-container);
  border-color: transparent;
  color: var(--on-secondary-container);
  font-weight: var(--weight-semibold);
}
/* Connected-service chip (home services row): orange dot = on. */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--on-surface-variant);
  opacity: .6;
  flex-shrink: 0;
}
.chip.on .dot { background: var(--primary); opacity: 1; }
.chip.on { color: var(--on-surface); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }

/* ---------- Cards ----------
   .card = M3 elevated. .card--filled / .card--outlined variants. */
.card {
  background: var(--surface-container-low);
  border-radius: var(--shape-lg);
  padding: var(--space-4);
  box-shadow: var(--elevation-1);
  border: 1px solid transparent;
}
.card + .card { margin-top: var(--space-3); }
.card--filled {
  background: var(--surface-container-high);
  box-shadow: none;
}
.card--outlined {
  background: var(--surface);
  border-color: var(--outline-variant);
  box-shadow: none;
}
.card--pressable {
  transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card--pressable:hover { background: var(--surface-container); }
.card--pressable:active { transform: scale(.99); }

/* ---------- M3 search bar ----------
   56px tonal pill; the input is borderless, the button docks inside.
   Capped well below the content column so the field (and the input's
   native clear button) never stretches edge-to-edge on desktop. */
.search-form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: 640px;
  min-height: 56px;
  background: var(--surface-container-high);
  border: 1px solid transparent;
  border-radius: var(--shape-full);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-5);
  margin-bottom: var(--space-2);
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.search-form:hover { background: var(--surface-container-highest); }
.search-form:focus-within {
  border-color: var(--primary);
  background: var(--surface-container-highest);
}
.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  background: transparent;
  border: 0;
  color: var(--on-surface);
  font-size: var(--ts-body-lg);
}
.search-form input[type="search"]:focus { outline: none; }
.search-form input[type="search"]::placeholder {
  color: var(--on-surface-variant);
  opacity: .75;
}
.search-form .btn { flex-shrink: 0; }

/* ---------- App header (M3 top app bar) ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--app-max);
  margin-inline: auto;
  padding: var(--space-4) var(--space-4) var(--space-2);
  padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0px));
}
.logo {
  height: 44px;
  width: auto;               /* primary mark is not square — never stretch it */
  border-radius: var(--shape-md);
  flex-shrink: 0;
  background: #000;          /* mark's own black field blends into the dark theme */
}
.brand { min-width: 0; }
.wordmark {
  font-size: var(--ts-title-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -.01em;
  line-height: var(--lh-tight);
}
.tagline {
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
}
.noscript {
  max-width: var(--app-max);
  margin: var(--space-6) auto;
  padding: var(--space-4);
}

/* ---------- Brand wiring (assets/brand/) ----------
   logo-primary.jpg + logotype.jpg sit only on black/very-dark surfaces.
   Never stretched (auto on one axis), never recolored, never gradiented.
   Generous clear space around the marks. */

/* Hero lockup on the home tab: primary mark over the wordmark. */
.brand-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-4);
}
.brand-hero__mark { height: 96px; width: auto; }
.brand-hero__wordmark { width: min(260px, 70%); height: auto; }

/* Returning visitors (km:lion-intro already set) already saw the full
   lockup once during onboarding and see the mark+wordmark again in the
   persistent header — collapse to just the short welcome line so Home
   leads with content on every return visit, not brand art. */
.brand-hero--compact { padding-block: var(--space-4); }
.brand-hero--compact .brand-hero__mark,
.brand-hero--compact .brand-hero__wordmark,
.brand-hero--compact .brand-hero__character { display: none; }

/* Credits footer at the end of the page. */
.app-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  max-width: var(--app-max);
  margin-inline: auto;
  padding: var(--space-8) var(--space-4);
  background: var(--surface-container-lowest);
  border-top: 1px solid var(--line);
  text-align: center;
}
.app-credits__mark { height: 40px; width: auto; }
.app-credits__wordmark { width: 120px; height: auto; }
.app-credits__text { font-size: var(--ts-body-sm); color: var(--on-surface-variant); }

/* ---------- Track rows (Spotify clarity) ----------
   64px rows, 56px rounded artwork, two-line title/artist,
   right-side actions. */
.track-list { display: flex; flex-direction: column; gap: 2px; }

.track-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: var(--space-2);
  border-radius: var(--shape-md);
  transition: background-color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.track-row:hover { background: color-mix(in srgb, var(--on-surface) var(--state-hover), transparent); }
.track-row:active { background: color-mix(in srgb, var(--on-surface) var(--state-pressed), transparent); }
.track-row-sm { min-height: 56px; }

.track-row__meta, .track-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.track-row__title, .track-title {
  font-size: var(--ts-body-lg);
  font-weight: var(--weight-medium);
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-row__artist, .track-artist, .track-sub {
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-row__badge { flex-shrink: 0; }
.track-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ---------- Cover art ----------
   Tonal gradient keyed to --hue; soft sheen, no neon. */
.cover {
  --hue: 42;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--shape-md);
  background:
    linear-gradient(135deg,
      hsl(var(--hue), 42%, 34%),
      hsl(calc(var(--hue) + 40), 38%, 22%));
  position: relative;
  overflow: hidden;
}
.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .16), transparent 55%);
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cg stroke='rgba(0,0,0,.4)' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M10 28v0M18 20v16M26 12v32M34 18v20M42 24v8'/%3E%3C/g%3E%3C/svg%3E");
}
.cover-sm { width: 48px; height: 48px; }
.cover-lg, .cover--lg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--shape-xl);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--ts-label-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: .04em;
  padding: 4px 8px;
  border-radius: var(--shape-sm);
  background: var(--surface-container-highest);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  white-space: nowrap;
}
.badge[data-source="spotify"]    { color: #7de2a3; border-color: color-mix(in srgb, var(--spotify) 45%, transparent);    background: color-mix(in srgb, var(--spotify) 14%, transparent); }
.badge[data-source="apple"]      { color: #ff9aa6; border-color: color-mix(in srgb, var(--apple) 45%, transparent);      background: color-mix(in srgb, var(--apple) 14%, transparent); }
.badge[data-source="youtube"]    { color: #ff8a8a; border-color: color-mix(in srgb, var(--youtube) 45%, transparent);    background: color-mix(in srgb, var(--youtube) 14%, transparent); }
.badge[data-source="soundcloud"] { color: #ffb287; border-color: color-mix(in srgb, var(--soundcloud) 45%, transparent); background: color-mix(in srgb, var(--soundcloud) 14%, transparent); }
.badge[data-source="local"]      { color: #cdbcfb; border-color: color-mix(in srgb, var(--local) 45%, transparent);      background: color-mix(in srgb, var(--local) 14%, transparent); }

/* ---------- Navigation bar (M3, fixed bottom) ----------
   80px bar, 6 destinations, active-indicator pill.
   Bottom-bar GEOMETRY lives only below 600px: layout.css is the single
   source of truth for #tabbar geometry at >=600px (navigation rail), so
   nothing here may set inset/right/max-width or auto margins outside
   the mobile media query. */
#tabbar, .tabbar {
  position: fixed;
  z-index: 50;
  background: var(--surface-container);
  border-top: 1px solid var(--outline-variant);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* --- Mobile (<600px): bottom-bar geometry --- */
@media (max-width: 599px) {
  #tabbar, .tabbar {
    inset: auto 0 0 0;
  }
  #tabbar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    max-width: var(--app-max);
    margin-inline: auto;
  }
}
.tabbar__inner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  max-width: var(--app-max);
  margin-inline: auto;
  min-height: var(--tabbar-height);
}
/* (Desktop #tabbar geometry is owned by layout.css; the mobile
   bottom-bar geometry lives in the <600px media query above.) */
#tabbar [data-tab], .tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: var(--space-2) 0 var(--space-3);
  color: var(--on-surface-variant);
  font-size: var(--ts-label-md);
  font-weight: var(--weight-medium);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease);
}
#tabbar [data-tab] svg, .tab svg {
  width: 24px;
  height: 24px;
  /* M3 active-indicator pill: 56×32 via content-box padding. */
  padding: 4px 16px;
  box-sizing: content-box;
  border-radius: var(--shape-full);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
#tabbar [data-tab]:hover, .tab:hover {
  color: var(--on-surface);
}
#tabbar [data-tab].active, .tab.active {
  color: var(--primary);
}
#tabbar [data-tab].active svg, .tab.active svg {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
}
#tabbar [data-tab]:active, .tab:active {
  background: color-mix(in srgb, var(--on-surface) var(--state-pressed), transparent);
}

/* ---------- Snackbar / toast (M3) ----------
   Inverse-surface container; visibility is driven by .show. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-bar-h, 64px) + env(safe-area-inset-bottom, 0px) + var(--space-4));
  transform: translate(-50%, 8px);
  z-index: 100;
  display: flex;
  align-items: center;
  max-width: min(92vw, 480px);
  min-height: 48px;
  background: #ece5d3; /* M3 inverse surface (dark theme) */
  color: #201a08;
  border-radius: var(--shape-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--ts-body-md);
  box-shadow: var(--elevation-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.toast[hidden] { display: none; }

/* ---------- Tip bar (LionDavid tip, dismissible) ---------- */
.tip-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-left: 3px solid var(--primary);
  border-radius: var(--shape-md);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}
.tip-bar[hidden] { display: none; }
.lion-tip-msg {
  flex: 1;
  min-width: 0;
  font-size: var(--ts-body-md);
  color: var(--on-surface);
}
.lion-tip-x {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--on-surface-variant);
  font-size: 1.25rem;
  line-height: 1;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.lion-tip-x:hover {
  background: color-mix(in srgb, var(--on-surface) var(--state-hover), transparent);
  color: var(--on-surface);
}
/* Legacy tip-bar children (kept working). */
.tip-bar__mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: var(--weight-bold);
}
.tip-bar__text { flex: 1; font-size: var(--ts-body-md); }
.tip-bar__text strong { color: var(--on-primary-container); }
.tip-bar__dismiss { color: var(--on-surface-variant); font-size: 1.125rem; line-height: 1; padding: var(--space-1); }
.tip-bar__dismiss:hover { color: var(--on-surface); }

/* ---------- Switch (M3) ----------
   DOM: <label class="switch"><input type="checkbox"><span></span></label>
   Track 52×32; thumb 16px off / 24px on. Label is a 48px touch target. */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.switch > span {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--shape-full);
  background: var(--surface-container-highest);
  border: 1px solid var(--outline);
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.switch > span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--outline);
  transform: translateY(-50%);
  transition: left var(--dur-fast) var(--ease), width var(--dur-fast) var(--ease),
              height var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.switch input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
}
.switch input:checked + span::after {
  left: calc(100% - 32px);
  width: 24px;
  height: 24px;
  background: var(--on-primary);
}
.switch input:hover + span::after {
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--on-surface) var(--state-hover), transparent);
}
.switch input:checked:hover + span::after {
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary) var(--state-hover), transparent);
}
.switch input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.switch input:disabled + span { opacity: .4; }

/* ---------- Range slider (M3) ----------
   4px track, orange active fill via --fill, 20px thumb. 48px touch height. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 48px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--shape-full);
  background: linear-gradient(to right,
    var(--primary) var(--fill, 50%),
    var(--surface-container-highest) var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  box-shadow: var(--elevation-1);
  transition: box-shadow var(--dur-fast) var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary) var(--state-hover), transparent);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--shape-full);
  background: var(--surface-container-highest);
}
input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: var(--shape-full);
  background: var(--primary);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  box-shadow: var(--elevation-1);
}

/* ---------- Switch / slider rows ----------
   56px M3 list-row rhythm: label left, control right. */
.switch-row, .slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 56px;
  padding-block: var(--space-2);
}
.switch-row > span:first-child,
.slider-row > span:first-child {
  flex: 1;
  min-width: 0;
  font-size: var(--ts-body-lg);
  color: var(--on-surface);
}
.slider-row input[type="range"] { flex: 1; min-width: 0; }
.slider-row output {
  min-width: 44px;
  text-align: right;
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
  font-variant-numeric: tabular-nums;
}

/* ---------- Section headers (Spotify generosity) ----------
   Title-large, generous 32/16 whitespace — no more cramped caps. */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-8) 0 var(--space-4);
  font-size: var(--ts-title-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -.01em;
  line-height: 1.25;
  color: var(--on-surface);
}
.section-title:first-child { margin-top: 0; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--on-surface-variant);
}
.empty-state__art {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  opacity: .6;
}
.empty-state p {
  font-size: var(--ts-body-md);
  max-width: 36ch;
  margin: var(--space-2) auto 0;
}
.empty {
  padding: var(--space-4) 0;
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
}
.hint {
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
  opacity: .8;
}
.status {
  min-height: 1.5em;
  margin: var(--space-2) 0;
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
}

/* ---------- Modal (M3 dialog, bottom-sheet on mobile) ----------
   DOM: <div class="modal show"><div class="modal-card card">… */
.modal, .modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: end center;
  background: rgba(4, 5, 9, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fadeIn var(--dur-med) var(--ease);
}
.modal.show { display: grid; }
.modal-overlay[hidden] { display: none; }
.modal-card, .onboarding__card {
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface-container-high);
  color: var(--on-surface);
  border: 1px solid transparent;
  border-radius: var(--shape-xl) var(--shape-xl) 0 0;
  padding: var(--space-6) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--elevation-3);
}
.modal.show .modal-card { animation: riseIn var(--dur-med) var(--ease); }
.modal-card .section-title { margin-top: 0; }
.modal-actions, .modal__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}
.modal__handle {
  width: 40px;
  height: 4px;
  border-radius: var(--shape-full);
  background: color-mix(in srgb, var(--on-surface) 22%, transparent);
  margin: 0 auto var(--space-4);
}
@media (min-width: 600px) {
  .modal, .modal-overlay { place-items: center; padding: var(--space-6); }
  .modal-card, .onboarding__card {
    border-radius: var(--shape-xl);
    max-width: 480px;
  }
}

/* ---------- Notice: honest simulated/mock disclaimer ----------
   Tonal orange container. Never hide it. */
.notice {
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-radius: var(--shape-md);
  padding: var(--space-4);
  font-size: var(--ts-body-md);
  color: var(--on-primary-container);
  margin-bottom: var(--space-4);
}
.notice strong { color: var(--on-primary-container); }
.notice p + p { margin-top: var(--space-2); }
/* Duplicate-mix warning variant — inherits .notice; hook kept for JS.
   Wraps the Combine button below the text in narrow mix-card columns
   instead of letting it overflow the card. */
.dup-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.dup-notice .btn { flex-shrink: 0; }

/* ---------- Form controls (M3 filled fields) ----------
   Note: input:not([type]) covers bare <input> elements, which
   default to the text state but don't match [type="text"]. */
select,
input[type="text"],
input:not([type]) {
  width: 100%;
  min-height: 56px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-container-highest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-md);
  padding: var(--space-3) var(--space-4);
  color: var(--on-surface);
  font-size: var(--ts-body-lg);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
select:hover,
input[type="text"]:hover,
input:not([type]):hover { border-color: var(--outline); }
select:focus,
input[type="text"]:focus,
input:not([type]):focus {
  border-color: var(--primary);
  outline: none;
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: "▾";
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--on-surface-variant);
  pointer-events: none;
}
.select-wrap select { padding-right: var(--space-10); }

/* ---------- Dividers ---------- */
.divider, hr {
  border: 0;
  border-top: 1px solid var(--outline-variant);
  margin-block: var(--space-4);
}

/* ---------- Brand ----------
   In-app brand system (web/assets/brand/BRAND.md).
   Marks sit on black/dark only; the --brand-accent variable tints
   chrome AROUND the artwork (rings, glows, selected states) — the
   artwork itself is never stretched, recolored, or gradient-washed. */

/* Section header mark (small, round, tasteful). */
.section-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Shared empty-state artwork (Library / Mixes / Search). */
.brand-empty__art {
  display: block;
  width: min(240px, 62%);
  height: auto;
  margin: 0 auto var(--space-4);
  border-radius: var(--shape-lg);
  border: 1px solid var(--outline-variant);
  background: #000;
}
.brand-empty__title {
  font-size: var(--ts-title-md);
  font-weight: var(--weight-semibold);
  color: var(--on-surface);
}

/* Now Playing placeholder artwork (nothing playing yet). */
.np-empty__art {
  display: block;
  width: min(200px, 52%);
  height: auto;
  margin: 0 auto var(--space-4);
  border-radius: var(--shape-xl);
  border: 1px solid var(--outline-variant);
  background: #000;
  box-shadow: var(--elevation-2);
}

/* LionDavid tip-bar bust mark. */
.tip-bar__bust {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
}

/* Brand picker tiles (radio-style). */
.brand-note {
  font-size: var(--ts-body-md);
  color: var(--on-surface-variant);
  margin-bottom: var(--space-2);
  max-width: 60ch;
}
.brand-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.brand-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-height: 48px;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--shape-lg);
  border: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  color: var(--on-surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.brand-tile img {
  width: 56px;
  height: 56px;
  border-radius: var(--shape-md);
}
.brand-tile__label {
  font-size: var(--ts-label-lg);
  font-weight: var(--weight-semibold);
}
.brand-tile__note {
  font-size: var(--ts-label-sm);
  color: var(--on-surface-variant);
}
.brand-tile:hover { border-color: var(--outline); }
.brand-tile[aria-checked="true"] {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 1px var(--brand-accent),
              0 0 14px color-mix(in srgb, var(--brand-accent) 35%, transparent);
  background: color-mix(in srgb, var(--brand-accent) 8%, var(--surface-container-low));
}
.brand-tile:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* Brand accent swatches (radio-style). */
.brand-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.brand-swatch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2);
  border-radius: var(--shape-full);
  border: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  color: var(--on-surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.brand-swatch__dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sw, var(--brand-accent));
  flex-shrink: 0;
}
.brand-swatch__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.brand-swatch__label {
  font-size: var(--ts-label-lg);
  font-weight: var(--weight-semibold);
}
.brand-swatch__note {
  font-size: var(--ts-label-sm);
  color: var(--on-surface-variant);
}
.brand-swatch:hover { border-color: var(--outline); }
.brand-swatch[aria-checked="true"] {
  border-color: var(--sw, var(--brand-accent));
  box-shadow: 0 0 0 1px var(--sw, var(--brand-accent));
}
.brand-swatch:focus-visible {
  outline: 2px solid var(--on-surface);
  outline-offset: 2px;
}

/* ---------- Brand icon gallery (GitHub-style variant picker) ----------
   Rows load from icons/variants/manifest.json at runtime. The selected
   row gets the brand-accent ring/glow; the accent tints chrome only,
   never the artwork itself. */
.brand-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.brand-sheet {
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-lg);
  overflow: hidden;
  background: #000;
}
.brand-sheet img {
  display: block;
  width: 100%;
  height: auto;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-lg);
  background: var(--surface-container-low);
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.brand-row__thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--shape-md);
  flex-shrink: 0;
  background: #000;
}
.brand-row__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.brand-row__name {
  font-size: var(--ts-label-lg);
  font-weight: var(--weight-semibold);
}
.brand-row__desc {
  font-size: var(--ts-label-sm);
  color: var(--on-surface-variant);
}
.brand-row__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  color: transparent;
  flex-shrink: 0;
}
.brand-row:hover { border-color: var(--outline); }
.brand-row[aria-checked="true"] {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 1px var(--brand-accent),
              0 0 14px color-mix(in srgb, var(--brand-accent) 35%, transparent);
  background: color-mix(in srgb, var(--brand-accent) 8%, var(--surface-container-low));
}
.brand-row[aria-checked="true"] .brand-row__check {
  border-color: var(--brand-accent);
  background: var(--brand-accent);
  color: #000;
}
.brand-row:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}
.brand-gallery__note {
  font-size: var(--ts-label-sm);
  color: var(--on-surface-variant);
  padding: var(--space-2) var(--space-1) 0;
}

/* ============================================================
   Declutter pass — info-tips, Labs accordion, LionDavid assistant
   ============================================================ */

/* ---------- ⓘ info button + popover ---------- */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  border-radius: var(--shape-full);
  border: 1px solid var(--outline-variant);
  background: transparent;
  color: var(--on-surface-variant);
  font-size: .72rem;
  font-style: italic;
  font-family: Georgia, serif;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  flex: none;
}
.info-btn:hover { color: var(--on-surface); border-color: var(--outline); }
.info-btn[aria-expanded="true"] {
  color: var(--on-primary-container);
  border-color: var(--primary);
  background: var(--primary-container);
}
.info-pop {
  position: fixed;
  z-index: 300;
  padding: var(--space-3);
  border-radius: var(--shape-md);
  background: var(--surface-container-high);
  border: 1px solid var(--line-strong);
  box-shadow: var(--elevation-3);
  color: var(--on-surface);
  font-size: var(--ts-body-md);
  line-height: var(--lh-body);
  animation: riseIn var(--dur-fast) var(--ease);
}

/* ---------- Labs (collapses the technique prototypes) ---------- */
.labs-card { padding: var(--space-4); }
.labs-head { display: flex; align-items: center; margin: 0 0 var(--space-1); }
.labs-head .section-title { margin: 0; }
.labs-sub { margin: 0 0 var(--space-3); color: var(--on-surface-variant); font-size: var(--ts-body-md); }
.labs-row {
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-md);
  margin-top: var(--space-2);
  background: var(--surface-container-low);
  overflow: hidden;
}
.labs-row > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  cursor: pointer;
  list-style: none;
  font-weight: var(--weight-medium);
}
.labs-row > summary::-webkit-details-marker { display: none; }
.labs-row > summary::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--on-surface-variant);
  border-bottom: 2px solid var(--on-surface-variant);
  transform: rotate(-45deg);
  transition: transform var(--dur-fast) var(--ease);
}
.labs-row[open] > summary::before { transform: rotate(45deg); }
.labs-row > summary .chip { margin-left: auto; }
.labs-row > summary .info-btn { margin-left: 0; }
.labs-body { padding: 0 var(--space-3) var(--space-3); border-top: 1px solid var(--outline-variant); }
.labs-body .tech-panel { border: 0; background: transparent; padding: var(--space-2) 0 0; margin: 0; }
.labs-body .tech-panel + .tech-panel { margin-top: 0; }

/* ---------- LionDavid assistant: FAB + sheet ---------- */
#lion-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-height) + 16px);
  z-index: 90;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: var(--shape-full);
  border: 2px solid var(--brand-accent, var(--primary));
  background: var(--surface-container-high);
  box-shadow: var(--elevation-3);
  cursor: pointer;
  overflow: hidden;
}
#lion-fab img { width: 100%; height: 100%; object-fit: cover; display: block; }
#lion-fab .fab-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: var(--shape-full);
  background: var(--primary);
  border: 2px solid var(--surface);
}
#lion-fab.attn { animation: fabNudge 1.6s var(--ease) 2; }
@keyframes fabNudge {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
  60% { transform: translateY(0); }
}
/* Lift above the player bar when it is visible. */
#player:not([hidden]) ~ #lion-fab { bottom: calc(var(--tabbar-height) + 96px + 16px); }
@media (min-width: 600px) {
  #lion-fab { bottom: 16px; }
  #player:not([hidden]) ~ #lion-fab { bottom: 112px; }
}
.lion-sheet { max-width: 420px; }
.lion-sheet__head { display: flex; align-items: center; gap: var(--space-3); }
.lion-sheet__head img { width: 56px; height: 56px; border-radius: var(--shape-full); object-fit: cover; }
.lion-sheet__head h3 { margin: 0; font-size: var(--ts-title-md); }
.lion-sheet__head p { margin: 2px 0 0; color: var(--on-surface-variant); font-size: var(--ts-body-md); }
.lion-sheet__tip {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border-radius: var(--shape-md);
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  font-size: var(--ts-body-md);
  min-height: 3.2em;
}
.lion-sheet__links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* Slim LionDavid strip on Home (replaces the old intro card). */
.lion-strip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--shape-lg);
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  margin-bottom: var(--space-4);
}
.lion-strip img { width: 44px; height: 44px; border-radius: var(--shape-full); object-fit: cover; flex: none; }
.lion-strip__text { flex: 1; min-width: 0; }
.lion-strip__text strong { display: block; font-size: var(--ts-title-sm); }
.lion-strip__text span { color: var(--on-surface-variant); font-size: var(--ts-body-md); }

/* ---------- Sources rows: less chrome per row ---------- */
.source-row .track-meta { min-width: 0; }
.source-row .btn-ghost { padding: 6px 8px; }
.src-blurb { display: none; } /* blurb now lives behind the ⓘ next to the tier chip */
