/* shell.css — app-shell layout for iranian.fi.
   RTL by default. Grid: [right sidebar 400px | main 1fr | left sidebar 220px].
   Fixed sticky player 80px at bottom. Responsive breakpoints:
     ≥ 1280px  full 3-column
     1024-1279 collapse left to drawer
     < 768     single column + right as modal + mini player */

*{margin:0;padding:0;box-sizing:border-box}
:root{
  --bg: #07070b;
  --panel: #14141c;
  --line: #262630;
  --muted: rgba(255,255,255,.6);
  --gold: #e7c873;
  --accent: #a78bfa;
  --top-h: 62px;
  --player-h: 80px;
  --left-w: 220px;
  --right-w: 400px;
}
html { height: 100%; }
body {
  height: 100%;
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* --- TOP NAV BAR (spans full width) --------------------------------------
   Same background as the body so it visually reads as a single unified surface, not a
   separate band glued on top. Subtle border-bottom for definition, no gradient. */
.app-top {
  height: var(--top-h);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 22px;
  gap: 18px;
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  z-index: 50;
}
.tb-left { display: flex; align-items: center; gap: 8px; }
.tb-brand { display: flex; align-items: center; padding: 6px 0; }
.tb-brand img { height: 28px; width: auto; display: block; }
.tb-burger {
  display: none;
  background: none; border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 10px;
  align-items: center; justify-content: center;
}
.tb-burger:hover { background: rgba(255,255,255,.06); }
.tb-burger svg { width: 22px; height: 22px; }

.tb-search {
  position: relative;
  display: flex; align-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  padding: 0 14px 0 12px;
  height: 40px;
  max-width: 520px;
  width: 100%;
  justify-self: center;
  transition: background .15s, border-color .15s;
}
.tb-search:focus-within { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); }
.tb-search .tbs-ic { width: 18px; height: 18px; opacity: .55; flex-shrink: 0; margin-inline-end: 8px; }
.tb-search input {
  flex: 1;
  background: none; border: none; outline: none;
  color: #fff; font: inherit; font-size: .92rem;
  padding: 0; min-width: 0;
}
.tb-search input::placeholder { color: rgba(255,255,255,.45); font-size: .88rem; }
.tb-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: rgba(12,12,18,.98);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 70vh; overflow: auto;
  z-index: 55;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}

.tb-user { display: flex; align-items: center; gap: 10px; }
.tb-lang { font-size: .74rem; padding: 6px 11px; border-radius: 20px; color: rgba(255,255,255,.7); background: rgba(255,255,255,.05); border: 1px solid transparent; transition: background .15s; }
.tb-lang:hover { background: rgba(255,255,255,.1); color: #fff; }
.tb-ava { display: flex; align-items: center; }
.tb-ava img, .tb-ava-ph { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.tb-ava-ph { background: var(--gold); color: #1a1a1a; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: .95rem; }
.tb-login {
  background: var(--gold); color: #1a1a1a;
  border: none; border-radius: 20px;
  padding: 8px 16px; font-weight: 800; font-size: .82rem;
  transition: filter .15s;
}
.tb-login:hover { filter: brightness(1.06); }

/* --- APP GRID (below top bar, above player) ------------------------------
   RTL: col 1 = right side (400px, playing info), col 2 = middle (fluid), col 3 = left (220px, nav).
   Only main + right scroll internally; left holds a short nav and doesn't need to scroll. */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: var(--right-w) 1fr var(--left-w);
  grid-template-rows: minmax(0, 1fr);   /* SINGLE row: without this, browser was creating 3 implicit rows and stacking the columns vertically like stairs */
  overflow: hidden;
  min-height: 0;
  gap: 0;
}
.app-right { grid-column: 1; grid-row: 1; min-height: 0; }
.app-main  { grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; }
.app-left  { grid-column: 3; grid-row: 1; min-height: 0; }
/* thin, quiet scrollbars — only visible on hover, Spotify-style */
.app-main, .right-scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.app-main:hover, .right-scroll:hover { scrollbar-color: rgba(255,255,255,.14) transparent; }
.app-main::-webkit-scrollbar, .right-scroll::-webkit-scrollbar { width: 8px; }
.app-main::-webkit-scrollbar-track, .right-scroll::-webkit-scrollbar-track { background: transparent; }
.app-main::-webkit-scrollbar-thumb, .right-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; transition: background .15s; }
.app-main:hover::-webkit-scrollbar-thumb, .right-scroll:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); }

