/*
 * Визитка ReStar — «свой Instagram»: шапка профиля, хайлайты с историями,
 * сетка постов, Reels. Шрифт системный, как у Instagram. Светлая и тёмная тема.
 */

:root {
  --bg: #ffffff;
  --page: #fafafa;
  --text: #0f1419;
  --muted: #737373;
  --line: #dbdbdb;
  --soft: #efefef;
  --card: #ffffff;
  --link: #00376b;
  --accent: #ff6500;
  --accent-dark: #e65a00;
  --wa: #25d366;
  --ring: linear-gradient(45deg, #ffb347 0%, #ff6500 35%, #e1306c 70%, #833ab4 100%);
  --ring-seen: #c7c7c7;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --page: #000000;
    --text: #f5f5f5;
    --muted: #a8a8a8;
    --line: #262626;
    --soft: #1f1f1f;
    --card: #121212;
    --link: #e0f1ff;
    --ring-seen: #363636;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

img,
video {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cd-ico {
  width: 1em;
  height: 1em;
  flex: none;
}

.cd-loading {
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

/* Колонка как у мобильного Instagram; на компьютере — по центру */
.cd {
  width: 100%;
  max-width: 600px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(84px + var(--safe-b));
  background: var(--bg);
}

@media (min-width: 640px) {
  .cd {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* ---------- Верхняя строка ---------- */

.cd-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: content-box;
  height: 52px;
  padding: env(safe-area-inset-top, 0px) 8px 0 16px;   /* в полном экране шапка не уходит под вырез камеры */
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.cd-top > span {
  display: flex;
}

.cd-top h1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cd-iconbtn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 24px;
}

.cd-iconbtn:active {
  opacity: 0.6;
}

/* ---------- Шапка профиля ---------- */

.cd-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 8px 16px 0;
}

.cd-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: var(--ring);
}

.cd-avatar img {
  width: 100%;
  height: 100%;
  border: 3px solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
  background: var(--soft);
}

.cd-avatar-play {
  position: absolute;
  right: -2px;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
}

.cd-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.cd-stats b {
  display: block;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.cd-stats span {
  font-size: 13px;
}

.cd-about {
  padding: 12px 16px 0;
}

.cd-about h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.cd-category {
  color: var(--muted);
}

.cd-bio {
  margin: 2px 0 0;
  white-space: pre-line;
}

.cd-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}

.cd-link .cd-ico {
  font-size: 14px;
}

/* ---------- Кнопки связи ---------- */

.cd-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 6px;
  padding: 14px 16px 0;
}

.cd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.cd-btn:active {
  opacity: 0.75;
}

.cd-btn .cd-ico {
  font-size: 16px;
}

.cd-btn--primary {
  background: var(--accent);
  color: #fff;
}

.cd-btn--wa {
  background: var(--wa);
  color: #fff;
}

/* ---------- Хайлайты ---------- */

.cd-hls {
  display: flex;
  gap: 14px;
  padding: 18px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cd-hls::-webkit-scrollbar {
  display: none;
}

.cd-hl {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 78px;   /* «Презентация» влезает целиком */
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
}

.cd-hl-ring {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  padding: 2px;
  border-radius: 50%;
  background: var(--ring-seen);   /* как в Instagram: у хайлайтов кольцо серое; цветное — только у презентации */
}

.cd-hl-ring img {
  width: 100%;
  height: 100%;
  border: 3px solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
  background: var(--soft);
}

.cd-hl span {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Хайлайт «Презентация», пока его не открыли: обводка с градиентом
 * Instagram медленно вращается, кружок дышит, от него расходится волна —
 * сайт без слов ведёт посмотреть презентацию */
.cd-hl.is-promo .cd-hl-ring {
  position: relative;
  padding: 3px;
  background: none;
  animation: hl-breathe 1.8s ease-in-out infinite;
}

.cd-hl.is-promo .cd-hl-ring::before,
.cd-hl.is-promo .cd-hl-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.cd-hl.is-promo .cd-hl-ring::before {
  background: conic-gradient(from 0deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
  animation: hl-spin 3s linear infinite;
}

.cd-hl.is-promo .cd-hl-ring::after {
  border: 2px solid #d62976;
  opacity: 0;
  animation: hl-wave 1.8s ease-out infinite;
}

.cd-hl.is-promo .cd-hl-ring img {
  position: relative;
  z-index: 1;
}

.cd-hl.is-promo span {
  font-weight: 600;
}

@keyframes hl-spin {
  to { transform: rotate(360deg); }
}

@keyframes hl-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes hl-wave {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
  .cd-hl.is-promo .cd-hl-ring,
  .cd-hl.is-promo .cd-hl-ring::before,
  .cd-hl.is-promo .cd-hl-ring::after {
    animation: none;
  }
}

/* ---------- Вкладки ---------- */

.cd-tabs {
  position: sticky;
  top: 52px;
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.cd-tab {
  position: relative;
  display: grid;
  place-items: center;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
}

.cd-tab.is-active {
  color: var(--text);
}

.cd-tab.is-active::after {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: -1px;
  height: 1px;
  background: var(--text);
}

/* ---------- Сетка ---------- */

.cd-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
}

.cd-tile {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: var(--soft);
}

.cd-grid--reels .cd-tile {
  aspect-ratio: 9 / 16;
}

.cd-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

.cd-tile:active img {
  opacity: 0.8;
}

.cd-tile-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  color: #fff;
  font-size: 18px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.cd-tile-views {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.cd-empty {
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

.cd-foot {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 16px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.cd-foot b {
  color: var(--text);
  font-size: 13px;
}

/* ---------- Плавающая кнопка «Написать» ---------- */

.cd-float {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-b));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(255, 101, 0, 0.35);
  transform: translate(-50%, 140%);
  transition: transform 0.25s ease;
}

.cd-float.is-shown {
  transform: translate(-50%, 0);
}

.cd-float .cd-ico {
  font-size: 18px;
}

/* =========================================================================
   Полноэкранные окна: публикации, Reels, истории
   ========================================================================= */

.cd-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  background: var(--bg);
  animation: cd-in 0.18s ease-out;
}

@keyframes cd-in {
  from { opacity: 0; transform: translateY(12px); }
}

.cd-layer-col {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  height: 100%;
}

.cd-layer-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  flex: none;
  box-sizing: content-box;   /* полный экран Android: отступ под вырез камеры — сверху, а не за счёт шапки */
  height: 52px;
  padding: env(safe-area-inset-top, 0px) 4px 0;
  border-bottom: 1px solid var(--line);
}

.cd-layer-top b {
  font-size: 16px;
  text-align: center;
}

.cd-feed {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(80px + var(--safe-b));
}

/* ---------- Пост ---------- */

.cd-post {
  padding-bottom: 14px;
}

.cd-post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.cd-post-ava {
  width: 34px;
  height: 34px;
  padding: 2px;
  border-radius: 50%;
  background: var(--ring);
}

.cd-post-ava img {
  width: 100%;
  height: 100%;
  border: 2px solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
}

.cd-post-head div {
  display: grid;
  line-height: 1.25;
}

.cd-post-head b {
  font-size: 14px;
}

.cd-post-head small {
  color: var(--muted);
  font-size: 12px;
}

.cd-media {
  position: relative;
  background: #000;
}

.cd-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.cd-track::-webkit-scrollbar {
  display: none;
}

.cd-slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 4 / 5;
  scroll-snap-align: center;
  background: #000;
}

.cd-slide img,
.cd-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cd-media--reel .cd-slide {
  aspect-ratio: 9 / 16;
  max-height: 78vh;
}

.cd-media--reel .cd-slide video {
  object-fit: contain;
}

.cd-count {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.cd-sound {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
}

.cd-bigplay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 64px;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

.cd-heart-pop {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #fff;
  font-size: 96px;
  pointer-events: none;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.35));
  transform: translate(-50%, -50%) scale(0);
  animation: cd-heart 0.8s ease-out forwards;
}

@keyframes cd-heart {
  15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(0.95); }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.cd-post-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 0;
}

.cd-post-bar .cd-iconbtn {
  width: 40px;
  height: 40px;
}

.cd-post-bar .is-liked {
  color: #ff3040;
}

.cd-post-bar .is-liked svg {
  fill: currentColor;
}

.cd-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex: 1;
  margin-right: 84px;
}

