/* AtomicBlast — iPhone / mobile overrides */
/* NOTE: This file is injected LAST in <head>, after the inline <style> block,
   so same-specificity rules here win over the inline CSS. */

html.is-ios-webkit,
html.is-ios-webkit body {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

html.is-ios-webkit body {
  min-height: 100dvh;
  overflow: hidden !important;
  touch-action: manipulation;
}

html.is-ios-webkit .main,
html.is-ios-webkit .music-layout {
  min-height: 0 !important;
}

/* ── Sidebar toggle button — hidden on desktop ───────────────────────── */
#sidebar-toggle-btn { display: none; }
#sidebar-overlay    { display: none; }

/* ── Hide desktop-only status bar on mobile ──────────────────────────── */
.status-bar { display: none !important; }

/* ── Mini player stays floating on iPhone ────────────────────────────── */
#player-bar {
  bottom: max(10px, calc(env(safe-area-inset-bottom) + 8px)) !important;
  left: 10px !important;
  right: 10px !important;
  height: auto !important;
  min-height: 74px !important;
  padding: 10px 12px !important;
  padding-bottom: 10px !important;
  gap: 6px !important;
  border-radius: 22px !important;
  box-shadow: 0 16px 40px rgba(0,0,0,0.42) !important;
}

/* ── Safe areas for notch / Dynamic Island ──────────────────────────── */
.topnav {
  padding-top: max(env(safe-area-inset-top), 0px) !important;
  height: auto !important;
  min-height: calc(60px + env(safe-area-inset-top)) !important;
  align-items: flex-end !important;
  padding-bottom: 8px !important;
}

/* ── Contain momentum scroll — stops the loose rubber-band overscroll ── */
.music-content, .main-body, #queue-list, .music-tree {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

html.is-ios-webkit body.player-bar-active #main-content,
html.is-ios-webkit body.player-bar-active .music-content,
html.is-ios-webkit body.player-bar-active #music-content-inner {
  padding-bottom: calc(116px + env(safe-area-inset-bottom)) !important;
}

/* Safari/iOS can mis-measure cards and rows when content-visibility is used.
   Turning it off there keeps the library tiles and tracks consistently sized. */
html.is-ios-webkit .lib-card,
html.is-ios-webkit .lib-track-row {
  content-visibility: visible !important;
  contain-intrinsic-size: auto !important;
}

.lib-card,
.lib-card-info,
.lib-card-name,
.lib-card-sub,
.stacked-art,
.stacked-art .stacked-front,
.stacked-art .stacked-back {
  min-width: 0;
}

html, body,
.music-content, .main-body, #queue-list, .music-tree {
  scroll-snap-type: none !important;
  scroll-padding: 0 !important;
}

.lib-card,
.music-track-row,
.lib-track-row,
.queue-item,
.cloud-item,
.fav-row,
.music-tree-item,
.lib-header,
.music-album-header,
.lib-section-header,
.lib-breadcrumb {
  scroll-snap-align: none !important;
  scroll-snap-stop: normal !important;
}

/* ── Prevent tap highlight / text selection on controls ─────────────── */
button, .nav-item, .music-track-row, .music-tree-item,
.lib-track-row, .album-tile, .artist-tile, .cloud-item,
.queue-item, .ctx-item {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Keep the queue drawer out of sight on startup. It should only appear after
   playback has created the mini player and the user opens Up Next. */
#queue-panel {
  display: none !important;
}

body.player-bar-active.queue-open #queue-panel {
  display: flex !important;
}

/* ── Streaming-style B2 home / library polish ───────────────────────── */
.b2-home {
  min-height: 100%;
  padding: 18px 22px 116px;
  background:
    radial-gradient(circle at 18% 0%, rgba(81, 214, 132, 0.24), transparent 34%),
    radial-gradient(circle at 92% 10%, rgba(16, 185, 129, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(19, 34, 22, 0.92), #070a08 42%, #050706 100%);
}

.b2-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 255, 185, 0.13);
  border-radius: 32px;
  padding: 26px;
  min-height: 248px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 24px;
  align-items: end;
  background:
    linear-gradient(135deg, rgba(83, 235, 134, 0.18), rgba(8, 14, 10, 0.94) 50%),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.13), transparent 30%);
  box-shadow: 0 24px 70px rgba(0,0,0,0.48), inset 0 1px 0 rgba(255,255,255,0.06);
}

