/* صفحه‌ی موسیقی: RTL، تم روشن/تاریک (هم از prefers-color-scheme و هم از data-theme روی html)، واکنش‌گرا */
:root {
  color-scheme: light;
  --m-bg: #faf8f4;
  --m-surface: #ffffff;
  --m-text: #1f1c18;
  --m-muted: #6c655c;
  --m-line: #e5ded2;
  --m-accent: #6b3fd6;
  --m-accent-text: #ffffff;
  --m-chip: #efebe3;
  --m-danger: #b3261e;
  --m-focus: #2563eb;
  --m-current: #efe8ff;
  --m-radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --m-bg: #141210;
    --m-surface: #1e1b18;
    --m-text: #f1ece4;
    --m-muted: #a9a195;
    --m-line: #36312b;
    --m-accent: #a98bff;
    --m-accent-text: #141210;
    --m-chip: #2a261f;
    --m-danger: #ff8a80;
    --m-focus: #8ab4ff;
    --m-current: #2e2640;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --m-bg: #141210;
  --m-surface: #1e1b18;
  --m-text: #f1ece4;
  --m-muted: #a9a195;
  --m-line: #36312b;
  --m-accent: #a98bff;
  --m-accent-text: #141210;
  --m-chip: #2a261f;
  --m-danger: #ff8a80;
  --m-focus: #8ab4ff;
  --m-current: #2e2640;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--m-bg); color: var(--m-text); font-family: system-ui, "Vazirmatn", Tahoma, sans-serif; line-height: 1.7; }
body { padding-bottom: env(safe-area-inset-bottom, 0px); }
:focus-visible { outline: 3px solid var(--m-focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.m-app { max-width: 960px; margin: 0 auto; padding: 16px 16px 120px; }
.m-head h1 { margin: 8px 0 0; font-size: 1.6rem; }
.m-sub, .m-hint, .m-meta { color: var(--m-muted); margin: 0; font-size: 0.9rem; }
.m-status { min-height: 1.5em; margin: 8px 0; color: var(--m-muted); }

.m-card { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-radius); padding: 16px; margin: 16px 0; }
.m-card h2 { font-size: 1.1rem; margin: 0 0 8px; }
.m-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.m-search input {
  width: min(320px, 100%); min-height: 44px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--m-line); background: var(--m-bg); color: var(--m-text); font: inherit;
}

.m-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.m-chip {
  min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--m-line);
  background: var(--m-chip); color: var(--m-text); font: inherit; cursor: pointer;
}
.m-chip[aria-pressed="true"] { background: var(--m-accent); border-color: var(--m-accent); color: var(--m-accent-text); }

.m-list, .m-queue, ol.m-list, ol.m-queue { list-style: none; margin: 0; padding: 0; }
.m-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 10px 8px; border-bottom: 1px solid var(--m-line); border-radius: 8px;
}
.m-row.is-current { background: var(--m-current); }
.m-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; }
.m-title { font-weight: 600; overflow-wrap: anywhere; }
.m-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.m-btn {
  min-height: 44px; min-width: 44px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--m-line);
  background: var(--m-surface); color: var(--m-text); font: inherit; cursor: pointer;
}
.m-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.m-btn-primary { background: var(--m-accent); border-color: var(--m-accent); color: var(--m-accent-text); text-decoration: none; display: inline-block; }
.m-empty { color: var(--m-muted); margin: 12px 0 0; }

.m-file { margin: 12px 0 4px; }
.m-file input[type="file"] { min-height: 44px; max-width: 100%; }

.m-player {
  position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--m-surface);
  border-top: 1px solid var(--m-line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
}
.m-player-inner { max-width: 960px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.m-now { flex: 1 1 200px; min-width: 0; }
.m-now-title { font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-controls { display: flex; gap: 8px; align-items: center; }
.m-seek { flex: 2 1 240px; display: flex; align-items: center; gap: 8px; }
.m-seek input { flex: 1; min-height: 44px; accent-color: var(--m-accent); }
.m-time { font-variant-numeric: tabular-nums; color: var(--m-muted); font-size: 0.85rem; white-space: nowrap; }

@media (max-width: 600px) {
  .m-app { padding-bottom: 180px; }
  .m-seek { order: 3; flex-basis: 100%; }
}

/* ---------- پلی‌لیست‌ها ---------- */
.m-pl-form { display: grid; gap: 10px; margin: 12px 0; }
.m-pl-form label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--m-muted); }
.m-pl-form input, .m-pl-form textarea {
  min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--m-line);
  background: var(--m-bg); color: var(--m-text); font: inherit; resize: vertical;
}
.m-detail { border-top: 1px solid var(--m-line); margin-top: 16px; padding-top: 12px; }
.m-detail h3 { margin: 0 0 4px; font-size: 1.05rem; }
.m-detail .m-actions { margin: 10px 0; }
.m-btn-danger { color: var(--m-danger); border-color: var(--m-danger); }
.m-menu {
  flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px; margin-top: 4px; border: 1px dashed var(--m-line); border-radius: 10px; background: var(--m-bg);
}
.m-menu .m-hint { margin: 0; }
.m-detail .m-hint { white-space: pre-line; }

/* پلیر سراسری سایت (#gp در صفحه) جای پلیر داخلی این صفحه را گرفته است؛ کنترل‌های داخلی برای آزمون‌ها در DOM می‌مانند */
.m-player { display: none; }

/* متغیرهای تم سایت برای پلیر سراسری در این صفحه: از توکن‌های همین صفحه استفاده می‌کنند */
:root {
  --fg: var(--m-text);
  --card: var(--m-surface);
  --line: var(--m-line);
  --accent: var(--m-accent);
  --soft: var(--m-chip);
  --muted: var(--m-muted);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* دو تب صفحه‌ی موسیقی + فهرست لینک‌های Spotify */
.m-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 14px; background: var(--m-chip); border-radius: 999px; }
.m-tab { flex: 1; border: 0; background: transparent; color: var(--m-muted); font: inherit; padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background-color .25s ease, color .25s ease, box-shadow .25s ease; }
.m-tab[aria-selected="true"] { background: var(--m-surface); color: var(--m-text); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.m-tab:focus-visible { outline: 2px solid var(--m-focus); outline-offset: 2px; }
.m-pane:not([hidden]) { animation: m-pane-in .28s ease; }
@keyframes m-pane-in { from { opacity: 0; transform: translateY(8px); } }
.m-sp-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--m-line); border-radius: 12px; background: var(--m-surface); animation: m-pane-in .3s ease; }
.m-sp-row.is-current { border-color: var(--m-accent); background: var(--m-current); }
.m-sp-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-sp-meta small { color: var(--m-muted); direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .m-pane:not([hidden]), .m-sp-row { animation: none; } .m-tab { transition: none; } }
