/* =====================================================================
   Graphite × Cassette (UI v2, ADR-033) — design tokens (single source of truth)
   Every colour, size, radius, shadow and motion value used anywhere in
   Casset resolves to one of these. Templates must never carry a raw hex.
   ===================================================================== */
:root{
  --font: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  --container: 1120px;
  --container-wide: 1280px;

  /* Type scale */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 19px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 40px;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --radius-1: 4px;   /* covers, notification rows, icon tiles */
  --radius-2: 6px;   /* buttons, inputs, cards, panels */
  --radius-3: 8px;   /* large avatars, dialogs */
  --radius-pill: 999px;

  /* Hairlines separate; shadows are only for floating things. */
  --shadow-1: 0 18px 48px rgba(0,0,0,.55);  /* notification panel, dialogs */
  --shadow-2: 0 12px 32px rgba(0,0,0,.50);  /* toast, menus */

  --dur: 160ms;
  --ease: cubic-bezier(.2,.8,.2,1);

  /* DISCOVER-V2: the paper label of a cassette and its reels. Paper is paper
     in both themes, so these do not flip with the theme. */
  --label-paper: #f3ead8;
  --label-ink:   #1c1c1f;
  --label-ink2:  #4a4338;
  --reel-hub:    #d7d7dc;
  --tape-window: #16130f;
}

/* --- Dark (default) --- */
html[data-theme="dark"]{
  --bg:      #0d0d0e;
  --bg2:     #0d0d0e;
  --panel:   #161618;
  --panel2:  #1e1e21;
  --text:    #f3f3f4;
  --muted:   #a3a3ab;
  --line:    #242428;
  --line-strong: #34343a;
  --focus:   rgba(255,122,47,.55);

  --accent:  #ff7a2f;
  --accent2: #ff9d66;
  --on-accent:#0d0d0e;
  /* UI v2: orange is the brand fill; purple is the quiet secondary accent
     (ADR-034, reversing ADR-033's neutralisation at PYMN's request). */
  --purple:  #8b5cf6;
  --purple2: #c4a6ff;
  --on-purple:#0d0d0e;

  /* Accent used as TEXT, which is a different problem from accent used as
     a fill. Every rule that colours text with the brand must use this,
     never --accent/--accent2. */
  --accent-text: #ff9d66;
  --purple-text: #c4a6ff;

  --good:    #34d399;
  --bad:     #fb7185;
  --gold:    #f5c451;
  --on-gold: #0d0d0e;

  /* Derived surface tints — kept as tokens so the light theme can flip
     them wholesale instead of every rule guessing an alpha over white. */
  --surface-1: rgba(255,255,255,.02);
  --surface-2: rgba(255,255,255,.04);
  --surface-3: rgba(255,255,255,.07);
  --field-bg:  #0d0d0e;
  --glass:     rgba(22,22,24,.86);
  --scrim:     rgba(0,0,0,.66);
  --tape:      #5a4030;
  --wave-on:   var(--accent);
  --wave-off:  #55555d;
  --deck-window: #08080a;

  --tint-accent: rgba(255,122,47,.13);
  --tint-purple: rgba(139,92,246,.16);
  --tint-good:   rgba(52,211,153,.14);
  --tint-bad:    rgba(251,113,133,.14);
  --tint-gold:   rgba(245,196,81,.16);

  /* Channel triplets: let any rule build an alpha of a themed colour with
     rgb(var(--x-rgb) / .18) instead of re-hardcoding the hex + alpha. */
  --text-rgb:   243 243 244;
  --bg-rgb:     13 13 14;
  --panel-rgb:  22 22 24;
  --accent-rgb: 255 122 47;
  --purple-rgb: 139 92 246;
  --good-rgb:   52 211 153;
  --bad-rgb:    251 113 133;
  --gold-rgb:   245 196 81;

  color-scheme: dark;
}