.b2-hero::before {
  content: '';
  position: absolute;
  inset: auto -8% -34% 42%;
  height: 82%;
  background: radial-gradient(circle, rgba(74,222,128,0.28), transparent 66%);
  filter: blur(18px);
  pointer-events: none;
}

.b2-eyebrow,
.b2-section-kicker {
  color: #7ef2a6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.b2-hero h1 {
  margin: 10px 0 8px;
  color: #fff;
  font-size: clamp(36px, 7vw, 76px);
  line-height: .88;
  letter-spacing: -.07em;
  max-width: 740px;
}

.b2-hero-sub {
  color: #aab7ac;
  max-width: 620px;
  font-size: 14px;
  line-height: 1.55;
}

.b2-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.b2-primary-btn,
.b2-ghost-btn,
.b2-pill-btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 850;
  -webkit-tap-highlight-color: transparent;
}

.b2-primary-btn {
  color: #06100a;
  background: linear-gradient(180deg, #77f4a4, #32d66e);
  padding: 12px 22px;
  box-shadow: 0 14px 32px rgba(74,222,128,0.24);
}

.b2-ghost-btn {
  color: #e7f0e9;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  padding: 12px 18px;
  backdrop-filter: blur(14px);
}

.b2-hero-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  transform: rotate(-2deg);
}

.b2-cover-tile {
  aspect-ratio: 1;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #152117, #0b110c);
  box-shadow: 0 18px 38px rgba(0,0,0,0.36);
  border: 1px solid rgba(255,255,255,0.07);
}

.b2-cover-tile:nth-child(2) { transform: translateY(28px) rotate(4deg); }
.b2-cover-tile:nth-child(3) { transform: translateY(-8px) rotate(6deg); }
.b2-cover-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.b2-cover-ph { width:100%; height:100%; display:flex; align-items:center; justify-content:center; color:#2b5f35; font-size:42px; font-weight:900; }

.b2-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 20px;
}

.b2-stat-card {
  border-radius: 22px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.b2-stat-num { color:#fff; font-size:24px; font-weight:900; letter-spacing:-.04em; }
.b2-stat-label { color:#738075; font-size:11px; margin-top:2px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; }

.b2-edition-section {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.075);
  margin: 14px 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(168px, .34fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  box-shadow: 0 22px 54px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.035);
}

.b2-edition-vinyl {
  background:
    radial-gradient(circle at 14% 22%, rgba(255, 178, 86, .18), transparent 34%),
    linear-gradient(135deg, rgba(43, 30, 17, .94), rgba(8, 12, 10, .96) 58%);
}

.b2-edition-cd {
  background:
    radial-gradient(circle at 18% 18%, rgba(170, 222, 255, .16), transparent 32%),
    linear-gradient(135deg, rgba(20, 32, 42, .95), rgba(8, 12, 10, .96) 58%);
}

.b2-edition-cassette {
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 210, 122, .15), transparent 34%),
    linear-gradient(135deg, rgba(42, 31, 22, .95), rgba(8, 12, 10, .96) 58%);
}

.b2-edition-dat,
.b2-edition-minidisc {
  background:
    radial-gradient(circle at 18% 18%, rgba(116, 214, 255, .14), transparent 32%),
    linear-gradient(135deg, rgba(18, 31, 39, .95), rgba(8, 12, 10, .96) 58%);
}

.b2-edition-reel {
  background:
    radial-gradient(circle at 16% 18%, rgba(230, 177, 111, .15), transparent 34%),
    linear-gradient(135deg, rgba(38, 27, 20, .95), rgba(8, 12, 10, .96) 58%);
}