.cd-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}

.cd-dots i.is-on {
  background: #0095f6;
}

.cd-cta-line {
  margin-left: auto;
}

.cd-caption {
  padding: 4px 12px 0;
  white-space: pre-line;
  word-break: break-word;
}

/* свёрнуто — строки подписи идут подряд, как в Instagram, без пустой строки с «…» */
.cd-caption.is-short {
  display: -webkit-box;
  white-space: normal;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cd-capwrap {
  padding-bottom: 10px;
}

.cd-capwrap[data-act] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cd-more {
  display: block;
  padding: 2px 12px 0;
  color: var(--muted);
}

.cd-tags {
  color: var(--link);
}

/* ---------- Reels и истории — на чёрном ---------- */

.cd-layer--dark {
  background: #000;
  color: #fff;
}

.cd-reels {
  width: 100%;
  max-width: 600px;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.cd-reels::-webkit-scrollbar {
  display: none;
}

.cd-reel {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
}

.cd-reel video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cd-reel-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 78px calc(18px + var(--safe-b)) 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  transition: background 0.25s ease;
}

/* Развёрнутая подпись, как в Instagram: весь ролик темнеет, текст читается,
 * длинный — листается внутри, до половины экрана. Тап — свернуть */
.cd-reel-info.is-open {
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.62);
}

