/* ========== Welcome (first screen) ========== */
.first-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.first-screen[data-state="1"],
.first-screen[data-state="2"] {
  background-color: #f4f7f6;
}

.first-screen[data-state="3"] {
  background-color: #fffbf5;
}

.first-screen__gradient {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.first-screen[data-state="3"] .first-screen__gradient {
  display: block;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(232, 243, 247, 0.7) 0%,
    rgba(232, 243, 247, 0.6) 26%,
    rgba(232, 243, 247, 0.5) 65%,
    rgba(232, 243, 247, 0.4) 89%
  );
}

.first-screen__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 320px;
}

/* Custom spring: stiffness 371, damping 12.4, mass 1 → приближение cubic-bezier с лёгким overshoot, 968ms */
.first-screen__intro-spring {
  transition-duration: 968ms;
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.first-screen__content--intro {
  display: none;
}

.first-screen__content--intro .first-screen__logo,
.first-screen__content--intro .first-screen__title,
.first-screen__content--intro .first-screen__tagline {
  transition: opacity 968ms cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 968ms cubic-bezier(0.34, 1.56, 0.64, 1),
              font-size 968ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.first-screen[data-state="1"] .first-screen__content--intro,
.first-screen[data-state="2"] .first-screen__content--intro {
  display: flex;
  justify-content: center;
  gap: 19px;
}

.first-screen[data-state="1"] .first-screen__content--intro {
  padding-top: 12vh;
  gap: 8px;
  flex-direction: column;
}

.first-screen[data-state="1"] .first-screen__content--intro .first-screen__logo {
  opacity: 0;
  transform: scale(0.5);
  position: absolute;
  pointer-events: none;
  margin-top: -40px;
}

.first-screen[data-state="1"] .first-screen__content--intro .first-screen__title {
  font-size: 32px;
  letter-spacing: 0.04em;
}

.first-screen[data-state="2"] .first-screen__content--intro {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 12px 8px;
}

.first-screen[data-state="2"] .first-screen__content--intro .first-screen__tagline {
  flex-basis: 100%;
  text-align: center;
}

.first-screen[data-state="2"] .first-screen__content--intro .first-screen__logo {
  opacity: 1;
  transform: scale(1);
  position: relative;
}

.first-screen[data-state="2"] .first-screen__content--intro .first-screen__title {
  font-size: 20px;
}

.first-screen__content--state-3 {
  display: none;
}

.first-screen[data-state="3"] .first-screen__content--state-3 {
  display: flex;
  justify-content: center;
  gap: 19px;
}

.first-screen__logo {
  flex-shrink: 0;
  width: 46px;
  height: 47px;
}

.first-screen__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.first-screen__title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: normal;
  color: #023e61;
  margin: 0;
  letter-spacing: 0.02em;
}

.first-screen__tagline {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 12px;
  line-height: normal;
  color: #023e61;
  margin: 0;
}

.first-screen__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  width: 100%;
  max-width: 200px;
}