.b2-edition-sacd,
.b2-edition-dvd {
  background:
    radial-gradient(circle at 18% 18%, rgba(191, 241, 255, .16), transparent 32%),
    linear-gradient(135deg, rgba(22, 29, 42, .95), rgba(8, 12, 10, .96) 58%);
}

.b2-edition-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.b2-edition-copy h2 {
  color: #fff;
  font-size: clamp(24px, 3vw, 38px);
  line-height: .95;
  letter-spacing: -.055em;
  margin-top: 8px;
}

.b2-edition-copy p {
  color: #9ba89d;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 10px;
}

.b2-edition-wall {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 174px);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.b2-edition-wall::-webkit-scrollbar { display: none; }

.b2-edition-card {
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.085) !important;
  border-radius: 24px !important;
  padding: 10px !important;
  backdrop-filter: blur(12px);
}

.b2-edition-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  color: #071009;
  background: #b9ffc9;
  border-radius: 999px;
  padding: 5px 8px 4px;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .09em;
  box-shadow: 0 8px 18px rgba(0,0,0,.24);
}

.b2-edition-art {
  position: relative;
  overflow: visible !important;
  border-radius: 18px !important;
  background: transparent !important;
  z-index: 1;
  display: block;
}

.b2-edition-art img,
.b2-edition-art .lib-card-initial {
  position: relative;
  z-index: 2;
  width: 86% !important;
  height: 86% !important;
  margin: 7%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(0,0,0,.34);
}

.b2-edition-art .lib-card-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #152117, #0b110c);
}

/* Sleeve — LP jacket showing artwork, positioned left */
.edition-vinyl .b2-edition-art img,
.edition-vinyl .b2-edition-art .lib-card-initial {
  width: 65% !important;
  height: 90% !important;
  margin: 5% 0 5% 4%;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 20px 42px rgba(0,0,0,.55);
  z-index: 2;
}

/* Vinyl record — half tucked inside sleeve, half emerging from right */
.edition-vinyl .b2-edition-art::before {
  content: '';
  position: absolute;
  /* inset chosen so element is ~82%×82% of container → perfect circle */
  inset: 9% -10% 9% 28%;
  border-radius: 999px;
  background:
    /* highlight sheen — top-left */
    radial-gradient(ellipse at 30% 34%, rgba(255,255,255,.10) 0%, transparent 52%),
    /* label: spindle hole, inner ring, label body, label edge, lead-in groove */
    radial-gradient(circle,
      #080808 0 2.5%,
      #c89040 2.5% 5%,
      #d4a452 5%   22%,
      #a86e28 22%  24%,
      #1a1a1a 24%  26%,
      transparent  26%
    ),
    repeating-radial-gradient(circle,
      #060606 0 2px, #191919 2.5px 5px, #0a0a0a 5.5px 7.5px
    );
  box-shadow:
    -7px 0 18px rgba(0,0,0,.6),   /* shadow cast onto the sleeve face */
    0 18px 38px rgba(0,0,0,.52),
    inset 0 0 0 1px rgba(255,255,255,.025);
  z-index: 0;
}

/* Sleeve gloss + right-edge shadow where record exits */
.edition-vinyl .b2-edition-art::after {
  content: '';
  position: absolute;
  /* covers the same area as the sleeve artwork */
  inset: 5% 31% 5% 4%;
  border-radius: 2px;
  background:
    /* top-left source light */
    linear-gradient(128deg, rgba(255,255,255,.22) 0%, transparent 42%),
    /* right-edge darkening — the opening where the record slides out */
    linear-gradient(270deg, rgba(0,0,0,.32) 0%, transparent 22%),
    /* bottom darkening */
    linear-gradient(180deg, transparent 55%, rgba(0,0,0,.14));
  border: 1px solid rgba(255,255,255,.13);
  /* inner-right shadow — depth at the opening edge */
  box-shadow: inset -4px 0 10px rgba(0,0,0,.30);
  pointer-events: none;
  z-index: 3;
}

/* Cassette tape body — square card = cassette face front-on */
.edition-cassette .b2-edition-art {
  background: linear-gradient(160deg, #26272e 0%, #17181d 100%) !important;
  border-radius: 10px !important;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.14),
    inset 0 -2px 0 rgba(0,0,0,.6),
    inset 0 0 0 2px rgba(255,255,255,.06),
    0 20px 40px rgba(0,0,0,.58) !important;
}