.cd-reel-info b {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cd-reel-info b img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

/* свёрнуто — две строки подряд, без обрезанной посередине строки */
.cd-reel-info p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cd-reel-info.is-open p {
  display: block;
  max-height: 52vh;
  padding-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: pre-line;
  -webkit-line-clamp: unset;
  -webkit-mask-image: linear-gradient(transparent, #000 22px);
  mask-image: linear-gradient(transparent, #000 22px);
}

.cd-reel-more {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.cd-reel-more i {
  font-style: normal;
}

.cd-reel-info:not(.is-open) .cd-reel-more i + i,
.cd-reel-info.is-open .cd-reel-more i:first-child {
  display: none;
}

.cd-reel-side {
  position: absolute;
  z-index: 2;   /* кнопки поверх развёрнутой подписи */
  right: 6px;
  bottom: calc(24px + var(--safe-b));
  display: grid;
  gap: 10px;
}

.cd-reel-side .cd-iconbtn {
  color: #fff;
  font-size: 28px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.cd-reel-side .is-liked {
  color: #ff3040;
}

.cd-reel-side .is-liked svg {
  fill: currentColor;
}

.cd-close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 6px;
  z-index: 5;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

/* ---------- Истории ---------- */

/* как в Instagram: история в скруглённой рамке, под ней строка ответа */
.cd-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* рамка под картинку + строка ответа — по центру экрана */
  width: 100%;
  max-width: 480px;
  height: 100%;
  overflow: hidden;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.cd-story-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 0 0 12px 12px;
  background: #000;
}

@media (min-width: 640px) {
  .cd-story {
    height: min(100%, 860px);
    margin: auto;
    border-radius: 12px;
  }
}

.cd-story-bg {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(30px) brightness(0.55);
}

/* место и размер картинки задаёт fitStory: рамка под её пропорции */
.cd-story-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cd-story-frame.is-card .cd-story-media {
  border-radius: 10px;
}

/* шапка над картинкой — постоянная зона 62px (fitStory), без отступа под
 * вырез камеры: рамка и так по центру экрана */
.cd-story-frame.is-roomy .cd-bars {
  top: 8px;
}

.cd-story-frame.is-roomy .cd-story-head {
  top: 16px;
}

/* полос по бокам нет — размытый фон не нужен */
.cd-story-bg {
  display: none;
}

/* шапка поверх картинки — лёгкое затемнение, чтобы читалась */
.cd-story-frame:not(.is-roomy) .cd-story-head::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -4px;
  left: -10px;
  z-index: -1;
  height: 100px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
  pointer-events: none;
}

.cd-bars {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(8px + var(--side, 0px));
  right: calc(8px + var(--side, 0px));
  z-index: 3;
  display: flex;
  gap: 3px;
}

.cd-bars i {
  flex: 1;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.cd-bars i span {
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
}

.cd-bars i.is-done span {
  width: 100%;
}

.cd-story-head {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top, 0px));
  left: calc(10px + var(--side, 0px));
  right: calc(4px + var(--side, 0px));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.cd-story-head img {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.cd-story-head b {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-story-head small {
  opacity: 0.8;
}

.cd-story-head .cd-iconbtn {
  margin-left: auto;
  color: #fff;
}

.cd-story-tap {
  position: absolute;
  top: 70px;
  bottom: 0;
  z-index: 2;
  width: 35%;
  border: 0;
  background: transparent;
}

.cd-story-tap--prev {
  left: 0;
}

.cd-story-tap--next {
  right: 0;
  width: 65%;
}

.cd-reply {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 8px calc(10px + var(--safe-b)) 12px;
  background: #000;
}

.cd-reply-input {
  display: block;
  flex: 1;
  min-width: 0;
  height: 46px;
  max-height: 118px;
  margin: 0;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 23px;
  font-family: inherit;
  line-height: 20px;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: #fff;
  font-size: 16px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.cd-reply-input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

.cd-reply-input:focus {
  border-color: #fff;
}

.cd-reply-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 27px;
}

.cd-reply-btn .cd-ico {
  stroke-width: 1.7;
}

/* печатает ответ: история на месте и темнеет, поле — над клавиатурой */
.cd-story-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cd-story.is-typing .cd-story-frame::after {
  opacity: 1;
  pointer-events: auto;
}

.cd-story.is-typing .cd-reply {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 18px;   /* отступ от клавиатуры */
  background: transparent;
}

.cd-story.is-typing .cd-reply-btn[href] {
  display: none;
}

/* Окно «Куда отправить?» снизу */
.cd-sheet {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
}

.cd-sheet.is-open {
  background: rgba(0, 0, 0, 0.55);
}

.cd-sheet-panel {
  width: 100%;
  padding: 8px 18px calc(16px + var(--safe-b));
  border-radius: 22px 22px 0 0;
  background: rgba(30, 30, 32, 0.97);
  color: #fff;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.cd-sheet.is-open .cd-sheet-panel {
  transform: none;
}

.cd-sheet-grip {
  display: block;
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
}

.cd-sheet-panel h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.cd-sheet-msg {
  display: -webkit-box;
  margin: 0 0 18px;
  padding: 10px 14px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.cd-sheet-apps {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-bottom: 18px;
}

.cd-sheet-app {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
}

.cd-sheet-app span {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 28px;
  transition: transform 0.15s ease;
}

.cd-sheet-app:active span {
  transform: scale(0.92);
}

.cd-sheet-app--wa span {
  background: var(--wa);
}

.cd-sheet-app--tg span {
  background: #2aabee;
}

.cd-sheet-app--tg .cd-ico {
  margin: 2px 3px 0 0;
}

.cd-sheet-app--max span {
  background: linear-gradient(135deg, #3d7bff, #8a3dff);
}

.cd-sheet-app--max b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cd-sheet-cancel {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
}

.cd-toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-b));
  z-index: 80;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(30, 30, 30, 0.95);
  color: #fff;
  font-size: 13px;
  transform: translateX(-50%);
  animation: cd-in 0.18s ease-out;
}

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

/* =========================================================================
   Приветствие: видео со Станиславом на весь экран, потом — визитка
   ========================================================================= */

.in {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: #0b0b0d;
  color: #fff;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.in.is-leaving {
  opacity: 0;
  transform: translateY(-4%) scale(1.02);
  pointer-events: none;
}

/* пока видео нет или оно грузится — тёмный фон с тёплым свечением бренда */
.in-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(60% 45% at 50% 38%, rgba(255, 101, 0, 0.35), transparent 70%),
    radial-gradient(80% 60% at 50% 110%, rgba(255, 101, 0, 0.18), transparent 70%),
    #0b0b0d;
}

.in-fallback img {
  width: min(40vw, 180px);
  filter: drop-shadow(0 0 48px rgba(255, 101, 0, 0.55));
  transform: translateY(-16vh);
}

.in-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.in.no-video .in-video {
  display: none;
}

.in-shade {
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, transparent 18%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.55) 34%, transparent 58%);
  pointer-events: none;
}

.in-progress {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 14px;
  right: 14px;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
}

.in-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
}