/* --- Light: a complete, independent palette (not a patch over dark) --- */
html[data-theme="light"]{
  --bg:      #fafafa;
  --bg2:     #fafafa;
  --panel:   #ffffff;
  --panel2:  #f4f4f5;
  --text:    #18181b;
  --muted:   #52525b;
  --line:    #e4e4e7;
  --line-strong: #d1d1d6;
  --focus:   rgba(232,100,28,.50);

  --accent:  #e8641c;
  --accent2: #ff7a2f;
  /* Dark ink on the orange fill, not white (white on #e8641c is 3.35:1). */
  --on-accent:#0d0d0e;
  --purple:  #6d28d9;
  --purple2: #8b5cf6;
  --on-purple:#ffffff;

  /* 5.02:1 on this theme's ground; the fill orange would be 3.18:1. */
  --accent-text: #b8480a;
  --purple-text: #5b21b6;

  --good:    #0a7a4c;
  --bad:     #b81733;
  --gold:    #8f6708;
  --on-gold: #ffffff;

  --surface-1: rgba(24,24,27,.025);
  --surface-2: rgba(24,24,27,.05);
  --surface-3: rgba(24,24,27,.08);
  --field-bg:  #ffffff;
  --glass:     rgba(255,255,255,.88);
  --scrim:     rgba(24,24,27,.42);
  --tape:      #d8cbb8;
  --wave-on:   var(--accent);
  --wave-off:  #a1a1aa;
  --deck-window: #e4e4e7;

  --tint-accent: rgba(232,100,28,.10);
  --tint-purple: rgba(109,40,217,.10);
  --tint-good:   rgba(10,122,76,.10);
  --tint-bad:    rgba(184,23,51,.10);
  --tint-gold:   rgba(143,103,8,.12);

  --text-rgb:   24 24 27;
  --bg-rgb:     250 250 250;
  --panel-rgb:  255 255 255;
  --accent-rgb: 232 100 28;
  --purple-rgb: 109 40 217;
  --good-rgb:   10 122 76;
  --bad-rgb:    184 23 51;
  --gold-rgb:   143 103 8;

  color-scheme: light;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
/* A horizontal scrollbar on a phone is always a bug, never a feature.
   Belt to the min-width braces above: if a component ever overflows
   again it gets clipped rather than shifting the whole layout sideways
   (which, in RTL, silently scrolls the page away from its own content). */
html{ overflow-x: hidden; }
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  /* Flat ground (UI v2): no glow, no gradient. */
  background: var(--bg);
  padding-bottom: 64px; /* space for bottomnav on mobile */
}

a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:none; }
img{ max-width:100%; display:block; }

:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-2);
}

.skiplink{
  position:absolute; inset:auto auto auto 12px;
  transform: translateY(-140%);
  background: var(--panel);
  border:1px solid var(--line);
  padding:10px 12px;
  border-radius:var(--radius-2);
  z-index:9999;
}
.skiplink:focus{ transform: translateY(12px); }