/* Artwork label — upper portion of cassette face */
.edition-cassette .b2-edition-art img,
.edition-cassette .b2-edition-art .lib-card-initial {
  width: 80% !important;
  height: 44% !important;
  margin: 7% 10% 0;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(0,0,0,.5);
  z-index: 2;
}

/* Two reel windows — lower half of cassette face */
.edition-cassette .b2-edition-art::before {
  content: '';
  position: absolute;
  inset: 54% 6% 6%;
  border-radius: 5px 5px 8px 8px;
  background:
    /* Left reel hub: spindle, hub ring, reel body */
    radial-gradient(circle at 27% 50%,
      #080808 0% 16%,
      #c8a048 16% 25%,
      #1a1a1a 25% 34%,
      rgba(0,0,0,.55) 34% 52%,
      #232323 52% 100%
    ),
    /* Right reel hub */
    radial-gradient(circle at 73% 50%,
      #080808 0% 16%,
      #c8a048 16% 25%,
      #1a1a1a 25% 34%,
      rgba(0,0,0,.55) 34% 52%,
      #232323 52% 100%
    ),
    /* Tape head window — center bridge */
    linear-gradient(90deg,
      transparent 0% 40%,
      #0d0d0d 40% 60%,
      transparent 60% 100%
    ),
    /* Side alignment post highlights */
    linear-gradient(90deg,
      rgba(255,255,255,.12) 0% 3%,
      transparent 3% 97%,
      rgba(255,255,255,.12) 97% 100%
    ),
    linear-gradient(180deg, #232328 0%, #151518 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 3px 10px rgba(0,0,0,.4);
  z-index: 1;
}

/* Gloss + surface reflection across the whole cassette face */
.edition-cassette .b2-edition-art::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 20% 18%, rgba(255,255,255,.18) 0%, transparent 48%),
    linear-gradient(130deg, rgba(255,255,255,.10) 0%, transparent 45%);
  border: 1px solid rgba(255,255,255,.09);
  pointer-events: none;
  z-index: 4;
}

.edition-dat .b2-edition-art::before {
  content: '';
  position: absolute;
  inset: 15% 1% 16% 25%;
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.18), transparent 22%, transparent 78%, rgba(255,255,255,.12)),
    linear-gradient(135deg, #111e26, #65c7ec 48%, #d9f7ff 52%, #17232a);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.08), 0 14px 28px rgba(0,0,0,.28);
  z-index: 0;
}

.edition-minidisc .b2-edition-art::before {
  content: '';
  position: absolute;
  inset: 10% 0 10% 22%;
  border-radius: 16px;
  background:
    linear-gradient(90deg, transparent 0 16%, rgba(255,255,255,.24) 17% 31%, transparent 32%),
    linear-gradient(135deg, #21303a, #9ee7ff 48%, #edf9ff 52%, #182329);
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.08), 0 14px 28px rgba(0,0,0,.28);
  z-index: 0;
}

