/* ============================================================
   ReelMatch — оформление
   Токены берутся из темы Telegram, с запасными значениями.
   ============================================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --accent: #6d5cff;
  --accent-2: #14cddb;
  --accent-grad: linear-gradient(135deg, #6d5cff 0%, #8b5cf6 45%, #14cddb 100%);
  --danger: #ff5c6c;
  --success: #22c55e;
  --warning: #f59e0b;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;

  --shadow-sm: 0 1px 2px rgba(9, 11, 18, 0.06), 0 4px 14px rgba(9, 11, 18, 0.05);
  --shadow-md: 0 10px 30px rgba(9, 11, 18, 0.10);
  --shadow-accent: 0 10px 30px rgba(109, 92, 255, 0.35);

  --bg: #f5f6fa;
  --bg-elev: #ffffff;
  --bg-soft: #eef0f7;
  --text: #10121a;
  --text-2: #5c6377;
  --text-3: #8a90a3;
  --line: rgba(16, 18, 26, 0.08);
  --line-strong: rgba(16, 18, 26, 0.14);
  --glass: rgba(255, 255, 255, 0.78);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

:root[data-theme="dark"] {
  --bg: #0a0c11;
  --bg-elev: #141821;
  --bg-soft: #1b202b;
  --text: #f3f5f9;
  --text-2: #9aa2b6;
  --text-3: #6f7789;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --glass: rgba(10, 12, 17, 0.72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- каркас */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 420px at 85% -12%, rgba(109, 92, 255, 0.16), transparent 60%),
    radial-gradient(760px 380px at 0% 0%, rgba(20, 205, 219, 0.10), transparent 55%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  box-shadow: var(--shadow-accent);
  flex: none;
}
.brand-mark svg { width: 20px; height: 20px; color: #0b0d12; }
.brand-name {
  font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: -2px; }

.main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px calc(96px + var(--safe-bottom));
}

.screen { animation: fade-up 0.32s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- шапка экрана */

.screen-head { margin-bottom: 16px; }
.screen-title { font-size: 26px; line-height: 1.14; font-weight: 750; letter-spacing: -0.035em; margin: 0 0 6px; }
.screen-sub { font-size: 14.5px; line-height: 1.45; color: var(--text-2); margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px;
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  border-radius: var(--r-xl);
  padding: 26px 22px 22px;
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(20, 205, 219, 0.18), transparent 55%),
    radial-gradient(120% 120% at 0% 100%, rgba(109, 92, 255, 0.22), transparent 60%),
    var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: auto -40px -80px auto;
  width: 220px; height: 220px;
  background: conic-gradient(from 120deg, rgba(109,92,255,.35), rgba(20,205,219,.25), transparent 60%);
  filter: blur(38px);
  pointer-events: none;
}
.hero h1 {
  font-size: 27px; line-height: 1.13; letter-spacing: -0.04em; font-weight: 780;
  margin: 0 0 10px; max-width: 19ch;
}
.hero p { font-size: 14.5px; line-height: 1.5; color: var(--text-2); margin: 0 0 20px; max-width: 44ch; }

.trust-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.trust-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 550; color: var(--text-2);
  background: var(--bg-soft);
  border-radius: 999px; padding: 7px 11px;
}
.trust-pill svg { width: 14px; height: 14px; color: var(--success); flex: none; }

/* --------------------------------------------------------------- поля */

.field-block { margin-top: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 8px; }

.input-shell {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 3px 6px 3px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input-shell:focus-within {
  border-color: rgba(109, 92, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(109, 92, 255, 0.12);
}
.input-shell.invalid { border-color: rgba(255, 92, 108, 0.7); box-shadow: 0 0 0 4px rgba(255, 92, 108, 0.10); }
.input-shell .ig-icon { width: 20px; height: 20px; color: var(--text-3); flex: none; }

input.ig-input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: none;
  font-size: 15.5px; padding: 13px 0;
  text-overflow: ellipsis;
}
input.ig-input::placeholder { color: var(--text-3); }
.input-clear {
  border: 0; background: transparent; color: var(--text-3);
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  cursor: pointer; flex: none;
}
.input-clear:hover { background: var(--bg-soft); color: var(--text-2); }

.field-hint { font-size: 12.5px; color: var(--text-3); margin: 8px 2px 0; line-height: 1.4; min-height: 18px; display: flex; gap: 6px; align-items: flex-start; }
.field-hint.error { color: var(--danger); }
.field-hint.ok { color: var(--success); }

/* --------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--r-md);
  padding: 14px 18px;
  font-size: 15px; font-weight: 650; letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s;
  min-height: 50px;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-quiet { background: transparent; color: var(--text-2); min-height: 42px; padding: 10px 14px; }
.btn-danger { background: rgba(255, 92, 108, 0.12); color: var(--danger); }
.btn-sm { min-height: 40px; padding: 10px 14px; font-size: 13.5px; border-radius: 12px; }
.btn svg { width: 18px; height: 18px; }

.hero .btn-block { margin-top: 14px; }

/* ---------------------------------------------------------------- чипы */

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12.5px; font-weight: 550;
  background: var(--bg-soft);
  color: var(--text-2);
  border: 1px solid transparent;
}
.chip.accent { background: rgba(109, 92, 255, 0.12); color: #8b7cff; border-color: rgba(109, 92, 255, 0.18); }
.chip.demo { background: rgba(245, 158, 11, 0.14); color: #d97706; border-color: rgba(245, 158, 11, 0.2); font-weight: 650; }
:root[data-theme="dark"] .chip.accent { color: #a99bff; }
:root[data-theme="dark"] .chip.demo { color: #fbbf24; }
.chip-button { cursor: pointer; background: var(--bg-elev); border-color: var(--line-strong); }
.chip-button:hover { border-color: var(--accent); color: var(--accent); }

.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2);
  white-space: nowrap;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-chip.real .dot { background: var(--success); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16); }
.status-chip.demo .dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16); }
.status-chip.offline .dot { background: var(--danger); }