/* Icons */
.icon{
  width:20px; height:20px;
  display:inline-block;
  /* UI v2 line style (spec section 4): glyphs inside the sprite opt in to
     solid with fill="currentColor" stroke="none" on their own element. */
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.iconbtn{
  position: relative; /* anchor for state badges, e.g. .iconbtn--repeat-one */
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:44px;
  min-width:44px;
  padding:0 12px;
  border-radius: var(--radius-2);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  transition: transform var(--dur), background var(--dur), border-color var(--dur);
  cursor:pointer;
}
/* Active-state (shuffle on / repeat all|one) — app.js toggles this same
   "primary" class on #npShuffle/#npRepeat (still plain .iconbtn here);
   the popover-row versions of these two (.menu__item.primary, in
   casset-ui.css) get the equivalent rule since they're a different base
   class. Neither had a color rule at all before, so the toggle was a
   no-op with no visible feedback. */
.iconbtn.primary{ color: var(--accent); border-color: rgb(var(--accent-rgb) / .4); }
/* Repeat-one indicator — a small badge, not a swapped-out icon.
   app.js used to overwrite the repeat button's textContent with an emoji
   to show this state, which destroyed the <svg> permanently on first use. */
.iconbtn--repeat-one::after{
  content:"1";
  position:absolute;
  bottom:1px; inset-inline-end:1px;
  width:12px; height:12px;
  border-radius:50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size:8px;
  font-weight:900;
  line-height:12px;
  text-align:center;
}
.iconbtn:hover{ background: rgb(var(--text-rgb) / .06); }
.iconbtn--primary{
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}
.iconbtn--primary:hover{ background: var(--accent2); }
.iconbtn--ghost{
  background: rgb(var(--text-rgb) / .03);
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  height:44px;
  padding:0 18px;
  border-radius: var(--radius-2);
  border:1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-weight:700;
  transition: transform var(--dur), background var(--dur), border-color var(--dur);
}
.btn:hover{ background: rgb(var(--text-rgb) / .06); }
.btn--primary{
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}
.btn--primary:hover{ background: var(--accent2); }
.btn--ghost{
  background: transparent;
}

/* Typography helpers */
h1,h2,h3{ margin:0 0 10px 0; letter-spacing:-.3px; }
h1{ font-size: 26px; font-weight: 800; }
h2{ font-size: 20px; font-weight: 700; }
.small{ font-size: 13px; }
.muted{ color: var(--muted); }

/* Layout */
.topbar{
  position: sticky;
  top:0;
  z-index: 90;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar__inner{
  max-width: calc(var(--container) + 56px);
  margin: 0 auto;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  gap:14px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: var(--radius-2);
}
.brand__name{ font-weight: 950; font-size: 18px; letter-spacing:.2px; }


.search{
  flex:1;
  /* min-width:0 is what actually lets this shrink.
     A flex item defaults to min-width:auto, and a text input's intrinsic
     width is ~20 characters — so on a 375px screen the brand, the search
     box and the actions could not fit, the header overflowed by 49px, and
     every page got a horizontal scrollbar on every phone. */
  min-width: 0;
  display:flex;
  align-items:center;
  gap:10px;
  padding: 4px 10px;
  min-height: 44px;
  border-radius: var(--radius-2);
  border:1px solid var(--line);
  background: var(--field-bg);
}
.search__input{
  border:0;
  outline:0;
  width:100%;
  min-width: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}
.search__input::placeholder{ color: rgb(var(--text-rgb) / .50); }
.search:focus-within{ outline: 3px solid var(--focus); outline-offset: 2px; }

.topbar__actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:10px;
  height:44px;
  padding:0 14px;
  border-radius: 999px;
  border:1px solid var(--line-strong);
  background: transparent;
  font-weight:700;
}
.chip .icon{ width:18px;height:18px; color: var(--accent); }

/* Below the tablet breakpoint the header cannot hold the brand, a search
   box and the account controls at once — it overflowed by ~40px once a
   logged-in user's avatar chip appeared. The bottom nav already carries a
   dedicated Search entry, so the header's copy is the one to drop. */
@media (max-width: 739px){
  .topbar .search{ display: none; }
}

.appshell{
  max-width: calc(var(--container) + 56px);
  margin: 0 auto;
  padding: 16px 18px 120px; /* space for playerbar */
  display:block;
}

.sidebar{
  display:none;
  position: sticky;
  top: 92px;
  /* Fixed sticky height with no scroll used to clip the VIP card and the
     now-playing hint off the bottom on shorter laptop viewports whenever
     the nav had enough links to fill the box (base.html renders 4-8
     depending on auth state). overflow-y:auto lets the box itself scroll
     instead of silently pushing content past the visible viewport. */
  max-height: calc(100vh - 92px - 16px);
  overflow-y: auto;
  scrollbar-width: thin;
  align-self: start;
  border:1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--panel);
  padding: 14px;
}
.sidenav{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.sidenav__link{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 12px 12px;
  border-radius: var(--radius-2);
  border:1px solid transparent;
  color: var(--muted);
  background: transparent;
  min-height: 44px;
}
.sidenav__link .icon{ color: var(--muted); }
.sidenav__link:hover{
  background: rgb(var(--text-rgb) / .04);
  border-color: var(--line);
  color: var(--text);
}
.sidebar__hint{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sidebar__np{
  margin-top: 6px;
  font-weight:600;
  font-size: 13px;
  color: var(--text);
  opacity:.9;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.page{
  min-height: 60vh;
}

/* Desktop shell */
@media (min-width: 980px){
  body{ padding-bottom: 18px; }
  .bottomnav{ display:none; }
  .appshell{
    display:grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 16px;
  }
  .sidebar{ display:block; }
}

/* Anonymous-visitor hero on Discover — the one thing a logged-out visitor
   sees before anything else, so it's the one place worth a deliberate
   gradient treatment instead of the flat .card look used everywhere else. */





/* Cards & content */
.card{
  border:1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--panel);
  padding: 18px;
}
.stack{ display:flex; flex-direction:column; }
.gap-1{ gap:8px; }
.gap-2{ gap:12px; }
.gap-3{ gap:16px; }

.grid{
  display:grid;
  gap: 14px;
}
@media (min-width: 740px){
  .grid{ grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); }
}

.list{ display:flex; flex-direction:column; gap:10px; margin-top: 12px; }
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius-2);
  border:1px solid var(--line);
  background: transparent;
}
.row:hover{ background: rgb(var(--text-rgb) / .04); }
.dot{
  width:10px;height:10px;border-radius:999px;
  background: var(--accent);
}
.badge{
  display:inline-flex;
  align-items:center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border:1px solid transparent;
  color: var(--accent-text);
  background: var(--tint-accent);
}

/* Casset Pro badge (M6) — a creator-side membership marker, distinct from
   the staff-only verified check. */