.edition-reel .b2-edition-art::before {
  content: '';
  position: absolute;
  inset: 8% -2% 8% 22%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 36% 36%, transparent 0 8%, #c9a16a 9% 13%, transparent 14%),
    radial-gradient(circle at 63% 35%, transparent 0 8%, #c9a16a 9% 13%, transparent 14%),
    radial-gradient(circle at 50% 66%, transparent 0 8%, #c9a16a 9% 13%, transparent 14%),
    radial-gradient(circle, #111 0 9%, #b88952 10% 18%, #181818 19% 100%);
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.025), 0 14px 28px rgba(0,0,0,.34);
  z-index: 0;
}

/* ── CD jewel case — closed front view ───────────────────────────────────────
   Layout: thin spine on left, booklet artwork fills the front face,
   clear polycarbonate panel sits over everything.                            */

.edition-cd .b2-edition-art,
.edition-sacd .b2-edition-art,
.edition-dvd .b2-edition-art {
  border-radius: 6px !important;
  background:
    /* Spine — dark plastic strip on left */
    linear-gradient(90deg,
      #0e0f13 0% 9%,
      rgba(255,255,255,.10) 9% 10.5%,
      transparent 10.5%
    ),
    /* Top locking ridge */
    linear-gradient(180deg,
      #191a20 0% 5%,
      rgba(255,255,255,.08) 5% 6.5%,
      transparent 7%
    ),
    /* Bottom locking ridge */
    linear-gradient(0deg,
      #131318 0% 5%,
      transparent 6%
    ),
    /* Case body */
    linear-gradient(155deg, #21222b, #15161d) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.10),
    0 20px 42px rgba(0,0,0,.55) !important;
}

/* Booklet — artwork fills front face, left margin leaves room for spine */
.edition-cd .b2-edition-art img,
.edition-cd .b2-edition-art .lib-card-initial,
.edition-sacd .b2-edition-art img,
.edition-sacd .b2-edition-art .lib-card-initial,
.edition-dvd .b2-edition-art img,
.edition-dvd .b2-edition-art .lib-card-initial {
  width: 84% !important;
  height: 88% !important;
  margin: 6% 4% 6% 12%;
  border-radius: 1px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0,0,0,.5);
  z-index: 2;
}

/* Clear polycarbonate front panel — thin border over the booklet */
.edition-cd .b2-edition-art::before,
.edition-sacd .b2-edition-art::before,
.edition-dvd .b2-edition-art::before {
  content: '';
  position: absolute;
  inset: 5% 3% 5% 11%;
  border-radius: 2px;
  background: rgba(210,220,255,.025);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14),
    inset 0 -1px 0 rgba(0,0,0,.18);
  pointer-events: none;
  z-index: 3;
}

/* Strong polycarbonate gloss — diagonal light hit across full case */
.edition-cd .b2-edition-art::after,
.edition-sacd .b2-edition-art::after,
.edition-dvd .b2-edition-art::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 24% 18%, rgba(255,255,255,.30) 0%, transparent 44%),
    linear-gradient(122deg, rgba(255,255,255,.18) 0%, transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,.06) 0%, transparent 28%);
  pointer-events: none;
  z-index: 4;
}

