/* Tunedex Mini App: dark blue-green */
/* Vazirmatn (OFL, fonts/OFL.txt) for Persian and Arabic script only: the unicode-range keeps Latin on the system
   font, so mixed titles get Vazirmatn letters next to native digits and punctuation. One variable file covers
   every weight the app uses (400-700); self-hosted because Google Fonts is unreliable from Iran and the PWA
   works offline. */
@font-face { font-family: Vazirmatn; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/Vazirmatn-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
:root {
  --bg: #0b1014;
  --bg-grad: radial-gradient(120% 55% at 50% 0%, #103138 0%, #0b1014 65%);
  --surface: #121a20;
  --raised: #1a252d;
  --line: rgba(255,255,255,.08);
  --fg: #e8f1f2;
  --muted: #7f949b;
  --accent: #2dd4bf;
  --accent-2: #3b82f6;
  --grad: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
  --accent-fg: #06131a;
  --danger: #ef5350;
  --tint: #103138;
  --sat: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --cat: var(--tg-content-safe-area-inset-top, 0px);
  --tabs-h: 56px;
  --mini-h: 60px;
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100%; background: var(--bg) var(--bg-grad) no-repeat; color: var(--fg);
  font: 15px/1.35 Vazirmatn, -apple-system, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1 { font-size: 22px; font-weight: 700; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
.bidi { unicode-bidi: plaintext; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: block; pointer-events: none; }
.ib { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--fg); position: relative; flex: none; }
.ib:active { background: rgba(255,255,255,.08); }
.ib.on { color: var(--accent); }
.ib .lbl { position: absolute; inset-inline-end: 3px; bottom: 5px; font-size: 10px; font-weight: 700; color: var(--accent); pointer-events: none; }

/* layout */
#content { padding: calc(var(--sat) + var(--cat) + 12px) 0 calc(var(--tabs-h) + var(--sab) + 16px); min-height: 100vh; }
body.has-mini #content { padding-bottom: calc(var(--tabs-h) + var(--mini-h) + var(--sab) + 22px); }
.screen-h { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 16px 10px; }
.screen-h small { color: var(--muted); }
.empty { padding: 32px 20px; color: var(--muted); text-align: center; line-height: 1.5; }
/* boot splash: the app mark (gradient disc, five bars) pulsing like a level meter, wordmark, one status line */
.splash { min-height: calc(100vh - var(--tabs-h) - 80px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center; animation: splash-in .5s var(--ease) both; }
.splash .mark { width: 88px; height: 88px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 14px 44px rgba(45,212,191,.28), 0 0 0 10px rgba(45,212,191,.06); margin-bottom: 6px; }
.splash .mark i { width: 7px; border-radius: 4px; background: #fff; height: var(--h); animation: splash-eq 1.1s ease-in-out infinite alternate; animation-delay: var(--d); }
.splash .mark i:nth-child(1) { --h: 16px; --d: -.15s; }
.splash .mark i:nth-child(2) { --h: 28px; --d: -.55s; }
.splash .mark i:nth-child(3) { --h: 40px; --d: -.95s; }
.splash .mark i:nth-child(4) { --h: 28px; --d: -.35s; }
.splash .mark i:nth-child(5) { --h: 16px; --d: -.75s; }
.splash .word { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.splash .st { color: var(--muted); font-size: 14px; animation: splash-breathe 1.6s ease-in-out infinite; }
.splash.err .mark { background: var(--raised); box-shadow: none; }
.splash.err .mark i { animation: none; background: var(--muted); }
.splash.err .st { color: var(--fg); animation: none; max-width: 320px; line-height: 1.45; }
.splash .btn { margin-top: 8px; }
@keyframes splash-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes splash-eq { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
@keyframes splash-breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .splash, .splash .mark i, .splash .st { animation: none; } }
.hint { color: var(--muted); font-size: 13px; }
.section { margin-top: 18px; }
.section h2 { padding: 0 16px 6px; }
.section .sh { display: flex; align-items: baseline; justify-content: space-between; padding-inline-end: 12px; }
.section .sh h2 { flex: 1; min-width: 0; }
.seeall { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-size: 13px; font-weight: 600; flex: none; }
.seeall .chev { width: 16px; height: 16px; transform: rotate(-90deg); }
.screen-h small[data-act] { cursor: pointer; }
.screen-h .hr { display: flex; align-items: center; gap: 2px; }
.screen-h .hr .ib { width: 36px; height: 36px; color: var(--muted); }
.langpick { padding: 60px 24px; text-align: center; }
.langpick h1 { margin-bottom: 8px; }
.langpick p { color: var(--muted); margin-bottom: 24px; }
.langpick .btn { margin: 6px 0; }
.signin { padding: 60px 24px; text-align: center; max-width: 420px; margin: 0 auto; }
.signin h1 { margin-bottom: 8px; }
.signin p { color: var(--muted); margin: 0 0 24px; }
.signin .btn { display: block; text-decoration: none; margin: 6px 0; }
.signin .btn.wide { width: 100%; margin: 6px 0 10px; }
.signin .btn.disabled { opacity: .5; pointer-events: none; }
.signin .warn { color: var(--danger); }
.signin .hint { font-size: 13px; margin-top: 20px; }
.signin code { display: inline-block; margin-top: 6px; padding: 4px 8px; border-radius: 6px; background: var(--surface); color: var(--fg); user-select: all; direction: ltr; }
.why { color: var(--muted); font-size: 12px; }
.banner { margin: 0 16px 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); font-size: 14px; }
.banner .ixrow { display: flex; flex-direction: column; gap: 5px; padding: 3px 0; }
.banner .bar { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.banner .bar i { display: block; height: 100%; background: var(--accent, #2fbf9b); transition: width .4s; }
.nudge { margin: 0 16px 10px; padding: 14px; border-radius: 14px; background: var(--surface); line-height: 1.5; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 12px; font-weight: 600; background: var(--raised); }
.btn:active { opacity: .85; }
.btn.grad { background: var(--grad); color: var(--accent-fg); }
.btn.line { border: 1px dashed var(--muted); color: var(--accent); background: none; }
.btn.danger { color: var(--danger); }
.btn.wide { width: calc(100% - 32px); margin: 4px 16px 10px; justify-content: center; }
.btn .ic { width: 20px; height: 20px; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; flex: none; }
.btn.sm .ic { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; }

/* chips */
.chips { display: flex; gap: 6px; padding: 2px 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 7px 13px; border-radius: 16px; background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 500; }
.chips button.on { background: var(--raised); color: var(--fg); box-shadow: inset 0 0 0 1px var(--accent); }

/* art */
.art { width: 48px; height: 48px; border-radius: 8px; background: var(--raised); flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--muted); }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art .ic { width: 22px; height: 22px; }

/* track rows */
li.tr { display: flex; align-items: center; gap: 12px; padding-block: 7px; padding-inline: 16px 8px; }
li.tr:active { background: var(--surface); }
li.tr .meta { flex: 1; min-width: 0; }
li.tr .t { font-weight: 500; }
li.tr .p { color: var(--muted); font-size: 13px; }
li.tr.playing .t { color: var(--accent); }
li.tr .dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
li.tr .ib { width: 40px; height: 40px; color: var(--muted); }
li.more { display: flex; justify-content: center; padding: 14px; min-height: 48px; }
li.more .spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
li.more.err .spin { animation: none; border-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.stale { opacity: .55; transition: opacity .15s; }
li.g { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
li.g:active { background: var(--surface); }
li.g .art { border-radius: 10px; }
li.g .meta { flex: 1; min-width: 0; }
li.g .p { color: var(--muted); font-size: 13px; }
li.g .n { color: var(--muted); font-size: 13px; flex: none; }
li.g .chev { color: var(--muted); transform: rotate(-90deg); width: 20px; height: 20px; }
li.g.set .sico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--muted); flex: none; }
li.g.set .sico .ic { width: 20px; height: 20px; }
li.tr.off { opacity: .45; pointer-events: none; }
.seclabel { padding: 14px 16px 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* quick picks + mixes */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 8px; }
.qp { display: flex; align-items: center; gap: 10px; height: 56px; border-radius: 10px; background: var(--surface); overflow: hidden; text-align: start; font-weight: 600; font-size: 14px; }
.qp:active { background: var(--raised); }
.qp .art { width: 56px; height: 56px; border-radius: 0; }
.qp span { flex: 1; min-width: 0; padding-inline-end: 10px; font-size: 13px; line-height: 1.25; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.art.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.art.grad { background: var(--grad); color: var(--accent-fg); }
.art.grad.mix-new { background: linear-gradient(135deg, #2dd4bf 0%, #0ea5e9 100%); }
.art.grad.mix-weekly { background: linear-gradient(135deg, #6366f1 0%, #2dd4bf 100%); }
.art.grad.mix-trending { background: linear-gradient(135deg, #3b82f6 0%, #14b8a6 100%); }
.art.grad.mix-liked { background: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%); }
.card.mix { width: 136px; }
.card.mix .art { width: 136px; height: 136px; }
.card.mix .art .ic { width: 40px; height: 40px; }
.gh .hero .art.grad .ic { width: 48px; height: 48px; }

/* horizontal cards */
.hrow { display: flex; gap: 12px; padding: 0 16px 4px; overflow-x: auto; scrollbar-width: none; }
.hrow::-webkit-scrollbar { display: none; }
.card { flex: none; width: 104px; }
.card .art { width: 104px; height: 104px; border-radius: 12px; }
.card .t { font-size: 13px; font-weight: 500; margin-top: 6px; }
.card .p { font-size: 12px; color: var(--muted); }
.card.playing .t { color: var(--accent); }
.continue { margin: 0 16px 6px; padding: 12px; border-radius: 14px; background: var(--surface); display: flex; gap: 12px; align-items: center; }
.continue:active { background: var(--raised); }
.continue .art { width: 56px; height: 56px; border-radius: 10px; }
.continue .meta { flex: 1; min-width: 0; }
.continue .lbl { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.continue .t { font-weight: 600; }
.continue .bar { height: 3px; border-radius: 2px; background: var(--raised); margin-top: 8px; overflow: hidden; }
.continue .bar .fill { height: 100%; background: var(--grad); }
.continue .ib { color: var(--accent); }

/* group detail */
.gh { padding: 0 16px 12px; }
.gh .top { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; margin-inline-start: -12px; }
.gh .hero { display: flex; gap: 14px; align-items: flex-end; }
.gh .hero .art { width: 120px; height: 120px; border-radius: 14px; box-shadow: 0 12px 28px rgba(0,0,0,.4); }
.gh .hero .art .ic { width: 40px; height: 40px; }
.gh .hero .meta { flex: 1; min-width: 0; }
.gh .hero .kind { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.gh .hero h1 { font-size: 22px; line-height: 1.15; margin: 4px 0; overflow-wrap: anywhere; }
.gh .hero .sub { color: var(--muted); font-size: 13px; }
.gh .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* search */
.sbox { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; padding-block: 0; padding-inline: 12px 4px; border-radius: 12px; background: var(--surface); color: var(--muted); }
.sbox input { flex: 1; padding: 11px 0; background: none; border: 0; color: var(--fg); outline: none; min-width: 0; }
.sbox input::placeholder { color: var(--muted); }
.sbox .ib { width: 36px; height: 36px; color: var(--muted); }
.sbox .ib[hidden] { display: none; }

/* tab bar */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; height: calc(var(--tabs-h) + var(--sab));
  padding-bottom: var(--sab); display: flex; background: var(--surface); border-top: 1px solid var(--line); }
#tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
#tabs button.on { color: var(--accent); }
#tabs button[hidden] { display: none; }

/* mini player */
#mini { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabs-h) + var(--sab) + 6px); z-index: 5; height: var(--mini-h);
  background: var(--raised); border-radius: 14px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.35); touch-action: pan-y; user-select: none; }
#mini .bar { height: 2px; background: rgba(255,255,255,.1); }
#mini .bar .fill { height: 100%; width: 0; background: var(--grad); }
#mini .row { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 10px; height: calc(var(--mini-h) - 2px); }
#mini .art { width: 40px; height: 40px; }
#mini .txt { flex: 1; min-width: 0; }
#mini .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* now playing */
#np { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column;
  padding: calc(var(--sat) + var(--cat) + 8px) 24px calc(var(--sab) + 16px);
  background: linear-gradient(180deg, var(--tint) 0%, var(--bg) 60%);
  transform: translateY(100%); transition: transform 240ms var(--ease), background 400ms; will-change: transform; touch-action: none; user-select: none; }
#np.open { transform: translateY(0); }
#np.drag { transition: none; }
.np-top { display: flex; align-items: center; justify-content: center; position: relative; height: 44px; }
.np-top .grab { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
.np-top .ib { position: absolute; inset-inline-start: -10px; top: 0; }
.np-art { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px 0 16px; }
.np-art .art { width: min(100%, 52vh); aspect-ratio: 1; height: auto; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,.45); }
.np-art .art .ic { width: 64px; height: 64px; }
.np-meta { display: flex; align-items: center; gap: 8px; }
.np-meta .txt { flex: 1; min-width: 0; }
.np-meta .t { font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-meta .s { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.np-from { display: inline-block; margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.np-from[hidden] { display: none; }
.np-from .ic { vertical-align: -3px; }
.np-seek { padding: 14px 0 4px; touch-action: none; }
.np-seek .track { position: relative; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); }
.np-seek .fill { height: 100%; width: 0; border-radius: 2px; background: var(--grad); }
.np-seek .thumb { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.np-seek .times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.np-ctl { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.np-ctl .ib.big .ic { width: 32px; height: 32px; }
.np-ctl .main { width: 72px; height: 72px; border-radius: 50%; background: var(--grad); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(45,212,191,.25); }
.np-ctl .main .ic { width: 34px; height: 34px; }
.np-ctl .main:active { transform: scale(.96); }
.np-foot { display: flex; justify-content: space-between; padding: 4px 8px 0; }
.np-foot .ib { color: var(--muted); }
.np-foot .ib.on { color: var(--accent); }

/* sheets */
#sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.55); display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 200ms; }
#sheet.open { opacity: 1; pointer-events: auto; }
#sheet .box { width: 100%; max-height: 82vh; overflow-y: auto; background: var(--raised); border-radius: 18px 18px 0 0;
  padding: 8px 0 calc(var(--sab) + 12px); transform: translateY(40px); transition: transform 240ms var(--ease); }
#sheet.open .box { transform: none; }
#sheet .box::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); margin: 4px auto 10px; }
#sheet h3 { margin: 4px 16px 10px; font-size: 16px; font-weight: 600; }
#sheet .head { display: flex; align-items: center; gap: 12px; padding: 4px 16px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
#sheet .head .meta { flex: 1; min-width: 0; }
#sheet .head .t { font-weight: 600; }
#sheet .head .p { color: var(--muted); font-size: 13px; }
#sheet .opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px; text-align: start; font-size: 15px; }
#sheet .opt:active { background: rgba(255,255,255,.06); }
#sheet .opt .ic { color: var(--muted); flex: none; }
#sheet .opt.on .ic { color: var(--accent); }
#sheet .opt.danger { color: var(--danger); }
#sheet .opt.danger .ic { color: var(--danger); }
#sheet .opt small { color: var(--muted); margin-inline-start: auto; font-size: 12px; }
#sheet input { width: calc(100% - 32px); margin: 4px 16px 10px; padding: 11px 12px; border-radius: 10px; border: 0; background: var(--surface); color: var(--fg); outline: none; }
#sheet .sub { padding: 10px 16px 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
#sheet li.tr.dragging { opacity: .5; background: var(--surface); }
#sheet li.tr .hnd { touch-action: none; color: var(--muted); cursor: grab; }
#sheet p.hint { margin: 0 16px 10px; line-height: 1.5; }
/* AI playlist sheet: scoped under #sheet so it does not reflow the unrelated library/admin filter chips, which
   also use .chips but for a horizontally scrolling single-select row (see .chips / .chips button above). */
#sheet .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 16px; padding: 0; overflow: visible; }
#sheet .chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: none; color: var(--fg); font: inherit; }
#aiPrompt { width: calc(100% - 32px); margin: 8px 16px; font: inherit; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }

/* Track picker sheet (js/ui/picker.js): the playlist's Add tracks. Channel rows, then a channel's tracks with a
   tick per row and a sticky Add button that counts the ticks. */
#sheet .pick .pick-h { display: flex; align-items: center; gap: 4px; padding: 0 8px 6px; }
#sheet .pick .pick-h .meta { flex: 1; min-width: 0; }
#sheet .pick .pick-h .t { font-weight: 600; }
#sheet .pick .pick-h .p { color: var(--muted); font-size: 13px; }
#sheet .pick .sbox { margin-bottom: 6px; }
#sheet .pick li.g.off { opacity: .45; pointer-events: none; }
#sheet .pick li.tr { cursor: pointer; }
#sheet .pick .tick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--muted); display: inline-flex; align-items: center;
  justify-content: center; flex: none; margin-inline-end: 8px; color: transparent; transition: background .12s, border-color .12s; }
#sheet .pick .tick .ic { width: 16px; height: 16px; }
#sheet .pick li.tr.on .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
#sheet .pick li.tr.have { opacity: .55; pointer-events: none; }
#sheet .pick li.tr.have .tick { border-color: transparent; color: var(--muted); }
#sheet .pick .pick-foot { position: sticky; bottom: 0; margin-top: 8px; padding: 10px 16px 4px; background: linear-gradient(to top, var(--raised) 70%, transparent); }
#sheet .pick .pick-foot[hidden] { display: none; }
#sheet .pick .pick-foot .btn { width: 100%; justify-content: center; padding: 12px 14px; }

/* admin */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px; }
.tile { padding: 12px 12px 10px; border-radius: 14px; background: var(--surface); min-width: 0; }
.tile .v { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-b { margin: 0 16px; padding: 12px; border-radius: 14px; background: var(--surface); }
.card-b.kv { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.chart .col .lbl { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 3px; line-height: 1; }
.chart .col .bar { width: 100%; max-width: 18px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 0; transition: height .3s; }
.chart .col:active .bar { opacity: .7; }
.axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
.warn { color: #f5b942; }
ul.adm li.row { display: flex; align-items: center; gap: 10px; padding-block: 9px; padding-inline: 16px 12px; }
li.row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
li.row:active { background: var(--surface); }
li.row .meta { flex: 1; min-width: 0; }
li.row .t { font-weight: 500; }
li.row .p { font-size: 13px; }
li.row .n { color: var(--muted); width: 20px; text-align: end; font-variant-numeric: tabular-nums; flex: none; }
li.row .chev { color: var(--muted); transform: rotate(-90deg); width: 20px; height: 20px; flex: none; }
li.row.off .meta { opacity: .55; }
li.row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
li.row .dot.ok { background: var(--accent); }
li.row .dot.bad { background: var(--danger); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 9px; background: var(--raised); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: 2px; margin-inline-start: 2px; }
.badge.on { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: none; }
.badge.ok { color: var(--accent); }
.badge.busy { color: #f5b942; }
.badge.bad { color: var(--danger); }
.sug .desc { -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; white-space: normal; }

/* admin: detail sheets and settings */
.kv2 { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 4px 16px 8px; font-size: 13px; align-items: baseline; }
.kv2 .k { color: var(--muted); white-space: nowrap; }
.kv2 .v { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv2 code, #sheet code { font-size: 12px; background: var(--surface); padding: 1px 5px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; }
#sheet ul.adm { list-style: none; margin: 0; padding: 0 0 4px; }
#sheet ul.adm li.row { padding-inline: 16px 12px; }
#sheet .empty.hint { padding: 8px 16px 10px; font-size: 13px; }
pre.json { margin: 0 16px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface); font-size: 12px; line-height: 1.4;
  overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; direction: ltr; text-align: left; max-height: 40vh; }
ul.adm li.row .val { color: var(--accent); font-variant-numeric: tabular-nums; flex: none; direction: ltr; }
#content .opt.add { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; text-align: start; font-size: 15px; color: var(--accent); }
#content .opt.add .ic { color: var(--accent); }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--mini-h) + var(--sab) + 20px); transform: translateX(-50%);
  z-index: 20; padding: 10px 14px; border-radius: 12px; background: var(--raised); color: var(--fg); font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: calc(100% - 32px); pointer-events: none; }

body.np-open #toast { bottom: auto; top: calc(var(--sat) + var(--cat) + 56px); }

@media (prefers-reduced-motion: reduce) { #np, #sheet, #sheet .box { transition: none; } }

/* Persian: mirror navigation glyphs, keep mixed-script rows flush, no tracking on Arabic script. */
.bidi { text-align: left; }
[dir=rtl] .bidi { text-align: right; }
[dir=rtl] .seeall .chev, [dir=rtl] li.g .chev, [dir=rtl] li.row .chev { transform: rotate(90deg); }
[dir=rtl] [data-act=back] svg { transform: scaleX(-1); }
[lang=fa] body { line-height: 1.5; }
[lang=fa] .seclabel, [lang=fa] .continue .lbl, [lang=fa] .gh .kind, [lang=fa] .tile .l, [lang=fa] #sheet .sub { letter-spacing: 0; }

/* Desktop / wide browsers: keep the phone layout, centre it. Fixed elements centre via inset + max-width + auto margins. */
@media (min-width: 600px) {
  :root { --col: 480px; }
  #content, #tabs, #mini, #np { max-width: var(--col); margin-left: auto; margin-right: auto; }
  #mini { left: 0; right: 0; width: calc(var(--col) - 16px); }
  #sheet .box { max-width: var(--col); margin: 0 auto; }
  body { background-attachment: fixed; }
}

/* Pro plan */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pill.on { background: var(--grad); color: var(--accent-fg); box-shadow: none; }
.pill .ic { width: 14px; height: 14px; }
.lock { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; font-size: 11px; font-weight: 700; color: var(--accent); vertical-align: 1px; }
.lock .ic { width: 12px; height: 12px; }
#sheet .plan h3 { display: flex; align-items: center; gap: 8px; }
#sheet .plan h3 .ic { width: 20px; height: 20px; color: var(--accent); }
#sheet .plan .reason { margin: 0 16px 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); color: var(--fg); line-height: 1.45; }
#sheet .plan ul.feats { list-style: none; margin: 0 16px 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 13px; }
#sheet .plan ul.feats li { display: flex; align-items: center; gap: 6px; }
#sheet .plan ul.feats .ic { width: 16px; height: 16px; color: var(--accent); flex: none; }
#sheet .plan .seg { display: flex; margin: 0 16px 10px; border-radius: 12px; background: var(--surface); padding: 3px; }
#sheet .plan .seg button { flex: 1; padding: 8px; border-radius: 10px; font-weight: 600; }
#sheet .plan .seg button.on { background: var(--raised); color: var(--accent); }
#sheet .plan .kv { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; margin: 0 16px 10px; font-size: 14px; }
#sheet .plan .kv b { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
#sheet .plan .kv b.bidi { direction: inherit; unicode-bidi: plaintext; }
#sheet img.receipt { display: block; max-width: calc(100% - 32px); max-height: 60vh; margin: 0 16px 12px; border-radius: 12px; background: var(--surface); }
#sheet .plan input { width: calc(100% - 32px); margin: 0 16px 10px; }
#sheet .plan .hint { margin: 0 16px 8px; }

/* Admin > Monitor */
.mon { margin: 0 16px 8px; padding: 12px; border-radius: 14px; background: var(--surface); }
.mon .mh { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.mon .mh .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.mon .mh .dot.ok { background: var(--accent); } .mon .mh .dot.bad { background: var(--danger); }
.mon .mh .hint { font-weight: 400; margin-inline-start: auto; font-size: 12px; }
.mon .kv2 { margin: 0; }
.spark { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 16px 8px; }
.spark .sp { padding: 10px 12px 8px; border-radius: 14px; background: var(--surface); min-width: 0; }
.spark .sp .l { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.spark .sp .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.spark svg { width: 100%; height: 40px; display: block; margin-top: 4px; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

/* AI: the search bar's mode pill, the descriptive-search intro, and the playlist sheet's three views */
.eq { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 36px; }
.eq i { width: 6px; border-radius: 3px; background: var(--grad); height: var(--h); animation: splash-eq 1.1s ease-in-out infinite alternate; animation-delay: var(--d); }
.eq i:nth-child(1) { --h: 14px; --d: -.15s; }
.eq i:nth-child(2) { --h: 24px; --d: -.55s; }
.eq i:nth-child(3) { --h: 36px; --d: -.95s; }
.eq i:nth-child(4) { --h: 24px; --d: -.35s; }
.eq i:nth-child(5) { --h: 14px; --d: -.75s; }
.sbox { transition: box-shadow .2s, color .2s; }
.sbox.ai { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.sbox .pill { flex: none; margin-inline: 2px 6px; padding: 5px 10px 5px 7px; cursor: pointer; }
.sbox .pill:not(.on):active { background: rgba(45,212,191,.12); }
.ai-intro { padding-top: 44px; }
.ai-intro .eq { height: 44px; margin-bottom: 8px; }
.ai-intro .eq i { animation: none; }
.ai-intro p { margin: 8px auto 0; max-width: 34ch; }
#sheet .ai textarea { display: block; width: calc(100% - 32px); margin: 4px 16px 10px; padding: 12px; border-radius: 12px; border: 0;
  background: var(--surface); color: var(--fg); outline: none; resize: none; font: inherit; line-height: 1.4; transition: box-shadow .15s; }
#sheet .ai textarea:focus { box-shadow: inset 0 0 0 1px var(--accent); }
#sheet .ai textarea::placeholder { color: var(--muted); }
#sheet .ai .chip { color: var(--muted); }
#sheet .ai .chip:active { background: var(--surface); }
#sheet .ai .ai-actions { display: flex; gap: 10px; margin: 12px 16px 4px; }
#sheet .ai h3 { display: flex; align-items: center; gap: 8px; }
#sheet .ai h3 .ic { width: 20px; height: 20px; color: var(--accent); }
#sheet .ai .ai-actions .btn { flex: 1; justify-content: center; padding: 12px 14px; white-space: nowrap; }
#sheet .ai .ai-actions .btn.line { flex: 0 0 auto; }
#sheet .ai .ai-actions .btn:only-child { flex: 1; }
#sheet .ai .ai-actions .btn.line { border-style: solid; border-color: var(--line); color: var(--fg); }
#sheet .ai .ai-comp { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 20px 10px; text-align: center; }
#sheet .ai .ai-comp blockquote { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.45; max-width: 32ch; quotes: "“" "”"; }
[lang=fa] #sheet .ai .ai-comp blockquote { quotes: "«" "»"; }
#sheet .ai .ai-comp blockquote::before { content: open-quote; color: var(--muted); }
#sheet .ai .ai-comp blockquote::after { content: close-quote; color: var(--muted); }
#sheet .ai .ai-comp .st { color: var(--muted); font-size: 13px; min-height: 18px; animation: splash-breathe 1.6s ease-in-out infinite; }
#sheet .ai .skel-list { margin-top: 6px; }
#sheet .ai .skel { pointer-events: none; }
#sheet .ai .skel .art, #sheet .ai .skel .t, #sheet .ai .skel .p { background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.11) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }
#sheet .ai .skel .t, #sheet .ai .skel .p { height: 11px; border-radius: 6px; }
#sheet .ai .skel .t { width: 62%; margin-bottom: 9px; }
#sheet .ai .skel .p { width: 38%; }
#sheet .ai .skel:nth-child(4) { opacity: .75; }
#sheet .ai .skel:nth-child(5) { opacity: .5; }
#sheet .ai .skel:nth-child(6) { opacity: .28; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#sheet .ai .ai-head { padding: 4px 16px 4px; }
#sheet .ai .kicker { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
#sheet .ai .kicker .ic { width: 14px; height: 14px; }
#sheet .ai .ai-head h2 { font-size: 21px; margin: 6px 0 2px; line-height: 1.25; }
#sheet .ai .ai-head .hint { margin: 0 0 10px; line-height: 1.45; }
#sheet .ai .chip.prompt { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 13px; }
#sheet .ai .chip.prompt .ic { width: 14px; height: 14px; flex: none; }
#sheet .ai .chip.prompt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sheet .ai .note { margin: 6px 16px 4px; padding: 9px 12px; border-radius: 10px; background: var(--surface); }
[lang=fa] #sheet .ai .kicker { letter-spacing: 0; }
@media (prefers-reduced-motion: reduce) { .eq i, #sheet .ai .ai-comp .st, #sheet .ai .skel .art, #sheet .ai .skel .t, #sheet .ai .skel .p { animation: none; } }
.postText{white-space:pre-wrap;overflow-wrap:anywhere}
.postTrack{font-weight:600;overflow-wrap:anywhere}