.badge--pro{
  gap: 4px;
  color: var(--purple-text);
  border-color: rgb(var(--purple-rgb) / .45);
  background: var(--tint-purple);
  letter-spacing: .02em;
}
.badge--pro .icon{ width:13px; height:13px; }

/* Creator growth-tier badge (ADR-010) — a rolling activity level, distinct
   from both the staff-verified check and the paid Casset Pro membership
   above (deliberately a different color so the three never blur into
   "the same kind of badge"). Only tier 2/3 render one publicly — tier 1
   is the common baseline, not something worth a badge. */
.badge--tier{
  gap: 4px;
  color: var(--gold);
  border-color: rgb(var(--gold-rgb) / .45);
  background: rgb(var(--gold-rgb) / .14);
  letter-spacing: .02em;
}
.badge--tier .icon{ width:13px; height:13px; }

/* Forms */
input,select,textarea{
  font-family: var(--font);
}
.field{ display:flex; flex-direction:column; gap:8px; margin-top: 12px; }
.input{
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-2);
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--text);
}
textarea.input{ height:auto; padding: 12px; }
label{ font-weight: 600; }

/* Alerts / toast */
.alert{
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-2);
  border:1px solid rgb(var(--accent-rgb) / .35);
  background: rgb(var(--accent-rgb) / .10);
}
.toast{
  position: fixed;
  inset-inline-start: 12px;
  inset-inline-end: 12px;
  bottom: 86px;
  /* Above every overlay (.overlay-panel: 130, the portalled .menu__panel:
     145, #npView: 140) — a toast is feedback for whatever the visitor just
     did, which is very often an action taken *inside* one of those, e.g.
     "به پلی‌لیست اضافه شد" from the add-to-playlist modal. It used to sit
     at z-index 120, below the modal it was reporting on, so it rendered
     invisibly behind it. */
  z-index: 200;
  display:flex;
  flex-direction: column;
  gap: 8px;           /* stacked toasts */
  align-items: stretch;
}
@media (min-width: 720px){
  .toast{ inset-inline-end: auto; width: 380px; bottom: 96px; }
}
.toast__inner{
  display: flex; align-items: center; gap: 12px;
  border-radius: var(--radius-2);
  border:1px solid var(--line-strong);
  background: var(--panel2);
  box-shadow: var(--shadow-2);
  padding: 10px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.toast__dot{
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.toast__dot .icon{ width: 16px; height: 16px; }
.toast__inner--ok .toast__dot{ background: var(--tint-good); color: var(--good); }
.toast__inner--bad .toast__dot{ background: var(--tint-bad); color: var(--bad); }
.toast__text{ flex: 1; min-width: 0; }
.toast__close{
  flex: none; width: 44px; height: 44px; margin-block: -8px; margin-inline-end: -8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius-2);
}
.toast__close:hover{ color: var(--text); }
.toast__close .icon{ width: 16px; height: 16px; }

/* Overlay panels: queue / add-to-playlist / embed-snippet — see base.html
   #qPanel, #plModal, #embedModal and their app.js open/close handlers. */
.overlay-panel{
  position: fixed;
  inset: 0;
  /* Above #npView (140): the queue / add-to-playlist dialogs are opened FROM
     the full player, and at 130 they rendered behind it, unreachable. */
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--scrim);
  backdrop-filter: blur(2px);
}
.overlay-panel__inner{
  width: 100%;
  max-width: 440px;
  max-height: min(80vh, 640px);
  overflow-y: auto;
}
/* WP-10: inline action in a toast (guest "ورود" invitation). */
.toast__action{
  color: var(--accent-text);
  font-weight: 700;
  flex: none;
}

/* Playerbar — a full-width bar flush against the bottom edge (mobile:
   directly on top of .bottomnav, itself flush to the true edge; desktop:
   flush to the viewport edge, no .bottomnav there), not a floating inset
   card. Was `left/right: 12-18px` + its own border-radius, i.e. a rounded
   card with visible page background around it on every side. */