/* SACD — gold-warm spine tint */
.edition-sacd .b2-edition-art {
  background:
    linear-gradient(90deg, #13100a 0% 9%, rgba(255,220,140,.14) 9% 10.5%, transparent 10.5%),
    linear-gradient(180deg, #1c1a12 0% 5%, rgba(255,220,100,.08) 5% 6.5%, transparent 7%),
    linear-gradient(0deg, #141209 0% 5%, transparent 6%),
    linear-gradient(155deg, #24221a, #171510) !important;
}

/* DVD-A — cool blue-dark spine tint */
.edition-dvd .b2-edition-art {
  background:
    linear-gradient(90deg, #0a0d16 0% 9%, rgba(100,160,255,.14) 9% 10.5%, transparent 10.5%),
    linear-gradient(180deg, #12161e 0% 5%, rgba(100,160,255,.08) 5% 6.5%, transparent 7%),
    linear-gradient(0deg, #0e1118 0% 5%, transparent 6%),
    linear-gradient(155deg, #1c2030, #111421) !important;
}

.b2-section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 2px 12px;
}

.b2-section-title h2 {
  color: #fff;
  font-size: 22px;
  letter-spacing: -.035em;
}

.b2-pill-btn {
  color: #8cf4ad;
  background: rgba(74,222,128,0.09);
  border: 1px solid rgba(74,222,128,0.18);
  padding: 8px 13px;
  font-size: 12px;
}

/* Physical Media Hub Grid */
.b2-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}

.b2-hub-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.b2-hub-card:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.07);
  border-color: rgba(74,222,128,0.25);
}

.b2-hub-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #152117, #0b110c);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.b2-hub-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.b2-hub-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #000;
  text-shadow: none;
}

.b2-hub-info {
  min-width: 0;
}

.b2-hub-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.b2-hub-subtitle {
  color: #7a8a7d;
  font-size: 12px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.b2-hub-count {
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.b2-category-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
}

.b2-shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(152px, 188px);
  gap: 14px;
  overflow-x: auto;
  padding: 0 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.b2-shelf::-webkit-scrollbar { display: none; }

.b2-home .lib-grid {
  padding: 0 !important;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.b2-home .lib-card,
.b2-home-card {
  background: rgba(255,255,255,0.055) !important;
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 22px !important;
  padding: 10px;
  box-shadow: 0 18px 42px rgba(0,0,0,0.2);
}

.b2-home .lib-card-art,
.b2-home-card .lib-card-art {
  border-radius: 16px !important;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}

.b2-home .lib-card-info {
  padding: 10px 3px 2px !important;
}

@media (max-width: 900px) {

  /* ── Nav bar ─────────────────────────────────────────────────────────── */
  .topnav {
    padding-left: 10px !important;
    padding-right: 10px !important;
    gap: 0 !important;
  }
  .topnav-logo { display: none !important; }
  .topnav-tabs {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    gap: 0;
  }
  .topnav-tabs::-webkit-scrollbar { display: none; }
  .nav-item {
    padding: 8px 12px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .topnav-right {
    flex-shrink: 0;
    gap: 4px;
    margin-left: 6px !important;
  }
  .search-bar input {
    width: 110px !important;
    font-size: 12px !important;
    padding: 6px 10px !important;
  }

  /* ── Sidebar toggle button ───────────────────────────────────────────── */
  #sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    padding: 6px 8px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  #sidebar-toggle-btn:active { color: #4ade80; }

  /* ── Sidebar overlay backdrop ────────────────────────────────────────── */
  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 304;
    pointer-events: none;
  }
  #sidebar-overlay.active {
    display: block;
    pointer-events: auto;
    left: min(80vw, 300px);
  }

  /* ── Sidebar: hidden by default, slides in as overlay when open ──────── */
  .music-lib-panel {
    display: none !important;
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 80vw !important;
    max-width: 300px !important;
    z-index: 305;
    box-shadow: 4px 0 32px rgba(0,0,0,0.85);
    overflow-y: auto;
    padding-top: max(env(safe-area-inset-top), 0px) !important;
    pointer-events: auto !important;
  }
  .music-lib-panel.sidebar-open {
    display: flex !important;
    flex-direction: column !important;
  }
  body.sidebar-open .music-content,
  body.sidebar-open #main-content,
  body.sidebar-open .main-body,
  body.sidebar-open #player-bar {
    pointer-events: none !important;
  }
  body.sidebar-open .music-lib-panel,
  body.sidebar-open .music-lib-panel * {
    pointer-events: auto !important;
  }
  .music-layout { flex-direction: column; }
  .music-content { width: 100% !important; min-width: 0; }

  /* ── Compact player bar ─────────────────────────────────────────────── */
  /* Keep art small in the mini bar */
  #player-bar .player-art {
    width: 48px !important;
    height: 48px !important;
    font-size: 18px !important;
    border-radius: 14px !important;
  }
  /* Meta stretches to fill space */
  #player-bar .player-meta {
    flex: 1 !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  /* Hide non-essential controls */
  #player-bar .player-seek,
  #player-bar .player-vol,
  #player-bar #p-shuffle,
  #player-bar #p-repeat,
  #player-bar #p-like,
  #player-bar #p-fullscreen {
    display: none !important;
  }
  /* Bigger touch targets for prev/play/next */
  #player-bar .p-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    font-size: 16px !important;
  }
  #player-bar .p-btn.p-play {
    width: 48px !important;
    height: 48px !important;
    font-size: 24px !important;
  }
  #player-bar .player-btns {
    gap: 6px !important;
    padding: 4px !important;
  }
  #player-bar #p-queue-btn {
    min-width: 40px !important;
    padding: 0 10px !important;
  }
  #player-bar .queue-btn-label {
    display: none !important;
  }

  /* ── Main body padding — just enough to clear the 60px player bar ───── */
  .main-body { padding: 12px 16px 92px; }
  .view-header { padding: 12px 16px 0; }

  .b2-home {
    padding: 12px 12px 112px;
  }

  .b2-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 18px;
    border-radius: 24px;
    gap: 12px;
  }

  .b2-hero h1 {
    font-size: clamp(34px, 11vw, 48px);
    line-height: .95;
  }

  .b2-hero-stack {
    display: none !important;
  }

  .b2-cover-tile {
    border-radius: 15px;
  }

  .b2-cover-tile:nth-child(2),
  .b2-cover-tile:nth-child(3) {
    transform: none;
  }

  .b2-stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 14px;
  }

  .b2-stat-card {
    border-radius: 18px;
    padding: 12px 10px;
  }

  .b2-stat-num {
    font-size: 20px;
  }

  .b2-stat-label {
    font-size: 9px;
  }

  .b2-edition-section {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 24px;
  }

  .b2-edition-copy h2 {
    font-size: 26px;
  }

  .b2-edition-copy p {
    margin-top: 6px;
  }

  .b2-edition-wall {
    grid-auto-columns: minmax(132px, 42vw);
    gap: 10px;
  }

  .b2-shelf {
    grid-auto-columns: minmax(132px, 42vw);
    gap: 10px;
  }

  .b2-home .lib-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 0 !important;
  }

  .b2-home .lib-card,
  .b2-home-card {
    border-radius: 22px !important;
    padding: 10px !important;
    background: rgba(255,255,255,0.055) !important;
    border: 1px solid rgba(255,255,255,0.065) !important;
    box-shadow: 0 18px 42px rgba(0,0,0,0.2) !important;
  }

  .b2-home .lib-card-art,
  .b2-home-card .lib-card-art {
    border-radius: 16px !important;
  }

  .b2-home .b2-edition-card,
  .b2-home .b2-edition-art {
    overflow: visible !important;
  }

  /* ── Artist / album grid — 3 columns, tighter cards ─────────────────── */
  .artist-grid, .album-grid,
  .lib-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 0 12px 16px !important;
  }
  /* Smaller, grounded cards */
  .lib-card {
    border-radius: 4px !important;
    transform: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }
  .lib-card-art {
    border-radius: 4px 4px 0 0 !important;
  }
  .lib-card-art .lib-card-initial {
    font-size: 28px !important;
  }
  .lib-card-info {
    padding: 5px 7px 6px !important;
  }
  .lib-card-name {
    font-size: 11px !important;
  }
  .lib-card-sub {
    font-size: 10px !important;
    margin-top: 1px !important;
  }
  .stacked-art .stacked-back {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    opacity: 0.28 !important;
  }
  .stacked-art .stacked-front {
    border-radius: 4px 4px 0 0 !important;
  }
  .stacked-badge {
    top: 4px !important;
    right: 4px !important;
  }

  /* ── Touch-friendly track rows ───────────────────────────────────────── */
  .music-track-row, .lib-track-row {
    padding: 11px 10px;
    min-height: 52px;
  }
  .music-track-header { display: none; }

  /* ── Larger cloud items ──────────────────────────────────────────────── */
  .cloud-item { padding: 12px 14px; font-size: 14px; min-height: 48px; }

  /* ── Album header ────────────────────────────────────────────────────── */
  .music-album-header { padding: 16px 16px 12px; gap: 12px; }
  .music-album-art { width: 80px !important; height: 80px !important; }
  .music-album-meta h2 { font-size: 16px; }

  /* ── Queue panel full-width ──────────────────────────────────────────── */
  .queue-panel {
    width: 100% !important;
    max-width: 100% !important;
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    border-radius: 0 !important;
  }

  /* ── Context menu ────────────────────────────────────────────────────── */
  #ctx-menu { font-size: 15px; }
  .ctx-item { padding: 13px 18px; min-height: 48px; }
}