.in.no-video .in-progress {
  display: none;
}

.in-top {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 18px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.in-logo {
  display: block;
  width: auto;
  height: 42px;
  max-width: 62vw;
  filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.35));
}

.in-brand {
  display: grid;
  line-height: 1.05;
}

.in-brand b {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.in-brand small {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.in-top .cd-iconbtn {
  margin-left: auto;
  color: #fff;
  font-size: 22px;
}

.in.no-video .in-top .cd-iconbtn {
  display: none;
}

/* Кнопка Play: оранжевый круг с расходящимися кольцами, под ним подпись */
.in-play {
  position: absolute;
  left: 50%;
  top: 40%;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  transform: translate(-50%, -50%);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.in-play-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 12px 40px rgba(255, 101, 0, 0.5);
  font-size: 34px;
}

.in-play-btn::before,
.in-play-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 101, 0, 0.7);
  border-radius: 50%;
  animation: in-ring 2.4s ease-out infinite;
}

.in-play-btn::after {
  animation-delay: 1.2s;
}

.in-play-btn .cd-ico {
  margin-left: 4px;
  fill: currentColor;
}

.in-play small {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 13px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@keyframes in-ring {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.7); opacity: 0; }
}

.in.is-playing .in-play {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.8);
}

.in.no-video .in-play {
  display: none;
}