.playerbar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 62px; /* height of .bottomnav below */
  z-index: 110;
  animation: pbSlideUp .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes pbSlideUp{
  from{ transform: translateY(16px); opacity: 0; }
  to{ transform: translateY(0); opacity: 1; }
}
@media (min-width: 980px){
  .playerbar{
    bottom: 0; /* .bottomnav is display:none here */
  }
}
.playerbar__inner{
  width: 100%;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  border-top-color: var(--line-strong);
  /* Full-bleed bar (flush to the screen edges and the bottom); its content is
     centred to the same measure as the page via inline padding. */
  padding-block: 10px max(8px, env(safe-area-inset-bottom));
  padding-inline: max(16px, env(safe-area-inset-left), calc((100% - var(--container-wide) - 56px) / 2));
  display:flex;
  flex-direction: column;
  gap: 4px;
}
.playerbar__row{
  display:flex;
  align-items:center;
  gap: 12px;
}
.playerbar__left{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
  border-radius: var(--radius-2);
  padding: 2px 4px;
  transition: background var(--dur);
}
.playerbar__left:hover{ background: rgb(var(--text-rgb) / .04); }
/* UI v2: the cover is replaced by a cassette window (92x48) with two reels
   whose tape radius follows playback (--prog is set on #playerbar by app.js). */
.playerbar__cover{
  width: 92px;
  height: 48px;
  border-radius: var(--radius-2);
  background: var(--deck-window) !important;
  border: 1px solid var(--line-strong);
  flex: none;
}
.playerbar__meta{ min-width:0; }
.playerbar__title{
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.playerbar__by{
  font-size: 12px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.playerbar__controls, .playerbar__tools{
  display:flex;
  align-items:center;
  gap: 4px;
}
/* Sized down from the original 36/44px: with cover + title/creator name on
   one side and 5 transport + 7 tool buttons on the other, the buttons were
   winning the fight for space and the track title/creator name — the thing
   a listener actually needs to read — got squeezed into an ellipsis. */
.playerbar__controls .iconbtn{ height:44px; min-width:44px; padding:0 6px; border-color: transparent; }
.playerbar__controls .iconbtn--primary{ height:44px; min-width:44px; border-radius: 50%; background: var(--text); color: var(--bg); box-shadow: none; }
.playerbar__controls .iconbtn--primary:hover{ background: var(--text); opacity: .88; }
.playerbar__controls .iconbtn--primary:active{ transform: scale(.92); }
.playerbar__controls .icon, .playerbar__tools .icon{ width:17px; height:17px; }
.playerbar__tools .iconbtn{ height:44px; min-width:44px; padding:0 6px; border-color: transparent; }
.playerbar__close{ flex: none; margin-inline-start: 2px; }
/* .playerbar__tools now holds only the "بیشتر" popover trigger + expand —
   volume/speed/sleep moved to #npView, and queue/playlist/shuffle/repeat
   live inside the popover instead of as 4 separate icons — so, unlike
   before, this fits at every width and is never hidden outright. */
@media (max-width: 900px){
  .playerbar__wave{ display:none; }
}
@media (max-width: 420px){
  .playerbar__controls #pbBack10, .playerbar__controls #pbFwd10{ display:none; }
}

/* Seek/scrub row — the primary, always-visible seek control (native range
   input: touch-drag, keyboard arrows and accessibility all come for free,
   unlike the click-only waveform above). */
.playerbar__scrub{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 0 2px;
  direction: ltr;
}
.playerbar__time{
  font-size: 11px;
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pb-seek{
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--seek-pct, 0%), rgb(var(--text-rgb) / .14) 0);
  outline: none;
  cursor: pointer;
}
.pb-seek::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .25);
  transition: transform .12s ease;
}
.pb-seek::-webkit-slider-thumb:hover{ transform: scale(1.15); }
.pb-seek::-moz-range-thumb{
  width: 13px; height: 13px; border: none; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .25);
}
.pb-seek::-moz-range-track{ height:4px; border-radius:999px; background: rgb(var(--text-rgb) / .14); }
.pb-seek::-moz-range-progress{ height:4px; border-radius:999px; background: var(--accent); }

/* Volume popover */
.pb-vol{ position: relative; }
.pb-vol__pop{
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 12px 8px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur), transform var(--dur);
  z-index: 5;
}
.pb-vol__pop.open{ opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }

/* "بیشتر" popover (queue/playlist-add/shuffle/repeat) — same opens-upward
   shape as .pb-vol__pop, since its trigger sits in the same fixed bottom
   bar and a downward-opening popover would render mostly off-screen. */
