/* ==========================================================
   Premium Touch — ГЛАВНАЯ: ленты сторис • страница для гостей
   ========================================================== */

/* ---------- СТОРИС ---------- */

.list:has(.stories_list_body) {
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 4px 0 0 !important;
  margin: 0 0 4px !important;
  animation: none;
}

.stories_list_body {
  display: flex;
  gap: 10px;
  height: auto !important;
  padding: 2px 12px 12px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: normal !important;
  scroll-snap-type: x proximity;
  scroll-padding-left: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.stories_list_body::-webkit-scrollbar { display: none; }

.stories_list_body > a { display: block; flex: 0 0 auto; }

.stories_list {
  position: relative !important;
  overflow: hidden !important;
  flex: 0 0 auto;
  display: block !important;
  width: 94px !important;
  height: 152px !important;
  margin: 0 !important;
  border-radius: 24px !important;
  box-shadow: 0 14px 24px -14px rgba(30, 25, 90, .55);
  scroll-snap-align: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

.stories_list:active { transform: scale(.94); }

.stories_list img,
.stories_list .stories_form_img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
}

.stories_list::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 6, 30, .28) 0%, rgba(8, 6, 30, 0) 34%, rgba(8, 6, 30, 0) 52%, rgba(8, 6, 30, .72) 100%);
  pointer-events: none;
}

/* базовые свойства аватара (на случай если stories.css не подключён) */
.stories_list_avatar {
  position: absolute;
  display: block;
  border-radius: 100%;
  overflow: hidden;
  text-align: center;
}

/* аватар сверху слева с кольцом */
.stories_list .stories_list_avatar {
  top: 9px !important;
  left: 9px !important;
  bottom: auto !important;
  transform: none !important;
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  z-index: 2;
  box-sizing: border-box;
  background: #fff;
}

.stories_list .stories_list_avatar img {
  position: static;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
}

.stories_list_avatar_border_active {
  border: 2.5px solid #fff !important;
  box-shadow: 0 0 0 2.5px #7d6dff, 0 0 14px rgba(125, 109, 255, .8);
}

.stories_list_avatar_border_no_active {
  border: 2.5px solid rgba(255, 255, 255, .65) !important;
  box-shadow: none;
}

.stories_list_name {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 10px;
  z-index: 2;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.1px;
  line-height: 1.2;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* первая карточка — «создать историю» */
.stories_list_body > a:first-child .stories_list {
  background: var(--grad) !important;
  box-shadow: 0 16px 28px -14px var(--grad-glow);
}

.stories_list_body > a:first-child .stories_list::after { display: none; }

.stories_list_body > a:first-child .stories_list_avatar {
  top: 44px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  background: rgba(255, 255, 255, .24) !important;
  border: none !important;
  box-shadow: none !important;
  color: #fff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-align: center;
}

.stories_list_body > a:first-child .stories_list_avatar i { font-size: 24px !important; }

.stories_list_plus_my {
  top: auto !important;
  bottom: 12px;
  left: 0 !important;
  right: 0;
  transform: none !important;
  text-align: center;
  font-size: 12.5px !important;
  font-weight: 800;
  letter-spacing: -.1px;
  z-index: 2;
}

/* ---------- СТРАНИЦА ДЛЯ ГОСТЕЙ ---------- */

:root {
  --gl-bg: #f3f1ff;
  --gl-card: rgba(255, 255, 255, .72);
  --gl-ink: #14152a;
}

html.night-mode {
  --gl-bg: #07070c;
  --gl-card: rgba(22, 22, 34, .72);
  --gl-ink: #f3f3fa;
}

@keyframes glFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(40px, 30px, 0) scale(1.12); }
}

@keyframes glBob {
  from { transform: translateY(0) rotate(var(--r, 0deg)); }
  to   { transform: translateY(-10px) rotate(var(--r, 0deg)); }
}

@keyframes glRing { from { stroke-dashoffset: 290; } to { stroke-dashoffset: 40; } }

@keyframes glWave { 0%, 100% { transform: scaleY(.55); } 50% { transform: scaleY(1); } }

body:has(.gl) { background: var(--gl-bg) !important; }

.gl {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: var(--gl-bg);
  color: var(--gl-ink);
}