/* ------------------------------------------------------------- утилиты */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; color: var(--text-3); }
.section-gap { margin-top: 22px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ------------------------------------------------------- процесс анализа */

.analysis-screen { max-width: 560px; margin: 0 auto; }
.steps-card { padding: 22px 20px; }
.steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 8px; border-radius: 14px;
}
.step + .step { border-top: 1px solid var(--line); }
.step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-soft); color: var(--text-3);
  font-size: 12px; font-weight: 700; flex: none;
}
.step-dot svg { width: 14px; height: 14px; }
.step-label { font-size: 14.5px; font-weight: 600; color: var(--text-2); }
.step-detail { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.step.running .step-label { color: var(--text); }
.step.running .step-dot { background: rgba(109, 92, 255, 0.14); color: var(--accent); }
.step.done .step-label { color: var(--text); }
.step.done .step-dot { background: rgba(34, 197, 94, 0.14); color: var(--success); }
.step.failed .step-label { color: var(--danger); }
.step.failed .step-dot { background: rgba(255, 92, 108, 0.14); color: var(--danger); }
.step-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(109, 92, 255, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 16px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--accent-grad); transition: width 0.5s ease; }

/* ------------------------------------------------------------ профиль */

.profile-hero { padding: 22px; }
.profile-top { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px; height: 56px; border-radius: 18px; flex: none;
  background: var(--accent-grad);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 750; color: #fff;
  box-shadow: var(--shadow-accent);
}
.profile-handle { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.profile-summary { font-size: 14.5px; line-height: 1.55; color: var(--text-2); margin: 16px 0 0; }

.meter { margin-top: 16px; }
.meter-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.meter-track { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent-grad); border-radius: 999px; }

.profile-grid { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 4px; }
.profile-block { padding: 16px 0; border-top: 1px solid var(--line); }
.profile-block h3 {
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3); margin: 0 0 9px;
}
.profile-block p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.22);
  font-size: 12.5px; line-height: 1.45; color: var(--text-2);
}
.notice svg { width: 16px; height: 16px; color: #d97706; flex: none; margin-top: 1px; }

/* ------------------------------------------------------- карточки видео */

.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.results-count { font-size: 12.5px; color: var(--text-3); }

.video-grid { display: flex; flex-direction: column; gap: 16px; }

.video-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: fade-up 0.35s ease both;
}
.video-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-soft);
  overflow: hidden;
}
.video-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.01em;
  background: rgba(8, 10, 16, 0.62); color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.badge.demo { background: rgba(245, 158, 11, 0.92); color: #23180a; border-color: transparent; }
.badge.platform { text-transform: capitalize; }

.score-pill {
  position: absolute; right: 10px; bottom: 10px;
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 6px 10px; border-radius: 12px;
  background: rgba(8, 10, 16, 0.7);
  backdrop-filter: blur(10px);
  color: #fff; font-weight: 750; font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.score-pill small { font-size: 10px; font-weight: 600; opacity: 0.7; }

.video-body { padding: 16px 16px 14px; }
.video-title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; margin: 0 0 6px; }
.video-author { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.video-author .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.video-desc { font-size: 13.5px; line-height: 1.5; color: var(--text-2); margin: 10px 0 0; }

.trait-chips { margin-top: 12px; }

.reason-block {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(109, 92, 255, 0.07);
  border: 1px solid rgba(109, 92, 255, 0.14);
}
.reason-block h4 {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 6px; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: #8b7cff; font-weight: 700;
}
.reason-block h4 svg { width: 14px; height: 14px; }
.reason-block p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text); }
:root[data-theme="dark"] .reason-block h4 { color: #a99bff; }

.adapt-block {
  margin-top: 10px; padding: 13px 14px;
  border-radius: 16px;
  background: rgba(20, 205, 219, 0.07);
  border: 1px solid rgba(20, 205, 219, 0.16);
}
.adapt-block h4 { color: #0ea5b7; }
:root[data-theme="dark"] .adapt-block h4 { color: #35d6e3; }

.video-actions {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong);
  background: transparent; color: var(--text-2);
  border-radius: 13px; padding: 11px 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.16s ease;
}
.act svg { width: 17px; height: 17px; }
.act:hover { background: var(--bg-soft); color: var(--text); }
.act.active-like { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); color: var(--success); }
.act.active-dislike { background: rgba(255, 92, 108, 0.12); border-color: rgba(255, 92, 108, 0.35); color: var(--danger); }
.act.active-save { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.35); color: #d97706; }
:root[data-theme="dark"] .act.active-save { color: #fbbf24; }

.open-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 650; color: var(--accent);
  margin-top: 12px;
}
.open-link svg { width: 14px; height: 14px; }

/* --------------------------------------------------------- список подборок */

.collection-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s ease;
  width: 100%;
  text-align: left;
}
.collection-row:hover { border-color: var(--line-strong); }
.collection-row:active { transform: scale(0.99); }
.coll-thumb {
  width: 58px; height: 58px; border-radius: 16px; flex: none;
  background: var(--accent-grad);
  display: grid; place-items: center; color: #fff;
  font-weight: 750; font-size: 18px;
  box-shadow: var(--shadow-accent);
}
.coll-info { flex: 1; min-width: 0; }
.coll-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coll-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.coll-chevron { color: var(--text-3); flex: none; }
.coll-chevron svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- пусто */

