/* Music Home — personalized dense directory */
.sd-music-home {
  --mh-bg: #0b0d12;
  --mh-panel: #12151c;
  --mh-text: #e8eaef;
  --mh-muted: #9aa3b2;
  --mh-accent: #3b82f6;
  --mh-line: rgba(255, 255, 255, 0.08);
  color: var(--mh-text);
  font: 500 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  contain: layout style;
}
.sd-music-home * { box-sizing: border-box; }
.sd-music-home .mh-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 2px;
  flex-shrink: 0;
}
.sd-music-home .mh-title { font-size: 16px; font-weight: 700; letter-spacing: 0.01em; }
.sd-music-home .mh-sub { color: var(--mh-muted); font-size: 11px; font-weight: 500; }
.sd-music-home .mh-body {
  flex: 1 1 auto; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  contain: layout style;
  padding-bottom: 12px;
  /* One clear vertical scroller — avoid paint thrash while scrolling */
  background: transparent;
}
.sd-music-home .mh-loading,
.sd-music-home .mh-empty,
.sd-music-home .mh-err {
  padding: 24px 16px; color: var(--mh-muted); font-size: 13px;
}
.sd-music-home .mh-hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  margin: 4px 12px 14px;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,.28), rgba(18,21,28,.95) 55%);
  border: 1px solid var(--mh-line);
  cursor: pointer;
}
.sd-music-home .mh-hero-art,
.sd-music-home .mh-hero-art.mh-fallback {
  width: 112px; height: 112px; border-radius: 12px; object-fit: cover;
  background: #1a1f2a; display: block;
}
.sd-music-home .mh-hero-kicker {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--mh-muted); font-weight: 700; margin-bottom: 4px;
}
.sd-music-home .mh-hero-title {
  font-size: 17px; font-weight: 800; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sd-music-home .mh-hero-sub {
  color: var(--mh-muted); font-size: 12px; margin: 4px 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sd-music-home .mh-hero-play {
  appearance: none; border: 0; border-radius: 999px;
  background: #fff; color: #0b0d12; font: 700 13px/1 inherit;
  padding: 8px 16px; cursor: pointer; min-height: 36px;
}
.sd-music-home .mh-section { padding: 2px 0 12px; overflow: hidden; }
.sd-music-home .mh-section h3 {
  margin: 0 0 8px; padding: 0 12px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--mh-muted); font-weight: 700;
}
.sd-music-home .mh-scroll {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; overscroll-behavior-y: none;
  touch-action: none; /* axis-lock owns gestures; never bubble to pull-refresh */
  contain: layout style;
  scrollbar-width: none; display: flex; gap: 10px; padding: 2px 12px 6px;
  scroll-snap-type: x proximity;
  scroll-behavior: auto;
}
.sd-music-home .mh-scroll::-webkit-scrollbar { display: none; }
.sd-music-home .mh-card {
  flex: 0 0 auto; scroll-snap-align: start;
  width: 118px; border: 0; background: transparent; color: inherit;
  text-align: left; cursor: pointer; padding: 0; touch-action: manipulation;
  position: relative;
}
.sd-music-home .mh-section.dense .mh-card { width: 96px; }
.sd-music-home .mh-card-art-wrap .art,
.sd-music-home .mh-card .art,
.sd-music-home .mh-card .art.mh-fallback {
  width: 118px; height: 118px; border-radius: 12px; object-fit: cover;
  background: #1a1f2a; display: block;
}
.sd-music-home .mh-section.dense .mh-card-art-wrap .art,
.sd-music-home .mh-section.dense .mh-card .art,
.sd-music-home .mh-section.dense .mh-card .art.mh-fallback {
  width: 96px; height: 96px; border-radius: 10px;
}
.sd-music-home .mh-card.radio .art,
.sd-music-home .mh-card.artist .art,
.sd-music-home .mh-card.radio .mh-card-art-wrap .art,
.sd-music-home .mh-card.artist .mh-card-art-wrap .art { border-radius: 50%; }
.sd-music-home .mh-card .n {
  display: block; margin-top: 6px; font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sd-music-home .mh-card .c {
  display: block; color: var(--mh-muted); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sd-music-home .mh-jumps {
  display: flex; gap: 8px; padding: 4px 12px 16px;
}
.sd-music-home .mh-jumps button {
  flex: 1; min-height: 40px; border: 1px solid var(--mh-line); border-radius: 12px;
  background: var(--mh-panel); color: var(--mh-text); font: 600 13px/1 inherit; cursor: pointer;
}
.sd-music-home .mh-artists {
  margin: 2px 0 4px;
  padding-top: 6px;
  border-top: 1px solid var(--mh-line);
  background: linear-gradient(180deg, rgba(59,130,246,.06), transparent 56px);
}
.sd-music-home .mh-artists h3 { margin-bottom: 6px; }
.sd-music-home .mh-sec-tools {
  display: flex; justify-content: flex-end; padding: 0 12px 6px;
}
.sd-music-home .mh-sec-tools .ml-see-all {
  appearance: none; border: 0; background: transparent;
  color: #93c5fd; font: 600 12px/1 inherit; cursor: pointer;
  min-height: 40px; min-width: 44px;
  padding: 10px 8px; margin: -10px -4px;
  display: inline-flex; align-items: center; justify-content: flex-end;
  touch-action: manipulation;
}
.sd-music-home .mh-radio {
  margin: 2px 0 4px;
  padding-top: 6px;
  border-top: 1px solid var(--mh-line);
  background: linear-gradient(180deg, rgba(16,185,129,.05), transparent 56px);
}
.sd-music-home .mh-radio h3 { margin-bottom: 6px; }
.sd-music-home .mh-library {
  margin: 2px 0 4px;
  padding-top: 6px;
  border-top: 1px solid var(--mh-line);
  background: linear-gradient(180deg, rgba(59,130,246,.06), transparent 56px);
}
.sd-music-home .mh-library h3 { margin-bottom: 6px; }

/* Compact Library strip — Spotify/Apple-style 2×N entry */
.sd-music-home .mh-lib-strip {
  margin: 2px 0 8px;
  padding-top: 2px;
  border-top: 0;
  background: transparent;
}
.sd-music-home .mh-lib-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 6px;
}
.sd-music-home .mh-lib-strip-head h3 {
  margin: 0;
  padding: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #93c5fd;
  font-weight: 700;
}
.sd-music-home .mh-lib-strip-head .ml-see-all {
  appearance: none;
  border: 0;
  background: transparent;
  color: #93c5fd;
  font: 600 12px/1 inherit;
  cursor: pointer;
  min-height: 40px;
  min-width: 44px;
  padding: 10px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  touch-action: manipulation;
}
.sd-music-home .mh-lib-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 8px;
}
.sd-music-home .mh-lib-tile {
  appearance: none;
  border: 1px solid var(--mh-line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,.05), rgba(18,21,28,.92));
  color: var(--mh-text);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.sd-music-home .mh-lib-tile:hover,
.sd-music-home .mh-lib-tile:focus-visible {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  outline: none;
}
.sd-music-home .mh-lib-tile-ico {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.22);
  position: relative;
}
.sd-music-home .mh-lib-tile-ico::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 2px;
  background: #93c5fd;
  opacity: 0.9;
}
.sd-music-home .mh-lib-tile.tone-liked .mh-lib-tile-ico {
  background: rgba(248, 113, 113, 0.2);
}
.sd-music-home .mh-lib-tile.tone-liked .mh-lib-tile-ico::after {
  inset: 11px;
  border-radius: 50%;
  background: #f87171;
}
.sd-music-home .mh-lib-tile.tone-playlists .mh-lib-tile-ico {
  background: rgba(52, 211, 153, 0.18);
}
.sd-music-home .mh-lib-tile.tone-playlists .mh-lib-tile-ico::after {
  background: #6ee7b7;
  border-radius: 1px;
  box-shadow: 0 -5px 0 #6ee7b7, 0 5px 0 #6ee7b7;
  inset: 16px 10px;
  height: 2px;
  width: auto;
  top: 17px;
  bottom: auto;
  left: 10px;
  right: 10px;
}
.sd-music-home .mh-lib-tile.tone-artists .mh-lib-tile-ico {
  background: rgba(167, 139, 250, 0.2);
}
.sd-music-home .mh-lib-tile.tone-artists .mh-lib-tile-ico::after {
  inset: 9px 11px 15px;
  border-radius: 50%;
  background: #c4b5fd;
  box-shadow: 0 14px 0 -2px #c4b5fd;
}
.sd-music-home .mh-lib-tile.tone-albums .mh-lib-tile-ico {
  background: rgba(96, 165, 250, 0.2);
}
.sd-music-home .mh-lib-tile.tone-albums .mh-lib-tile-ico::after {
  inset: 8px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid #93c5fd;
  box-shadow: inset 0 0 0 5px transparent;
}
.sd-music-home .mh-lib-tile.tone-saved .mh-lib-tile-ico {
  background: rgba(251, 191, 36, 0.16);
}
.sd-music-home .mh-lib-tile.tone-saved .mh-lib-tile-ico::after {
  inset: 10px 12px 8px;
  border-radius: 2px 2px 3px 3px;
  background: #fbbf24;
}
.sd-music-home .mh-lib-tile-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sd-music-home .mh-lib-tile-meta .n {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-music-home .mh-lib-tile-meta .c {
  color: var(--mh-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 720px) {
  .sd-music-home .mh-lib-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .sd-music-home .mh-lib-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.sd-music-home .mh-seg {
  display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; overscroll-behavior-y: none;
  touch-action: pan-x;
  scrollbar-width: none; padding: 0 12px 8px; scroll-snap-type: x proximity;
}
.sd-music-home .mh-seg::-webkit-scrollbar { display: none; }
.sd-music-home .mh-seg-btn {
  flex: 0 0 auto; scroll-snap-align: start;
  appearance: none; border: 1px solid var(--mh-line); border-radius: 999px;
  background: transparent; color: var(--mh-muted);
  font: 600 11px/1 inherit; padding: 7px 11px; min-height: 30px; cursor: pointer;
}
.sd-music-home .mh-seg-btn.on {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.55);
  color: var(--mh-text);
}
.sd-music-home .mh-section.mh-compact { opacity: 0.9; }
.sd-music-home .mh-section.mh-compact .mh-card { width: 96px; }
.sd-music-home .mh-section.mh-compact .mh-card .art { width: 96px; height: 96px; }
.sd-music-home .mh-section.mh-primary h3 {
  color: var(--mh-text);
  font-size: 13px;
}
.sd-music-home[data-mh-focus="station"] .mh-section[data-mh-focus="featured"],
.sd-music-home[data-mh-focus="station"] .mh-section[data-mh-focus="moods"] {
  display: none;
}
.sd-music-home[data-mh-focus="artist"] .mh-artists {
  border-top: 0;
  margin-top: 0;
}
.sd-music-home[data-mh-focus="station"] .mh-radio {
  border-top: 0;
  margin-top: 0;
  background: linear-gradient(180deg, rgba(16,185,129,.08), transparent 64px);
}
.sd-music-home[data-mh-focus="track"] .mh-library,
.sd-music-home[data-mh-focus="all"] .mh-library.mh-primary {
  border-top-color: rgba(59, 130, 246, 0.18);
}
@media (max-width: 380px) {
  .sd-music-home .mh-hero { grid-template-columns: 96px 1fr; }
  .sd-music-home .mh-hero-art { width: 96px; height: 96px; }
  .sd-music-home .mh-card { width: 104px; }
  .sd-music-home .mh-card .art,
  .sd-music-home .mh-card-art-wrap .art { width: 104px; height: 104px; }
  .sd-music-home .mh-seg-btn { padding: 6px 10px; font-size: 10px; }
}

/* Wide Home: denser multi-shelf grids */
@media (min-width: 900px) and (orientation: landscape), (min-width: 1100px) {
  .sd-music-home .mh-card { width: 132px; }
  .sd-music-home .mh-card .art,
  .sd-music-home .mh-card-art-wrap .art { width: 132px; height: 132px; }
  .sd-music-home .mh-hero {
    grid-template-columns: 140px 1fr;
    max-width: 720px;
  }
  .sd-music-home .mh-hero-art { width: 140px; height: 140px; }
}