.gl-aurora { position: absolute; inset: 0; pointer-events: none; }

.gl-aurora i {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
  animation: glFloat 16s ease-in-out infinite alternate;
}

html.night-mode .gl-aurora i { opacity: .32; }

.gl-aurora i:nth-child(1) { width: 360px; height: 360px; left: -100px; top: -80px; background: #8a78ff; }
.gl-aurora i:nth-child(2) { width: 320px; height: 320px; right: -110px; top: 180px; background: #ff7eb0; animation-delay: -5s; }
.gl-aurora i:nth-child(3) { width: 340px; height: 340px; left: 10%; top: 780px; background: #ffc27a; animation-delay: -9s; }

.gl-wrap {
  position: relative;
  z-index: 2;
  max-width: 1020px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 60px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "brand" "hero" "auth" "demo" "feat";
  gap: 22px;
}

.gl-brand { grid-area: brand; display: flex; align-items: center; gap: 10px; font-size: 19px; letter-spacing: -.3px; }

.gl-logo {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px -8px var(--grad-glow);
}

.gl-hero { grid-area: hero; padding-top: 6px; }

.gl-hero h1 {
  margin: 0;
  font-size: clamp(40px, 11vw, 66px);
  line-height: 1.01;
  font-weight: 800;
  letter-spacing: -2.2px;
}

.gl-hero h1 span {
  display: block;
  background: linear-gradient(100deg, #7d6dff 0%, #ff5c93 55%, #ffb86b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gl-hero p {
  margin: 16px 0 0;
  max-width: 520px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--vk-muted);
}

.gl-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.gl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  padding: 0 26px;
  border-radius: 18px;
  background: var(--gl-card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--vk-line);
  color: var(--gl-ink) !important;
  font-size: 16.5px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
  -webkit-tap-highlight-color: transparent;
}

.gl-btn:active { transform: scale(.95); }

.gl-btn-main {
  background: var(--grad);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 16px 30px -12px var(--grad-glow);
}

.gl-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.gl-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--gl-card);
  border: 1px solid var(--vk-line);
  font-size: 14px;
  color: var(--vk-muted);
}

.gl-stats b { color: var(--gl-ink); font-weight: 800; }

.gl-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .25); }

/* форма входа / регистрации */
.gl-auth {
  grid-area: auth;
  scroll-margin-top: 14px;
  border-radius: 34px;
  background: var(--gl-card);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid var(--vk-line);
  box-shadow: var(--shadow-pop);
  padding: 6px;
}

.gl-auth .gc2 { display: block; width: 100%; padding: 0; margin: 0; }

.gl-auth .gc3 {
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 20px 16px 8px !important;
}

.gl-auth h1 { text-align: left !important; font-size: 26px !important; font-weight: 800; letter-spacing: -.8px; margin: 0 0 16px !important; color: var(--gl-ink); }
.gl-auth .gc-footer { padding: 8px 12px 14px; text-align: center; font-size: 13px; }
.gl-auth .gc-footer a, .gl-auth .gc-footer span { color: var(--vk-muted) !important; margin: 0 7px; }
.gl-auth .no_account { margin-top: 14px; text-align: center; color: var(--vk-muted); }
.gl-auth .no_account a { color: var(--vk-accent) !important; font-weight: 700; }
.gl-auth .mode_button { opacity: .8; }

/* превью: чат + кружок + истории */
.gl-demo { grid-area: demo; position: relative; height: 360px; width: 100%; max-width: 430px; margin: 4px auto 0; }

.gl-d-chat {
  position: absolute;
  left: 0;
  right: 36px;
  top: 0;
  padding: 16px 14px 18px;
  border-radius: 32px;
  background: var(--wall-0);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: rotate(-2deg);
  animation: glBob 5.5s ease-in-out infinite alternate;
  --r: -2deg;
}

