/* Majestic — мини-апп нарезок. Дизайн-система Majestic Dark (те же токены). */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #0C0D12; --surface: rgba(255,255,255,.045); --surface-solid: #14151C; --surface-2: #1A1B24;
  --border: rgba(255,255,255,.08); --border-strong: rgba(255,255,255,.14);
  --text: #F2F3F7; --text-dim: #9A9DAC; --text-faint: #62656F;
  --pink: #F80D53; --pink-soft: #FF5C8A;
  --grad: linear-gradient(135deg,#FF5C8A 0%,#F80D53 100%);
  --grad-soft: linear-gradient(135deg,rgba(255,92,138,.18),rgba(248,13,83,.18));
  --pink-glow: 0 6px 24px rgba(248,13,83,.35);
  --mint: #3DDC97; --mint-dim: rgba(61,220,151,.14);
  --radius: 20px; --radius-sm: 14px; --shadow: 0 8px 28px rgba(0,0,0,.4); --tabbar-h: 64px;
  --logo: url("/static/majestic-white.png");
}
:root[data-theme="light"] {
  --bg: #F4F4F8; --surface: rgba(255,255,255,.72); --surface-solid: #FFF; --surface-2: #ECECF1;
  --border: rgba(20,21,28,.08); --border-strong: rgba(20,21,28,.16);
  --text: #17181F; --text-dim: #6B6E7B; --text-faint: #A2A5B1; --shadow: 0 8px 24px rgba(23,24,31,.08);
  --logo: url("/static/majestic-black.png");
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 40% at 80% 0%, rgba(248,13,83,.10), transparent 70%),
    radial-gradient(50% 40% at 0% 20%, rgba(255,92,138,.05), transparent 70%);
}

/* ── Шапка ── */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(18px); -webkit-backdrop-filter: saturate(140%) blur(18px);
}
.wordmark {
  width: 132px; height: 30px; background: var(--logo) left center / contain no-repeat; display: block;
}
.bell {
  position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.bell-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }

main { padding: 14px 16px 0; max-width: 720px; margin: 0 auto; }
.tab { display: flex; flex-direction: column; gap: 12px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

/* ── Карточки, поля, кнопки ── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; backdrop-filter: var(--blur);
}
.field-label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; font-weight: 600; }
.input {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-solid); color: var(--text); font: inherit; font-size: 15px; outline: none;
}
.input:focus { border-color: var(--pink-soft); }
.quality-row { display: flex; gap: 8px; margin: 12px 0; }
.chip {
  flex: 1; padding: 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: .15s;
}
.chip.active { background: var(--grad-soft); border-color: transparent; color: var(--text); }
.range-row { display: flex; gap: 8px; margin-bottom: 6px; }
.range-field { flex: 1; }
.range-field .field-label { margin-bottom: 6px; }
.range-hint { font-size: 12px; color: var(--text-faint); margin-bottom: 12px; }
.opt-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.opt-chip { flex: 1; padding: 11px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .15s; }
.opt-chip.active { background: var(--grad-soft); border-color: transparent; color: var(--text); }
.btn {
  width: 100%; padding: 14px; border-radius: var(--radius-sm); border: none; font: inherit; font-size: 15px;
  font-weight: 700; cursor: pointer; transition: .15s; color: #fff; display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-grad { background: var(--grad); box-shadow: var(--pink-glow); }
.btn-grad:active { transform: scale(.99); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn.sm { width: auto; padding: 9px 16px; font-size: 13px; }
.section-head { font-size: 13px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin: 6px 2px 0; }

/* ── Баннер Яндекса ── */
.yadisk-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.yb-text { font-size: 14px; color: var(--text-dim); }

/* ── Задачи (прогресс) ── */
.task {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-title { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-status { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.bar { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .4s ease; }
.task-detail { font-size: 12px; color: var(--text-faint); }
.task.err .task-status { color: #FF7A59; }

/* ── Диск ── */
.disk-summary { font-size: 13px; color: var(--text-dim); padding: 2px 2px 2px; }
.disk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.folder {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: .15s; display: flex; flex-direction: column;
}
.folder:active { transform: scale(.98); }
.folder-thumb { aspect-ratio: 16/10; background: var(--surface-2) center/cover no-repeat; position: relative; }
.folder-thumb.empty { display: grid; place-items: center; color: var(--text-faint); }
.folder-badge {
  position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  background: var(--mint-dim); color: var(--mint); backdrop-filter: blur(8px);
}
.folder-meta { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 3px; }
.folder-ch { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-sub { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--text-faint); font-size: 14px; padding: 60px 20px; line-height: 1.6; }

/* ── Настройки ── */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-title { font-size: 15px; font-weight: 700; }
.set-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.version { text-align: center; color: var(--text-faint); font-size: 12px; padding: 16px; }

/* ── Нижняя навигация ── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; z-index: 40;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(18px); -webkit-backdrop-filter: saturate(140%) blur(18px);
  border-top: 1px solid var(--border);
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: var(--text-faint); font: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: color .15s;
}
.tab-btn.active { color: var(--text); }
.tab-btn.active svg { stroke: url(#g); }
.tab-btn.active { background: none; }
.tab-btn.active span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tab-btn.active svg path, .tab-btn.active svg circle { stroke: var(--pink); }

/* ── Оверлеи / шторки ── */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--surface-solid);
  border-radius: 24px 24px 0 0; border: 1px solid var(--border); padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideup .28s cubic-bezier(.2,.9,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.sheet-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.sheet-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }

/* Части в папке */
.part {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px; border-radius: var(--radius-sm); background: var(--surface);
}
.part + .part { margin-top: 8px; }
.part-thumb { width: 56px; height: 40px; border-radius: 8px; background: var(--surface-2) center/cover no-repeat; }
.part-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-sub { font-size: 11px; color: var(--text-faint); }
.part-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; }

/* Плеер */
.player { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; }
.player video { width: 100%; max-height: 100%; }
.player-close { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 16px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(0,0,0,.5); color: #fff; font-size: 18px; cursor: pointer; }

/* Тосты */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--surface-solid); color: var(--text); border: 1px solid var(--border-strong); padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: fade .2s ease; max-width: 90%; }
.toast.err { border-color: #FF7A59; }