.pb-more{ position: relative; }
.pb-more__pop{
  position: absolute;
  bottom: calc(100% + 10px);
  inset-inline-end: 0;
  min-width: 190px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 6px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity var(--dur), transform var(--dur);
  z-index: 5;
}
.pb-more__pop.open{ opacity: 1; pointer-events: auto; transform: translateY(0); }
.pb-vol__pop input[type="range"]{
  writing-mode: vertical-lr;
  direction: rtl;
  width: 6px;
  height: 84px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Waveform: real decoded peaks when available (tracks/audio_processing.py),
   falling back to the CSS-pulse placeholder below when they aren't (older
   tracks, or a track whose async waveform job hasn't finished yet). A
   timeline reads left-to-right even on an RTL page — the same convention
   every media player uses regardless of UI language — so this whole block
   is pinned to `direction: ltr`. */
.playerbar__wave{
  display:flex;
  align-items:center;
  gap: 1px;
  height: 44px;
  flex: 0 1 280px;
  position: relative;
  direction: ltr;
}
.playerbar__wave span{
  flex: 1 1 auto;
  width: 3px;
  border-radius: 1px;
  background: var(--wave-off);
  height: 30%;
  align-self: flex-end;
  transition: height .2s ease;
}
.playerbar__wave.is-playing span{
  animation: pbwave 1.1s ease-in-out infinite;
  background: var(--wave-on);
}
.playerbar__wave span:nth-child(2n){ animation-delay: -0.9s; }
.playerbar__wave span:nth-child(3n){ animation-delay: -0.6s; }
.playerbar__wave span:nth-child(4n){ animation-delay: -0.3s; }
.playerbar__wave span:nth-child(5n){ animation-delay: -1.1s; }
@keyframes pbwave{
  0%, 100% { height: 25%; }
  50% { height: 90%; }
}
@media (max-width: 720px){
  .playerbar__wave{ display:none; }
}

/* Real waveform mode: two stacked bar rows (dim "base" + bright "progress"),
   the progress row clipped to the playback ratio's width — the standard
   scrubber trick, cheap to update every timeupdate tick (one width write). */
.playerbar__wave.wave-real{ cursor: pointer; }
.playerbar__wave .wave-row{
  display:flex;
  align-items:flex-end;
  gap: 1px;
  height: 100%;
  width: 100%;
}
.playerbar__wave .wave-row--base span{
  background: var(--wave-off);
  animation: none;
}
.playerbar__wave .wave-row--progress{
  position: absolute;
  inset: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}
.playerbar__wave .wave-row--progress-inner{
  position: absolute;
  inset: 0;
  height: 100%;
}
.playerbar__wave .wave-row--progress-inner span{
  background: var(--wave-on);
  animation: none;
}

/* ---- Now Playing — full-screen expanded view (#npView) ---- */
.np-view{
  position: fixed;
  inset: 0;
  z-index: 140;
  background: var(--bg);
  animation: npFadeIn .22s ease;
}
@keyframes npFadeIn{ from{ opacity:0; } to{ opacity:1; } }
.np-view__inner{
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  display:flex;
  flex-direction: column;
  padding: 18px 22px 28px;
}
.np-view__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
}




.np-view__scrub{ margin-bottom: 16px; }
.np-view__controls{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 14px;
  margin-top: 8px;
}
.np-view__controls .iconbtn{ height:44px; min-width:44px; }
.np-view__play{ height:64px !important; min-width:64px !important; }
.np-view__play .icon{ width:26px; height:26px; }
/* Volume/speed/sleep — relocated here from the compact playerbar (their
   only home before, and unreachable below 1080/720px with no
   alternative). #pbVolPop still opens upward relative to its own
   button (unchanged CSS), which still reads fine inside this view. */
.np-view__tools{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  margin-top: 14px;
}

