/* Лента роликов #сагамивпн (/reels/) — листается как рилсы. */
:root {
  --bg: #030807;
  --text: #EEF6F3;
  --muted: rgba(238, 246, 243, 0.62);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #3DE7BC;
  --accent-2: #12B48C;
  --accent-rgb: 61, 231, 188;
  --ink: #04110D;
  --top: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Шапка ---------- */
.rl-top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: linear-gradient(180deg, rgba(3, 8, 7, 0.85), rgba(3, 8, 7, 0)); pointer-events: none; }
.rl-top > * { pointer-events: auto; }
.rl-brand { display: flex; align-items: center; gap: 10px; }
.rl-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink); box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.35); }
.rl-mark svg { width: 18px; height: 18px; fill: currentColor; stroke: none; margin-left: 2px; }
.rl-brand-t { display: flex; flex-direction: column; line-height: 1.1; }
.rl-brand-t b { font-family: var(--display); font-size: 17px; }
.rl-brand-t i { font-style: normal; font-size: 12px; color: var(--accent); }
.rl-tabs { margin: 0 auto; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); }
.rl-tabs button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: background .25s var(--ease), color .2s; }
.rl-tabs button.on { background: #fff; color: #06100D; }
.rl-cta { font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 999px; background: rgba(var(--accent-rgb), 0.14); color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.35); white-space: nowrap; transition: background .2s; }
.rl-cta:hover { background: rgba(var(--accent-rgb), 0.24); }
@media (max-width: 560px) {
  .rl-brand-t, .rl-cta { display: none; }
  .rl-tabs { margin: 0 0 0 auto; }
  .rl-top { gap: 10px; }
}

/* ---------- Лента ---------- */
.rl-feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.rl-feed::-webkit-scrollbar { display: none; }
.rl-slide { position: relative; height: 100dvh; min-height: 100vh; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden;
  display: grid; place-items: center; }
@supports (height: 100dvh) { .rl-slide { min-height: 0; } }
.rl-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(36px) brightness(0.45) saturate(1.2); transform: scale(1.1); }
.rl-slide::after { content: ''; position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 40%, transparent, rgba(3, 8, 7, 0.6)); pointer-events: none; }

.rl-wrap { position: relative; z-index: 2; display: flex; align-items: flex-end; gap: 18px; margin-top: calc(var(--top) - 6px); }
.rl-stage { position: relative; height: calc(100dvh - var(--top) - 18px); aspect-ratio: 9 / 16; max-width: calc(100vw - 130px);
  border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06); }
.rl-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .4s ease, transform .6s var(--ease); }
.rl-slide.playing .rl-cover { opacity: 0; }
.rl-player { position: absolute; inset: 0; }
.rl-player iframe { width: 100%; height: 100%; border: 0; display: block; opacity: 0; transition: opacity .35s ease .15s; }
.rl-player iframe.ready { opacity: 1; }
.rl-play { position: absolute; z-index: 3; inset: 0; margin: auto; width: 78px; height: 78px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, 0.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); transition: transform .2s var(--ease), opacity .25s; }
.rl-play svg { width: 30px; height: 30px; fill: #fff; stroke: none; margin-left: 4px; }
.rl-play:hover { transform: scale(1.06); }
.rl-slide.playing .rl-play { opacity: 0; pointer-events: none; transform: scale(.8); }
.rl-badge { position: absolute; z-index: 3; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: opacity .3s; }
.rl-badge svg { width: 14px; height: 14px; }
.rl-slide.playing .rl-badge { opacity: 0; }

/* Действия справа */
.rl-actions { position: relative; z-index: 4; display: flex; flex-direction: column; gap: 14px; align-items: center; margin-bottom: 64px; }
.rl-act { display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; background: transparent; cursor: pointer; padding: 0; color: #fff; min-width: 64px; }
.rl-act i { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .2s var(--ease), background .2s; }
.rl-act:hover i { background: rgba(255, 255, 255, 0.18); transform: translateY(-2px); }
.rl-act:active i { transform: scale(.92); }
.rl-act svg { width: 23px; height: 23px; }
.rl-act b { font-family: var(--display); font-size: 13.5px; font-weight: 700; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.rl-act small { font-size: 10.5px; color: var(--muted); margin-top: -3px; }
.rl-act.like i { color: #FF5C7A; }
.rl-act.like i svg { fill: #FF5C7A; stroke: #FF5C7A; }
.rl-act.open i { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--ink); border-color: transparent; }

/* Подпись снизу */
.rl-info { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0;
  padding: 60px 16px 16px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78)); pointer-events: none; transition: opacity .3s; }
.rl-info > * { pointer-events: auto; }
.rl-author { display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 700; }
.rl-ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink); font-family: var(--display); font-size: 14px; flex: 0 0 34px; border: 2px solid rgba(255, 255, 255, 0.85); }
.rl-ava img { width: 100%; height: 100%; object-fit: cover; }
.rl-desc { margin: 9px 0 6px; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, 0.92); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; word-break: break-word; }
.rl-desc.open { -webkit-line-clamp: 12; }
.rl-desc .tag { color: var(--accent); font-weight: 600; }
.rl-meta { font-size: 12px; color: var(--muted); }
.rl-slide.playing .rl-info { opacity: 0.0; }
.rl-slide.playing:hover .rl-info { opacity: 1; }