.in-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 22px calc(26px + env(safe-area-inset-bottom, 0px));
}

.in-body h1 {
  margin: 0;
  font-size: clamp(34px, 10.5vw, 52px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
  transition: font-size 0.5s ease, opacity 0.5s ease;
}

.in-body h1 em {
  display: block;
  color: var(--accent);
  font-style: normal;
}

.in-body p {
  max-width: 34ch;
  max-height: 8em;
  margin: 14px 0 22px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  opacity: 0.9;
  transition: opacity 0.3s ease, max-height 0.5s ease, margin 0.5s ease;
}

/* пока Станислав говорит — заголовок мельче и ниже, текст убран, лицо открыто */
.in.is-playing .in-body h1 {
  font-size: 22px;
  opacity: 0.85;
}

.in.is-playing .in-body p {
  max-height: 0;
  margin: 0 0 14px;
  opacity: 0;
}

.in.is-playing .in-shade {
  opacity: 0.45;
}

/* Кнопка-ползунок: тянуть кружок вправо или просто нажать */
.in-slider {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 64px;
  padding: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 40px rgba(255, 101, 0, 0.4);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.in-slider b {
  flex: 1;
  font-size: 17px;
  font-weight: 400;
  text-align: center;
  transition: opacity 0.2s;
}

.in-knob {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 22px;
  transition: transform 0.25s ease;
}

.in-slider.is-dragging .in-knob {
  transition: none;
}

.in-chev {
  display: grid;
  place-items: center;
  width: 52px;
  font-size: 26px;
  animation: in-nudge 1.4s ease-in-out infinite;
}

@keyframes in-nudge {
  50% { transform: translateX(5px); opacity: 0.6; }
}

.in-skip {
  display: block;
  margin: 14px auto 0;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

@media (min-width: 640px) {
  .in-video {
    object-fit: contain;
  }
}

/* =========================================================================
   Презентация-журнал
   ========================================================================= */

.cd-layer--book {
  overflow: hidden;
}

.bk {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #2b2b30, #0b0b0d 72%);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

.bk-top {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 14px;
  right: 4px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
}

.bk-top b {
  font-size: 14px;
  font-weight: 600;
}

.bk-count {
  margin-left: auto;
  font-size: 13px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.bk-top .cd-iconbtn {
  color: #fff;
}

.bk-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;   /* щипок — наш зум, а не масштаб всей страницы браузером */
}

/* слой зума: увеличивается весь журнал, листалка внутри о нём не знает */
.bk-zoom {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  padding: calc(42px + env(safe-area-inset-top, 0px)) 8px calc(8px + var(--safe-b));
  transform-origin: 0 0;
  will-change: transform;
}

.bk-zoom.is-animating {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bk-unzoom {
  position: absolute;
  bottom: calc(14px + var(--safe-b));
  left: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.25s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.bk-unzoom .cd-ico {
  font-size: 16px;
}

.bk.is-zoomed .bk-unzoom {
  opacity: 1;
  pointer-events: auto;
}

.bk.is-zoomed .bk-hint {
  opacity: 0;
}

/* увеличили — строка кнопок уходит, страница на весь экран; вернуть —
 * «Отдалить» или двойной тап */
.bk-top,
.bk-nav {
  transition: opacity 0.25s ease;
}

.bk.is-zoomed .bk-top,
.bk.is-zoomed .bk-nav {
  opacity: 0;
  pointer-events: none;
}

.bk-book {
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);   /* в такт перелистыванию (flippingTime) */
}

.bk-page {
  overflow: hidden;
  background: #fff;   /* превью страницы, пока грузится полная */
  -webkit-touch-callout: none;
}

/* Корешок, как в настоящем журнале и во FlipHTML5: страницы мягко темнеют
 * к сгибу — разворот объёмный, а не плоский. Лист в перелистывании несёт
 * свою тень с собой. У обложки и задника тени нет */
.bk-page::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16%;
  pointer-events: none;
}

.bk-page.--left::after {
  right: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.05) 45%, rgba(0, 0, 0, 0.16) 80%, rgba(0, 0, 0, 0.3) 100%);
}

.bk-page.--right::after {
  left: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.05) 45%, rgba(0, 0, 0, 0.18) 82%, rgba(0, 0, 0, 0.34) 100%);
}