/* Queue panel reorder buttons */
.q-reorder{
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.q-reorder button{
  width: 26px; height: 20px;
  display:flex; align-items:center; justify-content:center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.q-reorder button:hover{ background: rgb(var(--text-rgb) / .06); color: var(--text); }
.q-reorder button:disabled{ opacity:.3; cursor:default; }
.q-reorder button .icon{ width:12px; height:12px; }

/* Add-to-playlist modal's inline "create new" row (#plModal, base.html) */
.pl-modal-create{ display:flex; gap:8px; align-items:center; }
.pl-modal-create .input{ flex:1; height:40px; }

/* Bottom nav */
.bottomnav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62px;
  z-index: 100;
  display:flex;
  justify-content:space-around;
  align-items:center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  max-width: 100vw;
  overflow: hidden;
}
.bottomnav__link{
  /* flex-basis 0, not width:25%.
     The old rule hardcoded a four-item bar; with five items it summed to
     125% and, because a flex item cannot shrink below its min-content
     width, the nav ended up 424px wide inside a 375px viewport — giving
     every page on every phone a horizontal scrollbar. Equal shares of
     whatever space exists, with min-width:0 so the labels may truncate,
     makes the bar exactly viewport-wide for any number of items. */
  flex: 1 1 0;
  min-width: 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 6px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.bottomnav__link span{
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottomnav__link .icon{ width: 20px; height: 20px; color: var(--accent); opacity:.9; }
.bottomnav__link:hover{ color: var(--text); }

/* Compatibility with existing templates */
.container{ max-width: var(--container); margin: 0 auto; }
.page{ padding: 0; }

/* Legacy template compatibility (existing pages) */
.btn.primary{ background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover{ background: var(--accent2); }
.item{ padding: 12px 12px; border-radius: var(--radius-2); border:1px solid var(--line); background: transparent; }
.item:hover{ background: rgb(var(--text-rgb) / .04); }
input[type="text"],input[type="password"],input[type="email"],input[type="url"],input[type="search"],input[type="number"],select,textarea{
  width:100%;
  border-radius: var(--radius-2);
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--text);
  padding: 10px 12px;
  min-height: 44px;
  font-family: var(--font);
  font-size: 14px;
}
textarea{ min-height: 120px; resize: vertical; }
@media (max-width: 979px){
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
  select, textarea{ font-size: 16px; }
  .search__input{ font-size: 16px; }
}

/* ---- Profile page (templates/accounts/public_profile_pro.html) ----
   Moved out of that template's inline <style> for consistency with the
   rest of the site's styling and to layer in the redesign (tabs, stat
   buttons, social links, mini-card grid) without duplicating rules. */
.profile-hero{ margin-bottom: 4px; }
/* UI v2 profile header: equaliser bar (or the creator's cover image), the
   avatar straddling its bottom edge, then name block, stat table and deck keys. */
.profile-cover{
  position: relative;
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center;
}
.profile-eq{ width: 100%; height: 100%; padding: 22px 18px 0; fill: var(--line-strong); }
.profile-id{ margin-top: -74px; padding-inline: 20px; position: relative; }
.profile-hero__inner{
  display:flex;
  align-items:flex-start;
  gap:22px;
  flex-wrap:wrap;
}
.profile-avatar{
  width:148px; height:148px;
  border-radius: 50%;
  overflow:hidden;
  background: var(--panel2);
  display:flex; align-items:center; justify-content:center;
  border: 4px solid var(--bg);
  flex: none;
}
.profile-avatar img{ width:100%; height:100%; object-fit:cover; }
.avatar-fallback{ font-size:48px; font-weight:800; opacity:.9; }
.profile-meta{ min-width:0; flex: 1 1 240px; margin-top: 82px; }
.profile-eyebrow{ font-size: 12px; font-weight: 700; color: var(--accent-text); margin-bottom: 2px; }
.profile-name{ display:flex; align-items:center; flex-wrap: wrap; gap:8px; font-size:36px; font-weight: 800; margin-bottom:4px; }
.profile-handle{ display:flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom:8px; }
.profile-bio{ max-width: 560px; font-size: 14px; line-height:1.9; margin-bottom:8px; }

.profile-actions{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.profile-report{ margin-inline-start: auto; }

/* Deck keys, refined: a hairline-framed group of light keys. Hit areas stay 44px,
   the look is thin — 13px/600 text, --line (not --line-strong) dividers. */
.deck-keys{
  display: flex; flex-wrap: wrap; gap: 1px;      /* 1px gaps over this background = key dividers */
  border: 1px solid var(--line); border-radius: var(--radius-2);
  overflow: hidden; background: var(--line);
}
.deck-keys > .btn, .deck-keys > .menu > .iconbtn{
  min-height: 44px; border: 0; border-radius: 0; background: var(--bg); flex: 1 1 auto;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.deck-keys > .btn:hover, .deck-keys > .menu > .iconbtn:hover{ color: var(--text); background: var(--surface-1); }
.deck-keys > .menu{ display: flex; }
.deck-keys > .menu > .iconbtn{ width: 100%; padding-inline: 14px; }
.deck-keys > .btn--primary{ background: var(--accent); color: var(--on-accent); }
.deck-keys > .btn--primary:hover{ background: var(--accent2); color: var(--on-accent); }
.deck-keys .profile-report{ margin-inline-start: 0; }
.profile-report--mobile-only{ display: none !important; }
.menu__item--share{ display: none; }
@media (max-width: 640px){
  .deck-keys__share{ display: none; }
  .menu__item--share{ display: flex; }
  .profile-report--mobile-only{ display: flex !important; }
  .deck-keys > .btn, .deck-keys > .menu > .iconbtn{ font-size: 12px; padding-inline: 10px; }
}

/* Stats: almost frameless — three quiet figures separated by hairlines. */
.profile-stats{
  display:grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 12px;
  max-width: 560px;
}
.profile-stat{
  display:flex; flex-direction:column; align-items:flex-start; gap:2px;
  padding: 4px 18px;
  border: 0; border-radius: 0;
  background: transparent; color: var(--text);
  font-family: var(--font); text-align: start;
  cursor:pointer;
}
.profile-stat:first-child{ padding-inline-start: 0; }
.profile-stat + .profile-stat{ border-inline-start: 1px solid var(--line); }
.profile-stat:hover .stat{ color: var(--accent-text); }
.profile-stat--static{ cursor:default; }
.profile-stat--static:hover .stat{ color: inherit; }
.profile-stat .muted{ font-size: 12px; font-weight: 400; }
.profile-stat .stat{ font-size:22px; font-weight:700; font-variant-numeric: tabular-nums; }
@media (max-width: 640px){
  .profile-cover{ height: 120px; }
  .profile-eq{ padding: 14px 10px 0; }
  .profile-id{ margin-top: -48px; padding-inline: 12px; }
  .profile-avatar{ width: 96px; height: 96px; }
  .profile-meta{ margin-top: 12px; }
  .profile-name{ font-size: 26px; }
  .profile-stat{ padding: 4px 10px; }
  .profile-stat .stat{ font-size: 18px; }
}
}












.icon-btn{
  background:transparent; border:1px solid var(--line); border-radius:var(--radius-2);
  padding:6px 10px; cursor:pointer; color:var(--text);
  transition: background var(--dur);
}
.icon-btn:hover{ background: rgb(var(--text-rgb) / .06); }

.card-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap:14px; }
.mini-card{ display:block; border-radius: var(--radius-2); overflow:hidden; }
.mini-card__cover{
  aspect-ratio: 1/1; border-radius: var(--radius-2);
  background-color: var(--panel2);
  background-size: cover; background-position:center;
  margin-bottom:8px;
}
.mini-card__cover--playlist{ display:flex; align-items:center; justify-content:center; font-size:30px; }
.mini-card__title{ font-weight:900; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.suggest-row{ display:flex; justify-content:space-between; align-items:center; padding:8px 0; }
.btn--sm{ padding:6px 10px; font-size:12px; height:auto; }

/* ---- Upload page (templates/uploads/upload.html + static/upload.js) ---- */
.err, .field-error{
  color: var(--bad);
  font-size: 12px;
  margin-top: 4px;
}
.dropzone{
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius-2);
  padding: 18px;
  text-align: center;
  transition: border-color var(--dur), background var(--dur);
  background: rgb(var(--text-rgb) / .015);
}
.dropzone--over{
  border-color: var(--accent);
  background: rgb(var(--accent-rgb) / .06);
}
.dropzone__hint{ font-weight:800; opacity:.85; margin-bottom: 4px; }
.dropzone__file{ min-height: 16px; }
.dropzone__input{
  position:absolute; inset:0;
  width:100%; height:100%;
  opacity:0; cursor:pointer;
}
.cover-preview{
  margin-top: 10px;
  width: 120px; height: 120px;
  border-radius: var(--radius-2);
  background-size: cover;
  background-position: center;
  background-color: var(--panel2);
  border: 1px solid var(--line);
  display:none;
}
.cover-preview--visible{ display:block; }
.upload-progress-track{
  height: 8px;
  border-radius: 999px;
  background: rgb(var(--text-rgb) / .08);
  overflow: hidden;
  margin: 8px 0 4px;
}
.upload-progress-bar{
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .15s ease;
}

/* ---- Staff dashboard charts (Chart.js, vendored in static/vendor/) ---- */
.chart-card{ padding: 14px; }
.chart-card canvas{ max-width: 100%; margin-top: 8px; }

/* ---- Shared small cover thumbnail for list rows (track_list, library,
   trending, playlist_detail) — a real cover image everywhere one exists,
   the same soft gradient placeholder everywhere one doesn't, instead of
   the previous mix of a plain accent dot and no artwork at all. ---- */
.row-cover{
  width: 42px; height: 42px;
  border-radius: var(--radius-1);
  flex: none;
  background-size: cover;
  background-position: center;
  background-color: var(--panel2);
  background-image: none;
}

/* Live spectrum (static/js/spectrum.js) replaces the old bar-strip when present. */
.playerbar__wave.has-spectrum{ display: none; }
.playerbar__spectrum{ flex: 0 1 280px; height: 44px; min-width: 120px; }
.playerbar__spectrum .spectrum{ display: block; width: 100%; height: 100%; }
@media (max-width: 720px){ .playerbar__spectrum{ display: none; } }