/* --- LEFT SIDEBAR (nav only; brand + user + lang live in top bar now) ---- */
.app-left {
  background: var(--bg);
  border-inline-start: 1px solid rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  padding: 22px 12px;
  /* no internal scroll: nav fits in viewport */
}
.lnav { display: flex; flex-direction: column; gap: 3px; }
.litem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  font-weight: 700;
  transition: background .15s, color .15s;
  border-inline-start: 3px solid transparent;
}
.litem:hover { background: rgba(255,255,255,.04); color: #fff; }
.litem.active { background: rgba(231,200,115,.09); color: var(--gold); border-inline-start-color: var(--gold); }
.litem svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }

/* --- MAIN CONTENT ------------------------------------------------------ */
.app-main {
  padding: 22px 30px 40px;
  scroll-behavior: smooth;
}
.app-main > *:first-child { margin-top: 0; }

/* --- RIGHT SIDEBAR (context-aware playing info) ------------------------ */
.app-right {
  background: var(--bg);
  border-inline-end: 1px solid rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.right-scroll { flex: 1; overflow-y: auto; padding: 22px 22px 30px; }
.rp-placeholder { text-align: center; padding: 8px 8px 40px; color: var(--muted); }
.rp-ph-cover {
  width: 180px; height: 180px;
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  border: 1px dashed rgba(255,255,255,.1);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  opacity: .45;
}
.rp-ph-title { font-size: 1.02rem; font-weight: 800; color: #fff; margin-bottom: 5px; }
.rp-ph-sub { font-size: .8rem; color: var(--muted); line-height: 1.6; }

/* right sidebar: live-radio state (filled by shell.js) */
.rp-live { text-align: center; }
.rp-cover { width: 260px; height: 260px; margin: 0 auto 16px; border-radius: 18px; background: #1b1b24 center/cover no-repeat; box-shadow: 0 22px 50px -16px rgba(0,0,0,.7); }
.rp-station { display: inline-flex; align-items: center; gap: 7px; background: linear-gradient(135deg, #ff2d55, #d50f3f); color: #fff; padding: 5px 11px; border-radius: 20px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; margin-bottom: 12px; }
.rp-station i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% {opacity:1} 50%{opacity:.35} }
.rp-title { font-size: 1.2rem; font-weight: 800; line-height: 1.35; margin-bottom: 6px; }
.rp-artist { font-size: .9rem; color: var(--muted); margin-bottom: 20px; }

.rp-stswitch { display: inline-flex; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 22px; padding: 3px; gap: 0; margin-bottom: 20px; }
.rp-stswitch button { background: none; border: none; color: rgba(255,255,255,.6); font: inherit; font-size: .74rem; font-weight: 800; padding: 6px 14px; border-radius: 18px; letter-spacing: .04em; }
.rp-stswitch button:hover { color: #fff; }
.rp-stswitch button.on { background: linear-gradient(135deg, #ff2d55, #d50f3f); color: #fff; }

.rp-hist { margin-top: 24px; text-align: start; }
.rp-hist h4 { font-size: .78rem; font-weight: 800; color: var(--muted); margin-bottom: 10px; letter-spacing: .04em; }
.rp-hist-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.rp-hist-row:hover { background: rgba(255,255,255,.04); }
.rp-hist-row .rph-c { width: 38px; height: 38px; border-radius: 6px; background: #1b1b24 center/cover no-repeat; flex-shrink: 0; }
.rp-hist-row .rph-t { font-size: .82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-hist-row .rph-a { font-size: .7rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- PLAYER BAR (bottom of body flex column) --------------------------- */
.app-player {
  flex-shrink: 0;
  height: var(--player-h);
  background: #0a0a10;
  border-top: 1px solid rgba(255,255,255,.06);
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 26px;
  gap: 24px;
}
.pl-track { display: flex; align-items: center; gap: 13px; min-width: 0; }
.pl-cover { width: 52px; height: 52px; border-radius: 9px; background: #1b1b24 center/cover no-repeat; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; opacity: .5; }
.pl-cover.has-cover { opacity: 1; }
.pl-cover.has-cover span { display: none; }
.pl-meta { min-width: 0; }
.pl-title { font-size: .9rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: .74rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pl-controls { display: flex; align-items: center; gap: 6px; justify-content: center; }
.pl-btn {
  background: none; border: none;
  color: rgba(255,255,255,.75);
  padding: 8px 10px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.pl-btn svg { width: 22px; height: 22px; }
.pl-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.pl-btn:disabled { opacity: .25; cursor: not-allowed; }
.pl-btn:disabled:hover { background: none; }
.pl-play {
  width: 48px; height: 48px; border-radius: 50%;
  background: #fff; color: #1a1a1a;
  border: none;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, background .15s;
}
.pl-play svg { width: 24px; height: 24px; }
.pl-play:hover { background: #f5f5f5; }
.pl-play:active { transform: scale(.94); }
.pl-play.loading { background: rgba(255,255,255,.15); color: #fff; }
.pl-play.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pl-extras { display: flex; align-items: center; gap: 14px; justify-content: end; }
.pl-like svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.pl-like.on { color: #ff4d6d; }
.pl-like.on svg { fill: currentColor; }
.pl-vol {
  width: 110px;
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.1);
  outline: none;
  cursor: pointer;
}
.pl-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; cursor: pointer; border: none; }
.pl-vol::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; cursor: pointer; border: none; }

/* --- TABLET: collapse left sidebar to drawer (opens via top-bar burger) -- */
@media (max-width: 1279px) {
  .app { grid-template-columns: var(--right-w) 1fr; }
  .tb-burger { display: inline-flex; }
  .app-left {
    grid-column: unset;
    position: fixed;
    top: var(--top-h);
    inset-inline-end: 0; /* physical left in RTL */
    bottom: var(--player-h);
    width: 240px;
    z-index: 90;
    transform: translateX(-105%);
    transition: transform .28s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,.5);
  }
  html[dir="rtl"] .app-left { transform: translateX(105%); }
  .app.left-open .app-left { transform: translateX(0); }
  /* backdrop when drawer is open */
  .app.left-open::before {
    content: ""; position: fixed;
    top: var(--top-h); left: 0; right: 0; bottom: var(--player-h);
    background: rgba(0,0,0,.55); z-index: 85;
  }
}

/* --- MOBILE: single column, right becomes swipe-up sheet ---------------- */
@media (max-width: 767px) {
  :root { --player-h: 62px; --top-h: 54px; --right-w: 0; }
  .app { grid-template-columns: 1fr; }
  .tb-search { max-width: none; }
  .tb-search input { font-size: .86rem; }
  .tb-search input::placeholder { font-size: .82rem; }
  .tb-lang { display: none; }
  .app-right {
    grid-column: unset;
    position: fixed;
    top: var(--top-h); left: 0; right: 0;
    bottom: var(--player-h);
    z-index: 95;
    transform: translateY(105%);
    transition: transform .28s ease;
  }
  .app.right-open .app-right { transform: translateY(0); }
  .app-main { padding: 16px 14px 30px; }
  .app-top { padding: 0 12px; gap: 10px; }

  .app-player { padding: 0 12px; grid-template-columns: 1fr auto; gap: 10px; }
  .pl-extras { display: none; }
  .pl-controls { gap: 2px; }
  .pl-play { width: 42px; height: 42px; }
  .pl-play svg { width: 20px; height: 20px; }
  .pl-btn { padding: 6px 8px; }
  .pl-btn svg { width: 18px; height: 18px; }
  .pl-cover { width: 42px; height: 42px; font-size: 1.1rem; }
  .pl-title { font-size: .82rem; }
  .pl-sub { font-size: .68rem; }
}


/* ==== On-demand Now-Playing panel (right sidebar) ==== */
/* Rendered by shell.js renderRight() when a track is loaded via IR.playTrack().
   RIGHT COLUMN = list-shape context (related tracks). LYRICS stay in the CENTER
   on /song.php where the wide column can breathe. */
.rp-od { text-align: center; direction: rtl; }
.rp-cover-lg { display: block; width: 280px; height: 280px; margin: 0 auto 16px; border-radius: 18px; background: #1b1b24 center/cover no-repeat; box-shadow: 0 22px 50px -16px rgba(0,0,0,.7); cursor: pointer; transition: transform .18s; }
.rp-cover-lg:hover { transform: translateY(-2px); }
.rp-title-lg { font-size: 1.35rem; font-weight: 800; line-height: 1.3; margin-bottom: 4px; padding: 0 6px; }
.rp-artist-lg { font-size: .96rem; color: rgba(255,255,255,.55); margin-bottom: 12px; }
.rp-fapers { margin-bottom: 16px; }
.rp-fapers .rp-fa { font-size: 1rem; font-weight: 700; color: #fff; opacity: .85; margin-bottom: 3px; }
.rp-fapers .rp-fb { font-size: .8rem; color: rgba(255,255,255,.5); }

.rp-od .vtags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 12px 0 4px; }
.rp-od .vtag { font-size: .68rem; padding: 3px 10px; border-radius: 18px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.78); text-decoration: none; transition: background .15s; }
.rp-od .vtag:hover { background: rgba(255,255,255,.13); }
.rp-od .vtag.f-mood { color: #ffd87a; border-color: rgba(255,216,122,.3); }
.rp-od .vtag.f-genre { color: #a7c7ff; border-color: rgba(167,199,255,.3); }
.rp-od .vtag.f-theme { color: #ffb0c8; border-color: rgba(255,176,200,.28); }
.rp-od .vtag.f-version { color: #b9f6c8; border-color: rgba(185,246,200,.3); }

/* Related tracks list (right sidebar's raison d'être in on-demand mode) */
.rp-rel-title { margin: 26px 0 10px; font-size: .78rem; font-weight: 800; color: rgba(255,255,255,.55); letter-spacing: .04em; text-align: start; padding: 0 4px; }
.rp-rel { display: flex; flex-direction: column; gap: 2px; }
.rp-rel-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; color: inherit; text-decoration: none; transition: background .15s; }
.rp-rel-row:hover { background: rgba(255,255,255,.05); }
.rp-rel-cov { width: 42px; height: 42px; border-radius: 7px; background: #1b1b24 center/cover no-repeat; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.rp-rel-meta { flex: 1; min-width: 0; text-align: start; }
.rp-rel-t { font-size: .84rem; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-rel-a { font-size: .7rem; color: rgba(255,255,255,.55); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==== Bottom player progress + times (Phase C) ==== */
/* Thin bar at the top edge of the player. Grows on hover so click/drag targets a bigger
   surface. Fill uses the current track's accent (set via seedTrack/playTrack). */
.app-player { position: relative; padding-top: 0; }
.pl-progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  z-index: 3;
  transition: height .15s;
}
.pl-progress::before {
  /* invisible hit-area extending above the bar so the click target is comfortable */
  content: "";
  position: absolute;
  inset: -10px 0 0 0;
}
.pl-progress:hover, .pl-progress.dragging { height: 6px; }
.pl-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent, #e7c873);
  pointer-events: none;
  transition: width .1s linear;
}
.pl-progress.dragging .pl-progress-fill { transition: none; }
.pl-progress-head {
  position: absolute;
  top: 50%;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
  transform: translate(50%, -50%) scale(0);
  transition: transform .15s;
  pointer-events: none;
}
.pl-progress:hover .pl-progress-head, .pl-progress.dragging .pl-progress-head {
  transform: translate(50%, -50%) scale(1);
}

.pl-times {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  flex-shrink: 0;
  margin-inline-start: 12px;
}
.pl-times .pl-times-sep { opacity: .5; }

/* enable prev/next once populated (JS removes the disabled attribute) */
.pl-btn:disabled { opacity: .35; cursor: default; }

/* ==== Mobile Phase M1: bottom tabs + sheet toggle + close ==== */

/* Right sidebar CLOSE button — visible on mobile only (chevron down handle at top of sheet) */
.right-close {
  display: none;
  background: none; border: none; color: #fff;
  padding: 10px; margin: 0 auto;
  width: 100%; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer; opacity: .6;
}
.right-close svg { width: 26px; height: 26px; }
.right-close::before {
  /* pill "handle" above the chevron, iOS-style bottom-sheet indicator */
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 40px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.28);
}

/* Bottom tab bar — mobile only. Fixed above the player row so the tabs are always reachable
   even while a track is playing. Desktop keeps the full left sidebar and hides these tabs. */
.app-tabs {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 58px;
  background: #0a0a10;
  border-top: 1px solid rgba(255,255,255,.06);
  z-index: 105;
  padding-bottom: env(safe-area-inset-bottom, 0);
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
}
.app-tabs .tab {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.55);
  font-size: .65rem;
  text-decoration: none;
  transition: color .15s;
}
.app-tabs .tab svg { width: 21px; height: 21px; }
.app-tabs .tab.active { color: var(--gold, #e7c873); }
.app-tabs .tab:active { transform: scale(.95); }

/* On mobile, the player floats above the tab bar and the whole app column shortens */
@media (max-width: 767px) {
  :root { --tabs-h: 58px; }
  .app-tabs { display: grid; }
  .app-player { bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0)); position: fixed; left: 0; right: 0; z-index: 100; }
  /* the right SHEET sits between top-bar and player (already positioned that way in base). Show close handle. */
  .app-right { top: 0; z-index: 200; }
  .right-close { display: flex; position: relative; padding-top: 20px; }
  .right-scroll { padding: 4px 20px 30px; }

  /* Ensure body scroll accommodates fixed player + tabs (was not accounting for tab bar) */
  body { padding-bottom: 0; }
  .app { padding-bottom: calc(var(--player-h) + var(--tabs-h)); }

  /* Progress bar handle bigger for touch */
  .pl-progress { height: 4px; }
  .pl-progress:hover, .pl-progress.dragging { height: 6px; }

  /* Mini-player: cover + meta act as the tap-to-open-sheet target */
  .pl-track { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .pl-times { display: none; }
}

/* On very small (< 400px), tighten tab labels */
@media (max-width: 399px) {
  .app-tabs .tab { font-size: .6rem; }
  .app-tabs .tab svg { width: 19px; height: 19px; }
}

/* ==== Mobile Phase M2: compact mini + progress inside ==== */
/* Progress moves OUT of the top edge into the mini row itself — a thin bar aligned
   under the meta text. Player height shrinks from 62 → 52 to match Spotify's density. */
@media (max-width: 767px) {
  :root { --player-h: 52px; }

  /* progress bar becomes an inline sliver at the BOTTOM edge of the player
     (still touchable but not the visual "cap"). Chevron head hidden on mobile. */
  .pl-progress { top: unset; bottom: 0; height: 3px; }
  .pl-progress:hover, .pl-progress.dragging { height: 5px; }
  .pl-progress-head { display: none; }

  /* Mini row: tighter cover + smaller text, controls right */
  .app-player { padding: 0 10px; grid-template-columns: 1fr auto; gap: 10px; }
  .pl-cover { width: 38px; height: 38px; font-size: 1rem; border-radius: 6px; }
  .pl-track { gap: 10px; align-items: center; padding: 4px 0; }
  .pl-meta { min-width: 0; }
  .pl-title { font-size: .82rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pl-sub { font-size: .68rem; line-height: 1.2; }
  .pl-play { width: 38px; height: 38px; }
  .pl-play svg { width: 18px; height: 18px; }
  .pl-prev, .pl-next { display: none; }   /* mini has only play; prev/next live in the Now-Playing sheet */
}

/* ==== Mobile Phase M3: cleaner top-bar (Spotify iOS style) ==== */
@media (max-width: 767px) {
  /* Hide brand logo on mobile — Safari's URL bar already tells the user which app.
     Freed space goes to a full-width search bar with proper padding. */
  .app-top .tb-brand { display: none; }
  .app-top { grid-template-columns: auto 1fr auto; padding: 0 10px; gap: 8px; height: var(--top-h); }
  .tb-left { gap: 4px; }
  .tb-burger { padding: 6px; }
  .tb-search { padding: 6px 12px; gap: 8px; }
  .tb-search input { font-size: .84rem; }
  .tb-search input::placeholder { font-size: .82rem; }
  .tb-user { gap: 6px; }
  .tb-ava { width: 32px; height: 32px; }
  .tb-login { padding: 6px 12px; font-size: .78rem; }
}

/* ==== Mobile Phase M4: enforce hidden sidebars ==== */
/* Belt-and-braces: previously the transform in RTL was moving .app-left INTO view
   (translateX(105%) is physical-positive-right regardless of writing direction),
   so drawer content bled onto the page edge. visibility guarantees they stay off. */
@media (max-width: 767px) {
  .app-left, .app-right { visibility: hidden; }
  .app.left-open .app-left, .app.right-open .app-right { visibility: visible; }
  /* also correct the RTL drawer transform so open animation is right */
  html[dir="rtl"] .app-left { transform: translateX(-105%); }
  html[dir="rtl"] .app.left-open .app-left { transform: translateX(0); }
  /* brand really must go on mobile (previous rule wasn't specific enough vs the img styles) */
  .app-top .tb-brand,
  .app-top .tb-brand img { display: none !important; }
}

/* ==== Mobile Phase M5: sheet doesn't cover the mini-player ==== */
/* Now-Playing sheet slides up but leaves the player + tabs visible below (Spotify pattern).
   Was `bottom: var(--player-h)` which used the OLD 62px and didn't account for the tab bar
   below — the sheet extended into the player's fixed area and hid the mini row. */
@media (max-width: 767px) {
  .app-right {
    bottom: calc(var(--player-h) + var(--tabs-h) + env(safe-area-inset-bottom, 0));
  }
}

/* ==== Sheet play-CTA (Now-Playing panel commit button) ==== */
/* Sits below cover+title+tags, above the related list. Big enough to tap without
   thinking. Fills with accent color of the previewed track. */
.rp-play-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 4px;
  padding: 12px 30px;
  border: none;
  border-radius: 999px;
  background: var(--accent, #e7c873);
  color: #0a0a0a;
  font: inherit;
  font-weight: 800;
  font-size: .96rem;
  cursor: pointer;
  box-shadow: 0 12px 28px -10px rgba(231,200,115,.55);
  transition: transform .12s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.rp-play-cta:hover { filter: brightness(1.05); }
.rp-play-cta:active { transform: scale(.96); }
.rp-play-cta svg { width: 20px; height: 20px; }

/* ==== Related row: currently-playing highlight ==== */
/* When user taps a related row in the sheet, audio swaps but the sheet stays put.
   We mark the tapped row with .playing so they have visual confirmation. */
.rp-rel-row.playing { background: rgba(231,200,115,.12); }
.rp-rel-row.playing .rp-rel-t { color: var(--accent, #e7c873); }
.rp-rel-row.playing .rp-rel-cov::after {
  content: "♪";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.5);
  color: var(--accent, #e7c873);
  font-size: 20px;
  border-radius: 7px;
}
.rp-rel-cov { position: relative; }

/* ==== Mobile M6: taller mini + roomier tap targets (was too cramped) ==== */
@media (max-width: 767px) {
  :root { --player-h: 62px; }    /* was 52 — Spotify-ish */
  .app-player { padding: 0 12px; }
  .pl-cover { width: 46px; height: 46px; border-radius: 8px; }
  .pl-track { gap: 12px; }
  .pl-title { font-size: .9rem; line-height: 1.25; }
  .pl-sub { font-size: .74rem; line-height: 1.25; }
  .pl-play { width: 46px; height: 46px; }
  .pl-play svg { width: 22px; height: 22px; }
  .pl-progress { height: 3px; }
  .pl-progress:hover, .pl-progress.dragging { height: 5px; }
}

/* ==== Quality chip in shell player bar ==== */
/* Small pill showing the current kbps (128, 320, etc). Tap → popover menu with
   the 7-tier ladder. Sits next to volume. On mobile it's hidden (moves into sheet). */
.pl-quality {
  min-width: 44px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
  font: inherit; font-size: .68rem; font-weight: 800;
  cursor: pointer; letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  transition: background .15s, border-color .15s;
}
.pl-quality:hover { background: rgba(255,255,255,.1); border-color: rgba(231,200,115,.4); }
.pl-quality.on { background: rgba(231,200,115,.15); border-color: var(--gold, #e7c873); color: var(--gold, #e7c873); }

.pl-q-menu {
  position: fixed;
  z-index: 300;
  background: #12121a;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.7);
  min-width: 180px;
}
.pl-q-menu .pl-q-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.82);
  font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer;
  background: none; border: none; width: 100%;
  text-align: start;
}
.pl-q-menu .pl-q-item:hover { background: rgba(255,255,255,.06); }
.pl-q-menu .pl-q-item.on { background: rgba(231,200,115,.12); color: var(--gold, #e7c873); }
.pl-q-menu .pl-q-item .pl-q-hint { font-size: .68rem; opacity: .55; font-weight: 500; }
.pl-q-menu .pl-q-item.on::after { content: "✓"; color: var(--gold, #e7c873); font-weight: 900; margin-inline-start: 4px; }
.pl-q-menu .pl-q-head {
  padding: 8px 14px 4px; font-size: .68rem; letter-spacing: .06em;
  color: rgba(255,255,255,.5); font-weight: 800;
}

@media (max-width: 767px) {
  /* On mobile the chip lives INSIDE the Now-Playing sheet (rendered by shell.js
     renderRight) so the mini stays lean. Hide the bar version. */
  .pl-quality { display: none; }
}

/* Quality row inside the Now-Playing sheet (rendered by shell.js) */
.rp-quality-row {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  margin: 18px 0 4px;
}
.rp-quality-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.9);
  font: inherit; font-size: .8rem; font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.rp-quality-btn:hover { background: rgba(255,255,255,.1); }
.rp-quality-btn .rp-q-ico { font-size: 1rem; opacity: .7; }