.gl-d-in, .gl-d-out, .gl-d-voice {
  max-width: 82%;
  padding: 10px 14px;
  font-size: 15.5px;
  line-height: 1.3;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.gl-d-in { align-self: flex-start; background: rgba(255, 255, 255, .9); color: #15162a; border-radius: 20px 20px 20px 6px; }
.gl-d-out { align-self: flex-end; background: rgba(50, 68, 150, .74); color: #fff; border-radius: 20px 20px 6px 20px; }

.gl-d-voice {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 78%;
  background: rgba(50, 68, 150, .74);
  color: #fff;
  border-radius: 20px 20px 6px 20px;
}

.gl-d-play { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #fff; color: #5a3fe6; display: flex; align-items: center; justify-content: center; }
.gl-d-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; }
.gl-d-wave i { flex: 1; height: 100%; border-radius: 3px; background: rgba(255, 255, 255, .85); transform-origin: center; animation: glWave 1.4s ease-in-out infinite; }
.gl-d-wave i:nth-child(3n) { animation-delay: -.3s; height: 70%; }
.gl-d-wave i:nth-child(3n+1) { animation-delay: -.7s; height: 45%; }
.gl-d-wave i:nth-child(3n+2) { animation-delay: -1.1s; height: 85%; }
.gl-d-voice small { font-size: 12px; color: rgba(255, 255, 255, .85) !important; }

.gl-d-circle {
  position: absolute;
  right: 0;
  bottom: 18px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd0a8, #ff7eb0 45%, #7d6dff 100%);
  box-shadow: 0 24px 44px -14px rgba(125, 109, 255, .8);
  animation: glBob 4.6s ease-in-out infinite alternate-reverse;
}

.gl-d-circle > svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.gl-d-circle circle { fill: none; stroke: rgba(255, 255, 255, .3); stroke-width: 3; }
.gl-d-circle .gl-d-ring { stroke: #fff; stroke-linecap: round; stroke-dasharray: 290; animation: glRing 6s linear infinite; }
.gl-d-circle > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; }

.gl-d-stories { position: absolute; left: 6px; bottom: 0; display: flex; }

.gl-d-stories i {
  width: 74px;
  height: 112px;
  margin-right: -14px;
  border-radius: 20px;
  border: 3px solid var(--gl-bg);
  box-shadow: 0 14px 24px -12px rgba(30, 25, 90, .6);
  animation: glBob 5s ease-in-out infinite alternate;
}

.gl-d-stories i:nth-child(1) { background: linear-gradient(160deg, #C141D7, #F44336); --r: -8deg; transform: rotate(-8deg); }
.gl-d-stories i:nth-child(2) { background: linear-gradient(160deg, #35D33B, #2196F3); --r: 0deg; animation-delay: -1.4s; position: relative; top: -10px; }
.gl-d-stories i:nth-child(3) { background: linear-gradient(160deg, #FFABFE, #7AE3F4); --r: 8deg; transform: rotate(8deg); animation-delay: -2.6s; }

/* возможности */
.gl-features { grid-area: feat; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.gl-f {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 14px;
  border-radius: 26px;
  background: var(--gl-card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--vk-line);
  box-shadow: var(--shadow-card);
}

.gl-f span {
  width: 46px;
  height: 46px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 20px -10px var(--c);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%);
}

.gl-f b { font-size: 16.5px; font-weight: 800; letter-spacing: -.3px; }
.gl-f small { font-size: 13px; color: var(--vk-muted); }

/* компактный режим (регистрация / восстановление) */
.gl-compact .gl-wrap { max-width: 480px; grid-template-areas: "brand" "auth"; padding-top: calc(26px + env(safe-area-inset-top, 0px)); }

/* десктоп */
@media (min-width: 900px) {
  .gl-wrap {
    grid-template-columns: 1.1fr .9fr;
    grid-template-areas: "brand brand" "hero auth" "demo auth" "feat auth";
    column-gap: 44px;
    padding-top: 30px;
  }
  .gl-auth { align-self: start; position: sticky; top: 24px; }
  .gl-features { grid-template-columns: repeat(3, 1fr); }
  .gl-demo { margin: 0; }
  .gl-compact .gl-wrap { grid-template-columns: 1fr; max-width: 520px; grid-template-areas: "brand" "auth"; }
}

@media (prefers-reduced-motion: reduce) {
  .gl-aurora i, .gl-d-chat, .gl-d-circle, .gl-d-stories i, .gl-d-wave i, .gl-d-ring { animation: none !important; }
}