.bk-page--cover::after {
  display: none;
}

.bk-thumb,
.bk-page img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.bk-thumb {
  background: center / cover no-repeat;
}

.bk-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  transform: translateY(-50%);
}

.bk-nav--prev {
  left: 8px;
}

.bk-nav--next {
  right: 8px;
}

.bk.is-single .bk-nav {
  display: none;
}

/* на телефоне листают пальцем — стрелки не закрывают края страниц */
@media (pointer: coarse) {
  .bk-nav {
    display: none;
  }
}

.bk-hint {
  position: absolute;
  bottom: calc(22px + var(--safe-b));
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.3s ease;
}

.bk.show-hint .bk-hint {
  opacity: 1;
}

.bk-hint span {
  display: grid;
  font-size: 18px;
  animation: bk-swipe 1.4s ease-in-out infinite;
}

@keyframes bk-swipe {
  0%, 100% { transform: translateX(8px); }
  50% { transform: translateX(-8px); }
}

/* журнал лежит вдоль вертикального экрана: повёрнут на 90° по часовой */
.bk.is-turned {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
}

/* «Поверните телефон» */
.bk-rotate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  transition: opacity 0.4s ease;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(60% 40% at 50% 40%, rgba(255, 101, 0, 0.26), transparent 70%),
    #0b0b0d;
}

.bk-rotate[hidden] {
  display: none;
}

.bk-rotate.is-gone {
  opacity: 0;
  pointer-events: none;
}

.bk-rot-close {
  position: absolute;
  top: calc(4px + env(safe-area-inset-top, 0px));
  right: 4px;
  color: #fff;
}

/* полоска-таймер: заставка сама уйдёт через один круг анимации */
.bk-rot-timer {
  display: block;
  width: 120px;
  height: 3px;
  margin-top: 26px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}

.bk-rot-timer::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: bk-timer 3.4s linear forwards;
}

.bk-rotate.is-quick .bk-rot-timer::after { animation-duration: 2.2s; }
.bk-rotate.is-quick .bk-rot-arrow,
.bk-rotate.is-quick .bk-phone,
.bk-rotate.is-quick .bk-phone img { animation-duration: 2s; }

@keyframes bk-timer {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.bk-rot-anim {
  position: relative;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin-bottom: 22px;
}

.bk-rot-arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 120;
  animation: bk-arrow 3s ease-in-out infinite;
}

@keyframes bk-arrow {
  0%, 8% { stroke-dashoffset: 120; opacity: 0; }
  16% { opacity: 1; }
  42% { stroke-dashoffset: 0; opacity: 1; }
  70%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

.bk-phone {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 132px;
  border: 3px solid #fff;
  border-radius: 17px;
  box-shadow: 0 0 46px rgba(255, 101, 0, 0.4);
  animation: bk-turn 3s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.bk-phone i {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 18px;
  height: 4px;
  border-radius: 4px;
  background: #fff;
  transform: translateX(-50%);
}

.bk-phone span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 104px;
  margin-top: 6px;
  border-radius: 9px;
  background: linear-gradient(160deg, #2a2a2e, #141416);
}

.bk-phone img {
  width: 34px;
  animation: bk-turn-back 3s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes bk-turn {
  0%, 16% { transform: rotate(0deg); }
  42%, 74% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

/* логотип на «экране» остаётся ровным — как картинка после поворота */
@keyframes bk-turn-back {
  0%, 16% { transform: rotate(0deg); }
  42%, 74% { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

.bk-rotate h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.bk-rotate p {
  max-width: 260px;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.75;
}