@media (max-width: 640px) {
  .lib-grid, .artist-grid, .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .b2-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .b2-hub-card {
    padding: 10px !important;
    border-radius: 14px !important;
  }
  .b2-hub-art {
    border-radius: 10px !important;
    margin-bottom: 8px !important;
  }
  .b2-hub-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }
  .b2-hub-title {
    font-size: 14px !important;
  }
  .b2-hub-subtitle {
    font-size: 11px !important;
  }
}

@media (max-width: 480px) {
  .nav-item { padding: 7px 9px; font-size: 10.5px; }
  .lib-grid, .artist-grid, .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 0 10px 16px !important;
  }
  .b2-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 12px 0 20px !important;
  }
  .b2-hub-card {
    padding: 10px !important;
    border-radius: 12px !important;
  }
  .b2-hub-art {
    border-radius: 8px !important;
    margin-bottom: 8px !important;
  }
  .b2-hub-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 14px !important;
  }
  .b2-hub-title {
    font-size: 13px !important;
  }
  .b2-hub-subtitle {
    font-size: 10px !important;
  }
  .b2-hub-count {
    font-size: 10px !important;
  }
  .main-body { padding: 10px 10px 92px; }
}

/* iOS Safari/PWA fallback: force the phone drawer layout even when Safari
   reports an odd viewport width after app launch/rotation. */
