  :root {
    --bg: #0e0f13;
    --surface: #17191f;
    --surface-2: #1f222a;
    --press: #262a33;
    --hair: #262933;
    --text: #f2f3f5;
    --muted: #959aa6;
    --muted-2: #6b6f7a;
    /* ONE accent. Меняется одной строкой. */
    --accent: #7c6cff;
    --accent-ink: #ffffff;
    --accent-soft: rgba(124, 108, 255, .14);
    --r: 14px;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { background: var(--bg); color: var(--text);
    font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif; }
  body { padding: 10px 12px 96px; min-height: 100vh; overflow-x: hidden; max-width: 480px; margin: 0 auto; }
  .hidden { display: none !important; }
  svg { display: block; }
  button { font-family: inherit; cursor: pointer; }

  .top { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 2px 12px; }
  .top h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
  .top .count { font-size: 12px; color: var(--muted-2); font-weight: 600; }

  .search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 11px;
    padding: 9px 12px; margin-bottom: 10px; }
  .search svg { width: 16px; height: 16px; color: var(--muted-2); flex: 0 0 16px; }
  .search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; }
  .search input::placeholder { color: var(--muted-2); }

  /* Segmented control (тип) — телеграмовский, с плавающей пилюлей */
  .seg { position: relative; display: flex; background: var(--surface); border-radius: 11px; padding: 3px; margin-bottom: 8px; }
  .seg .pill { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: var(--surface-2);
    box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1); }
  .seg button { position: relative; z-index: 1; flex: 1; border: 0; background: none; color: var(--muted);
    font-size: 13px; font-weight: 700; padding: 7px 0; transition: color .25s; }
  .seg button.on { color: var(--text); }

  /* Платформенные чипы (второй уровень фильтра) */
  .chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 11px;
    border-radius: 9px; background: var(--surface); border: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
  .chip svg { width: 13px; height: 13px; flex: 0 0 13px; }
  .chip.on { background: var(--accent-soft); color: var(--accent); }

  .dayhead { color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; margin: 14px 4px 7px; }

  /* Карточка: превью + инфо + действие */
  .card { display: flex; gap: 10px; align-items: center; padding: 7px; background: var(--surface);
    border-radius: var(--r); margin-bottom: 7px; }
  .card:active { background: var(--press); }
  .thumb { position: relative; width: 106px; height: 60px; flex: 0 0 106px; border-radius: 9px; overflow: hidden; background: #000; }
  .thumb .img { position: absolute; inset: 0; background-size: cover; background-position: center; }
  .thumb .play { position: absolute; inset: 0; display: grid; place-items: center; }
  .thumb .play span { width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.5); display: grid; place-items: center; }
  .thumb .play svg { width: 11px; height: 11px; color: #fff; margin-left: 1px; }
  .thumb .dur { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.78); color: #fff;
    font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 4px; letter-spacing: .2px; }
  .thumb .pf { position: absolute; left: 4px; top: 4px; width: 17px; height: 17px; border-radius: 4px;
    display: grid; place-items: center; background: rgba(0,0,0,.6); }
  .thumb .pf svg { width: 11px; height: 11px; }
  /* Fallback cover: the platform glyph centered over the gradient, shown when a track/item has no
     preview image (or it fails to load). loadThumb() hides it once a real cover has loaded. */
  .covgl { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
  .covgl svg { width: 30%; height: 30%; max-width: 72px; max-height: 72px; opacity: .85; color: rgba(255,255,255,.85); }
  /* сердечко в углу превью */
  .fav-t { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%;
    background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
  .fav-t svg { width: 12px; height: 12px; }
  .fav-t.on { color: var(--accent); }
  .fav-t:active { transform: scale(.85); }
  .info { flex: 1; min-width: 0; }
  .info .t { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .info .m { color: var(--muted-2); font-size: 11.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .send { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; border: 0; display: grid;
    place-items: center; background: var(--accent-soft); color: var(--accent); margin-right: 3px; }
  .send svg { width: 16px; height: 16px; }
  .send:disabled { background: var(--surface-2); color: var(--muted-2); }
  .send:active { transform: scale(.9); }

  .empty { text-align: center; color: var(--muted-2); padding: 56px 20px; font-size: 14px; }
  .empty svg { width: 40px; height: 40px; margin: 0 auto 12px; }

  /* Прогресс активной загрузки (закреплён над списком) */
  .job { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface);
    border: 1px solid var(--hair); border-radius: var(--r); margin-bottom: 10px; }
  .job .jpf { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; flex: 0 0 34px; }
  .job .jpf svg { width: 17px; height: 17px; }
  .job .jt { flex: 1; min-width: 0; }
  .job .jt .t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .job .bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
  .job .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .35s ease; }
  .job .pct { font-size: 11.5px; font-weight: 700; color: var(--muted); flex: 0 0 auto; min-width: 34px; text-align: right; }

  /* МУЗЫКА: компактные ряды с обложкой */
  .trk { display: flex; align-items: center; gap: 11px; padding: 8px; background: var(--surface);
    border-radius: 12px; margin-bottom: 6px; }
  .trk:active { background: var(--press); }
  .trk .cov { position: relative; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 10px; overflow: hidden;
    background-size: cover; background-position: center; display: grid; place-items: center; }
  .trk .cov svg { width: 18px; height: 18px; color: rgba(255,255,255,.85); }
  .trk .tt { flex: 1; min-width: 0; }
  .trk .tt .t { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .trk .tt .m { color: var(--muted-2); font-size: 11.5px; margin-top: 2px; }
  .trk .go { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--accent-soft);
    color: var(--accent); display: grid; place-items: center; flex: 0 0 32px; }
  .trk .go svg { width: 14px; height: 14px; }
  .trk .go:disabled { background: var(--surface-2); color: var(--muted-2); }
  .trk .go:active { transform: scale(.9); }
  /* Чарт: место в списке слева, число скачавших справа. Климберы (ещё не дотянули до порога)
     показываем тем же числом, только приглушённым — это не отдельный сорт строки. */
  .trk .rank { flex: 0 0 16px; text-align: center; color: var(--muted-2); font-size: 12.5px; font-weight: 800; }
  .trk .cnt { flex: 0 0 auto; color: var(--muted-2); font-size: 12px; font-weight: 700; }
  .trk .cnt.climb { opacity: .5; }

  /* ИЗБРАННОЕ: коллекции */
  .cols { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
  .cols::-webkit-scrollbar { display: none; }
  .colc { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px;
    background: var(--surface); border: 0; color: var(--muted); font-size: 12.5px; font-weight: 700; }
  .colc svg { width: 13px; height: 13px; }
  .colc .n { color: var(--muted-2); font-weight: 600; }
  .colc.on { background: var(--accent-soft); color: var(--accent); }
  .colc.add { border: 1px dashed var(--hair); background: none; }

  /* ДЕТАЛЬ */
  .detail { position: fixed; inset: 0; background: var(--bg); z-index: 30; display: none;
    flex-direction: column; overflow-y: auto; max-width: 480px; margin: 0 auto; padding-bottom: 24px; }
  .detail.show { display: flex; animation: din .22s ease; }
  @keyframes din { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  .dhead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
  .dhead .back { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface);
    display: grid; place-items: center; color: var(--text); }
  .dhead .back svg { width: 16px; height: 16px; }
  .dhead .ht { font-weight: 700; font-size: 15px; }
  .dhead .hfav { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface);
    display: grid; place-items: center; color: var(--text); }
  .dhead .hfav svg { width: 16px; height: 16px; }
  .dhead .hfav.on { color: var(--accent); }
  .dhero { position: relative; margin: 0 14px; border-radius: 14px; overflow: hidden; aspect-ratio: 16/9;
    background-size: cover; background-position: center; }
  .dhero .play { position: absolute; inset: 0; display: grid; place-items: center; border: 0; background: none; width: 100%; }
  .dhero .play span { width: 50px; height: 50px; border-radius: 50%; background: rgba(0,0,0,.5); display: grid; place-items: center; }
  .dhero .play svg { width: 19px; height: 19px; color: #fff; margin-left: 2px; }
  .dhero .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.78); color: #fff;
    font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
  .dtitle { font-size: 17px; font-weight: 800; line-height: 1.3; margin: 14px 14px 6px; }
  .dmeta { color: var(--muted); font-size: 12.5px; margin: 0 14px 16px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .dmeta .chipm { background: var(--surface); padding: 3px 8px; border-radius: 6px; font-weight: 600; font-size: 11.5px; }
  .dprimary { margin: 0 14px; border: 0; border-radius: 12px; padding: 13px; background: var(--accent);
    color: var(--accent-ink); font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
  .dprimary svg { width: 17px; height: 17px; }
  .dprimary:disabled { opacity: .5; }
  .dprimary:active { transform: scale(.99); }
  .dsec { display: flex; gap: 8px; margin: 8px 14px 0; }
  .dsec button { flex: 1; border: 0; border-radius: 11px; padding: 11px; background: var(--surface);
    color: var(--text); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
  .dsec button svg { width: 15px; height: 15px; color: var(--muted); }
  .dsec button:active { background: var(--press); }

  /* АККАУНТ */
  .acc-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 4px; }
  .avatar { width: 68px; height: 68px; border-radius: 50%; background: var(--accent); display: grid;
    place-items: center; font-size: 26px; font-weight: 800; color: var(--accent-ink); }
  .acc-name { font-size: 17px; font-weight: 700; }
  .badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .3px; }
  .badge.free { background: var(--surface-2); color: var(--muted); }
  .badge.pro { background: var(--accent); color: var(--accent-ink); }

  .actions { display: flex; justify-content: center; gap: 26px; padding: 14px 0 6px; }
  .action { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: var(--text); }
  .action .ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface); color: var(--text); }
  .action .ic svg { width: 20px; height: 20px; }
  .action.primary .ic { background: var(--accent); color: var(--accent-ink); }
  .action .lbl { color: var(--muted); font-size: 11.5px; font-weight: 600; }
  .action:active .ic { transform: scale(.92); }

  .pro { background: var(--surface); border-radius: var(--r); padding: 15px; margin: 10px 0; }
  .pro h3 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
  .pro h3 svg { width: 18px; height: 18px; color: var(--accent); }
  .pro p { color: var(--muted); margin: 6px 0 12px; font-size: 12.5px; line-height: 1.45; }
  .perks { list-style: none; margin: 9px 0 13px; display: grid; gap: 7px; }
  .perks li { position: relative; padding-left: 17px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
  .perks li::before { content: ''; position: absolute; left: 3px; top: 7px; width: 5px; height: 5px;
    border-radius: 50%; background: var(--accent); }
  .btn-a { width: 100%; border: 0; border-radius: 11px; padding: 12px; font-size: 14px; font-weight: 800;
    color: var(--accent-ink); background: var(--accent); }
  .btn-a:active { transform: scale(.99); }

  .seclabel { color: var(--muted-2); font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; margin: 16px 4px 7px; }
  .stats, .rows { background: var(--surface); border-radius: var(--r); overflow: hidden; }
  .stat, .row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
    border-bottom: 1px solid var(--hair); }
  .stat:last-child, .row:last-child { border-bottom: 0; }
  .row:active { background: var(--press); }
  .stat .l, .row .l { color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
  .row .l { color: var(--text); }
  .stat .l svg, .row .l svg { width: 17px; height: 17px; color: var(--muted-2); }
  .stat .v { font-size: 16px; font-weight: 800; }
  .row .val { color: var(--muted); display: flex; align-items: center; gap: 7px; font-size: 13px; }
  .chev { width: 15px; height: 15px; color: var(--muted-2); }

  /* Нижний таб-бар: НАСТОЯЩИЙ liquid glass — рефракция фона (SVG displacement на backdrop),
     спекулярная кромка, капля = стеклянная линза. На iOS WKWebView displacement не поддержан —
     деградирует до frosted+кромка автоматически. */
  .nav { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex;
    align-items: center; border-radius: 26px; padding: 8px 6px 7px; z-index: 25; isolation: isolate; overflow: hidden;
    box-shadow: 0 14px 36px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.3); }
  .nav .glass-fx { position: absolute; inset: 0; border-radius: inherit; z-index: 0;
    backdrop-filter: blur(7px) saturate(1.3); -webkit-backdrop-filter: blur(7px) saturate(1.3);
    filter: url(#lg-dist); }
  .nav .glass-tint { position: absolute; inset: 0; border-radius: inherit; z-index: 1;
    background: rgba(24,27,34,.42); }
  .nav .glass-shine { position: absolute; inset: 0; border-radius: inherit; z-index: 3; pointer-events: none;
    box-shadow: inset 1.5px 1.5px 1px -1px rgba(255,255,255,.5), inset -1.5px -1.5px 1px -1px rgba(255,255,255,.22),
      inset 0 0 10px rgba(255,255,255,.05); }
  /* капля-линза: rounded rectangle на весь таб (иконка + подпись).
     Радиус концентричен бару: 26 (бар) − 6 (зазор) = 20 — зазор по контуру равномерный. */
  .nav .drop { position: absolute; top: 6px; bottom: 6px; left: 0; border-radius: 20px;
    z-index: 2; will-change: transform, width; background: rgba(255,255,255,.06);
    backdrop-filter: blur(2px) brightness(1.18) saturate(1.35);
    -webkit-backdrop-filter: blur(2px) brightness(1.18) saturate(1.35);
    box-shadow: inset 1px 1.5px 1px -.5px rgba(255,255,255,.5), inset -1px -1.5px 1px -.5px rgba(255,255,255,.2),
      0 3px 8px rgba(0,0,0,.28); }
  .nav button.tab { position: relative; z-index: 4; border: 0; background: none; color: #d7dae0;
    font-size: 10.5px; font-weight: 600; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 4px 13px 2px; transition: color .25s; }
  .nav button.tab .nic { display: grid; place-items: center; width: 24px; height: 24px; }
  .nav button.tab svg { width: 21px; height: 21px; }
  .nav button.tab.on { color: var(--accent); }
  /* центральная кнопка скачивания — единственный цветной элемент бара */
  .nav .fab { position: relative; z-index: 4; width: 42px; height: 42px; border-radius: 50%; border: 0;
    background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin: 0 5px;
    box-shadow: 0 4px 12px rgba(124,108,255,.4); }
  .nav .fab svg { width: 20px; height: 20px; }
  .nav .fab:active { transform: scale(.92); }

  .toast { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%) translateY(16px);
    background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13px;
    padding: 10px 16px; border-radius: 11px; border: 1px solid var(--hair); opacity: 0;
    transition: all .22s; pointer-events: none; z-index: 40; }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  .sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 45; display: none; align-items: flex-end; }
  .sheet-bg.show { display: flex; }
  .sheet { width: 100%; max-width: 480px; margin: 0 auto; background: var(--surface); border-radius: 18px 18px 0 0;
    padding: 6px 12px 24px; max-height: 78vh; overflow-y: auto; animation: up .2s ease; }
  @keyframes up { from { transform: translateY(100%); } to { transform: none; } }
  .sheet-h { text-align: center; font-weight: 800; font-size: 15px; padding: 12px 0 8px; }
  .lang { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-bottom: 1px solid var(--hair); font-size: 14px; }
  .lang:last-child { border-bottom: 0; }
  .lang:active { background: var(--press); border-radius: 10px; }
  .lang .check { margin-left: auto; width: 17px; height: 17px; color: var(--accent); visibility: hidden; }
  .lang.on .check { visibility: visible; }

  /* Шторка скачивания */
  .dl-in { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 11px;
    padding: 10px 12px; margin: 6px 0 10px; }
  .dl-in svg { width: 16px; height: 16px; color: var(--muted-2); flex: 0 0 16px; }
  .dl-in input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; }
  .dl-in input::placeholder { color: var(--muted-2); }
  .dl-in .paste { border: 0; background: var(--accent-soft); color: var(--accent); font-size: 12px;
    font-weight: 700; padding: 6px 10px; border-radius: 8px; flex: 0 0 auto; }
  .dl-src { display: flex; align-items: center; gap: 9px; padding: 4px 2px 10px; color: var(--muted); font-size: 12.5px; }
  .dl-src svg { width: 14px; height: 14px; }
  .dl-src .t { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vrow { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-bottom: 1px solid var(--hair); }
  .vrow:last-child { border-bottom: 0; }
  .vrow:active { background: var(--press); border-radius: 10px; }
  .vrow .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted-2); flex: 0 0 18px; display: grid; place-items: center; }
  .vrow.on .radio { border-color: var(--accent); }
  .vrow.on .radio::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
  .vrow .vl { flex: 1; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
  .vrow .pro-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .4px; background: var(--accent);
    color: var(--accent-ink); padding: 2px 5px; border-radius: 5px; }
  .vrow.locked .vl, .vrow.locked .vs { color: var(--muted); }
  .vrow.locked .radio { opacity: .35; }
  .vrow .vs { color: var(--muted-2); font-size: 12.5px; }
  .dl-go { width: 100%; border: 0; border-radius: 12px; padding: 13px; margin-top: 12px; background: var(--accent);
    color: var(--accent-ink); font-size: 15px; font-weight: 800; }
  .dl-go:disabled { opacity: .45; }
  .dl-wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 14px 4px; }
  .spin { width: 16px; height: 16px; border: 2px solid var(--surface-2); border-top-color: var(--accent);
    border-radius: 50%; animation: sp 1s linear infinite; }
  @keyframes sp { to { transform: rotate(360deg); } }

  .skeleton { height: 74px; border-radius: var(--r); margin-bottom: 7px;
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
    background-size: 200% 100%; animation: sh 1.2s infinite; }
  @keyframes sh { to { background-position: -200% 0; } }