.empty {
  text-align: center;
  padding: 48px 20px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-strong);
}
.empty-icon {
  width: 62px; height: 62px; border-radius: 20px;
  background: var(--bg-soft); color: var(--text-3);
  display: grid; place-items: center; margin: 0 auto 14px;
}
.empty-icon svg { width: 28px; height: 28px; }
.empty h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.empty p { margin: 0 auto; font-size: 13.5px; line-height: 1.5; color: var(--text-2); max-width: 36ch; }
.empty .btn { margin-top: 18px; }

/* -------------------------------------------------------------- настройки */

.settings-group {
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 16px;
}
.settings-row + .settings-row { border-top: 1px solid var(--line); }
.settings-row .label { font-size: 14.5px; font-weight: 550; }
.settings-row .desc { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.4; }
.settings-row button.collection-row { border: 0; box-shadow: none; }

.segmented {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
  padding: 7px 11px; border-radius: 8px; cursor: pointer;
}
.segmented button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }

.switch {
  position: relative; width: 46px; height: 27px; flex: none;
  border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line-strong);
  cursor: pointer; transition: background 0.18s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: transform 0.18s ease;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(19px); }

/* --------------------------------------------------------------- навигация */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  max-width: 640px; margin: 0 auto;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: transparent;
  padding: 7px 2px 5px;
  border-radius: 12px;
  color: var(--text-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  transition: color 0.16s ease, background 0.16s ease;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 18px; height: 3px; border-radius: 0 0 4px 4px;
  background: var(--accent);
}
.tab .badge-dot {
  position: absolute; top: 6px; right: 50%; margin-right: -16px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger);
  border: 1.5px solid var(--bg-elev);
}

/* --------------------------------------------------------------- тосты */

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + var(--safe-bottom));
  z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  width: min(92vw, 460px);
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: 14px;
  background: #191d27;
  color: #f4f6fa;
  font-size: 13.5px; line-height: 1.4;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.24s ease both;
  display: flex; gap: 9px; align-items: flex-start;
}
.toast.error { background: #3a1420; color: #ffd7dd; }
.toast.success { background: #10251a; color: #c9f7dc; }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- модалка */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 6, 10, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in 0.18s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(480px, 100%);
  background: var(--bg-elev);
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + var(--safe-bottom));
  box-shadow: var(--shadow-md);
  animation: sheet-up 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.modal h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -0.02em; }
.modal p { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------ загрузка */

.boot {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; color: var(--text-3);
}
.boot-logo { color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.45; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1); } }
.boot-text { font-size: 13.5px; }

.skeleton {
  position: relative; overflow: hidden;
  background: var(--bg-soft); border-radius: 12px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ------------------------------------------------------------- адаптив */

@media (min-width: 720px) {
  .main { padding: 26px 24px calc(110px + var(--safe-bottom)); }
  .screen-title { font-size: 30px; }
  .hero { padding: 34px 32px 30px; }
  .hero h1 { font-size: 33px; }
  .video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .video-card { display: flex; flex-direction: column; }
  .video-cover { aspect-ratio: 16 / 11; }
  .toasts { bottom: 100px; }
}

@media (min-width: 1000px) {
  .main { max-width: 980px; }
  .video-grid { grid-template-columns: 1fr 1fr 1fr; }
  .tabbar { padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