@supports (-webkit-touch-callout: none) {
  .music-layout {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .music-content,
  #music-content-inner {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .music-lib-panel {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 80vw !important;
    max-width: 300px !important;
    min-width: 0 !important;
    z-index: 305 !important;
    overflow-y: auto !important;
    padding-top: max(env(safe-area-inset-top), 0px) !important;
    pointer-events: auto !important;
  }

  .music-lib-panel.sidebar-open {
    display: flex !important;
    flex-direction: column !important;
  }

  #sidebar-toggle-btn {
    display: flex !important;
  }

  #sidebar-overlay.active {
    display: block !important;
    pointer-events: auto !important;
    left: min(80vw, 300px) !important;
  }

  body.sidebar-open .music-content,
  body.sidebar-open #main-content,
  body.sidebar-open .main-body,
  body.sidebar-open #player-bar {
    pointer-events: none !important;
  }

  body.sidebar-open .music-lib-panel,
  body.sidebar-open .music-lib-panel * {
    pointer-events: auto !important;
  }

  .b2-home {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    padding: 12px 12px 112px !important;
    overflow-x: hidden !important;
  }

  .b2-hero {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 18px !important;
    border-radius: 24px !important;
  }

  .b2-hero h1 {
    font-size: clamp(34px, 11vw, 48px) !important;
    line-height: .95 !important;
    letter-spacing: -.055em !important;
  }

  .b2-hero-sub {
    max-width: 100% !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  .b2-hero-stack {
    display: none !important;
  }

  .b2-cover-tile:nth-child(2),
  .b2-cover-tile:nth-child(3) {
    transform: none !important;
  }

  .b2-stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .b2-edition-section {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }

  .b2-edition-wall {
    grid-auto-columns: minmax(132px, 42vw) !important;
  }

  .b2-shelf {
    grid-auto-columns: minmax(132px, 42vw) !important;
  }

  .b2-home .lib-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 0 !important;
  }
}

/* ── Now Playing panel — touch-optimised ────────────────────────────── */
@media (max-width: 900px) {
  #np-panel {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  #np-art-wrap {
    width: min(100%, calc(100vw - 40px)) !important;
    margin-bottom: 16px !important;
  }
  #np-title {
    font-size: 32px !important;
  }
  #np-sub {
    font-size: 15px !important;
    margin-top: 8px !important;
  }
  #np-info,
  #np-seek-wrap,
  #np-controls,
  #np-bottom-row,
  .np-btn-label {
    max-width: calc(100vw - 40px) !important;
  }
  .np-btn {
    width: 50px !important;
    height: 50px !important;
    padding: 0 !important;
    font-size: 20px !important;
  }
  #np-play-btn {
    width: 72px !important;
    height: 72px !important;
    font-size: 42px !important;
  }
  #np-seek-bar {
    height: 6px !important;
    border-radius: 3px !important;
  }
  #np-seek-fill {
    border-radius: 3px !important;
  }
}
