/* Aza Downloader Mini App — дизайн-система «Premium Glassmorphism» */

@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/manrope-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-018E, U+0190-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* В Manrope нет заглавной Ə (азербайджанский) — только для неё Inter. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/inter-latin-ext.woff2) format("woff2"); unicode-range: U+018F; }

:root {
  --bg: #05070D;
  --surface: #0A1020;
  --accent: #2F7BFF;
  --accent-2: #22D3EE;
  --text: #F5F7FF;
  --muted: #8A94B0;
  --ok: #34D399;
  --err: #F87171;
  --warn: #FBBF24;

  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.10);
  --blur: blur(18px) saturate(140%);
  --r-lg: 20px;
  --r-sm: 14px;

  --safe-top: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --content-top: var(--tg-content-safe-area-inset-top, 0px);
  --content-bottom: var(--tg-content-safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 500 15px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none;
  font-feature-settings: "ss01";
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
.num, .tabular { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- Типографика ---------- */
.h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.h2 { font-size: 17px; font-weight: 600; margin: 0; }
.small { font-size: 13px; font-weight: 500; }
.muted { color: var(--muted); }

/* ---------- Фон ---------- */
#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#flow { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Верх и центр притемнены: стекло и текст читаются, свет — снизу и по краям. */
.shade { position: absolute; inset: 0;
  background:
    radial-gradient(70% 46% at 50% 36%, rgba(5,7,13,.62) 0%, rgba(5,7,13,.30) 60%, rgba(5,7,13,0) 100%),
    linear-gradient(180deg, rgba(5,7,13,.80) 0%, rgba(5,7,13,.42) 26%, rgba(5,7,13,.12) 55%, rgba(5,7,13,0) 72%); }

.aurora { position: absolute; inset: 0; }
.aurora .blob { position: absolute; border-radius: 50%; opacity: .8; will-change: transform, opacity; }
.aurora .b1 { width: 130vw; height: 70vh; left: -45vw; bottom: -22vh;
  background: radial-gradient(closest-side, rgba(47,123,255,.85), rgba(47,123,255,0));
  animation: drift1 26s ease-in-out infinite alternate; }
.aurora .b2 { width: 110vw; height: 60vh; right: -40vw; bottom: -10vh;
  background: radial-gradient(closest-side, rgba(34,211,238,.70), rgba(34,211,238,0));
  animation: drift2 30s ease-in-out infinite alternate; }
.aurora .b3 { width: 90vw; height: 50vh; left: 10vw; bottom: -30vh;
  background: radial-gradient(closest-side, rgba(30,91,255,.80), rgba(30,91,255,0));
  animation: drift3 22s ease-in-out infinite alternate; }
.aurora .b4 { width: 70vw; height: 55vh; left: -30vw; top: 8vh; opacity: .35;
  background: radial-gradient(closest-side, rgba(34,211,238,.35), rgba(34,211,238,0));
  animation: drift2 28s ease-in-out infinite alternate-reverse; }
.aurora .star { position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #CFE1FF; opacity: .35; animation: twinkle 9s ease-in-out infinite alternate; }
@keyframes drift1 { from { transform: translate3d(0,0,0) scale(1); opacity: .65; } to { transform: translate3d(12vw,-6vh,0) scale(1.12); opacity: .95; } }
@keyframes drift2 { from { transform: translate3d(0,0,0) scale(1.05); opacity: .55; } to { transform: translate3d(-14vw,-8vh,0) scale(.92); opacity: .85; } }
@keyframes drift3 { from { transform: translate3d(-6vw,0,0) scale(.95); opacity: .65; } to { transform: translate3d(8vw,-10vh,0) scale(1.1); opacity: .9; } }
@keyframes twinkle { from { opacity: .15; } to { opacity: .55; } }
.paused .aurora *, .paused .skeleton { animation-play-state: paused !important; }

/* ---------- Каркас ---------- */
#app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }
#screens { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + var(--content-top) + 16px) 16px
           calc(var(--nav-h) + var(--safe-bottom) + 28px); }
.screen { display: none; }
.screen.active { display: block; animation: screen-in 230ms var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Стекло ---------- */
/* Стекло по токену rgba(255,255,255,.06) поверх лёгкой тёмной подложки —
   светящиеся линии фона за карточкой не спорят с текстом. */
.glass { background: linear-gradient(var(--glass), var(--glass)), rgba(6, 10, 22, .38);
  border: 1px solid var(--glass-border); border-radius: var(--r-lg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.glass.sm { border-radius: var(--r-sm); }
.card { padding: 16px; }
.lite .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(16, 22, 40, .86); }

/* ---------- Кнопки ---------- */
.tap { transition: transform 120ms var(--ease), opacity 120ms; }
.tap:active { transform: scale(.97); }
.btn-primary { width: 100%; height: 52px; border-radius: 16px; display: flex; align-items: center;
  justify-content: center; gap: 10px; font-size: 17px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #2F7BFF 0%, #1E5BFF 100%);
  box-shadow: 0 10px 28px -8px rgba(47,123,255,.65), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary[disabled] { opacity: .45; box-shadow: none; }
.btn-primary svg { width: 22px; height: 22px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: var(--muted); }
.icon-btn:active { background: var(--glass-strong); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Шапка ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 2px 8px; }
.brand .logo { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 6px 18px rgba(47,123,255,.45)); }
.brand .title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ---------- Поле ссылки ---------- */
.link-card { padding: 8px; }
.link-row { display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 4px 0 8px; }
.link-row input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0;
  font-size: 16px; font-weight: 500; }
.link-row input::placeholder { color: var(--muted); }
.plat { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: rgba(47,123,255,.14); color: #8FB5FF; transition: background 200ms, color 200ms; }
.plat svg { width: 20px; height: 20px; }
.detected { display: flex; align-items: center; gap: 8px; padding: 2px 12px 8px; font-size: 13px;
  color: var(--muted); min-height: 22px; }
.detected b { color: var(--text); font-weight: 600; }
.detected:empty { display: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); flex: none; }

/* ---------- Чипы качества ---------- */
.section-title { display: flex; align-items: center; gap: 8px; margin: 2px 2px 10px; font-size: 15px; font-weight: 600; }
.section-title svg { width: 18px; height: 18px; color: var(--accent-2); }
.section-title .right { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chip { position: relative; height: 56px; border-radius: var(--r-sm); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; background: var(--glass);
  border: 1px solid var(--glass-border); font-weight: 700; font-size: 14px; }
.chip small { font-size: 11px; font-weight: 500; color: var(--muted); }
.chip.on { border-color: rgba(47,123,255,.9); background: rgba(47,123,255,.18);
  box-shadow: 0 0 0 1px rgba(47,123,255,.4), 0 8px 22px -10px rgba(47,123,255,.8); }
.chip.on small { color: #BFD4FF; }
.chip svg { width: 22px; height: 22px; }
.chip[disabled] { opacity: .35; }
.chip .badge { position: absolute; top: -7px; right: 6px; font-size: 9px; font-weight: 800; padding: 1px 5px;
  border-radius: 6px; background: var(--accent); color: #fff; letter-spacing: .04em; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg .chip { flex-direction: row; gap: 8px; height: 48px; }
.seg .chip svg { width: 18px; height: 18px; }
.chips.three { grid-template-columns: repeat(3, 1fr); }

.yt-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.yt-meta img { width: 96px; height: 54px; object-fit: cover; border-radius: 10px; flex: none; background: var(--surface); }
.yt-meta .t { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.notice { display: flex; gap: 10px; align-items: center; padding: 12px 14px; font-size: 13px; }
.notice svg { width: 20px; height: 20px; flex: none; }
.notice.warn { color: var(--warn); } .notice.err { color: var(--err); }

/* ---------- Последние загрузки ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }
.list-row + .list-row { border-top: 1px solid rgba(255,255,255,.06); }
.list-row .body { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { font-size: 12px; color: var(--muted); }
.status { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status.ok { background: var(--ok); } .status.error { background: var(--err); }
.status.cancelled, .status.too_large { background: var(--warn); }
.link-more { color: #8FB5FF; font-size: 13px; font-weight: 600; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }

/* ---------- Лимит ---------- */
.limit { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.limit .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(34,211,238,.12); color: var(--accent-2); flex: none; }
.limit .ic svg { width: 20px; height: 20px; }
.limit .val { font-weight: 700; font-size: 16px; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #2F7BFF, #22D3EE); transition: width 600ms var(--ease); }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.06); border-radius: 10px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; margin: 8px 0; } .sk-block { height: 72px; }

/* ---------- Навигация ---------- */
.tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 10px); z-index: 5;
  height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px;
  border-radius: 24px; background: rgba(10, 16, 32, .62); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.7); }
.lite .tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(12, 18, 34, .96); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 18px; }
.tab svg { width: 22px; height: 22px; transition: transform 200ms var(--ease); }
.tab::before { content: ""; position: absolute; inset: 2px; border-radius: 16px; opacity: 0;
  background: linear-gradient(180deg, rgba(47,123,255,.28), rgba(47,123,255,.12));
  border: 1px solid rgba(47,123,255,.45); transition: opacity 200ms var(--ease); }
.tab > * { position: relative; }
.tab.on { color: #fff; } .tab.on::before { opacity: 1; } .tab.on svg { color: #6FA3FF; transform: translateY(-1px); }

/* ---------- Заглушки разделов ---------- */
.soon { text-align: center; padding: 28px 18px; }
.soon .big { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center;
  background: rgba(47,123,255,.14); color: #8FB5FF; }
.soon .big svg { width: 28px; height: 28px; }

/* ---------- Переключатель ---------- */
.row-set { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.row-set + .row-set { border-top: 1px solid rgba(255,255,255,.06); }
.row-set .body { flex: 1; } .row-set .body .muted { font-size: 12px; }
.row-set > svg { width: 22px; height: 22px; color: #8FB5FF; flex: none; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: rgba(255,255,255,.14);
  transition: background 200ms; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform 220ms var(--ease); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.switch.on { background: var(--accent); } .switch.on::after { transform: translateX(20px); }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 16px 14px; }
.seg3 button { height: 36px; border-radius: 10px; background: var(--glass); border: 1px solid var(--glass-border);
  font-size: 13px; font-weight: 600; color: var(--muted); }
.seg3 button.on { color: #fff; border-color: rgba(47,123,255,.8); background: rgba(47,123,255,.2); }

/* ---------- Тост ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 26px); z-index: 20;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; max-width: calc(100% - 32px);
  padding: 11px 16px; border-radius: 14px; background: rgba(20, 28, 50, .96); border: 1px solid var(--glass-border);
  font-size: 14px; font-weight: 600; transition: opacity 200ms, transform 220ms var(--ease); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Ошибка запуска ---------- */
.fatal { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; }

@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
  .tap:active { transform: none; }
}

/* ---------- Экран загрузки ---------- */
.btn-secondary { width: 100%; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  gap: 10px; font-size: 16px; font-weight: 700; color: #DCE6FF; background: rgba(47,123,255,.12);
  border: 1px solid rgba(47,123,255,.45); }
.btn-secondary svg, .btn-primary svg { width: 21px; height: 21px; }
.btn-secondary[disabled] { opacity: .5; }
.job-preview { overflow: hidden; }
.job-preview .media { position: relative; aspect-ratio: 16 / 9; background: var(--surface); }
.job-preview .media img, .job-preview .media .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.job-preview .media .ph { display: grid; place-items: center; }
.job-preview .media .ph svg { width: 56px; height: 56px; opacity: .9; }
.qbadge { position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: rgba(5,7,13,.72); border: 1px solid rgba(255,255,255,.14); }
.job-preview .body { padding: 14px 16px 16px; }
.job-preview .title { font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
svg.inl { width: 14px; height: 14px; vertical-align: -2px; }
.progress { display: grid; grid-template-columns: 112px 1fr auto; align-items: center; gap: 16px; position: relative; }
.ring { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: rgba(255,255,255,.08); }
.ring .bar-c { stroke: url(#rg); stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(47,123,255,.6)); }
.pct { position: absolute; left: 0; top: 0; width: 112px; height: 112px; display: flex; align-items: baseline;
  justify-content: center; padding-top: 38px; }
.pct b { font-size: 30px; font-weight: 800; } .pct small { font-size: 15px; font-weight: 700; margin-left: 1px; }
.pinfo .h2 { margin-bottom: 4px; } .pinfo .muted { font-size: 14px; }
.icon-btn.round { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(47,123,255,.5);
  background: rgba(47,123,255,.12); color: #DCE6FF; }
.done-line { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 14px; font-size: 15px; }
.done-line svg { width: 22px; height: 22px; color: var(--ok); }
.ready-btns { display: grid; gap: 10px; }
.file-list { margin-top: 12px; max-height: 320px; overflow-y: auto; }
.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.act { height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text); }
.act svg { width: 22px; height: 22px; color: #8FB5FF; }
.act small { font-size: 10px; color: var(--muted); margin-top: -3px; }
.more-sheet { margin-top: 10px; overflow: hidden; }
.more-sheet .row-set { width: 100%; text-align: left; }
svg.chev { width: 18px; height: 18px; color: var(--muted); }

/* ---------- 18+ ---------- */
.adult { text-align: center; padding: 26px 18px; }
.adult .big { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(251,191,36,.14); color: var(--warn); font-weight: 800; font-size: 20px; }
.adult .btns { display: grid; gap: 10px; margin-top: 18px; }