.first-screen__btn {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 12px;
  line-height: 1;
  border: none;
  cursor: pointer;
  width: 166px;
  height: 30px;
  border-radius: 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.first-screen__btn:active {
  transform: scale(0.98);
}

.first-screen__btn--primary {
  background: linear-gradient(90deg, #252a2d 0%, #023e61 100%);
  color: #fff;
}

.first-screen__btn--secondary {
  background: #fff;
  color: #023e61;
  box-shadow: 0 1px 2px rgba(2, 62, 97, 0.1);
}

.first-screen__btn--secondary:hover {
  box-shadow: 0 2px 6px rgba(2, 62, 97, 0.15);
}

@media (min-width: 400px) {
  .first-screen__actions {
    margin-top: 40px;
  }
}

/* ========== Главный экран (Home) — центрирование и масштабирование ========== */
.main-screen {
  --main-fs-card: 10px;
  --main-lh-title: 14.1px;
  --main-lh-card: 9.4px;
  /* Верх: 10% экрана; низ: ~8% высоты рамки; центр: scale всего слоя */
  --main-top-shift: 0;
  --main-nav-shift: calc(var(--app-frame-height) * 0.08);
  --main-center-scale: 1.2;
  --main-fs-title: calc(36px / var(--main-center-scale));
  --main-center-origin-y: 44%;
  --main-content-left: 31.66px;
  --main-content-width: 312.98px;
  /* Края .inner после scale(1.2) — для шапки вне scale-слоя */
  --main-rail-left-scaled: calc(50% + (var(--main-content-left) - 50%) * var(--main-center-scale));
  --main-rail-width-scaled: calc(var(--main-content-width) * var(--main-center-scale));
  /* Шапка — unscaled отступ как на макете (не scale-компенсация) */
  --main-header-inset-x: 6px;
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F4F7F6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: auto;
}

.main-screen__top {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transform: translateY(var(--main-top-shift));
}

.main-screen__top > * {
  pointer-events: auto;
}

/* Шапка: колонка контента + небольшой inset, как на макете */
.main-screen__header-rail {
  position: absolute;
  top: var(--main-header-top);
  left: var(--main-content-left);
  width: var(--main-content-width);
  height: 55px;
  pointer-events: none;
}

.main-screen__header-rail > * {
  pointer-events: auto;
}

.main-screen__center {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Отдельный слой: scale всей геометрии центра, не только font-size */
.main-screen__center-scale {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scale(var(--main-center-scale));
  transform-origin: 50% var(--main-center-origin-y);
  will-change: transform;
}

.main-screen__center-scale > * {
  pointer-events: auto;
}

/* Колонка карточек и Ask — одна линия с .inner */
.main-screen__rail {
  position: absolute;
  left: var(--main-content-left);
  width: var(--main-content-width);
  top: 0;
  height: 100%;
  pointer-events: none;
}

.main-screen__rail > * {
  pointer-events: auto;
}

.main-screen__inner > .app-bottom-nav {
  padding-top: 4px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  transform: translateY(var(--main-nav-shift));
}

/* Контентная рамка: fluid по viewport без transform-scale */
.main-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: visible;
  backface-visibility: visible;
}

/* Логотип — чуть внутрь от левого края колонки */
.main-screen .div2 {
  position: absolute;
  top: 0;
  left: var(--main-header-inset-x);
  width: 117px;
  height: 55px;
  font-size: 16px;
  font-family: "FF Meta Georgian", Montserrat, sans-serif;
  line-height: 1.15;
}

.main-screen .div2 .main-screen__pill-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.main-screen .child {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 226px;
  background-color: #252a2d;
  width: 100px;
  height: 26.6px;
}

.main-screen .item {
  position: absolute;
  top: 3px;
  left: 73px;
  filter: blur(19.9px);
  width: 24px;
  height: 15px;
}

.main-screen .logoIcon {
  position: absolute;
  height: 41.35%;
  width: 10.7%;
  top: 29.37%;
  right: 75.89%;
  bottom: 29.27%;
  left: 13.41%;
  max-width: 100%;
  overflow: hidden;
  max-height: 100%;
  object-fit: contain;
}

.main-screen .kliko {
  position: absolute;
  top: 6.79px;
  left: calc(50% + 2px);
  line-height: 94%;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

/* Шестерёнка — чуть внутрь от правого края колонки */
.main-screen .icon {
  position: absolute;
  top: 13px;
  right: var(--main-header-inset-x);
  left: auto;
  width: 29px;
  height: 29px;
  display: block;
}

/* Заголовок: Создавайте / контент легко — две строки по макету */
.main-screen .div3 {
  position: absolute;
  top: 118px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-size: var(--main-fs-title);
  font-family: Roboto, sans-serif;
  font-weight: 400;
  line-height: 94%;
  letter-spacing: 0;
  color: #252A2D;
  text-align: center;
}

.main-screen .div3__line {
  display: block;
  white-space: nowrap;
}

.main-screen .div3 .span {
  color: #6EB2ED;
  font-weight: 400;
}

/* Карточка «Идеи Reels» — внутри .main-screen__rail */
.main-screen__rail .div4,
.main-screen .div4 {
  position: absolute;
  top: 190px;
  left: 0;
  width: 100%;
  height: 122.87px;
  text-align: left;
  cursor: pointer;
}

.main-screen .div4 .inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  overflow: hidden;
  box-sizing: border-box;
  background: #031F30;
  box-shadow: 0 4px 12.8px rgba(0, 0, 0, 0.11), inset 0 4px 4px rgba(255, 255, 255, 0.25);
  border: 1px solid #fff;
}

.main-screen .div4 .inner-shadow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 4px 4px rgba(255, 255, 255, 0.25);
}

.main-screen .div4 .reels-blur {
  position: absolute;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
}

.main-screen .div4 .reels-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.main-screen .div4 .reels-blur--1 {
  left: 2.13px;
  top: 48.41px;
  width: 143.38px;
  height: 75.41px;
  background-image: url('../assets/Main/reels-blur1.svg');
}

.main-screen .div4 .reels-blur--2 {
  left: 0;
  top: 48.76px;
  width: 117.19px;
  height: 73.93px;
  background-image: url('../assets/Main/reels-blur2.svg');
}

.main-screen .div4 .reels {
  position: absolute;
  top: 84.72px;
  left: 14.24px;
  margin: 0;
  width: 114.52px;
  color: #fff;
  font-family: Inter, sans-serif;
  font-size: var(--main-fs-card);
  font-weight: 400;
  line-height: var(--main-lh-card);
}

.main-screen .div4 .reels-icon {
  position: absolute;
  pointer-events: none;
}

.main-screen .div4 .reels-icon--main {
  left: 244.21px;
  top: 231.88px;
  width: 78.51px;
  height: 56.68px;
  transform: translate(-31.66px, -184px);
  border-radius: 15px;
  overflow: hidden;
}

.main-screen .div4 .reels-icon--overlay {
  left: 244.21px;
  top: 231.48px;
  width: 78.51px;
  height: 56.68px;
  transform: translate(-31.66px, -184px);
  border-radius: 15px;
  overflow: hidden;
}

.main-screen .div4 .reels-icon--bar {
  left: 257.94px;
  top: 210.05px;
  width: 51.05px;
  height: 6.34px;
  transform: translate(-31.66px, -184px);
  opacity: 0.4;
}

.main-screen .div4 .reels-icon--bar2 {
  left: 249.49px;
  top: 220.26px;
  width: 68.65px;
  height: 8.1px;
  transform: translate(-31.66px, -184px);
  opacity: 0.7;
}

/* Карточка «Создать серию контента» */
.main-screen__rail .div5,
.main-screen .div5 {
  position: absolute;
  top: 323px;
  left: calc(30.62px - var(--main-content-left));
  width: 159.21px;
  height: 109.86px;
  text-align: left;
}

.main-screen .rectangleDiv {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  background: #042131;
  box-shadow: 0 4px 12.8px rgba(0, 0, 0, 0.11), inset 0 4px 4px rgba(255, 255, 255, 0.25);
  border: 1px solid #fff;
  box-sizing: border-box;
}

.main-screen .icon2-wrap {
  position: absolute;
  left: 26.16px;
  top: 13.96px;
  width: 53.57px;
  height: 63.16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-screen .icon2 {
  width: 45.63px;
  height: 57.04px;
  border-radius: 15px;
  object-fit: cover;
  transform: rotate(8.51deg);
  transform-origin: center;
}

.main-screen .icon3-wrap {
  position: absolute;
  left: 40.96px;
  top: 20.24px;
  width: 58.17px;
  height: 61.74px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-screen .icon3 {
  width: 39.02px;
  height: 48.77px;
  border-radius: 15px;
  object-fit: cover;
  transform: rotate(30deg);
  transform-origin: center;
}

.main-screen .div6 {
  position: absolute;
  top: 29.84px;
  left: 22.57px;
  border-radius: 16px;
  background-color: rgba(217, 217, 217, 0.2);
  width: 24.3px;
  height: 30.4px;
  transform: rotate(-5.4deg);
  transform-origin: 0 0;
}

.main-screen .ellipseDiv {
  position: absolute;
  top: 10.82px;
  left: 126.7px;
  width: 24.86px;
  height: 24.86px;
}

.main-screen .child3 {
  position: absolute;
  top: 18.44px;
  left: 133.92px;
  width: 10.43px;
  height: 9.62px;
}

.main-screen .vectorIcon6 {
  position: absolute;
  left: 13.38px;
  top: 36.86px;
  width: 88.99px;
  height: 32.28px;
  pointer-events: none;
  overflow: hidden;
}

.main-screen .vectorIcon6 img {
  display: block;
  width: 100%;
  height: 100%;
}

.main-screen .div7 {
  position: absolute;
  top: 74.48px;
  left: 14.9px;
  font-family: Inter, sans-serif;
  font-size: var(--main-fs-card);
  font-weight: 400;
  line-height: var(--main-lh-card);
  color: #fff;
  width: 109.86px;
  height: auto;
}

/* Карточка «Сгенерировать изображение» */
.main-screen__rail .div8,
.main-screen .div8 {
  position: absolute;
  top: 323px;
  left: calc(194.48px - var(--main-content-left));
  width: 149.9px;
  height: 109.86px;
  text-align: left;
}

.main-screen .rectangleIcon {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 10px;
  width: 149.9px;
  height: 109.86px;
  object-fit: cover;
}

.main-screen .rectangleParent {
  position: absolute;
  top: 0;
  left: 0;
  width: 149.9px;
  height: 109.86px;
}

.main-screen .groupChild {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(44, 44, 44, 0.73));
  width: 149.9px;
  height: 109.86px;
}

.main-screen .div9 {
  position: absolute;
  top: 74.48px;
  left: 14.97px;
  font-family: Inter, sans-serif;
  font-size: var(--main-fs-card);
  font-weight: 500;
  line-height: var(--main-lh-card);
  color: #fff;
  width: 81.34px;
  height: auto;
}

/* Ask — края белой полосы = края .inner (312px rect в SVG при x=13.7) */
.main-screen__rail .div10,
.main-screen .div10 {
  position: absolute;
  top: 440px;
  left: 0;
  width: 100%;
  height: calc(var(--main-content-width) * 80 / 312);
  overflow: visible;
  text-decoration: none;
  color: inherit;
  display: block;
  border-radius: 15px;
  box-sizing: border-box;
  transition: transform 0.18s ease;
}

@media (hover: hover) {
  .main-screen .div10:hover {
    transform: scale(1.01);
  }
}

.main-screen .div10:focus-visible {
  outline: 2px solid #023e61;
  outline-offset: 3px;
}

/* Ask.svg: белый rect 312×52.4 @ x=13.7 — растягиваем по ширине rail, SVG целиком */
.main-screen .ask-visual {
  display: block;
  width: calc(100% * 340 / 312);
  height: auto;
  margin-left: calc(-100% * 13.7 / 312);
  pointer-events: none;
}

/* ========== Trends screen (Figma 111-106) ========== */
.trends-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
}

.trends-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.trends-screen__search-wrap {
  position: absolute;
  left: 50%;
  top: 35px;
  transform: translateX(-50%);
  width: 336px;
  height: 52.4px;
  margin-left: 0.5px;
}

.trends-screen__search-bg {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 4px 13.7px rgba(0, 0, 0, 0.05);
}

.trends-screen__search-inner {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 314.85px;
  height: 36.74px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: inset 0 4px 4px rgba(0, 0, 0, 0.02);
}

.trends-screen__search-label {
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: text;
  z-index: 0;
}

.trends-screen__search-placeholder {
  position: absolute;
  left: 40.62px;
  top: 23px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.trends-screen__search-input {
  position: absolute;
  left: 38px;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: 22px;
  border: none;
  background: transparent;
  font-family: Inter, sans-serif;
  font-size: 10px;
  color: #023e61;
  outline: none;
  box-sizing: border-box;
}

.trends-screen__search-input::placeholder {
  color: transparent;
}

.trends-screen__error,
.trends-screen__loading {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 96px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  color: #023e61;
  z-index: 1;
}

.trends-screen__error {
  color: #b00020;
}

.trends-screen__search-icon {
  position: absolute;
  left: 300px;
  top: 20px;
  width: 12px;
  height: 12px;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.trends-screen__search-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Скролл списка трендов (все результаты), навигация снизу не перекрывается */
.trends-screen__scroll {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 122px;
  bottom: 128px;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(2, 62, 97, 0.35) transparent;
}

.trends-screen__scroll::-webkit-scrollbar {
  width: 5px;
}

.trends-screen__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.trends-screen__scroll::-webkit-scrollbar-thumb {
  background: rgba(2, 62, 97, 0.28);
  border-radius: 5px;
}

.trends-screen__grid {
  position: relative;
  display: grid;
  grid-template-columns: 155px 155px;
  grid-auto-rows: 180px;
  gap: 10px 19px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  min-height: min-content;
  padding-bottom: 8px;
  box-sizing: border-box;
}

.trends-screen__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 12px 20px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  color: #023e61;
  opacity: 0.85;
}

.trends-screen__card {
  position: relative;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button.trends-screen__card {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

/* Плеер тренда — Figma 245:1421: видео на весь кадр, поиск сверху, низ: назад + CTA */
.trends-player {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
  box-sizing: border-box;
  pointer-events: none;
  isolation: isolate;
}

.trends-player:not([hidden]) {
  pointer-events: auto;
}

.trends-player[hidden] {
  display: none !important;
}

/* Пока открыт плеер — прячем весь макет «телефона» целиком */
.trends-screen--player-open .trends-screen__inner,
.trends-screen:has(.trends-player:not([hidden])) .trends-screen__inner {
  visibility: hidden;
  pointer-events: none;
}

.trends-player__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  z-index: 0;
}

.trends-player__frame {
  position: relative;
  z-index: 1;
  width: min(375px, calc(100vw - 24px));
  height: min(640px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  border-radius: 10px;
  overflow: hidden;
  background: #0a1620;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.trends-player__video-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}

.trends-player__video-wrap.is-buffering .trends-player__video {
  opacity: 0.45;
}

.trends-player__buffering {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #fff;
  pointer-events: none;
}

.trends-player__buffering[hidden] {
  display: none !important;
}

.trends-player__video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  vertical-align: top;
  background: #000;
}

.trends-player__no-video {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(180deg, #0a1620 0%, #152a3a 100%);
}

.trends-player__no-video[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.trends-player__no-video-text {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}

.trends-player__ig-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f58529, #dd2a7b, #8134af);
  color: #fff !important;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

/* Поиск — как на экране трендов (Figma) */
.trends-player__search-mock {
  position: absolute;
  left: 50%;
  top: 35px;
  transform: translateX(-50%);
  width: 336px;
  height: 52.4px;
  z-index: 12;
  pointer-events: none;
}

.trends-player__search-mock-bg {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 4px 13.7px rgba(0, 0, 0, 0.05);
}

.trends-player__search-mock-inner {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 314.85px;
  height: 36.74px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: inset 0 4px 4px rgba(0, 0, 0, 0.02);
}

.trends-player__search-mock-text {
  position: absolute;
  left: 40.62px;
  top: 23px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
  white-space: nowrap;
}

.trends-player__search-mock-icon {
  position: absolute;
  left: 300px;
  top: 20px;
  width: 12px;
  height: 12px;
}

.trends-player__search-mock-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Текст поверх градиента */
.trends-player__info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 108px;
  z-index: 11;
  padding: 0 16px 8px;
  max-height: 38%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: none;
}

.trends-player__info a {
  pointer-events: auto;
}

.trends-player__user {
  margin: 0 0 4px;
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.trends-player__stats {
  margin: 0 0 6px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.trends-player__hype-row {
  margin: 0 0 8px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.trends-player__hype-label {
  font-weight: 600;
  opacity: 0.9;
}

/* Расшифровка показателя «Хайп» (формула), вместо описания ролика */
.trends-player__hype-desc {
  margin: 0 0 8px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  max-height: 96px;
  overflow-y: auto;
}

.trends-player__hype-desc:empty {
  display: none;
}

.trends-player__ig-link {
  display: inline-block;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #a8d4ff;
  text-decoration: underline;
}

.trends-player__ig-link[hidden] {
  display: none !important;
}

/* Низ: назад + «Создать серию контента» (Figma) */
.trends-player__bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 52px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

.trends-player__bottom > * {
  pointer-events: auto;
}

/* Кнопки из Figma: Назад.svg, Создать серию контента.svg */
.trends-player__back {
  width: auto;
  height: auto;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

.trends-player__back img {
  display: block;
  width: 43px;
  height: 43px;
  object-fit: contain;
}

/* Смещение: задайте на элементе style или в родителе:
   --trends-player-cta-top, --trends-player-cta-left (любые единицы: px, rem) */
.trends-player__cta {
  position: relative;
  top: -1px;
  left: var(--trends-player-cta-left, 0);
  display: block;
  padding: 0;
  background: transparent;
  text-decoration: none;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

.trends-player__cta img {
  display: block;
  width: 200px;
  height: auto;
}

.trends-player__cta:active {
  opacity: 0.92;
}

.trends-player__cta-chooser {
  position: absolute;
  right: 20px;
  bottom: 48px;
  z-index: 14;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 210px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(10, 22, 32, 0.92);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.trends-player__cta-chooser[hidden] {
  display: none !important;
}

.trends-player__cta-option {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.trends-player__cta-option:hover,
.trends-player__cta-option:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.34);
  outline: none;
}

/* Режим подсказки (без видео) */
.trends-player__frame.trends-player--hint .trends-player__video-wrap {
  display: none !important;
}

.trends-player__frame.trends-player--hint .trends-player__search-mock {
  display: none;
}

.trends-player__frame.trends-player--hint .trends-player__cta {
  display: none;
}

.trends-player__frame.trends-player--hint {
  background: #f4f7f6;
}

.trends-player__frame.trends-player--hint .trends-player__info {
  position: relative;
  bottom: auto;
  max-height: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px 100px;
  color: #023e61;
}

.trends-player__frame.trends-player--hint .trends-player__user,
.trends-player__frame.trends-player--hint .trends-player__stats,
.trends-player__frame.trends-player--hint .trends-player__hype-row,
.trends-player__frame.trends-player--hint .trends-player__hype-desc {
  color: #023e61;
  text-shadow: none;
}

.trends-player__frame.trends-player--hint .trends-player__bottom {
  justify-content: center;
}

.trends-screen__card-hype {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: auto;
  margin: 0;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: Inter, sans-serif;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: rgba(2, 62, 97, 0.75);
  pointer-events: none;
}

.trends-screen__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trends-screen__card--3,
.trends-screen__card--4 {
  border-radius: 10px 10px 0 0;
}

/* ========== Settings screen (Figma 102-473) ========== */
.settings-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F4F7F6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: auto;
}

/* Контентная рамка: fluid по viewport без transform-scale */
.settings-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
  background: #f4f7f6;
  border-radius: 0;
}

.settings-screen__profile-card {
  position: absolute;
  left: 32px;
  top: 72px;
  width: 313px;
  min-height: 123px;
  background: rgba(255, 255, 255, 0.43);
  border: 1px solid #fff;
  border-radius: 15px;
  box-shadow: 0 4px 12.8px rgba(0, 0, 0, 0.11), inset 0 4px 4px rgba(255, 255, 255, 0.25);
  padding: 28px 0 0 48px;
}

.settings-screen__profile-avatar {
  position: absolute;
  right: 40px;
  top: 25px;
  width: 73px;
  height: 73px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(68, 93, 102, 0.26);
}

.settings-screen__profile-avatar img {
  display: block;
  width: 48px;
  height: 48px;
  margin: 50% 0 0 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
}

.settings-screen__profile-avatar img.is-user-photo {
  width: 100%;
  height: 100%;
  margin: 0;
  transform: none;
  object-fit: cover;
}

.settings-screen__profile-name {
  margin: 0 0 4px;
  font-family: Inter, sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 0.94;
  color: #215060;
}

.settings-screen__profile-tariff,
.settings-screen__profile-generations {
  margin: 0;
  font-family: Inter, sans-serif;
  font-weight: 400;
  font-size: 10px;
  line-height: 0.94;
  color: #215060;
}

.settings-screen__profile-tariff {
  margin-bottom: 2px;
}

.settings-screen__section-title {
  position: absolute;
  left: 45px;
  margin: 0;
  font-family: Roboto, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 0.94;
  text-align: left;
  background: linear-gradient(90deg, #384f58, #79acbe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.settings-screen__section-title--support {
  top: 272px;
}

.settings-screen__section-title--settings {
  top: 329px;
}

.settings-screen__link {
  position: absolute;
  left: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Inter, sans-serif;
  font-weight: 400;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.settings-screen__link--contact {
  top: 296px;
}

.settings-screen__link--notifications {
  top: 353px;
}

.settings-screen__link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23023e61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.settings-screen__link-icon--bell {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23023e61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E");
}

.settings-screen__legal {
  position: absolute;
  left: 41px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-weight: 400;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
}

.settings-screen__legal a {
  color: inherit;
  text-decoration: none;
}

.settings-screen__legal:first-of-type {
  top: 463px;
}

.settings-screen__legal:nth-of-type(2) {
  top: 478px;
}

.settings-screen__legal--logout {
  top: 493px;
}

/* ========== Support screen (Figma 102-620 / 245-998) ========== */
.support-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
}

.support-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.support-screen__back {
  position: absolute;
  left: 31px;
  top: 57px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.support-screen__back svg {
  display: block;
  width: 12px;
  height: 13px;
}

.support-screen__header {
  position: absolute;
  top: 46px;
  left: 210px;
  width: 100px;
  font-size: 15px;
  font-family: "FF Meta Georgian", Montserrat, sans-serif;
  line-height: 14.1px;
}

.support-screen__pill {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.support-screen__profile {
  position: absolute;
  right: 32px;
  top: 58px;
  width: 27px;
  height: 27px;
  overflow: hidden;
  border-radius: 50%;
}

.support-screen__profile-bg {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(68, 93, 102, 0.26), inset 0 4px 4px rgba(255, 255, 255, 0.25);
}

.support-screen__profile-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17.6px;
  height: 17.6px;
  margin-left: -8.8px;
  margin-top: -8.8px;
  object-fit: contain;
}

.support-screen__faq {
  position: absolute;
  left: 31px;
  top: 144px;
  width: 312px;
}

.support-screen__faq-item {
  margin-bottom: 10px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 13.7px rgba(0, 0, 0, 0.05);
}

.support-screen__faq-item:last-of-type {
  margin-bottom: 0;
}

.support-screen__faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 17px 12px 17px 12px;
  min-height: 43px;
  box-sizing: border-box;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 500;
  line-height: 0.94;
  color: #023e61;
  -webkit-tap-highlight-color: transparent;
}

.support-screen__faq-question-text {
  flex: 1;
  padding-right: 8px;
}

.support-screen__faq-chevron {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' fill='none'%3E%3Cpath d='M2 1L6 4L2 7' stroke='%23023e61' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}

.support-screen__faq-item--expanded .support-screen__faq-chevron {
  transform: rotate(0deg);
}

.support-screen__faq-answer {
  padding: 0 12px 17px 12px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
  color: #023e61;
}

.support-screen__faq-answer[hidden] {
  display: none;
}

.support-screen__faq-answer p {
  margin: 0;
}

.support-screen__ask {
  position: absolute;
  left: 31.5px;
  top: 524px;
  width: 312px;
  height: 52.4px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 4px 13.7px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  padding: 0 8px 0 16px;
  box-sizing: border-box;
}

.support-screen__ask-input {
  flex: 1;
  border: none;
  background: none;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
  outline: none;
}

.support-screen__ask-input::placeholder {
  color: #023e61;
  opacity: 0.6;
}

.support-screen__ask-send {
  width: 33px;
  height: 33px;
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.support-screen__ask-send svg {
  display: block;
}

/* ========== Privacy policy screen (Figma 245-747), Terms screen (245-886) — общий фон #f4f7f6 ========== */
.privacy-screen,
.terms-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
  background: #f4f7f6;
}

.privacy-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.privacy-screen__back {
  position: absolute;
  left: 31px;
  top: 57px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.privacy-screen__back svg {
  display: block;
  width: 12px;
  height: 13px;
}

.privacy-screen__sheet {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: 358px;
  height: 544px;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 4px 12.8px rgba(0, 0, 0, 0.11);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.privacy-screen__handle {
  flex-shrink: 0;
  width: 47px;
  height: 2px;
  margin: 18px auto 0;
  background: #023e61;
  border-radius: 87px;
  opacity: 0.55;
}

.privacy-screen__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.privacy-screen__title {
  margin: 0 0 4px;
  font-family: Roboto, Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #023e61;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.privacy-screen__subtitle {
  margin: 0 0 12px;
  font-family: Roboto, Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #023e61;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.privacy-screen__meta {
  margin: 0 0 4px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  color: #215060;
}

.privacy-screen__intro {
  margin: 16px 0 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  color: #252a2d;
}

.privacy-screen__heading {
  margin: 16px 0 8px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  color: #023e61;
}

.privacy-screen__heading:first-of-type {
  margin-top: 12px;
}

.privacy-screen__subheading {
  margin: 12px 0 6px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  color: #023e61;
}

.privacy-screen__body {
  margin: 0 0 8px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  color: #252a2d;
}

.privacy-screen__list {
  margin: 6px 0 10px;
  padding-left: 16px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  color: #252a2d;
}

.privacy-screen__list li {
  margin-bottom: 4px;
}

/* ========== Terms of service screen (Figma 245-886) ========== */
.terms-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.terms-screen__back {
  position: absolute;
  left: 31px;
  top: 57px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.terms-screen__back svg {
  display: block;
  width: 12px;
  height: 13px;
}

.terms-screen__sheet {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: 358px;
  height: 544px;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 4px 12.8px rgba(0, 0, 0, 0.11);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terms-screen__handle {
  flex-shrink: 0;
  width: 47px;
  height: 2px;
  margin: 18px auto 0;
  background: #023e61;
  border-radius: 87px;
  opacity: 0.55;
}

.terms-screen__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.terms-screen__title {
  margin: 0 0 4px;
  font-family: Roboto, Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #023e61;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.terms-screen__subtitle {
  margin: 0 0 12px;
  font-family: Roboto, Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #023e61;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.terms-screen__meta {
  margin: 0 0 4px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  color: #215060;
}

.terms-screen__intro {
  margin: 16px 0 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  color: #252a2d;
}

.terms-screen__heading {
  margin: 16px 0 8px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  color: #023e61;
}

.terms-screen__heading:first-of-type {
  margin-top: 12px;
}

.terms-screen__body {
  margin: 0 0 8px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  color: #252a2d;
}

/* ========== Profile screen (Figma 102-506) ========== */
.profile-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
}

.profile-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.profile-screen__photo-wrap {
  position: absolute;
  left: 50%;
  top: 47px;
  margin-left: -36.5px;
  width: 73px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-screen__photo {
  width: 73px;
  height: 73px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(68, 93, 102, 0.26);
  margin: 0 auto 10px;
}

.profile-screen__photo-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.profile-screen__photo img {
  display: block;
  width: 37px;
  height: 37px;
  margin: 50% 0 0 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
}

.profile-screen__photo img.is-user-photo {
  width: 100%;
  height: 100%;
  margin: 0;
  transform: none;
  object-fit: cover;
}

.profile-screen__photo-label {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 0.94;
  color: #215060;
  white-space: nowrap;
}

.profile-screen__section-title {
  position: absolute;
  left: 48px;
  top: 348px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 0.94;
  color: #215060;
}

/* Профиль: выравнивание по Figma 102-506 — метки 48px, значения 261px, шеврон 320px (375px canvas) */
.profile-screen__list {
  position: absolute;
  left: 48px;
  right: 48px;
  width: calc(100% - 96px);
  max-width: 279px;
}

.profile-screen__list:not(.profile-screen__list--connections) {
  top: 196px;
}

.profile-screen__list--connections {
  top: 374px;
}

.profile-screen__row {
  display: flex;
  align-items: center;
  padding: 7px 0;
  min-height: 26px;
  text-decoration: none;
  color: inherit;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 0.94;
  color: #215060;
  -webkit-tap-highlight-color: transparent;
}

.profile-screen__row-label {
  flex: 0 0 213px;
  font-weight: 400;
  font-size: 12px;
}

.profile-screen__list--connections .profile-screen__row-label {
  flex-basis: 168px;
}

.profile-screen__list--connections .profile-screen__row-value {
  overflow: visible;
  text-overflow: clip;
}

.profile-screen__row-value {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 300;
  font-size: 10px;
  text-align: right;
  margin-left: 0;
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-screen__row-chevron {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-left: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' fill='none'%3E%3Cpath d='M2 1L6 4L2 7' stroke='%23215060' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  transform: rotate(-90deg);
}

.profile-screen__gender-menu {
  position: absolute;
  left: 48px;
  right: 48px;
  top: 248px;
  background: #ffffff;
  border: 1px solid rgba(33, 80, 96, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(33, 80, 96, 0.12);
  overflow: hidden;
  z-index: 6;
}

.profile-screen__gender-option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #215060;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-screen__gender-option + .profile-screen__gender-option {
  border-top: 1px solid rgba(33, 80, 96, 0.08);
}

.profile-screen__gender-option:hover,
.profile-screen__gender-option:focus-visible {
  background: rgba(110, 178, 237, 0.12);
  outline: none;
}

.profile-screen__password-modal {
  position: absolute;
  inset: 0;
  z-index: 12;
}

.profile-screen__password-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 33, 41, 0.28);
}

.profile-screen__password-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 279px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(21, 46, 61, 0.22);
  padding: 14px 14px 12px;
  box-sizing: border-box;
}

.profile-screen__password-title {
  margin: 0 0 10px;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #215060;
}

.profile-screen__password-label {
  display: block;
  margin-bottom: 8px;
}

.profile-screen__password-label span {
  display: block;
  margin-bottom: 4px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #215060;
}

.profile-screen__password-label input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(33, 80, 96, 0.25);
  padding: 0 10px;
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #215060;
  background: #fff;
}

.profile-screen__password-label input:focus {
  outline: none;
  border-color: rgba(33, 80, 96, 0.55);
}

.profile-screen__password-error {
  margin: 6px 0 8px;
  min-height: 14px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #b4232f;
}

.profile-screen__password-actions {
  display: flex;
  gap: 8px;
}

.profile-screen__password-btn {
  flex: 1 1 0;
  height: 32px;
  border: 0;
  border-radius: 76px;
  background: linear-gradient(90deg, #252a2d, #023e61);
  color: #fff;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.profile-screen__password-btn--ghost {
  background: rgba(33, 80, 96, 0.1);
  color: #215060;
}

.profile-screen__email-modal {
  position: absolute;
  inset: 0;
  z-index: 12;
}

.profile-screen__email-card {
  min-height: 128px;
}

.profile-screen__email-value {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #215060;
  word-break: break-word;
}

/* Пока открыт лист тарифов — заливаем весь viewport фоном карточек (лист сидит внутри
   масштабированного 375×640, иначе сверху/снизу видны «полосы» чужого фона). */
html.profile-tariff-sheet-open,
html.profile-tariff-sheet-open body {
  background-color: #f4f7f6;
}

html.profile-tariff-sheet-open #app,
html.profile-tariff-sheet-open .app {
  background-color: #f4f7f6;
  min-height: 100dvh;
}

html.profile-tariff-sheet-open .profile-screen {
  background-color: #f4f7f6;
}

.profile-tariff-sheet {
  position: absolute;
  inset: 0;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
  background: #f4f7f6;
}

.profile-tariff-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
}

.profile-tariff-sheet.profile-tariff-sheet--locked .profile-tariff-sheet__close,
.profile-tariff-sheet.profile-tariff-sheet--locked .profile-tariff-sheet__backdrop {
  display: none;
}

.profile-tariff-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.profile-tariff-sheet__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.profile-tariff-sheet__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(2, 62, 97, .12);
  box-shadow: 0 2px 8px rgba(2, 62, 97, .14);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}

.profile-tariff-sheet__close span {
  position: relative;
  width: 16px;
  height: 16px;
  display: block;
}

.profile-tariff-sheet__close span::before,
.profile-tariff-sheet__close span::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 2px;
  height: 16px;
  border-radius: 2px;
  background: #023e61;
}

.profile-tariff-sheet__close span::before { transform: rotate(45deg); }
.profile-tariff-sheet__close span::after { transform: rotate(-45deg); }

.profile-tariff-sheet__close:active {
  transform: scale(.97);
}

.profile-tariff-sheet__track {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.profile-tariff-card {
  position: relative;
  width: 297px;
  height: 560px;
  border-radius: 383px;
  padding: 82px 36px 31px;
  box-sizing: border-box;
  color: #023e61;
  font-family: Montserrat, sans-serif;
  background: linear-gradient(180deg, rgba(232, 243, 247, .69) 12%, rgba(232, 243, 247, .44) 100%);
  box-shadow: 1px 4px 17.8px 11px rgba(107, 189, 212, .1);
  position: absolute;
  left: 39px;
  top: 40px;
  transition: left .36s cubic-bezier(.22, .72, .2, 1), top .36s cubic-bezier(.22, .72, .2, 1), transform .34s cubic-bezier(.22, .72, .2, 1), opacity .34s ease;
}

.profile-tariff-card:not(.is-active) {
  transform: scale(.94);
  opacity: .58;
}

.profile-tariff-card__logo {
  margin: 0 auto 18px;
  font-size: 38px;
  line-height: 1;
  font-weight: 700;
  text-align: center;
  letter-spacing: -.02em;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.profile-tariff-card__logo-icon {
  width: 25px;
  height: 25px;
  display: block;
}

.profile-tariff-card__logo--pro {
  font-size: 32px;
  font-weight: 600;
  gap: 7px;
}

.profile-tariff-card__logo--k {
  width: 18px;
  margin: 0 auto 18px;
  font-size: 0;
  line-height: 0;
  display: block;
  letter-spacing: 0;
}

.profile-tariff-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.profile-tariff-card__title--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.profile-tariff-card__subtitle {
  margin: 0 auto 46px;
  width: 182px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
}

.profile-tariff-card__features {
  margin: 0 auto 30px;
  padding: 0;
  width: 190px;
  list-style: none;
}

.profile-tariff-card__features li {
  position: relative;
  margin: 0 0 10px;
  padding-left: 24px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
}

.profile-tariff-card__features li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: -3px;
  font-size: 16px;
  line-height: 1;
}

.profile-tariff-card__price {
  margin: 0 auto 18px;
  width: 190px;
  font-size: 12px;
  line-height: 1.2;
}

.profile-tariff-card__price strong {
  font-weight: 600;
}

.profile-tariff-card__price span {
  font-weight: 500;
}

.profile-tariff-card--free .profile-tariff-card__price span {
  font-weight: 400;
}

.profile-tariff-card--month .profile-tariff-card__subtitle {
  margin-top: 2px;
}

.profile-tariff-card--half-year .profile-tariff-card__logo,
.profile-tariff-card--month .profile-tariff-card__logo {
  margin-bottom: 8px;
}

.profile-tariff-card__btn {
  display: block;
  width: 166px;
  height: 30px;
  margin: 0 auto;
  border: 0;
  border-radius: 76px;
  background: linear-gradient(90deg, #252a2d, #023e61);
  color: #fff;
  font-family: Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.profile-tariff-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: 8px;
  margin-right: -9px;
  border-radius: 50%;
  font-size: 10px;
  background: rgba(157, 196, 216, .75);
}

.profile-tariff-sheet__hit {
  position: absolute;
  top: 48px;
  bottom: 64px;
  width: 78px;
  border: 0;
  background: transparent;
  z-index: 2;
}

.profile-tariff-sheet__hit--prev { left: 0; }
.profile-tariff-sheet__hit--next { right: 0; }

/* ========== Library screen (Figma 245-1758) ========== */
.library-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
}

/* Контентная рамка: fluid по viewport без transform-scale */
.library-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.library-screen__title {
  position: absolute;
  left: 16px;
  top: 64px;
  margin: 0;
  font-family: Roboto, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 0.94;
  color: #252a2d;
}

.library-screen__title-accent {
  color: #6eb2ed;
}

.library-screen__header {
  position: absolute;
  right: 14px;
  top: 46px;
  width: 100px;
}

.library-screen__pill {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Прокрутка списка карточек; нижний зазор — .library-screen__scroll-end (не padding: он на overflow даёт баги в WebKit) */
.library-screen__scroll {
  position: absolute;
  left: 0;
  right: 0;
  top: 156px;
  bottom: 0;
  z-index: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  box-sizing: border-box;
}

/* Макет 375×640: подсветка нав ~512–612, иконки ~548–581 → резерв ≥128px + запас под многострочные подписи */
.library-screen__scroll-end {
  width: 100%;
  height: 168px;
  flex-shrink: 0;
  pointer-events: none;
}

.library-screen__grid {
  position: relative;
  left: 0;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 17px 14px;
  width: calc(100% - 16px);
  max-width: 335px;
  margin: 0;
  margin-left: 16px;
  padding: 0 8px 0 0;
  box-sizing: border-box;
}

.library-screen__empty {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  margin: 0 16px 16px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  color: #5a6b75;
  text-align: center;
}

.library-screen__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  z-index: 0;
}

.library-screen__card[data-library-item-id] {
  cursor: pointer;
}

.library-screen__card[data-library-item-id]:hover,
.library-screen__card[data-library-item-id]:focus-within {
  z-index: 1;
}

.library-screen__card-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 106px;
  border-radius: 15px;
  margin-bottom: 6px;
  overflow: visible;
  background: transparent;
  box-sizing: border-box;
  padding-right: 28px;
}

.library-screen__card-dots-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.library-screen__card-elipse {
  display: block;
  width: 8px;
  height: 8px;
  pointer-events: auto;
  z-index: 2;
}

.library-screen__card-folder-wrap {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
}

.library-screen__card-folder {
  display: block;
  position: static;
  width: 100px;
  max-width: 100%;
  height: auto;
  pointer-events: none;
}

/* Всплывающее меню по Figma 245-1901 */
.library-screen__card-menu-popup {
  position: absolute;
  right: 0;
  top: 4px;
  width: 93px;
  min-height: 25px;
  background: #031f30;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(68, 93, 102, 0.26);
  z-index: 10;
  display: none;
  overflow: hidden;
}

.library-screen__card-menu-popup.is-open {
  display: block;
}

.library-screen__card-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  font-family: Inter, sans-serif;
  font-weight: 400;
  font-size: 10px;
  line-height: 0.94;
  color: #fff;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.library-screen__card-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.library-screen__card-menu {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.library-screen__card-menu svg {
  display: block;
  flex-shrink: 0;
}

/* Подпись строго под превью карточки, влево */
.library-screen__card-label {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 17.71px;
  font-family: Inter, sans-serif;
  font-weight: 400;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: left;
  color: #252a2d;
  opacity: 1;
  box-sizing: border-box;
}

/* ========== Registration screen (.screen) ========== */
.screen {
  position: relative;
  background-color: #f4f7f6;
  min-height: 640px;
  min-width: 375px;
  width: 100%;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: 24px;
  box-sizing: border-box;
}

.screen__inner {
  position: relative;
  width: 375px;
  max-width: 100%;
  min-height: 640px;
  margin: 0 auto;
}

/* Spring: mass 1, stiffness 80, damping 20 */
.screen .view,
.screen .e-mail,
.screen .view-2,
.screen .view-3,
.screen .reg-mascot,
.screen .continue-with-google-centre-fixed,
.screen .continue-with-apple-centre-fixed,
.screen .VK-btn {
  transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.screen .reg-mascot {
  transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.screen .group-wrap,
.screen .header-pill {
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Состояние 2: пилл (rectangle + logo + label kliko, без стрелки) */
.screen .header-pill {
  display: none;
  position: absolute;
  left: 138px;
  top: 76px;
  width: 102px;
  height: 27px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.screen[data-reg-state="2"] .group-wrap {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.screen[data-reg-state="2"] .header-pill {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.screen .header-pill__img {
  display: block;
  width: 100px;
  height: 27px;
  object-fit: cover;
  object-position: left center;
}

.screen .group-wrap {
  position: absolute;
  left: 161px;
  top: 61px;
  width: 64px;
  height: 55px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen .group {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen .text-wrapper-3 {
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(90deg, rgba(56, 79, 88, 1) 0%, rgba(121, 172, 190, 1) 100%);
  background-clip: text;
  color: transparent;
  font-family: "Roboto-Regular", "Roboto", Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 400;
  left: calc(50% - 84px);
  letter-spacing: 0;
  line-height: 14.1px;
  position: absolute;
  text-align: center;
  top: 143px;
  white-space: nowrap;
}

.screen-form {
  margin: 0;
  padding: 0;
}

.screen .view,
.screen .e-mail,
.screen .view-2 {
  height: 41px;
  left: calc(50% - 144px);
  position: absolute;
  width: 291px;
  display: block;
  margin: 0;
}

.screen .view {
  top: 177px;
}

.screen .e-mail {
  top: 225px;
}

.screen .view-2 {
  top: 275px;
}

.screen .view .rectangle,
.screen .e-mail .rectangle,
.screen .view-2 .rectangle-2 {
  background-color: #ffffffd9;
  border-radius: 10px;
  box-shadow: inset 0 4px 4px #00000005;
  height: 41px;
  position: absolute;
  width: 289px;
  left: -2px;
  pointer-events: none;
}

.screen .view .rectangle,
.screen .e-mail .rectangle {
  top: 1px;
}

.screen .view-2 .rectangle-2 {
  top: 0;
}

.screen .view input,
.screen .e-mail input,
.screen .view-2 input {
  position: absolute;
  left: 0;
  top: 0;
  width: 289px;
  height: 41px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: "Inter-Regular", "Inter", Helvetica, sans-serif;
  font-size: 15px;
  color: #023e61;
  outline: none;
  box-sizing: border-box;
}

.screen .view input::placeholder,
.screen .e-mail input::placeholder,
.screen .view-2 input::placeholder {
  color: transparent;
}

.screen .text-wrapper-4,
.screen .text-wrapper-5,
.screen .text-wrapper-6 {
  color: #529bb5;
  font-family: "Inter-Regular", "Inter", Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 400;
  left: 23px;
  letter-spacing: 0;
  line-height: 9.4px;
  position: absolute;
  text-align: center;
  top: 15px;
  white-space: nowrap;
  pointer-events: none;
  transition: top 0.15s ease;
}

.screen .text-wrapper-4 { width: 22px; }
.screen .text-wrapper-5 { width: 32px; top: 16px; }
.screen .text-wrapper-6 { width: 39px; }

.screen .view input:focus ~ .text-wrapper-4,
.screen .view input:not(:placeholder-shown) ~ .text-wrapper-4,
.screen .e-mail input:focus ~ .text-wrapper-5,
.screen .e-mail input:not(:placeholder-shown) ~ .text-wrapper-5,
.screen .view-2 input:focus ~ .text-wrapper-6,
.screen .view-2 input:not(:placeholder-shown) ~ .text-wrapper-6 {
  top: 8px;
}

.screen .view-3 {
  height: 40px;
  left: 43px;
  position: absolute;
  top: 336px;
  width: 291px;
}

.screen .rectangle-3 {
  background: linear-gradient(90deg, rgba(37, 42, 45, 1) 0%, rgba(2, 62, 97, 1) 100%);
  border-radius: 10px;
  height: 40px;
  left: 0;
  position: absolute;
  top: 0;
  width: 289px;
  pointer-events: none;
}

.screen .text-wrapper-7 {
  color: #ffffff;
  font-family: "Roboto-Medium", "Roboto", Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 500;
  left: calc(50% - 48px);
  letter-spacing: 0;
  line-height: 14.1px;
  position: absolute;
  text-align: center;
  top: 13px;
  width: 94px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Маскот регистрации: декоративный слой по Figma, pointer-events: none */
.screen .reg-mascot {
  position: absolute;
  left: 353px;
  top: 339px;
  width: 22px;
  height: 232px;
  z-index: 10;
  pointer-events: none;
}

.screen .reg-mascot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

.screen .continue-with-google-centre-fixed {
  height: 40px !important;
  left: calc(50% - 144px) !important;
  overflow: hidden !important;
  position: absolute !important;
  top: 385px !important;
  width: 280px !important;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.17);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen .continue-with-google-instance {
  align-items: center !important;
  justify-content: center !important;
  margin-left: -1px !important;
  width: 190px !important;
  display: inline-flex;
  gap: 15px;
}

.screen .continue-with-google-centre-fixed-instance {
  font-size: 14px !important;
  margin-top: unset !important;
  font-family: "Roboto", Helvetica, sans-serif;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.54);
}

.screen .continue-with-google-centre-fixed img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.screen .continue-with-apple-centre-fixed {
  height: 40px !important;
  left: calc(50% - 144px) !important;
  overflow: hidden !important;
  position: absolute !important;
  top: 434px !important;
  width: 280px !important;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #000;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.17);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen .continue-with-apple-instance {
  align-items: center !important;
  justify-content: center !important;
  margin-left: unset !important;
  width: 181px !important;
  display: inline-flex;
  gap: 15px;
}

.screen .continue-with-apple-centre-fixed-instance {
  font-family: "Roboto-Regular", "Roboto", Helvetica, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  margin-top: unset !important;
  color: #fff;
}

.screen .continue-with-apple-centre-fixed img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.screen .VK-btn {
  height: 40px;
  left: 43px;
  position: absolute;
  top: 483px;
  width: 280px;
  padding: 7px 15px;
  border: none;
  border-radius: 10px;
  background: #0077ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: "Inter", Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.screen .VK-btn .VK {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.screen .text-wrapper-8 {
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(90deg, rgba(56, 79, 88, 1) 0%, rgba(121, 172, 190, 1) 100%);
  background-clip: text;
  color: transparent;
  font-family: "Roboto-Regular", "Roboto", Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 400;
  left: calc(50% - 64px);
  letter-spacing: 0;
  line-height: 14.1px;
  position: absolute;
  text-align: center;
  top: 543px;
  white-space: nowrap;
  padding: 0;
  border: none;
  background-color: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen .text-wrapper-8:hover {
  text-decoration: underline;
}

/* Регистрация: переключение шапки по data-reg-state (лого → пилл) */
.screen--registration[data-reg-state="2"] .login-logo {
  display: none;
}

.screen--registration[data-reg-state="2"] .login-header__pill {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* ========== Экран входа (и регистрации): общие стили ========== */

/* Root: min-height 100dvh, flex column, align-items center, background Figma #f4f7f6 */
.screen.screen--login {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 0;
  background-color: #f4f7f6;
  z-index: 1;
}

.screen--login .screen__root {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  z-index: 1;
}

/* Main: justify-content center to keep form centered vertically */
.screen--login .screen__main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.screen--login .screen__content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: min-content;
  overflow-x: hidden;
}

/* Form container: max-width 400px, padding 40px 24px, z-index 5 (below mascot) */
.screen--login .screen__form-wrap {
  width: 100%;
  max-width: 400px;
  padding: 40px 24px;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Bottom spacer: room for fixed mascot when scrolling */
.screen--login .screen__spacer {
  flex-shrink: 0;
  height: var(--spacer-mascot);
  width: 100%;
}

/* Mascot: внутри .login-social, поверх кнопок справа внизу, pointer-events: none */
.screen--login .screen__mascot {
  position: absolute;
  right: -36%;
  bottom: -100px;
  height: 55vh;
  max-height: 374px;
  width: auto;
  z-index: 100;
  pointer-events: none;
  display: block;
}

.screen--login .screen__mascot img {
  display: block;
  height: 100%;
  width: auto;
  object-fit: contain;
  object-position: right bottom;
}

/* Header: logo (state 1) or pill (state 2), centered via flex, no absolute */
.screen--login .login-header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 44px;
}

.screen--login .login-logo {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 27px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.4s;
}

.screen--login .login-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen--login .login-header__pill {
  display: none;
  align-items: center;
  justify-content: center;
  width: 102px;
  height: 27px;
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.4s;
}

.screen--login .login-header__pill-img {
  display: block;
  width: 100px;
  height: 27px;
  object-fit: cover;
  object-position: left center;
}

.screen--login[data-login-state="2"] .login-logo {
  display: none;
}

.screen--login[data-login-state="2"] .login-header__pill {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Title: theme-style, centered */
.screen--login .login-title {
  margin: 0;
  width: 100%;
  text-align: center;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(90deg, var(--color-gradient-start) 0%, var(--color-gradient-end) 100%);
  background-clip: text;
}

/* Form: gap 16px, full width */
.screen--login .login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin: 0;
}

.screen--login .login-form__error {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(180, 60, 60, 0.12);
  color: #8b2635;
  font-size: 13px;
  line-height: 1.4;
}

/* Inputs: height 52px, white bg, rounded 16px, subtle box-shadow, gap 16px */
.screen--login .login-field {
  position: relative;
  display: block;
  width: 100%;
  height: 52px;
}

.screen--login .login-field__bg {
  position: absolute;
  inset: 0;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.screen--login .login-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 16px 14px 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--color-primary);
  outline: none;
  box-sizing: border-box;
}

.screen--login .login-field input::placeholder {
  color: transparent;
}

.screen--login .login-field__label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: top 0.2s ease, transform 0.2s ease;
}

.screen--login .login-field input:focus ~ .login-field__label,
.screen--login .login-field input:not(:placeholder-shown) ~ .login-field__label {
  top: 8px;
  transform: none;
}

/* Submit: full width, height 52px, navy #0B2F45, border-radius 16px */
.screen--login .login-submit {
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: #0B2F45;
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.screen--login .login-submit:hover {
  opacity: 0.95;
}

.screen--login .login-submit:active {
  transform: scale(0.98);
}

/* Social: full width, gap 16px */
.screen--login .login-social {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.screen--login .login-social__btn {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 0 16px;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease, transform 0.1s ease;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.17);
}

.screen--login .login-social__btn--google {
  background: #fff;
  color: rgba(0, 0, 0, 0.54);
  font-family: var(--font-body);
  font-weight: 500;
}

.screen--login .login-social__btn--apple {
  background: #000;
  color: #fff;
  font-family: var(--font-body);
  font-weight: 400;
}

.screen--login .login-social__btn--vk {
  background: #0077FF;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 400;
  gap: 14px;
  padding: 10px 16px;
}

.screen--login .login-social__btn img,
.screen--login .login-social__icon-vk {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.screen--login .login-social__btn:active {
  transform: scale(0.98);
}

/* Footer link: centered at bottom of form, theme body */
.screen--login .login-footer-link {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(90deg, var(--color-gradient-start) 0%, var(--color-gradient-end) 100%);
  background-clip: text;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen--login .login-footer-link:hover {
  text-decoration: underline;
}

/* ========== Login screen (Экран входа — старые стили, не используются) ========== */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #f4f7f6;
  padding: 0 24px 24px;
  padding-top: env(safe-area-inset-top, 0);
  overflow-y: auto;
}

.login-screen__inner {
  width: 100%;
  max-width: 289px;
  margin: 0 auto;
  padding-top: 24px;
  padding-bottom: 48px;
}

.login-screen__header {
  margin-bottom: 24px;
}

.login-screen__header--state-1,
.login-screen__header--state-2 {
  display: none;
}

.login-screen[data-login-state="1"] .login-screen__header--state-1 {
  display: flex;
  justify-content: center;
}

.login-screen[data-login-state="2"] .login-screen__header--state-2 {
  display: block;
}

.login-screen__back {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: #023e61;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.login-screen__back:active {
  opacity: 0.7;
}

.login-screen__pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #252a2d;
  border-radius: 226px;
  height: 40px;
  padding: 0 16px 0 44px;
  position: relative;
  width: fit-content;
  min-width: 100px;
  margin: 0 auto;
}

.login-screen__back--in-pill {
  position: absolute;
  left: 12px;
  color: #fff;
}

.login-screen__pill-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-screen__pill-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.02em;
}

.login-screen__title {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 0.94;
  text-align: center;
  margin: 0 0 24px;
  background: linear-gradient(90deg, #384f58 0%, #79acbe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
}

.login-screen__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.login-screen__field {
  position: relative;
  display: block;
}

.login-screen__field input {
  width: 100%;
  height: 41px;
  padding: 12px 14px 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 4px 4px rgba(0, 0, 0, 0.02);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #023e61;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.login-screen__field input::placeholder {
  color: transparent;
}

.login-screen__label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: #529bb5;
  pointer-events: none;
  transition: top 0.2s, font-size 0.2s;
}

.login-screen__field input:focus ~ .login-screen__label,
.login-screen__field input:not(:placeholder-shown) ~ .login-screen__label {
  top: 8px;
  transform: none;
  font-size: 10px;
}

.login-screen__field input:placeholder-shown ~ .login-screen__label {
  top: 50%;
  transform: translateY(-50%);
}

.login-screen__submit {
  width: 289px;
  max-width: 100%;
  height: 40px;
  margin-top: 8px;
  margin-left: auto;
  margin-right: auto;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #252a2d 0%, #023e61 100%);
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 0.94;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.login-screen__submit:hover {
  opacity: 0.95;
}

.login-screen__submit:active {
  transform: scale(0.98);
}

.login-screen__social {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-bottom: 32px;
}

.login-screen__social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 280px;
  max-width: 100%;
  height: 40px;
  padding: 0 15px;
  border: none;
  border-radius: 10px;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.login-screen__social-btn--vk {
  gap: 14px;
  padding: 7px 15px;
}

.login-screen__social-btn:hover {
  opacity: 0.92;
}

.login-screen__social-btn:active {
  transform: scale(0.98);
}

.login-screen__social-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-screen__social-btn--google {
  background: #fff;
  color: rgba(0, 0, 0, 0.54);
  font-weight: 500;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.17);
}

.login-screen__social-btn--apple {
  background: #000;
  color: #fff;
  font-weight: 400;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.17);
}

.login-screen__social-btn--vk {
  background: #07f;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.08), 0 2px 3px rgba(0, 0, 0, 0.17);
}

.login-screen__footer {
  text-align: center;
  margin: 0;
}

.login-screen__footer-link {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 15px;
  background: linear-gradient(90deg, #384f58 0%, #79acbe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border: none;
  background-color: transparent;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.login-screen__footer-link:hover {
  text-decoration: underline;
}

/* ========== Reels screen (Идеи Reels — Сценарии и хуки) Figma 252-405 ========== */
.reels-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: auto;
}

/* Серия контента: без прокрутки всего экрана (масштаб + safe-area); чат — только в .reels-screen__chat-body */
.series-screen.reels-screen {
  overflow: hidden;
}

/* Reels / Серия / Изображение / Умный помощник — как на главной: верх выше, центр scale целиком */
.reels-screen {
  --main-top-shift: calc(var(--app-frame-height) * -0.08);
  --main-center-scale: 1.2;
  --main-center-origin-y: 48%;
}

.reels-screen .reels-screen__inner {
  overflow: visible;
  backface-visibility: visible;
}

.reels-screen__top {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  transform: translateY(var(--main-top-shift));
}

.reels-screen__top > * {
  pointer-events: auto;
}

.reels-screen__center {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.reels-screen__center-scale {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scale(var(--main-center-scale));
  transform-origin: 50% var(--main-center-origin-y);
  will-change: transform;
}

.reels-screen__center-scale > * {
  pointer-events: auto;
}

.reels-screen__inner {
  position: relative;
  width: var(--app-frame-width);
  height: var(--app-frame-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.main-screen__inner,
.trends-screen__inner,
.settings-screen__inner,
.support-screen__inner,
.privacy-screen__inner,
.terms-screen__inner,
.profile-screen__inner,
.library-screen__inner,
.reels-screen__inner {
  backface-visibility: hidden;
  transform-style: flat;
  will-change: auto;
}

/* Для редактора серии отключаем масштаб через transform:
   SVG-иконки в нижней панели иначе получают размытие/«пиксельные» края. */
.series-stories-editor-screen__inner.reels-screen__inner {
  transform: none;
}

/* Хедер Reels: стрелка (~24px) | большой отступ | пилюля Kliko (104×38) | отступ 12px | аватар (40px) */
.reels-screen__back {
  position: absolute;
  left: 31px;
  top: 60px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reels-screen__back svg {
  display: block;
  width: 22px;
  height: 24px;
}

.reels-screen__header {
  position: absolute;
  left: 195px;
  top: 45px;
}

.reels-screen__pill {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reels-screen__profile {
  position: absolute;
  right: 31px;
  top: 60px;
  width: 31px;
  height: 31px;
  overflow: hidden;
  border-radius: 50%;
}

.reels-screen__profile-bg {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(68, 93, 102, 0.26), inset 0 4px 4px rgba(255, 255, 255, 0.25);
}

.reels-screen__profile-logo {
  position: absolute;
  left: 62%;
  top: 60%;
  width: 16px;
  height: 16px;
  margin-left: -11px;
  margin-top: -11px;
  object-fit: contain;
}

/* Карточка Kliko — Figma 252-427: 167×141, тень, компактный текст */
.reels-screen__card {
  position: absolute;
  left: 49px;
  top: 165px;
  width: 167px;
  padding: 13px 8px 14px 8px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.reels-screen__card-author {
  margin: 0 0 6px 0;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  color: #023e61;
  line-height: 1;
}

.reels-screen__card-text {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.15;
  color: #023e61;
  width: 149px;
}

.reels-screen__card-text p {
  margin: 0 0 0 0;
}

/* Пропуск строчки между блоками — Figma ~12px */
.reels-screen__card-text p.reels-screen__card-gap {
  height: 0;
  margin: 0 0 10px 0;
  padding: 0;
  overflow: hidden;
}

.reels-screen__card-text p.reels-screen__card-gap:last-of-type {
  margin-bottom: 0;
}

/* Хвостик облачка: общие стили */
.reels-screen__card-tail {
  position: absolute;
  width: 10px;
  height: 22px;
  display: block;
  transform-origin: center center;
  object-fit: contain;
}

/* Reels — хвостик: Position 202/312, rotate 159.81deg (не для ask) */
.reels-screen:not(.series-screen):not(.image-screen):not(.ask-screen) .reels-screen__card-tail {
  left: 202px;
  top: 312px;
}

/* Series — хвостик: другой угол/позиция */
.series-screen .reels-screen__card-tail {
  left: 200px;
  top: 312px;
}

/* Image — хвостик: отдельный стиль */
.image-screen .reels-screen__card-tail {
  left: 198px;
  top: 285px;
}

/* Ask (умный помощник) — хвостик: отдельный стиль */
.ask-screen .reels-screen__card-tail {
  left: 200px;
  top: 248px;
}

/* Умный помощник: копирование всех ответов ИИ подряд (одна кнопка сверху) */
.ask-screen .reels-screen__assistant-copy-bar {
  flex-shrink: 0;
  padding: 0 30px 8px;
  box-sizing: border-box;
}

.ask-screen .reels-screen__assistant-copy-bar[hidden] {
  display: none !important;
}

.ask-screen .reels-screen__assistant-copy-all-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #023e61;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(2, 62, 97, 0.2);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ask-screen .reels-screen__assistant-copy-all-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Reels: копировать конкретный ответ бота под сообщением */
.reels-screen:not(.series-screen):not(.image-screen):not(.ask-screen) .reels-screen__reply {
  flex-wrap: wrap;
}

.reels-screen__reply-copy-row {
  flex: 0 0 100%;
  padding: 2px 0 4px 16px;
  box-sizing: border-box;
}

.reels-screen__assistant-copy-reply-btn {
  display: inline-block;
  margin: 0;
  padding: 6px 10px;
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: #023e61;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(2, 62, 97, 0.18);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reels-screen__mascot {
  position: absolute;
  left: 181px;
  top: 218px;
  width: 204px;
  height: 306px;
}

.reels-screen__mascot img {
  display: block;
  width: 90%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.reels-screen__welcome.is-hidden {
  display: none;
}

/* Чат после отправки: скрываем приветствие, показываем карточку пользователя и блок «Генерируем» */
.reels-screen__chat {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 165px;
  bottom: 0;
}

.reels-screen__chat[aria-hidden="false"] {
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.reels-screen__chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 30px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}

.reels-screen__chat-body .reels-screen__user-msg {
  align-self: flex-end;
}

.reels-screen__chat-body .reels-screen__reply {
  align-self: flex-start;
}

/* Карточка сообщения пользователя — справа (Figma 252-452) */
.reels-screen__user-msg {
  width: 189px;
  min-height: 44px;
  max-width: calc(100% - 60px);
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  flex-shrink: 0;
}

.reels-screen__user-msg-text {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #023e61;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Блок «Генерируем сценарий..» — в конце чата */
.reels-screen__generating {
  flex-shrink: 0;
  height: 40px;
  padding: 0 30px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.reels-screen__generating-ellipse {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: url("../assets/Reels/Ellipse.svg") center/contain no-repeat;
  filter: drop-shadow(0 2px 1px rgba(2, 62, 97, 0.8));
}

.reels-screen__generating-text {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 0.94;
  color: #023e61;
  white-space: nowrap;
}

.reels-screen__generating[aria-hidden="true"] {
  display: none;
}

/* Ответ приложения (слева, с точкой) — заглушка */
.reels-screen__reply {
  max-width: calc(100% - 60px);
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0 4px 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Серия: ответ + маскот справа (Figma 146:709) */
.series-screen__reply {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.series-screen__reply-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 1px;
  overflow: visible;
}

/*
 * Нельзя ставить overflow-x: visible вместе с overflow-y: auto — по спецификации горизонталь
 * превращается в auto и появляется нижний горизонтальный скролл (маскот + translate/margin шире колонки).
 */
.series-screen .reels-screen__chat-body {
  overflow-x: hidden;
  overflow-y: auto;
}

/* Группа «подсказка + Выбрать шаблон + маскот» — Figma 146:709 (сетка как 146:971 + 146:738 + 146:960) */
.series-screen__carousel-cta[hidden] {
  display: none !important;
}

/* Один ряд внутри: см. .carousel-cta-inner */
.series-screen__carousel-cta {
  align-self: flex-start;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

/* Колонка: только пузырь (.carousel-cta-main) и сразу под ним кнопка */
.series-screen__carousel-cta-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

/*
 * Figma 146:709 / 146:971: маскот top ~261, пузырь top 361 → смещение ~100px от верха маскота.
 * Раньше flex-end «прижимал» низ колонки к низу маскота — пузырь оказывался не там; нужен flex-start + margin-top у колонки.
 */
.series-screen__carousel-cta-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  transform: translateX(6px);
}

/* Только пузырь Kliko (кнопка — следующий sibling в .carousel-cta-stack) */
.series-screen__carousel-cta-main {
  display: block;
  position: relative;
  z-index: 2;
  max-width: 202px;
  min-width: 0;
  align-self: flex-end;
  /* 361 − 261 (Figma): пузырь ниже верха маскота в строке с маскотом */
  margin-top: 100px;
  /* Кнопка с margin-top: -90px заходит под пузырь; без этого первый клик попадает в подсказку и «теряется». */
  pointer-events: none;
}

/*
 * Маскот: Figma — пузырь правый край 298, маскот left 233 → перекрытие 65px.
 * В ассете слева часто есть прозрачный отступ у «шерсти» — чуть сильнее overlap, чем 65px по математике.
 */
/* Маскот 228×309: вплотную к правому краю 375-макета — отмена padding чата 30px (Figma 146:709/960) */
.series-screen__carousel-mascot {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
  width: min(228px, 66vw);
  max-width: 228px;
  margin-left: -104px;
  /* отмена padding-right 30px у .reels-screen__chat-body — правый край как у макета 375px */
  margin-top: -50px;
  margin-bottom: 0;
  z-index: 1;
  pointer-events: none;
  line-height: 0;
}

.series-screen__carousel-mascot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 228 / 309;
  object-fit: contain;
  /* Как в Figma: персонаж прижат к правому краю кадра (object-cover + right) */
  object-position: right center;
}

.reels-screen__reply[aria-hidden="true"] {
  display: none;
}

/* Кружок слева у ответа — тот же класс, что и в блоке «Генерируем» */
.reels-screen__reply .reels-screen__generating-ellipse {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.reels-screen__reply-text {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  box-sizing: border-box;
}

.reels-screen__reply-text p {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  color: #023e61;
  white-space: pre-wrap;
  word-break: break-word;
}

.reels-screen__reply--hooks-list .reels-screen__reply-text p {
  line-height: 1;
}

/* Серия контента: колонка «точка + текст + CTA» (Figma 146:709) */
.reels-screen__reply-column {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.series-screen .reels-screen__reply-column {
  /* текст ответа → минимальный зазор → блок маскот+пузырь → зазор → кнопка */
  gap: 8px;
  overflow: visible;
}

/* Текст ответа — ширина колонки как в Figma 146:714 (203px), маскот справа не наезжает на строки */
.series-screen .reels-screen__reply-text {
  max-width: 203px;
}

/* Figma 245:1508 — сообщение «пост создан», превью карточек, CTA */
.series-screen__reply--post-ready .reels-screen__reply-column {
  max-width: 100%;
}

/* Первая строка «Готово…» по верху на одной высоте с точкой (без сдвига margin-top у точки) */
.series-screen__reply--post-ready .reels-screen__generating-ellipse {
  margin-top: 0;
  align-self: flex-start;
}

.series-screen__reply--post-ready .series-screen__post-ready-text {
  padding-top: 0;
}

.series-screen__post-ready {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.series-screen__post-ready-text {
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #023e61;
  word-break: break-word;
}

.series-screen__post-ready-lead {
  font-weight: 500;
  margin: 0 0 0.85em;
  line-height: 1.15;
}

/* Переносы строк как в макете (пустые строки = \n\n в тексте) */
.series-screen__post-ready-body {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.15;
  color: #023e61;
  white-space: pre-line;
}

.series-screen__post-ready-cards {
  position: relative;
  height: 150px;
  margin: 12px 0 0;
  max-width: 280px;
  box-sizing: border-box;
}

.series-screen__post-ready-card {
  position: absolute;
  border-radius: 10px;
  overflow: hidden;
  /* Картинка слайда — источник правды; серый фон не подменяет шаблон по краям при cover-crop. */
  background: transparent;
  box-shadow: 0 2px 8px rgba(2, 62, 97, 0.12);
}

.series-screen__post-ready-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

/* Сторис 9:16 в узкой карточке: contain давал «белые уши» у части шаблонов */
.series-screen__reply--stories-ready .series-screen__post-ready-card img {
  object-fit: cover;
  object-position: center;
  background: transparent;
}

.series-screen__post-ready-card--back {
  left: 92px;
  top: 10px;
  width: 95px;
  height: 126px;
  transform: rotate(15deg);
  transform-origin: center center;
  z-index: 1;
}

.series-screen__post-ready-card--front {
  left: 0;
  top: 0;
  width: 94px;
  height: 126px;
  z-index: 2;
}

/* Сторис в чате: миниатюры 9:16 (ширина ~71 при высоте 126), без кнопок «ещё раз» */
.series-screen__reply--stories-ready .series-screen__post-ready-lead {
  margin-bottom: 0;
}

.series-screen__reply--stories-ready .series-screen__post-ready-cards--stories {
  height: 148px;
  margin-top: 10px;
}

.series-screen__reply--stories-ready .series-screen__post-ready-cards--stories .series-screen__post-ready-card--front {
  width: 71px;
  height: 126px;
}

.series-screen__reply--stories-ready .series-screen__post-ready-cards--stories .series-screen__post-ready-card--back {
  left: 68px;
  top: 12px;
  width: 72px;
  height: 126px;
}

/* Figma 254:54 — справа от превью слайда 2 (карточка --back: left 92px, width 95px) */
.series-screen__post-ready-edit {
  position: absolute;
  right: 50px;
  top: -12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.series-screen__post-ready-edit-img {
  display: block;
  width: 14px;
  height: 14px;
  object-fit: contain;
  pointer-events: none;
}

.series-screen__post-ready-edit:active {
  opacity: 0.75;
}

.series-screen__post-ready-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
  padding: 0 0 4px;
  box-sizing: border-box;
}

.series-screen__post-ready-cta {
  width: 300px;
  max-width: 100%;
  height: 26px;
  padding: 0 12px;
  box-sizing: border-box;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #252a2d 0%, #023e61 100%);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 0.94;
  font-variation-settings: "wdth" 100;
  color: #fff;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.series-screen__post-ready-cta:active {
  opacity: 0.92;
}

.series-screen__template-hint {
  right:-30px;
  top:-100px;
  position: relative;
  z-index: 2;
  width: 167px;
  max-width: 100%;
  min-height: 69px;
  /* Figma 146:962: высота карточки 69px — нижний padding меньше, чтобы не раздувать блок над кнопкой */
  padding: 8px 10px 10px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  overflow: visible;
}

/*
 * Хвост Figma 146:971: контейнер tail top 417, bubble bottom 430 — часть хвоста ниже белой карточки (~11px).
 * У правого края пузыря, смотрит к маскоту (rotate как в макете).
 */
 .series-screen__template-hint-tail {
  position: absolute;
  right: 4px;
  top: 60px;
  bottom: -11px;
  width: 10px;
  height: 22px;
  display: block;
  transform-origin: 50% 0%;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.06));
}

.series-screen__template-hint-brand {
  display: block;
  margin-bottom: 4px;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  color: #023e61;
}

.series-screen__template-hint-text {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
  color: #023e61;
}

/* Кнопка «Выбрать шаблон» — под строкой пузырь+маскот; зазор .series-screen__carousel-cta gap */
.series-screen__template-btn {
  width: 202px;
  max-width: 100%;
  height: 26px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #252a2d 0%, #023e61 100%);
  font-family: Roboto, Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 0.94;
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  -webkit-tap-highlight-color: transparent;
}

.series-screen__template-btn:active {
  opacity: 0.92;
}

/* Кнопка под пузырём в стеке; сдвиг как в Figma 146:738 (кнопка шире влево относительно пузыря) */
.series-screen__carousel-cta .series-screen__template-btn {
  position: relative;
  z-index: 3;
  margin-top: -90px;
  max-width: min(202px, calc(100vw - 96px));
  pointer-events: auto;
}

.reels-screen__image-result {
  margin-top: 6px;
  width: 100%;
  box-sizing: border-box;
}

.reels-screen__image-result[hidden] {
  display: none;
}

.reels-screen__image-result-frame {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
}

.reels-screen__image-result-img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  object-fit: cover;
  max-height: 200px;
}

.reels-screen__image-result-img--broken {
  min-height: 120px;
  background: #e8eef2;
  object-fit: none;
}

.reels-screen__image-result-clip {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  color: #023e61;
  box-shadow: 0 1px 4px rgba(2, 62, 97, 0.18);
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.reels-screen__image-result-clip:focus-visible {
  outline: 2px solid #023e61;
  outline-offset: 1px;
}

.reels-screen__image-result-clip.is-active {
  background: #023e61;
  color: #fff;
  box-shadow: 0 2px 6px rgba(2, 62, 97, 0.35);
}

.reels-screen__image-result-clip svg {
  display: block;
}

.reels-screen__image-result-download {
  margin-top: 6px;
  display: inline-block;
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #023e61;
  text-decoration: underline;
}

.reels-screen__input-wrap {
  position: absolute;
  left: 31px;
  top: 524px;
  width: 312px;
  min-height: 52.4px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 4px 13.7px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  box-sizing: border-box;
}

.reels-screen__input-wrap.has-response {
  min-height: 122px;
}

/* Reels: панель ввода должна быть одного размера на всех шагах */
.reels-screen:not(.series-screen) .reels-screen__input-wrap.has-response {
  min-height: 52.4px;
}

/* «Создать серию контента»: панель с сеткой тонов (Figma 146:651) */
.series-screen .reels-screen__input-wrap.has-response {
  min-height: 204px;
}

.reels-screen__input-wrap.has-response.has-hooks {
  min-height: 52.4px;
}

.series-screen__tones {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  padding: 0 16px 16px;
  box-sizing: border-box;
}

.series-screen .reels-screen__input-wrap.has-response .series-screen__tones {
  display: grid;
}

.series-screen .reels-screen__input-wrap.has-response.is-collapsed .series-screen__tones {
  display: none !important;
}

.reels-screen__input-handle {
  display: none;
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  flex-shrink: 0;
  width: 47px;
  height: 2px;
  margin: 0;
  background: #023e61;
  border-radius: 87px;
  opacity: 0.55;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reels-screen__input-wrap.has-response .reels-screen__input-handle {
  display: block;
  pointer-events: auto;
}

/* Reels: хендл не используется, панель фиксированная */
.reels-screen:not(.series-screen) .reels-screen__input-wrap .reels-screen__input-handle {
  display: none !important;
  pointer-events: none !important;
}

.reels-screen__input-wrap.has-hooks .reels-screen__input-handle {
  display: none !important;
}

.reels-screen__input-wrap.has-response.has-hooks .reels-screen__input-handle {
  display: none !important;
}

/* Свёрнутое состояние панели по клику на хендл */
.reels-screen__input-wrap.has-response.is-collapsed {
  min-height: 52.4px;
}

.reels-screen__input-wrap.has-response.is-collapsed .reels-screen__suggestions,
.reels-screen__input-wrap.has-response.is-collapsed .reels-screen__time-buttons,
.series-screen .reels-screen__input-wrap.has-response.is-collapsed .series-screen__tones {
  display: none !important;
}

.reels-screen__input-wrap.has-response.is-collapsed .reels-screen__input-row {
  display: flex !important;
}

.reels-screen__input-wrap.has-response.is-collapsed .reels-screen__input-icons {
  display: flex !important;
}

.reels-screen__input-wrap.has-response.is-collapsed .reels-screen__input {
  display: block !important;
}

.reels-screen__input-wrap.has-response.is-collapsed .reels-screen__input-handle {
  top: 10px;
}

.reels-screen__input-row {
  display: flex;
  align-items: center;
  height: 52.4px;
  padding: 12px 12px 12px 16px;
  gap: 8px;
  box-sizing: border-box;
}

.reels-screen__suggestions {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  padding: 0 16px 16px;
  box-sizing: border-box;
}

.reels-screen__input-wrap.has-hooks .reels-screen__suggestions {
  display: none !important;
}

.reels-screen__input-wrap.has-hooks .reels-screen__input-row {
  display: flex !important;
}

.reels-screen__input-wrap.has-hooks .reels-screen__time-buttons {
  display: none;
}

.reels-screen__time-buttons {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  padding: 0 16px 10px;
  box-sizing: border-box;
}

.reels-screen__input-wrap.has-response .reels-screen__time-buttons {
  display: grid;
}

/* В режиме выбора хука блок времени должен быть скрыт */
.reels-screen__input-wrap.has-response.has-hooks .reels-screen__time-buttons,
.reels-screen__input-wrap.has-hooks .reels-screen__time-buttons {
  display: none;
}

.reels-screen__suggestion-btn.is-selected {
  box-shadow: 0 0 0 1px rgba(121, 172, 190, 0.85), 0 1px 3px rgba(0, 0, 0, 0.15);
  filter: saturate(1.05) brightness(1.02);
}

/* Кнопки стилей (Figma 245-170): градиент, скругление, белый текст */
.reels-screen__suggestion-btn {
  height: 26px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #252a2d 0%, #023e61 100%);
  font-family: Roboto, Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 0.94;
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.reels-screen__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #023e61;
  outline: none;
}

.reels-screen__input::placeholder {
  color: #023e61;
  opacity: 0.7;
}

.reels-screen__input-icons {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reels-screen__input-mic,
.reels-screen__input-send,
.reels-screen__input-attach {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.reels-screen__input-send {
  border: none;
  padding: 0;
  cursor: pointer;
  background-color: transparent;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.reels-screen__input-send:focus {
  outline: none;
  box-shadow: none;
}

.reels-screen__input-mic {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23023e61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 1 3 3v6a3 3 0 0 1-6 0V5a3 3 0 0 1 3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='22'/%3E%3C/svg%3E");
}

.reels-screen__input-wrap button.reels-screen__input-mic,
.reels-screen__input-wrap button.reels-screen__input-attach {
  border: none;
  padding: 0;
  cursor: pointer;
  background-color: transparent;
  outline: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.reels-screen__input-attach {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23023e61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
  -webkit-tap-highlight-color: transparent;
}

.reels-screen__input-attach.is-active {
  background-color: rgba(2, 62, 97, 0.14);
  border-radius: 5px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23023e61' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
}

.reels-screen__input-attach:focus-visible {
  outline: 2px solid #023e61;
  outline-offset: 1px;
}

.reels-screen__input-attach:disabled {
  opacity: 0.45;
  cursor: wait;
}

/* Превью прикреплённого референса (экран «Генерация изображений») — как в чате с превью вложения */
.image-screen .reels-screen__input-wrap.has-image-ref-preview {
  min-height: auto;
  padding-bottom: 4px;
}

.image-screen__attach-preview {
  padding: 8px 12px 4px;
  box-sizing: border-box;
}

.image-screen__attach-preview[hidden] {
  display: none !important;
}

.image-screen__attach-preview-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(2, 62, 97, 0.06);
  border: 1px solid rgba(2, 62, 97, 0.12);
}

.image-screen__attach-preview.is-loading .image-screen__attach-preview-thumb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 62, 97, 0.08);
}

.image-screen__attach-preview.is-loading .image-screen__attach-preview-img {
  display: none;
}

.image-screen__attach-preview-thumb-wrap {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #e8eef2;
}

.image-screen__attach-preview-img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
}

.image-screen__attach-preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.image-screen__attach-preview-title {
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #023e61;
  letter-spacing: 0.01em;
}

.image-screen__attach-preview-name {
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #252a2d;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-screen__attach-preview-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(37, 42, 45, 0.06);
  color: #252a2d;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.image-screen__attach-preview-remove:active {
  background: rgba(37, 42, 45, 0.12);
}

.reels-screen__input-file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  left: 0;
  top: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* Анимация записи: пульсация, чтобы было видно, что идёт запись */
.reels-screen__input-mic.is-recording {
  animation: mic-recording-pulse 1s ease-in-out infinite;
}

.reels-screen__input-mic.is-recording::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(2, 62, 97, 0.15);
  animation: mic-recording-ring 1s ease-out infinite;
  pointer-events: none;
}

@keyframes mic-recording-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

@keyframes mic-recording-ring {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.reels-screen__input-send {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23023e61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2L15 22L11 13L2 9L22 2z'/%3E%3C/svg%3E");
}

/* ========== Template select (Выбор шаблона) Figma 146:802 ========== */
.template-select-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
}

.template-select-screen__inner.reels-screen__inner {
  background: #f4f7f6;
}

.template-select-screen .reels-screen__back,
.template-select-screen .reels-screen__header,
.template-select-screen .reels-screen__profile {
  z-index: 15;
}

/* Белый лист с ручкой, поиском и сеткой */
.template-select-screen__sheet {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: 358px;
  height: 544px;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 5;
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.04);
}

.template-select-screen__handle {
  width: 47px;
  height: 2px;
  margin: 25px auto 0;
  background: #023e61;
  opacity: 0.55;
  border-radius: 87px;
  flex-shrink: 0;
}

.template-select-screen__search {
  position: relative;
  flex-shrink: 0;
  width: 281px;
  margin: 18px auto 0;
  height: 33px;
  border: 1px solid #023e61;
  border-radius: 7px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 10px 0 34px;
}

.template-select-screen__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.85;
  pointer-events: none;
}

.template-select-screen__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
  outline: none;
}

.template-select-screen__search-input::placeholder {
  color: #023e61;
  opacity: 0.75;
}

.template-select-screen__grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: 130px 130px;
  gap: 16px 15px;
  justify-content: center;
  align-content: start;
  padding: 18px 8px 20px;
  box-sizing: border-box;
}

.template-select-card {
  position: relative;
  width: 130px;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #e5e9ec;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.template-select-card__media {
  display: block;
  width: 100%;
  height: 169px;
  background: #e5e9ec;
  position: relative;
  overflow: hidden;
}

.template-select-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* если превью не загрузилось */
.template-select-card__media--fallback {
  background: linear-gradient(145deg, #eef2f5 0%, #c8d4dd 100%);
  min-height: 169px;
}

.template-select-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  border-radius: 0 0 10px 10px;
}

.template-select-card__label {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 10px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 0.94;
  color: #fff;
  z-index: 1;
  pointer-events: none;
}

.template-select-card:active {
  opacity: 0.92;
}

/* ========== Template preview (Пост-карусель + Серия сторис) Figma 146:854 ========== */
.template-preview-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: hidden;
}

.template-preview-screen__inner.reels-screen__inner {
  background: #f4f7f6;
}

.template-preview-screen .reels-screen__back,
.template-preview-screen .reels-screen__header,
.template-preview-screen .reels-screen__profile {
  z-index: 15;
}

.template-preview-screen__sheet {
  position: absolute;
  left: 50%;
  top: 96px;
  bottom: 0;
  transform: translateX(-50%);
  width: 358px;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 5;
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.04);
  /* Высота = от 96px до низа reels-frame (640px): иначе лист растёт по контенту и низ обрезается overflow экрана — пропадает «Готово». */
  min-height: 0;
}

.template-preview-screen__handle {
  width: 47px;
  height: 2px;
  margin: 25px auto 0;
  background: #023e61;
  opacity: 0.55;
  border-radius: 87px;
  flex-shrink: 0;
}

.template-preview-screen__loading {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 12px 12px 0 0;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #023e61;
  pointer-events: none;
}

.template-preview-screen__loading[hidden] {
  display: none !important;
}

.template-preview-screen__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 0 20px;
  box-sizing: border-box;
}

/* Figma 146:907 / 146:947 — под рельсами; safe-area снизу на футере, кнопка всегда в зоне листа */
.template-preview-screen__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0;
  padding: 22px 16px calc(16px + env(safe-area-inset-bottom, 0));
  box-sizing: border-box;
}

/* Figma 146:948 / 146:949: 202×23, gradient, Roboto Medium 10px */
.template-preview-screen__done {
  width: 202px;
  max-width: calc(100% - 8px);
  height: 23px;
  padding: 0 12px;
  box-sizing: border-box;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #252a2d 0%, #023e61 100%);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  line-height: 0.94;
  font-variation-settings: "wdth" 100;
  letter-spacing: 0;
  color: #fff;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.template-preview-screen__done:active {
  opacity: 0.92;
}

.template-preview-screen__block {
  margin-bottom: 20px;
  min-width: 0;
  width: 100%;
}

.template-preview-screen__block--stories {
  margin-bottom: 0;
  /* Фон листа (#fff у sheet): без серой «подложки» вокруг нижнего рельса */
  background-color: transparent;
  border-radius: 10px;
  margin-left: 12px;
  margin-right: 12px;
  padding-top: 8px;
  padding-bottom: 12px;
  box-sizing: border-box;
}

.template-preview-screen__section-title {
  margin: 0 0 10px 20px;
  padding: 0;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #023e61;
}

.template-preview-screen__block--stories .template-preview-screen__section-title {
  margin-left: 16px;
  margin-right: 16px;
}

/* Figma 146:854 / 146:907 — горизонтальный скролл рельсов; «второй» слайд частично виден справа */
.template-preview-screen__rail {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  touch-action: pan-x pinch-zoom;
  overscroll-behavior-x: contain;
  padding: 0 16px 10px 20px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(2, 62, 97, 0.4) rgba(2, 62, 97, 0.06);
}

.template-preview-screen__rail::-webkit-scrollbar {
  height: 5px;
}

.template-preview-screen__rail::-webkit-scrollbar-track {
  background: rgba(2, 62, 97, 0.06);
  border-radius: 4px;
}

.template-preview-screen__rail::-webkit-scrollbar-thumb {
  background: rgba(2, 62, 97, 0.38);
  border-radius: 4px;
}

.template-preview-slide {
  flex: 0 0 181px;
  width: 181px;
  height: 235px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  scroll-snap-align: start;
  background: #e5e9ec;
  box-shadow: 0 2px 8px rgba(2, 62, 97, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.template-preview-slide:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(2, 62, 97, 0.12);
}

.template-preview-slide__media {
  position: absolute;
  inset: 0;
  background: #e5e9ec;
}

.template-preview-slide__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.template-preview-slide__svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Пост + сторис на листе превью: одна геометрия (иначе у сторис расходились правила с постом и появлялись полосы). */
.template-preview-screen__rail[data-template-preview-rail] {
  align-items: flex-start;
  min-height: 0;
}

.template-preview-screen__rail[data-template-preview-rail] .template-preview-slide {
  flex: 0 0 181px;
  width: 181px;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  align-self: flex-start;
  box-sizing: border-box;
  background: transparent;
}

.template-preview-screen__rail[data-template-preview-rail] .template-preview-slide__media {
  overflow: hidden;
  background: transparent;
}

.template-preview-screen__rail[data-template-preview-rail] .template-preview-slide__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  transform: none;
  transform-origin: center center;
  display: block;
  object-fit: fill;
  object-position: center;
}

.template-preview-screen__rail[data-template-preview-rail] .template-preview-slide__img {
  object-fit: contain;
  object-position: center center;
}

/* Сторис: только отличия от поста — скроллбар, скругление рельса, фон прозрачный (gap не сереет). */
.template-preview-screen__rail[data-template-preview-story] {
  scrollbar-width: none;
  -ms-overflow-style: none;
  background-color: transparent;
  border-radius: 8px;
}

.template-preview-screen__rail[data-template-preview-story]::-webkit-scrollbar {
  height: 0;
}

.template-preview-slide__media--fallback {
  background: linear-gradient(145deg, #eef2f5 0%, #c8d4dd 100%);
}

.template-preview-slide__overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  min-height: 42%;
  padding: 10px 10px 12px;
  box-sizing: border-box;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%);
  display: flex;
  align-items: flex-end;
}

.template-preview-slide__text {
  margin: 0;
  max-height: 108px;
  overflow: hidden;
  font-family: Inter, sans-serif;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
}

/* Path-шаблоны: текст «вшит» в кривые — показываем HTML поверх SVG с более широким затемнением */
.template-preview-slide__overlay--path-svg {
  top: 28%;
  min-height: 72%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.45) 50%,
    rgba(60, 82, 140, 0.35) 85%,
    rgba(60, 82, 140, 0.12) 100%
  );
}

/* Сторис: без широкого градиента на весь низ карточки — он визуально «перекрывал» фон SVG (в т.ч. полупрозрачный верх градиента). */
.template-preview-screen__rail--story .template-preview-slide__overlay--path-svg {
  top: auto;
  bottom: 0;
  min-height: 0;
  background: none;
}

.template-preview-screen__rail--story .template-preview-slide__overlay:not(.template-preview-slide__overlay--path-svg) {
  min-height: 0;
  background: none;
}

.template-preview-screen__rail--story .template-preview-slide__overlay {
  z-index: 1;
  min-height: 0;
  padding: 8px 8px 10px;
  background: none;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.template-preview-screen__rail--story .template-preview-slide__overlay .template-preview-slide__text {
  pointer-events: auto;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.45);
  background: rgba(2, 62, 97, 0.42);
  padding: 5px 7px;
  border-radius: 6px;
  box-sizing: border-box;
}

.template-preview-screen__empty {
  margin: 8px 20px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  color: #023e61;
  opacity: 0.85;
}

/* Trends: literally reuse home nav geometry */

/* ========== Series stories editor (Figma 120:70 — «Экран генерации контента») ========== */
.series-stories-editor-screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f7f6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
  overflow: auto;
}

/* Figma 245:54 — стрелка «Назад» */
.series-stories-editor-screen__back {
  position: absolute;
  left: 33px;
  top: 56px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__back-img {
  display: block;
  width: 13px;
  height: 13px;
  object-fit: contain;
}

.series-stories-editor-screen__back:active {
  opacity: 0.75;
}

/* edit-story.svg: viewBox 192×53, пилюля rect y≈14.9 — выравниваем верх пилюли к ~49px как в Figma */
.series-stories-editor-screen__header-title {
  position: absolute;
  left: 50%;
  top: 48px;
  z-index: 2;
  width: 192px;
  max-width: min(192px, calc(100% - 140px));
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  height: auto;
  display: block;
  transform: translateX(-50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__header-title-img {
  display: block;
  width: 100%;
  height: auto;
}

/*
 * Иконки main.svg / options.svg: viewBox не квадратный, внутри — круг + тени/фильтры.
 * Не задаём border-radius + overflow:hidden на кнопке — иначе обрезается нижняя часть и «ломается» круг.
 * Размер только квадратный (одинаковые width и height / aspect-ratio: 1), иначе круги выглядят овалами.
 */
.series-stories-editor-screen {
  --series-stories-editor-icon-size: 27px;
}

.series-stories-editor-screen__icon-btn {
  position: absolute;
  top: 57px;
  box-sizing: border-box;
  width: var(--series-stories-editor-icon-size);
  height: var(--series-stories-editor-icon-size);
  min-width: var(--series-stories-editor-icon-size);
  min-height: var(--series-stories-editor-icon-size);
  aspect-ratio: 1;
  border: none;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
}

.series-stories-editor-screen__icon-btn-img {
  display: block;
  object-fit: contain;
  object-position: center center;
  flex-shrink: 0;
  /* Без растягивания: при width/height у img по умолчанию object-fit: fill — явно contain */
  pointer-events: none;
}

.series-stories-editor-screen__icon-btn:active {
  opacity: 0.88;
  transform: scale(0.96);
}

/* Центр иконки «Главная» — calc(50% + 106px) по Figma */
.series-stories-editor-screen__icon-btn--home {
  left: calc(50% + 106px);
  transform: translateX(-50%);
}

.series-stories-editor-screen__icon-btn--home:active {
  transform: translateX(-50%) scale(0.96);
}

.series-stories-editor-screen__icon-btn--options {
  right: 31px;
}

/* Рельс на всю высоту; карточки как у пост-карусели 3:4 (редактор общий для текста поста) */
.series-stories-editor-screen__rail-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 164px;
  bottom: 150px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 8px;
  box-sizing: border-box;
}

.series-stories-editor-screen__rail {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  align-self: stretch;
  flex: 1 1 0;
  width: 100%;
  gap: 12px;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 4px;
  box-sizing: border-box;
  scrollbar-width: none;
}

.series-stories-editor-screen__rail::-webkit-scrollbar {
  display: none;
}

/* Story-SVG 9:16 — карточка flex, хост на всю высоту (иначе 100% у вложенного svg иногда схлопывается) */
.series-stories-editor-screen__slide {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: auto;
  aspect-ratio: 9 / 16;
  max-height: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(2, 62, 97, 0.18);
  background: #e8eef0;
}

.series-stories-editor-screen--carousel-post .series-stories-editor-screen__slide {
  aspect-ratio: 9 / 12;
}

.series-stories-editor-screen__slide img,
.series-stories-editor-screen__slide-svg-host {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.series-stories-editor-screen__slide img {
  object-fit: contain;
  object-position: center;
  vertical-align: top;
}

.series-stories-editor-screen__slide-svg-host {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.series-stories-editor-screen__slide-svg-host svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

/* Активный слайд в рельсе: без авто-зума, масштаб меняется только pinch-жестом в редакторе */
.series-stories-editor-screen__slide--active .series-stories-editor-screen__slide-svg-host svg {
  transform: scale(1);
  transform-origin: center center;
}

/* Story: meet + aspect карточки по viewBox (app.js) — масштаб 1.012 давал обрезку по overflow. */

.series-stories-editor-screen__slide--active {
  outline: 1px solid #023e61;
  outline-offset: 2px;
}

/* Поле ввода поверх SVG при тапе по тексту (режим «Текст») */
.series-stories-editor-screen__slide-inline-field {
  position: absolute;
  z-index: 12;
  margin: 0;
  padding: 2px 4px;
  box-sizing: border-box;
  border: 1px solid #023e61;
  border-radius: 4px;
  font-family: Inter, sans-serif;
  font-size: 13px;
  line-height: 1.3;
  color: #023e61;
  background: rgba(255, 255, 255, 0.96);
  resize: none;
  overflow: auto;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.series-stories-editor-screen__slide-inline-field:focus {
  outline: none;
  border-color: #023e61;
  box-shadow: 0 0 0 2px rgba(2, 62, 97, 0.25);
}

/* Режим «Текст»: пунктир вокруг редактируемых областей (#kliko-*) на слайдах */
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg #kliko-text-headline,
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg #kliko-text-body,
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg [id^='kliko-text-block-'],
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg [id^='kliko-list-'] {
  cursor: grab;
  outline: 2px dashed rgba(2, 62, 97, 0.92);
  outline-offset: 3px;
  overflow: visible;
  touch-action: none;
}

.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg #kliko-text-headline:active,
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg #kliko-text-body:active,
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg [id^='kliko-text-block-']:active,
.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg [id^='kliko-list-']:active {
  cursor: grabbing;
}

.series-stories-editor-screen--text-regions-visible .series-stories-editor-screen__slide-svg-host svg text[data-kliko-drag-active='1'] {
  cursor: grabbing;
  filter: drop-shadow(0 2px 3px rgba(2, 62, 97, 0.35));
  opacity: 0.96;
  transition: filter 0.12s ease, opacity 0.12s ease;
}

/* Режим «Фон»: явная красная рамка выбранного слоя (image или зона pattern) */
.series-stories-editor-screen--bg-mode-active .series-stories-editor-screen__slide-svg-host svg [data-kliko-selected='true'] {
  outline: 3px solid #e01818;
  outline-offset: 2px;
}

/* Figma 139:301 — панель «Шаблоны»: поиск + сетка 2 колонки */
.series-stories-editor-screen__templates-panel {
  width: 100%;
  max-width: 322px;
  margin: 0 auto;
  padding: 0 0 4px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.series-stories-editor-screen__templates-panel[hidden] {
  display: none !important;
}

.series-stories-editor-screen__templates-search {
  position: relative;
  width: 100%;
  max-width: 281px;
  margin: 4px auto 0;
  height: 33px;
  border: 1px solid #023e61;
  border-radius: 7px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 10px 0 34px;
}

.series-stories-editor-screen__templates-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.85;
  pointer-events: none;
}

.series-stories-editor-screen__templates-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 0.94;
  color: #023e61;
  outline: none;
}

.series-stories-editor-screen__templates-search-input::placeholder {
  color: #023e61;
  opacity: 0.75;
}

.series-stories-editor-screen__templates-grid {
  display: grid;
  grid-template-columns: 130px 130px;
  gap: 16px 15px;
  justify-content: center;
  align-content: start;
  padding: 14px 4px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(52vh, 420px);
  box-sizing: border-box;
}

.series-stories-editor-screen__template-card {
  position: relative;
  width: 130px;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #e5e9ec;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__template-card--current {
  outline: 2px solid #023e61;
  outline-offset: 2px;
}

.series-stories-editor-screen__template-card__media {
  display: block;
  width: 100%;
  height: 169px;
  background: #e5e9ec;
  position: relative;
  overflow: hidden;
}

.series-stories-editor-screen__template-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.series-stories-editor-screen__template-card__media--fallback {
  background: linear-gradient(145deg, #eef2f5 0%, #c8d4dd 100%);
  min-height: 169px;
}

.series-stories-editor-screen__template-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  border-radius: 0 0 10px 10px;
}

.series-stories-editor-screen__template-card__label {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 10px;
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 0.94;
  color: #fff;
  z-index: 1;
  pointer-events: none;
}

.series-stories-editor-screen__template-card:active {
  opacity: 0.92;
}

/* Режим «Шаблоны»: без подпанели шрифт/размер/цвет; больше места под сетку (Figma 139:301) */
.series-stories-editor-screen__sheet--templates .series-stories-editor-screen__tools--sub {
  display: none !important;
}

.series-stories-editor-screen__sheet--expanded.series-stories-editor-screen__sheet--templates {
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
}

/* Подпанели «Шрифт» / «Цвет» (активны при выборе подкнопки + режим «Текст») */
.series-stories-editor-screen__subtool-panel {
  width: 100%;
  max-width: 322px;
  margin: 0 auto;
  padding: 4px 0 8px;
  box-sizing: border-box;
}

.series-stories-editor-screen__subtool-panel[hidden] {
  display: none !important;
}

.series-stories-editor-screen__subtool-panel-label {
  margin: 0 0 6px;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: #023e61;
  opacity: 0.85;
}

.series-stories-editor-screen__subtool-select {
  width: 100%;
  max-width: 281px;
  margin: 0 auto 10px;
  display: block;
  padding: 8px 10px;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #023e61;
  background: #fff;
  box-sizing: border-box;
}

.series-stories-editor-screen__font-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.series-stories-editor-screen__font-chip {
  padding: 6px 10px;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  background: #fff;
  font-family: Inter, sans-serif;
  font-size: 10px;
  color: #023e61;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__font-chip:active {
  opacity: 0.92;
}

.series-stories-editor-screen__size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 281px;
  margin: 0 auto;
}

.series-stories-editor-screen__size-range {
  flex: 1;
  min-width: 0;
  accent-color: #023e61;
}

.series-stories-editor-screen__size-value {
  min-width: 52px;
  text-align: right;
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: #023e61;
}

.series-stories-editor-screen__color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 4px 0;
}

.series-stories-editor-screen__color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(2, 62, 97, 0.25);
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__color-swatch:focus-visible {
  outline: 2px solid #023e61;
  outline-offset: 2px;
}

.series-stories-editor-screen__tool--sub-active {
  background: var(--sse-tool-active-bg);
  border-radius: var(--sse-tool-active-radius);
}

/* Нижняя панель: свёрнута (только инструменты) / Figma 2328:59 — развёрнута (ручка, превью, 2 ряда) */
.series-stories-editor-screen__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  pointer-events: auto;
  touch-action: manipulation;
  min-height: 108px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.07);
  box-sizing: border-box;
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0));
  transition: box-shadow 0.2s ease, padding 0.25s ease;
}

.series-stories-editor-screen__sheet--expanded {
  padding: 7px 16px 6px 21px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

.series-stories-editor-screen__sheet-handle {
  display: block;
  width: 100%;
  max-width: 120px;
  margin: 0 auto 10px;
  padding: 6px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__sheet-handle::before {
  content: '';
  display: block;
  width: 47px;
  height: 2px;
  margin: 0 auto;
  border-radius: 87px;
  background: #023e61;
  opacity: 0.55;
}

/* В свёрнутом виде только полоса инструментов; ручка появляется в развёрнутом (Figma 2328:59) */
.series-stories-editor-screen__sheet:not(.series-stories-editor-screen__sheet--expanded) .series-stories-editor-screen__sheet-handle {
  display: none;
}

.series-stories-editor-screen__sheet:not(.series-stories-editor-screen__sheet--expanded) {
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0));
}

.series-stories-editor-screen__sheet-panel {
  /* Единый стиль кнопок инструментов (оба ряда) — Figma 2328:59, компактнее */
  --sse-tool-icon-max-height: 38px;
  --sse-tool-padding-y: 1px;
  --sse-tool-padding-x: 3px;
  --sse-tool-border-radius: 6px;
  --sse-tool-bg: transparent;
  --sse-tool-active-bg: #f0f2f5;
  --sse-tool-active-radius: var(--sse-tool-border-radius);
  --sse-tool-press-opacity: 0.85;
  --sse-tool-tap-highlight: transparent;
  --sse-tools-primary-gap-row: 6px;
  --sse-tools-primary-gap-col: 5px;
  --sse-tools-sub-gap: 10px;
  /* ширина одной «ячейки» как у верхнего ряда: (322 − 3×5) / 4 ≈ 76.75 → 76px */
  --sse-tool-cell-width: 76px;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-width: 322px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

.series-stories-editor-screen__sheet:not(.series-stories-editor-screen__sheet--expanded) .series-stories-editor-screen__sheet-preview {
  display: none !important;
}

.series-stories-editor-screen__sheet:not(.series-stories-editor-screen__sheet--expanded) .series-stories-editor-screen__tools--sub {
  display: none !important;
}

.series-stories-editor-screen__sheet-preview {
  width: 100%;
  max-width: 322px;
  height: 136px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f2f5;
  flex-shrink: 0;
}

.series-stories-editor-screen__sheet-preview-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.series-stories-editor-screen__tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: var(--sse-tools-primary-gap-row) var(--sse-tools-primary-gap-col);
  max-width: 322px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.series-stories-editor-screen__tools--sub {
  display: grid;
  /* Как верхний ряд: 4 равные колонки; 4-я — заглушка под «Скачать» */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: var(--sse-tools-primary-gap-row) var(--sse-tools-primary-gap-col);
  max-width: 322px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.series-stories-editor-screen__tool-slot--stub {
  pointer-events: none;
  width: 100%;
  min-height: var(--sse-tool-icon-max-height);
  box-sizing: border-box;
}

/* Второй ряд: те же по ширине ячейки, что и колонки первого ряда — единый масштаб иконок */
.series-stories-editor-screen__tools--sub .series-stories-editor-screen__tool {
  position: relative;
  z-index: 9;
  pointer-events: auto;
  width: 100%;
  flex: none;
  min-width: 0;
  box-sizing: border-box;
  overflow: visible;
}

.series-stories-editor-screen__tools:not(.series-stories-editor-screen__tools--sub) .series-stories-editor-screen__tool {
  flex: none;
  width: 100%;
  min-width: 0;
}

.series-stories-editor-screen__tool {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: none;
  background: var(--sse-tool-bg);
  padding: var(--sse-tool-padding-y) var(--sse-tool-padding-x);
  border-radius: var(--sse-tool-border-radius);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: var(--sse-tool-tap-highlight);
}

.series-stories-editor-screen__tool:active {
  opacity: var(--sse-tool-press-opacity);
}

/* SVG: одинаковые правила для верхнего и нижнего рядов (лимит высоты из токенов панели) */
.series-stories-editor-screen__tool-block {
  display: block;
  height: auto;
  max-height: var(--sse-tool-icon-max-height);
  margin: 0 auto;
  object-fit: contain;
  object-position: center bottom;
  flex-shrink: 0;
  pointer-events: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Верхний ряд: иконка тянется по ширине ячейки сетки */
.series-stories-editor-screen__tools:not(.series-stories-editor-screen__tools--sub) .series-stories-editor-screen__tool-block {
  width: 100%;
  max-width: 100%;
}

/* Нижний ряд: только иконка в img; подпись — отдельный span */
.series-stories-editor-screen__tools--sub .series-stories-editor-screen__tool-block {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 30px;
  object-fit: contain;
  object-position: center center;
  overflow: visible;
}

.series-stories-editor-screen__tools--sub .series-stories-editor-screen__tool {
  align-items: center;
  gap: 3px;
}

/* Подписи нижнего ряда вне SVG — иначе WebKit обрезает svg text по viewBox в узкой ячейке */
.series-stories-editor-screen__tools--sub .series-stories-editor-screen__tool-label {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
  box-sizing: border-box;
  font-family: Montserrat, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #023e61;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  pointer-events: none;
  flex-shrink: 0;
}

.series-stories-editor-screen__tool--active {
  background: var(--sse-tool-active-bg);
  border-radius: var(--sse-tool-active-radius);
}

/* Figma 2327:58 — подменю «Опции» (отдельный блок; стили кнопок .series-stories-editor-screen__icon-btn не трогаем) */
.series-stories-editor-screen__options-menu {
  position: absolute;
  z-index: 30;
  top: calc(57px + var(--series-stories-editor-icon-size) + 10px);
  right: 31px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  box-sizing: border-box;
  padding: 18px 31px 17px 10px;
  border-radius: 6px;
  background: #031f30;
  box-shadow: 0 2px 8px rgba(68, 93, 102, 0.26);
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  line-height: 0.94;
  color: #fff;
  white-space: nowrap;
}

.series-stories-editor-screen__options-menu[hidden] {
  display: none !important;
}

.series-stories-editor-screen__options-menu-item {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.series-stories-editor-screen__options-menu-item:hover,
.series-stories-editor-screen__options-menu-item:focus-visible {
  opacity: 0.88;
  outline: none;
}

.series-stories-editor-screen__options-menu-item:focus-visible {
  text-decoration: underline;
}

/* ========== Background Gallery Panel ========== */
.series-stories-editor-screen__bg-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  box-sizing: border-box;
}

.series-stories-editor-screen__bg-panel[hidden] {
  display: none !important;
}

.series-stories-editor-screen__bg-image-scale-row {
  width: 100%;
  max-width: 281px;
  margin: 0 auto;
  padding: 0 2px;
  box-sizing: border-box;
}

.series-stories-editor-screen__bg-image-scale-row[hidden] {
  display: none !important;
}

/* Режим «Фон»: жирная пунктирная обводка вокруг заменяемых слоёв (image / rect с pattern) */
.series-stories-editor-screen--bg-mode-active .series-stories-editor-screen__slide-svg-host svg [data-kliko-bg-target] {
  cursor: pointer;
  overflow: visible;
  transition: filter 0.22s ease, outline-color 0.18s ease, outline-width 0.18s ease, outline-offset 0.18s ease;
  outline: 4px dashed #023e61;
  outline-offset: 3px;
}

/* Активный слайд: после выбора — остальные цели приглушены, обводка слабее */
.series-stories-editor-screen--bg-mode-active
  .series-stories-editor-screen__slide--active
  .series-stories-editor-screen__slide-svg-host
  svg:has([data-kliko-bg-target][data-kliko-selected='true'])
  [data-kliko-bg-target]:not([data-kliko-selected='true']) {
  filter: brightness(0.82) contrast(1.06);
  outline-width: 3px;
  outline-color: rgba(2, 62, 97, 0.45);
  outline-offset: 3px;
}

/* Активный слайд: выбранный слой — более заметная пунктирная обводка */
.series-stories-editor-screen--bg-mode-active
  .series-stories-editor-screen__slide--active
  .series-stories-editor-screen__slide-svg-host
  svg:has([data-kliko-bg-target][data-kliko-selected='true'])
  [data-kliko-bg-target][data-kliko-selected='true'] {
  filter: none;
  outline-width: 4px;
  outline-style: dashed;
  outline-color: #2d8fd4;
  outline-offset: 4px;
}

.series-stories-editor-screen--bg-mode-active
  .series-stories-editor-screen__slide--active
  .series-stories-editor-screen__slide-svg-host
  svg:not(:has([data-kliko-bg-target][data-kliko-selected='true']))
  [data-kliko-bg-target]:hover {
  transition: filter 0.22s ease, outline-color 0.18s ease;
  filter: brightness(1.38) contrast(1.12);
  outline-color: #035a8a;
}

.series-stories-editor-screen--bg-mode-active
  .series-stories-editor-screen__slide--active
  .series-stories-editor-screen__slide-svg-host
  svg:has([data-kliko-bg-target][data-kliko-selected='true'])
  [data-kliko-bg-target]:not([data-kliko-selected='true']):hover {
  transition: filter 0.22s ease, outline-color 0.18s ease;
  filter: brightness(1.32) contrast(1.1);
  outline-color: rgba(2, 62, 97, 0.72);
}

@media (prefers-reduced-motion: reduce) {
  .series-stories-editor-screen--bg-mode-active .series-stories-editor-screen__slide-svg-host svg [data-kliko-bg-target] {
    filter: none;
    outline: 4px dashed #023e61;
    outline-offset: 3px;
  }
}

.series-stories-editor-screen__bg-grid {
  display: grid;
  --sse-bg-cell-size: 56px;
  grid-template-columns: repeat(4, var(--sse-bg-cell-size));
  grid-auto-rows: var(--sse-bg-cell-size);
  gap: 6px;
  justify-content: center;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 254px;
  width: 100%;
  margin: 0 auto;
  height: var(--sse-bg-cell-size);
  max-height: var(--sse-bg-cell-size);
  padding: 0 2px 2px;
  box-sizing: border-box;
}

.series-stories-editor-screen__bg-item {
  width: var(--sse-bg-cell-size);
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  background: #eee;
}

.series-stories-editor-screen__bg-item:hover {
  border-color: #6eb2ed;
}

.series-stories-editor-screen__bg-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.series-stories-editor-screen__bg-upload-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sse-bg-cell-size);
  height: 100%;
  border-radius: 8px;
  border: 2px dashed #97aac0;
  background: #f6f8fa;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.series-stories-editor-screen__bg-upload-tile::before {
  content: "+";
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1;
  color: #5d748b;
}

.series-stories-editor-screen__bg-upload-tile:hover,
.series-stories-editor-screen__bg-upload-tile:focus-within {
  border-color: #6eb2ed;
  background: #edf5fb;
}

.series-stories-editor-screen__bg-upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