@media (max-width: 760px) {
  :root { --top: 56px; }
  .rl-slide { display: block; place-items: normal; }
  .rl-wrap { position: relative; height: 100%; margin: 0; display: block; }
  .rl-badge { top: calc(var(--top) + 8px); }
  .rl-stage { height: 100%; width: 100%; max-width: none; border-radius: 0; aspect-ratio: auto; }
  .rl-cover { object-fit: cover; }
  .rl-actions { position: absolute; right: 10px; bottom: calc(110px + env(safe-area-inset-bottom)); margin: 0; gap: 12px; }
  .rl-act i { width: 46px; height: 46px; }
  .rl-act small { display: none; }
  .rl-info { right: 72px; padding: 40px 14px calc(18px + env(safe-area-inset-bottom)); }
  .rl-slide.playing .rl-info { opacity: 1; }
  .rl-slide.playing .rl-info .rl-desc { -webkit-line-clamp: 1; }
}

/* Навигация (компьютер) */
.rl-nav { position: fixed; z-index: 20; right: 22px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rl-nav button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); cursor: pointer; display: grid; place-items: center;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: background .2s, transform .2s var(--ease), opacity .2s; }
.rl-nav button:hover { background: rgba(255, 255, 255, 0.16); }
.rl-nav button:active { transform: scale(.92); }
.rl-nav button:disabled { opacity: .35; cursor: default; }
.rl-nav svg { width: 22px; height: 22px; }
.rl-nav span { font-family: var(--display); font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .rl-nav { display: none; } }

/* Комментарии */
.rl-sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.rl-sheet-bg.show { opacity: 1; pointer-events: auto; }
.rl-sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; width: min(560px, 100vw); max-height: 72dvh; display: flex; flex-direction: column;
  transform: translate(-50%, 105%); transition: transform .38s var(--ease); background: #0C1613; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5); }
.rl-sheet.show { transform: translate(-50%, 0); }
.rl-sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); margin: 10px auto 2px; }
.rl-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 12px; border-bottom: 1px solid var(--line); }
.rl-sheet-head b { font-family: var(--display); font-size: 16px; }
.rl-sheet-head button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.07); cursor: pointer; display: grid; place-items: center; }
.rl-sheet-head svg { width: 16px; height: 16px; }
.rl-sheet-list { overflow-y: auto; padding: 8px 18px; flex: 1; }
.rl-c { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 11px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); animation: rlIn .35s var(--ease) both; }
.rl-c:last-child { border-bottom: 0; }
.rl-c .rl-ava { width: 36px; height: 36px; flex-basis: 36px; border-width: 0; font-size: 13px; }
.rl-c-name { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rl-c-name em { font-style: normal; font-weight: 400; margin-left: 6px; }
.rl-c-text { font-size: 14px; line-height: 1.45; margin-top: 3px; word-break: break-word; }
.rl-c-like { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); padding-top: 2px; }
.rl-c-like svg { width: 15px; height: 15px; }
.rl-sheet-empty { padding: 34px 0; text-align: center; color: var(--muted); font-size: 14px; }
.rl-sheet-more { display: block; text-align: center; padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); font-size: 13.5px; font-weight: 600; color: var(--accent); border-top: 1px solid var(--line); }
@keyframes rlIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Пусто / загрузка */
.rl-loading, .rl-empty { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; color: var(--muted); }
.rl-loading span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(var(--accent-rgb), 0.2); border-top-color: var(--accent); animation: rlSpin .8s linear infinite; }
@keyframes rlSpin { to { transform: rotate(360deg); } }
.rl-empty-ic { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: rgba(var(--accent-rgb), 0.1); border: 1px solid rgba(var(--accent-rgb), 0.3); color: var(--accent); }
.rl-empty-ic svg { width: 34px; height: 34px; }
.rl-empty h1 { margin: 6px 0 0; font-family: var(--display); font-size: 26px; color: var(--text); letter-spacing: -0.01em; }
.rl-empty p { margin: 0; max-width: 420px; line-height: 1.55; }
.rl-empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.rl-btn { height: 46px; padding: 0 20px; border-radius: 14px; display: inline-flex; align-items: center; font-weight: 600; font-size: 14.5px; }
.rl-btn.p { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--ink); }
.rl-btn.g { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text); }

.rl-toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; padding: 11px 16px; border-radius: 12px;
  background: #0C1613; border: 1px solid rgba(var(--accent-rgb), 0.3); font-size: 14px; transition: opacity .25s, transform .3s var(--ease); pointer-events: none; }
.rl-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Появление слайда */
.rl-slide .rl-stage, .rl-slide .rl-actions, .rl-slide .rl-info { transition: transform .5s var(--ease), opacity .5s ease; }
.rl-slide:not(.seen) .rl-stage { transform: scale(.94); opacity: .6; }
.rl-slide:not(.seen) .rl-actions { transform: translateX(14px); opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .rl-slide .rl-stage, .rl-slide .rl-actions, .rl-slide .rl-info, .rl-sheet, .rl-c { transition: none; animation: none; }
  .rl-slide:not(.seen) .rl-stage, .rl-slide:not(.seen) .rl-actions { transform: none; opacity: 1; }
}
